Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leading 0s from analyzed result #16

Closed
wants to merge 11 commits into from
Prev Previous commit
Support discontinuous datqa channels
  • Loading branch information
tgtakaoka committed Dec 14, 2024
commit 363bf5566248154960b820bd1e19c45efebe0ae0
22 changes: 16 additions & 6 deletions src/SimpleParallelAnalyzerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ SimpleParallelAnalyzerSettings::~SimpleParallelAnalyzerSettings()
delete mDataChannelsInterface[ i ];
}

U32 SimpleParallelAnalyzerSettings::MostSiginificantBitPosition() const
{
const U32 count = mDataChannels.size();
U32 most_significant_bit = 0;
for( U32 i = 0; i < count; i++ )
{
if( mDataChannels[ i ] != UNDEFINED_CHANNEL && most_significant_bit < i )
most_significant_bit = i;
}
return most_significant_bit;
}

bool SimpleParallelAnalyzerSettings::SetSettingsFromInterfaces()
{
U32 count = mDataChannels.size();
Expand All @@ -89,6 +101,7 @@ bool SimpleParallelAnalyzerSettings::SetSettingsFromInterfaces()
{
mDataChannels[ i ] = mDataChannelsInterface[ i ]->GetChannel();
}
mDataBits = MostSiginificantBitPosition() + 1;

mClockChannel = mClockChannelInterface->GetChannel();
mClockEdge = static_cast<ParallelAnalyzerClockEdge>( U32( mClockEdgeInterface->GetNumber() ) );
Expand All @@ -109,14 +122,13 @@ bool SimpleParallelAnalyzerSettings::SetSettingsFromInterfaces()
void SimpleParallelAnalyzerSettings::UpdateInterfacesFromSettings()
{
U32 count = mDataChannels.size();
U32 num_used_channels = 0;
for( U32 i = 0; i < count; i++ )
{
mDataChannelsInterface[ i ]->SetChannel( mDataChannels[ i ] );
if( mDataChannels[ i ] != UNDEFINED_CHANNEL )
num_used_channels++;
}
mDataBits = num_used_channels;
mDataBits = MostSiginificantBitPosition() + 1;

mClockChannelInterface->SetChannel( mClockChannel );
mClockEdgeInterface->SetNumber( static_cast<double>( mClockEdge ) );
Expand All @@ -128,14 +140,12 @@ void SimpleParallelAnalyzerSettings::LoadSettings( const char* settings )
text_archive.SetString( settings );

U32 count = mDataChannels.size();
U32 num_used_channels = 0;

for( U32 i = 0; i < count; i++ )
{
text_archive >> mDataChannels[ i ];
if( mDataChannels[ i ] != UNDEFINED_CHANNEL )
num_used_channels++;
}
mDataBits = num_used_channels;
mDataBits = MostSiginificantBitPosition() + 1;

text_archive >> mClockChannel;
U32 edge;
Expand Down
2 changes: 2 additions & 0 deletions src/SimpleParallelAnalyzerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class SimpleParallelAnalyzerSettings : public AnalyzerSettings
ParallelAnalyzerClockEdge mClockEdge;

protected:
U32 MostSiginificantBitPosition() const;

std::vector<AnalyzerSettingInterfaceChannel*> mDataChannelsInterface;

std::unique_ptr<AnalyzerSettingInterfaceChannel> mClockChannelInterface;
Expand Down