Final purge of 'tuning profile' -> 'delay profile' in time-domain code

Only mention remains in the delay profile settings JSON
This commit is contained in:
JamesJCode 2025-04-19 00:30:34 +01:00
parent 80a25764eb
commit f1344e921a
13 changed files with 97 additions and 103 deletions

View File

@ -51,7 +51,7 @@ message NetClassBoardSettings
optional kiapi.common.types.Color color = 8; optional kiapi.common.types.Color color = 8;
// Since: 10.0.0 // Since: 10.0.0
optional string tuning_profile = 9; optional string delay_profile = 9;
} }
message NetClassSchematicSettings message NetClassSchematicSettings

View File

@ -61,7 +61,7 @@ enum
GRID_uVIADRILL, GRID_uVIADRILL,
GRID_DIFF_PAIR_WIDTH, GRID_DIFF_PAIR_WIDTH,
GRID_DIFF_PAIR_GAP, GRID_DIFF_PAIR_GAP,
GRID_TUNING_PROFILE, GRID_DELAY_PROFILE,
GRID_PCB_COLOR, GRID_PCB_COLOR,
GRID_FIRST_EESCHEMA, GRID_FIRST_EESCHEMA,
@ -298,7 +298,7 @@ void PANEL_SETUP_NETCLASSES::loadNetclasses()
[&]( int aRow, const NETCLASS* nc ) [&]( int aRow, const NETCLASS* nc )
{ {
m_netclassGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() ); m_netclassGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
m_netclassGrid->SetCellValue( aRow, GRID_TUNING_PROFILE, nc->GetTuningProfile() ); m_netclassGrid->SetCellValue( aRow, GRID_DELAY_PROFILE, nc->GetDelayProfile() );
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_WIREWIDTH, m_netclassGrid->SetOptionalUnitValue( aRow, GRID_WIREWIDTH,
nc->GetWireWidthOpt() ); nc->GetWireWidthOpt() );
@ -504,7 +504,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
nc->SetPriority( aRow ); nc->SetPriority( aRow );
nc->SetName( m_netclassGrid->GetCellValue( aRow, GRID_NAME ) ); nc->SetName( m_netclassGrid->GetCellValue( aRow, GRID_NAME ) );
nc->SetTuningProfile( m_netclassGrid->GetCellValue( aRow, GRID_TUNING_PROFILE ) ); nc->SetDelayProfile( m_netclassGrid->GetCellValue( aRow, GRID_DELAY_PROFILE ) );
nc->SetWireWidth( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_WIREWIDTH ) ); nc->SetWireWidth( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_WIREWIDTH ) );
nc->SetBusWidth( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_BUSWIDTH ) ); nc->SetBusWidth( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_BUSWIDTH ) );
@ -1105,7 +1105,7 @@ void PANEL_SETUP_NETCLASSES::OnMoveNetclassDownClick( wxCommandEvent& event )
} }
void PANEL_SETUP_NETCLASSES::UpdateTuningProfileNames( const std::vector<wxString>& aNames ) const void PANEL_SETUP_NETCLASSES::UpdateDelayProfileNames( const std::vector<wxString>& aNames ) const
{ {
wxArrayString profileNames; wxArrayString profileNames;
profileNames.push_back( wxEmptyString ); profileNames.push_back( wxEmptyString );
@ -1117,5 +1117,5 @@ void PANEL_SETUP_NETCLASSES::UpdateTuningProfileNames( const std::vector<wxStrin
wxGridCellAttr* attr = new wxGridCellAttr; wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( profileNames, false ) ); attr->SetEditor( new wxGridCellChoiceEditor( profileNames, false ) );
m_netclassGrid->SetColAttr( GRID_TUNING_PROFILE, attr ); m_netclassGrid->SetColAttr( GRID_DELAY_PROFILE, attr );
} }

View File

@ -59,7 +59,7 @@ NETCLASS::NETCLASS( const wxString& aName, bool aInitWithDefaults ) : m_isDefaul
SetName( aName ); SetName( aName );
SetPriority( -1 ); SetPriority( -1 );
SetTuningProfile( wxEmptyString ); SetDelayProfile( wxEmptyString );
// Colors are a special optional case - always set, but UNSPECIFIED used in place of optional // Colors are a special optional case - always set, but UNSPECIFIED used in place of optional
SetPcbColor( COLOR4D::UNSPECIFIED ); SetPcbColor( COLOR4D::UNSPECIFIED );
@ -102,7 +102,7 @@ void NETCLASS::ResetParents()
SetBusWidthParent( this ); SetBusWidthParent( this );
SetSchematicColorParent( this ); SetSchematicColorParent( this );
SetLineStyleParent( this ); SetLineStyleParent( this );
SetTuningProfileParent( this ); SetDelayProfileParent( this );
} }
@ -180,8 +180,8 @@ void NETCLASS::Serialize( google::protobuf::Any &aContainer ) const
if( m_pcbColor != COLOR4D::UNSPECIFIED ) if( m_pcbColor != COLOR4D::UNSPECIFIED )
PackColor( *board->mutable_color(), m_pcbColor ); PackColor( *board->mutable_color(), m_pcbColor );
if( HasTuningProfile() ) if( HasDelayProfile() )
board->set_tuning_profile( m_TuningProfile ); board->set_delay_profile( m_DelayProfile );
project::NetClassSchematicSettings* schematic = nc.mutable_schematic(); project::NetClassSchematicSettings* schematic = nc.mutable_schematic();
@ -249,8 +249,8 @@ bool NETCLASS::Deserialize( const google::protobuf::Any &aContainer )
if( nc.board().has_color() ) if( nc.board().has_color() )
m_pcbColor = UnpackColor( nc.board().color() ); m_pcbColor = UnpackColor( nc.board().color() );
if( nc.board().has_tuning_profile() ) if( nc.board().has_delay_profile() )
m_TuningProfile = nc.board().tuning_profile(); m_DelayProfile = nc.board().delay_profile();
if( nc.schematic().has_wire_width() ) if( nc.schematic().has_wire_width() )
m_wireWidth = nc.schematic().wire_width().value_nm(); m_wireWidth = nc.schematic().wire_width().value_nm();

View File

@ -75,7 +75,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
{ "priority", nc->GetPriority() }, { "priority", nc->GetPriority() },
{ "schematic_color", nc->GetSchematicColor( true ) }, { "schematic_color", nc->GetSchematicColor( true ) },
{ "pcb_color", nc->GetPcbColor( true ) }, { "pcb_color", nc->GetPcbColor( true ) },
{ "tuning_profile", nc->GetTuningProfile() } }; { "tuning_profile", nc->GetDelayProfile() } };
auto saveInPcbUnits = auto saveInPcbUnits =
[]( nlohmann::json& json, const std::string& aKey, int aValue ) []( nlohmann::json& json, const std::string& aKey, int aValue )
@ -133,7 +133,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
int priority = entry["priority"]; int priority = entry["priority"];
nc->SetPriority( priority ); nc->SetPriority( priority );
nc->SetTuningProfile( entry["tuning_profile"] ); nc->SetDelayProfile( entry["tuning_profile"] );
if( auto value = getInPcbUnits( entry, "clearance" ) ) if( auto value = getInPcbUnits( entry, "clearance" ) )
nc->SetClearance( *value ); nc->SetClearance( *value );
@ -928,10 +928,10 @@ void NET_SETTINGS::makeEffectiveNetclass( std::shared_ptr<NETCLASS>& effectiveNe
effectiveNetclass->SetSchematicColorParent( nc ); effectiveNetclass->SetSchematicColorParent( nc );
} }
if( nc->HasTuningProfile() ) if( nc->HasDelayProfile() )
{ {
effectiveNetclass->SetTuningProfile( nc->GetTuningProfile() ); effectiveNetclass->SetDelayProfile( nc->GetDelayProfile() );
effectiveNetclass->SetTuningProfileParent( nc ); effectiveNetclass->SetDelayProfileParent( nc );
} }
} }
@ -1024,11 +1024,11 @@ bool NET_SETTINGS::addMissingDefaults( NETCLASS* nc ) const
} }
// The tuning profile can be empty - only fill if a default tuning profile is set // The tuning profile can be empty - only fill if a default tuning profile is set
if( !nc->HasTuningProfile() && m_defaultNetClass->HasTuningProfile() ) if( !nc->HasDelayProfile() && m_defaultNetClass->HasDelayProfile() )
{ {
addedDefault = true; addedDefault = true;
nc->SetTuningProfile( m_defaultNetClass->GetTuningProfile() ); nc->SetDelayProfile( m_defaultNetClass->GetDelayProfile() );
nc->SetTuningProfileParent( m_defaultNetClass.get() ); nc->SetDelayProfileParent( m_defaultNetClass.get() );
} }
return addedDefault; return addedDefault;

View File

@ -35,7 +35,7 @@ TIME_DOMAIN_PARAMETERS::TIME_DOMAIN_PARAMETERS( JSON_SETTINGS* aParent, const st
aPath, false ) aPath, false )
{ {
auto saveViaOverrideConfigurationLine = auto saveViaOverrideConfigurationLine =
[]( nlohmann::json& json_array, const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& item ) []( nlohmann::json& json_array, const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& item )
{ {
const nlohmann::json item_json = { { "signal_layer_from", LSET::Name( item.m_SignalLayerFrom ) }, const nlohmann::json item_json = { { "signal_layer_from", LSET::Name( item.m_SignalLayerFrom ) },
{ "signal_layer_to", LSET::Name( item.m_SignalLayerTo ) }, { "signal_layer_to", LSET::Name( item.m_SignalLayerTo ) },
@ -62,16 +62,16 @@ TIME_DOMAIN_PARAMETERS::TIME_DOMAIN_PARAMETERS( JSON_SETTINGS* aParent, const st
int delay = entry["delay"]; int delay = entry["delay"];
TUNING_PROFILE_VIA_OVERRIDE_ENTRY item{ static_cast<PCB_LAYER_ID>( signalLayerFromId ), DELAY_PROFILE_VIA_OVERRIDE_ENTRY item{ static_cast<PCB_LAYER_ID>( signalLayerFromId ),
static_cast<PCB_LAYER_ID>( signalLayerToId ), static_cast<PCB_LAYER_ID>( signalLayerToId ),
static_cast<PCB_LAYER_ID>( viaLayerFromId ), static_cast<PCB_LAYER_ID>( viaLayerFromId ),
static_cast<PCB_LAYER_ID>( viaLayerToId ), delay }; static_cast<PCB_LAYER_ID>( viaLayerToId ), delay };
return item; return item;
}; };
auto saveUserDefinedProfileConfigurationLine = auto saveUserDefinedProfileConfigurationLine =
[&saveViaOverrideConfigurationLine]( nlohmann::json& json_array, const TIME_DOMAIN_TUNING_PROFILE& item ) [&saveViaOverrideConfigurationLine]( nlohmann::json& json_array, const DELAY_PROFILE& item )
{ {
nlohmann::json layer_velocities = nlohmann::json::array(); nlohmann::json layer_velocities = nlohmann::json::array();
@ -83,7 +83,7 @@ TIME_DOMAIN_PARAMETERS::TIME_DOMAIN_PARAMETERS( JSON_SETTINGS* aParent, const st
nlohmann::json via_overrides = nlohmann::json::array(); nlohmann::json via_overrides = nlohmann::json::array();
for( const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : item.m_ViaOverrides ) for( const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : item.m_ViaOverrides )
{ {
saveViaOverrideConfigurationLine( via_overrides, viaOverride ); saveViaOverrideConfigurationLine( via_overrides, viaOverride );
} }
@ -113,7 +113,7 @@ TIME_DOMAIN_PARAMETERS::TIME_DOMAIN_PARAMETERS( JSON_SETTINGS* aParent, const st
traceDelays[static_cast<PCB_LAYER_ID>( layerId )] = velocity; traceDelays[static_cast<PCB_LAYER_ID>( layerId )] = velocity;
} }
std::vector<TUNING_PROFILE_VIA_OVERRIDE_ENTRY> viaOverrides; std::vector<DELAY_PROFILE_VIA_OVERRIDE_ENTRY> viaOverrides;
for( const nlohmann::json& viaEntry : entry["via_overrides"] ) for( const nlohmann::json& viaEntry : entry["via_overrides"] )
{ {
@ -123,8 +123,7 @@ TIME_DOMAIN_PARAMETERS::TIME_DOMAIN_PARAMETERS( JSON_SETTINGS* aParent, const st
viaOverrides.push_back( readViaOverrideConfigurationLine( viaEntry ) ); viaOverrides.push_back( readViaOverrideConfigurationLine( viaEntry ) );
} }
TIME_DOMAIN_TUNING_PROFILE item{ profileName, viaPropDelay, std::move( traceDelays ), DELAY_PROFILE item{ profileName, viaPropDelay, std::move( traceDelays ), std::move( viaOverrides ) };
std::move( viaOverrides ) };
return item; return item;
}; };

View File

@ -48,7 +48,7 @@ public:
void ImportSettingsFrom( const std::shared_ptr<NET_SETTINGS>& aNetSettings ); void ImportSettingsFrom( const std::shared_ptr<NET_SETTINGS>& aNetSettings );
void UpdateTuningProfileNames( const std::vector<wxString>& aNames ) const; void UpdateDelayProfileNames( const std::vector<wxString>& aNames ) const;
private: private:
void OnAddNetclassClick( wxCommandEvent& event ) override; void OnAddNetclassClick( wxCommandEvent& event ) override;

View File

@ -238,11 +238,11 @@ public:
void SetPriority( int aPriority ) { m_Priority = aPriority; } void SetPriority( int aPriority ) { m_Priority = aPriority; }
int GetPriority() const { return m_Priority; } int GetPriority() const { return m_Priority; }
bool HasTuningProfile() const { return !m_TuningProfile.empty(); } bool HasDelayProfile() const { return !m_DelayProfile.empty(); }
void SetTuningProfile( const wxString& aTuningProfile ) { m_TuningProfile = aTuningProfile; } void SetDelayProfile( const wxString& aDelayProfile ) { m_DelayProfile = aDelayProfile; }
wxString GetTuningProfile() const { return m_TuningProfile; } wxString GetDelayProfile() const { return m_DelayProfile; }
void SetTuningProfileParent( NETCLASS* aParent ) { m_tuningProfileParent = aParent; } void SetDelayProfileParent( NETCLASS* aParent ) { m_delayProfileParent = aParent; }
NETCLASS* GetTuningProfileParent() const { return m_tuningProfileParent; } NETCLASS* GetDelayProfileParent() const { return m_delayProfileParent; }
protected: protected:
bool m_isDefault; ///< Mark if this instance is the default netclass bool m_isDefault; ///< Mark if this instance is the default netclass
@ -273,7 +273,7 @@ protected:
COLOR4D m_pcbColor; ///< Optional PCB color override for this netclass COLOR4D m_pcbColor; ///< Optional PCB color override for this netclass
wxString m_TuningProfile; ///< The tuning profile name being used by this netclass wxString m_DelayProfile; ///< The tuning profile name being used by this netclass
// The NETCLASS providing each parameter // The NETCLASS providing each parameter
NETCLASS* m_clearanceParent; NETCLASS* m_clearanceParent;
@ -290,7 +290,7 @@ protected:
NETCLASS* m_busWidthParent; NETCLASS* m_busWidthParent;
NETCLASS* m_schematicColorParent; NETCLASS* m_schematicColorParent;
NETCLASS* m_lineStyleParent; NETCLASS* m_lineStyleParent;
NETCLASS* m_tuningProfileParent; NETCLASS* m_delayProfileParent;
}; };
#endif // CLASS_NETCLASS_H #endif // CLASS_NETCLASS_H

View File

@ -28,7 +28,7 @@
/** /**
* Represents a single line in the time domain configuration via overrides configuration grid * Represents a single line in the time domain configuration via overrides configuration grid
*/ */
struct TUNING_PROFILE_VIA_OVERRIDE_ENTRY struct DELAY_PROFILE_VIA_OVERRIDE_ENTRY
{ {
PCB_LAYER_ID m_SignalLayerFrom; PCB_LAYER_ID m_SignalLayerFrom;
PCB_LAYER_ID m_SignalLayerTo; PCB_LAYER_ID m_SignalLayerTo;
@ -36,7 +36,7 @@ struct TUNING_PROFILE_VIA_OVERRIDE_ENTRY
PCB_LAYER_ID m_ViaLayerTo; PCB_LAYER_ID m_ViaLayerTo;
int m_Delay; int m_Delay;
bool operator<( const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& other ) const bool operator<( const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& other ) const
{ {
if( m_SignalLayerFrom != other.m_SignalLayerFrom ) if( m_SignalLayerFrom != other.m_SignalLayerFrom )
return IsCopperLayerLowerThan( m_SignalLayerFrom, other.m_SignalLayerFrom ); return IsCopperLayerLowerThan( m_SignalLayerFrom, other.m_SignalLayerFrom );
@ -58,12 +58,12 @@ struct TUNING_PROFILE_VIA_OVERRIDE_ENTRY
/** /**
* Represents a single line in the time domain configuration net class configuration grid * Represents a single line in the time domain configuration net class configuration grid
*/ */
struct TIME_DOMAIN_TUNING_PROFILE struct DELAY_PROFILE
{ {
wxString m_ProfileName; wxString m_ProfileName;
int m_ViaPropagationDelay; int m_ViaPropagationDelay;
std::map<PCB_LAYER_ID, int> m_LayerPropagationDelays; std::map<PCB_LAYER_ID, int> m_LayerPropagationDelays;
std::vector<TUNING_PROFILE_VIA_OVERRIDE_ENTRY> m_ViaOverrides; std::vector<DELAY_PROFILE_VIA_OVERRIDE_ENTRY> m_ViaOverrides;
}; };
@ -83,15 +83,12 @@ public:
void ClearDelayProfiles() { m_delayProfiles.clear(); } void ClearDelayProfiles() { m_delayProfiles.clear(); }
void AddDelayProfile( TIME_DOMAIN_TUNING_PROFILE&& aTraceEntry ) void AddDelayProfile( DELAY_PROFILE&& aTraceEntry ) { m_delayProfiles.emplace_back( std::move( aTraceEntry ) ); }
{
m_delayProfiles.emplace_back( std::move( aTraceEntry ) );
}
const std::vector<TIME_DOMAIN_TUNING_PROFILE>& GetDelayProfiles() const { return m_delayProfiles; } const std::vector<DELAY_PROFILE>& GetDelayProfiles() const { return m_delayProfiles; }
private: private:
std::vector<TIME_DOMAIN_TUNING_PROFILE> m_delayProfiles; std::vector<DELAY_PROFILE> m_delayProfiles;
}; };
#endif // KICAD_NET_SETTINGS_H #endif // KICAD_NET_SETTINGS_H

View File

@ -297,7 +297,7 @@ void DIALOG_BOARD_SETUP::onPageChanged( wxBookCtrlEvent& aEvent )
} }
else if( page == m_netclassesPage || m_currentPage == m_timeDomainParametersPage ) else if( page == m_netclassesPage || m_currentPage == m_timeDomainParametersPage )
{ {
m_netClasses->UpdateTuningProfileNames( m_timeDomainParameters->GetDelayProfileNames() ); m_netClasses->UpdateDelayProfileNames( m_timeDomainParameters->GetDelayProfileNames() );
} }
else if( page == m_timeDomainParametersPage ) else if( page == m_timeDomainParametersPage )
{ {

View File

@ -110,15 +110,15 @@ bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::TransferDataToWindow()
m_tracePropagationGrid->ClearRows(); m_tracePropagationGrid->ClearRows();
m_viaPropagationGrid->ClearRows(); m_viaPropagationGrid->ClearRows();
const std::vector<TIME_DOMAIN_TUNING_PROFILE>& delayProfiles = m_timeDomainParameters->GetDelayProfiles(); const std::vector<DELAY_PROFILE>& delayProfiles = m_timeDomainParameters->GetDelayProfiles();
SyncCopperLayers( m_board->GetCopperLayerCount() ); SyncCopperLayers( m_board->GetCopperLayerCount() );
for( const TIME_DOMAIN_TUNING_PROFILE& profile : delayProfiles ) for( const DELAY_PROFILE& profile : delayProfiles )
{ {
addProfileRow( profile ); addProfileRow( profile );
for( const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : profile.m_ViaOverrides ) for( const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : profile.m_ViaOverrides )
addViaRow( profile.m_ProfileName, viaOverride ); addViaRow( profile.m_ProfileName, viaOverride );
} }
@ -137,7 +137,7 @@ bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::TransferDataFromWindow()
for( int i = 0; i < m_tracePropagationGrid->GetNumberRows(); ++i ) for( int i = 0; i < m_tracePropagationGrid->GetNumberRows(); ++i )
{ {
TIME_DOMAIN_TUNING_PROFILE profile = getProfileRow( i ); DELAY_PROFILE profile = getProfileRow( i );
wxString profileName = profile.m_ProfileName; wxString profileName = profile.m_ProfileName;
for( int j = 0; j < m_viaPropagationGrid->GetNumberRows(); ++j ) for( int j = 0; j < m_viaPropagationGrid->GetNumberRows(); ++j )
@ -153,7 +153,7 @@ bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::TransferDataFromWindow()
} }
void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addProfileRow( const TIME_DOMAIN_TUNING_PROFILE& aDelayProfile ) void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addProfileRow( const DELAY_PROFILE& aDelayProfile )
{ {
const int rowId = m_tracePropagationGrid->GetNumberRows(); const int rowId = m_tracePropagationGrid->GetNumberRows();
m_tracePropagationGrid->AppendRows(); m_tracePropagationGrid->AppendRows();
@ -176,9 +176,9 @@ void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addProfileRow( const TIME_DOMAIN_TUNING
} }
TIME_DOMAIN_TUNING_PROFILE PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getProfileRow( const int aRow ) DELAY_PROFILE PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getProfileRow( const int aRow )
{ {
TIME_DOMAIN_TUNING_PROFILE entry; DELAY_PROFILE entry;
entry.m_ProfileName = getProfileNameForProfileGridRow( aRow ); entry.m_ProfileName = getProfileNameForProfileGridRow( aRow );
entry.m_ViaPropagationDelay = m_tracePropagationGrid->GetUnitValue( aRow, PROFILE_GRID_VIA_PROP_DELAY ); entry.m_ViaPropagationDelay = m_tracePropagationGrid->GetUnitValue( aRow, PROFILE_GRID_VIA_PROP_DELAY );
@ -193,8 +193,8 @@ TIME_DOMAIN_TUNING_PROFILE PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getProfileRow( co
} }
void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addViaRow( const wxString& aProfileName, void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addViaRow( const wxString& aProfileName,
const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& aViaOverrideEntry ) const const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& aViaOverrideEntry ) const
{ {
const int rowId = m_viaPropagationGrid->GetNumberRows(); const int rowId = m_viaPropagationGrid->GetNumberRows();
m_viaPropagationGrid->AppendRows(); m_viaPropagationGrid->AppendRows();
@ -211,7 +211,7 @@ void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addViaRow( const wxString&
} }
TUNING_PROFILE_VIA_OVERRIDE_ENTRY PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getViaRow( const int aRow ) DELAY_PROFILE_VIA_OVERRIDE_ENTRY PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getViaRow( const int aRow )
{ {
// Get layer info // Get layer info
const wxString signalLayerFrom = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_SIGNAL_LAYER_FROM ); const wxString signalLayerFrom = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_SIGNAL_LAYER_FROM );
@ -230,8 +230,8 @@ TUNING_PROFILE_VIA_OVERRIDE_ENTRY PANEL_SETUP_TIME_DOMAIN_PARAMETERS::getViaRow(
if( IsCopperLayerLowerThan( viaLayerIdFrom, viaLayerIdTo ) ) if( IsCopperLayerLowerThan( viaLayerIdFrom, viaLayerIdTo ) )
std::swap( viaLayerIdFrom, viaLayerIdTo ); std::swap( viaLayerIdFrom, viaLayerIdTo );
const TUNING_PROFILE_VIA_OVERRIDE_ENTRY entry{ signalLayerIdFrom, signalLayerIdTo, viaLayerIdFrom, viaLayerIdTo, const DELAY_PROFILE_VIA_OVERRIDE_ENTRY entry{ signalLayerIdFrom, signalLayerIdTo, viaLayerIdFrom, viaLayerIdTo,
m_viaPropagationGrid->GetUnitValue( aRow, VIA_GRID_DELAY ) }; m_viaPropagationGrid->GetUnitValue( aRow, VIA_GRID_DELAY ) };
return entry; return entry;
} }
@ -611,13 +611,13 @@ bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::Validate()
bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::validateViaRows() bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::validateViaRows()
{ {
std::map<wxString, std::set<TUNING_PROFILE_VIA_OVERRIDE_ENTRY>> rowCache; std::map<wxString, std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>> rowCache;
for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); row++ ) for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); row++ )
{ {
TUNING_PROFILE_VIA_OVERRIDE_ENTRY entry = getViaRow( row ); DELAY_PROFILE_VIA_OVERRIDE_ENTRY entry = getViaRow( row );
const wxString profileName = m_viaPropagationGrid->GetCellValue( row, VIA_GRID_PROFILE_NAME ); const wxString profileName = m_viaPropagationGrid->GetCellValue( row, VIA_GRID_PROFILE_NAME );
std::set<TUNING_PROFILE_VIA_OVERRIDE_ENTRY>& viaOverrides = rowCache[profileName]; std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>& viaOverrides = rowCache[profileName];
if( viaOverrides.contains( entry ) ) if( viaOverrides.contains( entry ) )
{ {

View File

@ -118,16 +118,16 @@ private:
bool validateViaRows(); bool validateViaRows();
/// Adds a tuning profile row with the given persisted parameters /// Adds a tuning profile row with the given persisted parameters
void addProfileRow( const TIME_DOMAIN_TUNING_PROFILE& aDelayProfile ); void addProfileRow( const DELAY_PROFILE& aDelayProfile );
/// Gets a tuning profile row as a set of persistable parameters /// Gets a tuning profile row as a set of persistable parameters
TIME_DOMAIN_TUNING_PROFILE getProfileRow( int aRow ); DELAY_PROFILE getProfileRow( int aRow );
/// Adds a via override row with the given persisted parameters /// Adds a via override row with the given persisted parameters
void addViaRow( const wxString& aProfileName, const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& aViaOverrideEntry ) const; void addViaRow( const wxString& aProfileName, const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& aViaOverrideEntry ) const;
/// Gets a via override row as a set of persistable parameters /// Gets a via override row as a set of persistable parameters
TUNING_PROFILE_VIA_OVERRIDE_ENTRY getViaRow( int aRow ); DELAY_PROFILE_VIA_OVERRIDE_ENTRY getViaRow( int aRow );
/// Gets the profile name for the given profile grid row /// Gets the profile name for the given profile grid row
wxString getProfileNameForProfileGridRow( int aRow ) const; wxString getProfileNameForProfileGridRow( int aRow ) const;

View File

@ -39,17 +39,17 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetPropagationDelays( const std::vector<LEN
if( aItems.empty() ) if( aItems.empty() )
return {}; return {};
const wxString tuningProfileName = aItems.front().GetEffectiveNetClass()->GetTuningProfile(); const wxString delayProfileName = aItems.front().GetEffectiveNetClass()->GetDelayProfile();
const TIME_DOMAIN_TUNING_PROFILE* tuningProfile = getTuningProfile( tuningProfileName ); const DELAY_PROFILE* delayProfile = GetDelayProfile( delayProfileName );
if( !tuningProfile ) if( !delayProfile )
return std::vector<int64_t>( aItems.size(), 0 ); return std::vector<int64_t>( aItems.size(), 0 );
std::vector<int64_t> propagationDelays; std::vector<int64_t> propagationDelays;
propagationDelays.reserve( aItems.size() ); propagationDelays.reserve( aItems.size() );
for( const LENGTH_DELAY_CALCULATION_ITEM& item : aItems ) for( const LENGTH_DELAY_CALCULATION_ITEM& item : aItems )
propagationDelays.emplace_back( getPropagationDelay( item, aContext, tuningProfile ) ); propagationDelays.emplace_back( getPropagationDelay( item, aContext, delayProfile ) );
return propagationDelays; return propagationDelays;
} }
@ -61,20 +61,19 @@ int64_t TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetPropagationDelay( const LENGTH_D
if( aItem.GetMergeStatus() == LENGTH_DELAY_CALCULATION_ITEM::MERGE_STATUS::MERGED_RETIRED ) if( aItem.GetMergeStatus() == LENGTH_DELAY_CALCULATION_ITEM::MERGE_STATUS::MERGED_RETIRED )
return 0; return 0;
const wxString tuningProfileName = aItem.GetEffectiveNetClass()->GetTuningProfile(); const wxString delayProfileName = aItem.GetEffectiveNetClass()->GetDelayProfile();
const TIME_DOMAIN_TUNING_PROFILE* tuningProfile = getTuningProfile( tuningProfileName ); const DELAY_PROFILE* delayProfile = GetDelayProfile( delayProfileName );
if( !tuningProfile ) if( !delayProfile )
return 0; return 0;
return getPropagationDelay( aItem, aContext, tuningProfile ); return getPropagationDelay( aItem, aContext, delayProfile );
} }
int64_t int64_t TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CALCULATION_ITEM& aItem,
TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CALCULATION_ITEM& aItem, const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext,
const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext, const DELAY_PROFILE* aDelayProfile ) const
const TIME_DOMAIN_TUNING_PROFILE* aTuningProfile ) const
{ {
if( aItem.GetMergeStatus() == LENGTH_DELAY_CALCULATION_ITEM::MERGE_STATUS::MERGED_RETIRED ) if( aItem.GetMergeStatus() == LENGTH_DELAY_CALCULATION_ITEM::MERGE_STATUS::MERGED_RETIRED )
return 0; return 0;
@ -83,7 +82,7 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CAL
if( itemType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE ) if( itemType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::LINE )
{ {
const double delayUnit = aTuningProfile->m_LayerPropagationDelays.at( aItem.GetStartLayer() ); const double delayUnit = aDelayProfile->m_LayerPropagationDelays.at( aItem.GetStartLayer() );
return static_cast<int64_t>( delayUnit * ( static_cast<double>( aItem.GetLine().Length() ) / PCB_IU_PER_MM ) ); return static_cast<int64_t>( delayUnit * ( static_cast<double>( aItem.GetLine().Length() ) / PCB_IU_PER_MM ) );
} }
@ -95,7 +94,7 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CAL
const PCB_LAYER_ID viaEndLayer = aItem.GetVia()->Padstack().EndLayer(); const PCB_LAYER_ID viaEndLayer = aItem.GetVia()->Padstack().EndLayer();
// First check for a layer-to-layer override - this assumes that the layers are already in CuStack() order // First check for a layer-to-layer override - this assumes that the layers are already in CuStack() order
auto& viaOverrides = m_viaOverridesCache.at( aTuningProfile->m_ProfileName ); auto& viaOverrides = m_viaOverridesCache.at( aDelayProfile->m_ProfileName );
const auto viaItr = viaOverrides.find( const auto viaItr = viaOverrides.find(
VIA_OVERRIDE_CACHE_KEY{ signalStartLayer, signalEndLayer, viaStartLayer, viaEndLayer } ); VIA_OVERRIDE_CACHE_KEY{ signalStartLayer, signalEndLayer, viaStartLayer, viaEndLayer } );
@ -105,7 +104,7 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CAL
// Otherwise, return the tuning profile default // Otherwise, return the tuning profile default
const double distance = m_lengthCalculation->StackupHeight( signalStartLayer, signalEndLayer ); const double distance = m_lengthCalculation->StackupHeight( signalStartLayer, signalEndLayer );
return static_cast<int64_t>( aTuningProfile->m_ViaPropagationDelay * ( distance / PCB_IU_PER_MM ) ); return static_cast<int64_t>( aDelayProfile->m_ViaPropagationDelay * ( distance / PCB_IU_PER_MM ) );
} }
if( itemType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::PAD ) if( itemType == LENGTH_DELAY_CALCULATION_ITEM::TYPE::PAD )
@ -117,15 +116,14 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::getPropagationDelay( const LENGTH_DELAY_CAL
} }
const TIME_DOMAIN_TUNING_PROFILE* const DELAY_PROFILE* TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetDelayProfile( const wxString& aDelayProfileName )
TIME_DOMAIN_PARAMETERS_USER_DEFINED::getTuningProfile( const wxString& aTuningProfileName )
{ {
if( !m_cachesInitialised ) [[unlikely]] if( !m_cachesInitialised ) [[unlikely]]
rebuildCaches(); rebuildCaches();
auto itr = m_tuningProfilesCache.find( aTuningProfileName ); auto itr = m_delayProfilesCache.find( aDelayProfileName );
if( itr != m_tuningProfilesCache.end() ) if( itr != m_delayProfilesCache.end() )
return itr->second; return itr->second;
return nullptr; return nullptr;
@ -136,8 +134,8 @@ int64_t
TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetTrackLengthForPropagationDelay( int64_t aDelay, TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetTrackLengthForPropagationDelay( int64_t aDelay,
const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext ) const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext )
{ {
const wxString tuningProfileName = aContext.NetClass->GetTuningProfile(); const wxString delayProfileName = aContext.NetClass->GetDelayProfile();
const TIME_DOMAIN_TUNING_PROFILE* profile = getTuningProfile( tuningProfileName ); const DELAY_PROFILE* profile = GetDelayProfile( delayProfileName );
if( !profile ) if( !profile )
return 0; return 0;
@ -151,8 +149,8 @@ TIME_DOMAIN_PARAMETERS_USER_DEFINED::GetTrackLengthForPropagationDelay( int64_t
int64_t TIME_DOMAIN_PARAMETERS_USER_DEFINED::CalculatePropagationDelayForShapeLineChain( int64_t TIME_DOMAIN_PARAMETERS_USER_DEFINED::CalculatePropagationDelayForShapeLineChain(
const SHAPE_LINE_CHAIN& aShape, const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext ) const SHAPE_LINE_CHAIN& aShape, const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext )
{ {
const wxString tuningProfileName = aContext.NetClass->GetTuningProfile(); const wxString delayProfileName = aContext.NetClass->GetDelayProfile();
const TIME_DOMAIN_TUNING_PROFILE* profile = getTuningProfile( tuningProfileName ); const DELAY_PROFILE* profile = GetDelayProfile( delayProfileName );
if( !profile ) if( !profile )
return 0; return 0;
@ -164,20 +162,20 @@ int64_t TIME_DOMAIN_PARAMETERS_USER_DEFINED::CalculatePropagationDelayForShapeLi
void TIME_DOMAIN_PARAMETERS_USER_DEFINED::rebuildCaches() void TIME_DOMAIN_PARAMETERS_USER_DEFINED::rebuildCaches()
{ {
m_tuningProfilesCache.clear(); m_delayProfilesCache.clear();
m_viaOverridesCache.clear(); m_viaOverridesCache.clear();
if( const PROJECT* project = m_board->GetProject() ) if( const PROJECT* project = m_board->GetProject() )
{ {
TIME_DOMAIN_PARAMETERS* params = project->GetProjectFile().TimeDomainParameters().get(); TIME_DOMAIN_PARAMETERS* params = project->GetProjectFile().TimeDomainParameters().get();
for( const TIME_DOMAIN_TUNING_PROFILE& profile : params->GetDelayProfiles() ) for( const DELAY_PROFILE& profile : params->GetDelayProfiles() )
{ {
m_tuningProfilesCache[profile.m_ProfileName] = &profile; m_delayProfilesCache[profile.m_ProfileName] = &profile;
std::map<VIA_OVERRIDE_CACHE_KEY, int64_t>& viaOverrides = m_viaOverridesCache[profile.m_ProfileName]; std::map<VIA_OVERRIDE_CACHE_KEY, int64_t>& viaOverrides = m_viaOverridesCache[profile.m_ProfileName];
for( const TUNING_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : profile.m_ViaOverrides ) for( const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : profile.m_ViaOverrides )
{ {
viaOverrides[VIA_OVERRIDE_CACHE_KEY{ viaOverride.m_SignalLayerFrom, viaOverride.m_SignalLayerTo, viaOverrides[VIA_OVERRIDE_CACHE_KEY{ viaOverride.m_SignalLayerFrom, viaOverride.m_SignalLayerTo,
viaOverride.m_ViaLayerFrom, viaOverride.m_ViaLayerTo }] = viaOverride.m_ViaLayerFrom, viaOverride.m_ViaLayerTo }] =

View File

@ -118,22 +118,22 @@ private:
* *
* @param aItem the board item to query propagation delay for * @param aItem the board item to query propagation delay for
* @param aContext the geometry context in which to query to propagation delay * @param aContext the geometry context in which to query to propagation delay
* @param aTuningProfile the time domain tuning profile for the given item * @param aDelayProfile the time domain tuning profile for the given item
*/ */
int64_t getPropagationDelay( const LENGTH_DELAY_CALCULATION_ITEM& aItem, int64_t getPropagationDelay( const LENGTH_DELAY_CALCULATION_ITEM& aItem,
const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext, const TIME_DOMAIN_GEOMETRY_CONTEXT& aContext,
const TIME_DOMAIN_TUNING_PROFILE* aTuningProfile ) const; const DELAY_PROFILE* aDelayProfile ) const;
/** /**
* Gets the tuning profile pointer for the given tuning profile name * Gets the tuning profile pointer for the given tuning profile name
* *
* @param aTuningProfileName the tuning profile name to return * @param aDelayProfileName the tuning profile name to return
* @returns Valid pointer to a tuning profile, or nullptr if no profile found * @returns Valid pointer to a tuning profile, or nullptr if no profile found
*/ */
const TIME_DOMAIN_TUNING_PROFILE* getTuningProfile( const wxString& aTuningProfileName ); const DELAY_PROFILE* GetDelayProfile( const wxString& aDelayProfileName );
/// Cached map of tuning profile names to per-layer time domain parameters /// Cached map of tuning profile names to per-layer time domain parameters
std::map<wxString, const TIME_DOMAIN_TUNING_PROFILE*> m_tuningProfilesCache; std::map<wxString, const DELAY_PROFILE*> m_delayProfilesCache;
/// Cached per-tuning profile via overrides /// Cached per-tuning profile via overrides
std::map<wxString, std::map<VIA_OVERRIDE_CACHE_KEY, int64_t>> m_viaOverridesCache; std::map<wxString, std::map<VIA_OVERRIDE_CACHE_KEY, int64_t>> m_viaOverridesCache;