Sim: Add "number of bits" parameter to KIBIS PRBS model and some more fixes

The other fixes:

- PRBS's `m_bits` should be an integer.
- Fix some references to outdated parameter names.
This commit is contained in:
Mikolaj Wielgus 2022-12-01 09:14:14 +01:00
parent 757b73e50e
commit d2adcdfde0
2 changed files with 18 additions and 11 deletions

View File

@ -113,7 +113,7 @@ public:
};
double m_bitrate = 10e6;
double m_delay = 0;
double m_bits = 10;
int m_bits = 10;
std::vector<std::pair<int, double>> GenerateBitSequence() override;
bool Check( IbisWaveform* aRisingWf, IbisWaveform* aFallingWf ) override;

View File

@ -173,11 +173,11 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const st
if ( m_model.FindParam( "toff" ) )
waveform->m_toff = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "toff" )->value ).Get().value_or( 1 );
if ( m_model.FindParam( "delay" ) )
waveform->m_delay = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "delay" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "td" ) )
waveform->m_delay = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "td" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "cycles" ) )
waveform->m_cycles = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "cycles" )->value ).Get().value_or( 1 );
if ( m_model.FindParam( "n" ) )
waveform->m_cycles = static_cast<SIM_VALUE_INT&>( *m_model.FindParam( "n" )->value ).Get().value_or( 1 );
kparams.m_waveform = waveform;
@ -195,11 +195,11 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const st
if ( m_model.FindParam( "f0" ) )
waveform->m_bitrate = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "f0" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "bits" ) )
waveform->m_bits = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "bits" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "td" ) )
waveform->m_delay = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "td" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "delay" ) )
waveform->m_delay = static_cast<SIM_VALUE_FLOAT&>( *m_model.FindParam( "delay" )->value ).Get().value_or( 0 );
if ( m_model.FindParam( "n" ) )
waveform->m_bits = static_cast<SIM_VALUE_INT&>( *m_model.FindParam( "n" )->value ).Get().value_or( 0 );
kparams.m_waveform = waveform;
@ -466,7 +466,7 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeRectWaveformParamInfos(
paramInfos.push_back( paramInfo );
paramInfo.name = "n";
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.type = SIM_VALUE::TYPE_INT;
paramInfo.unit = "";
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
paramInfo.defaultValue = "1";
@ -490,8 +490,15 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makePrbsWaveformParamInfos(
paramInfo.description = _( "Bitrate" );
paramInfos.push_back( paramInfo );
paramInfo.name = "n";
paramInfo.name = "td";
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = "s";
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
paramInfo.description = _( "Delay" );
paramInfos.push_back( paramInfo );
paramInfo.name = "n";
paramInfo.type = SIM_VALUE::TYPE_INT;
paramInfo.unit = "";
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
paramInfo.defaultValue = "";