本文整理汇总了C++中Params::SetParams方法的典型用法代码示例。如果您正苦于以下问题:C++ Params::SetParams方法的具体用法?C++ Params::SetParams怎么用?C++ Params::SetParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::SetParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetConfig
void ByteModel::SetConfig( Config *config, bool createChildren )
{
Params *params = new Params( );
params->SetParams( config );
SetParams( params );
EnduranceModel::SetConfig( config, createChildren );
}
示例2: SetConfig
void RowModel::SetConfig( Config *conf, bool createChildren )
{
Params *params = new Params( );
params->SetParams( conf );
SetParams( params );
SetGranularity( p->COLS * 8 );
EnduranceModel::SetConfig( conf, createChildren );
}
示例3: SetConfig
void WordModel::SetConfig( Config *config, bool createChildren )
{
Params *params = new Params( );
params->SetParams( config );
SetParams( params );
SetGranularity( p->BusWidth * 8 );
EnduranceModel::SetConfig( config, createChildren );
}
示例4: SetConfig
void StandardRank::SetConfig( Config *c, bool createChildren )
{
//std::cout<< "HRANK named " << StatName()<< std::endl;
/*
std::stringstream formatter1;
formatter1.str( "" );
formatter1 << GetParent( )->StatName( ) << ".babyhrank";
StatName(formatter1.str( ));
std::cout<<"StandardRank::SetConfig"<<std::endl;
*/
//std::vector<NVMObject_hook *>::iterator it;
//std::vector<NVMObject_hook *>& childNodes = GetParent( )->GetTrampoline( )-> GetChildren( );
//std::cout<<"parent name is "<< GetParent( )->StatName( )<<std::endl;
//it = childNodes.begin();
//std::cout << "Mother's children hook name is " << (*it)->StatName( ) << std::endl;
/*
for( it = childNodes.begin(); it != childNodes.end(); it++ )
{
std::cout << "Mother's children hook name is " << (*it)->StatName( ) << std::endl;
}
*/
conf = c;
Params *params = new Params( );
params->SetParams( c );
SetParams( params );
deviceWidth = p->DeviceWidth;
busWidth = p->BusWidth;
banksPerRefresh = p->BanksPerRefresh;
if( conf->GetValue( "RAW" ) == -1 )
{
std::cout << "NVMain Warning: RAW (Row Activation Window) is not "
<< "specified. Has set it to 4 (FAW)" << std::endl;
rawNum = 4;
}
else
rawNum = p->RAW;
assert( rawNum != 0 );
/* Calculate the number of devices needed. */
deviceCount = busWidth / deviceWidth;
if( busWidth % deviceWidth != 0 )
{
std::cout << "NVMain: device width is not a multiple of the bus width!\n";
deviceCount++;
}
bankCount = p->BANKS;
if( createChildren )
{
/* When selecting a child, use the bank field from the decoder. */
AddressTranslator *rankAT = DecoderFactory::CreateDecoderNoWarn( conf->GetString( "Decoder" ) );
std::cout << "The parent hook name is "<< GetParent( )->StatName( ) <<std::endl;/*zhuguoliang*/
rankAT->SetTranslationMethod( GetParent( )->GetTrampoline( )->GetParent( )->GetTrampoline( )->GetDecoder( )->GetTranslationMethod( ) );
rankAT->SetDefaultField( BANK_FIELD );
rankAT->SetConfig( c, createChildren );
SetDecoder( rankAT );
std::cout << "Creating " << bankCount << " banks in all "
<< deviceCount << " devices.\n";
for( ncounter_t i = 0; i < bankCount; i++ )
{
std::stringstream formatter;
Bank *nextBank = BankFactory::CreateBankNoWarn( conf->GetString( "BankType" ) );
formatter << i;
nextBank->SetId( i );
formatter.str( "" );
formatter << StatName( ) << ".bank" << i;
nextBank->StatName( formatter.str( ) );
//std::cout<< "HRANK named " << StatName()<< std::endl;
nextBank->SetParent( this );
AddChild( nextBank );
/* SetConfig recursively. */
nextBank->SetConfig( c, createChildren );
nextBank->RegisterStats( );
}
}
/*
* Make sure this doesn't cause unnecessary tRRD delays at start
* TODO: have Activate check currentCycle < tRRD/tRAW maybe?
*/
lastActivate = new ncycle_t[rawNum];
for( ncounter_t i = 0; i < rawNum; i++ )
//.........这里部分代码省略.........
示例5: SetConfig
void NVMain::SetConfig( Config *conf, std::string memoryName, bool createChildren )
{
TranslationMethod *method;
int channels, ranks, banks, rows, cols, subarrays;
Params *params = new Params( );
params->SetParams( conf );
SetParams( params );
StatName( memoryName );
config = conf;
if( config->GetSimInterface( ) != NULL )
config->GetSimInterface( )->SetConfig( conf, createChildren );
else
std::cout << "Warning: Sim Interface should be allocated before configuration!" << std::endl;
if( createChildren )
{
if( conf->KeyExists( "MATHeight" ) )
{
rows = static_cast<int>(p->MATHeight);
subarrays = static_cast<int>( p->ROWS / p->MATHeight );
}
else
{
rows = static_cast<int>(p->ROWS);
subarrays = 1;
}
cols = static_cast<int>(p->COLS);
banks = static_cast<int>(p->BANKS);
ranks = static_cast<int>(p->RANKS);
channels = static_cast<int>(p->CHANNELS);
word_size = static_cast<uint64_t>( p->tBURST * p->RATE * p->BusWidth/8);
std::cout<<"word size is "<<word_size<<std::endl;
std::cout<<"cols is"<<cols<<std::endl;
std::cout<<"rows is"<<rows<<std::endl;
std::cout<<"ranks is"<<ranks<<std::endl;
std::cout<<"banks is"<<banks<<std::endl;
std::cout<<"ranks is"<<ranks<<std::endl;
std::cout<<"channels is"<<channels<<std::endl;
std::cout<<"subarrays is"<<subarrays<<std::endl;
if( !config->KeyExists("DRCVariant") )
{
memory_size += word_size * cols * rows * banks * ranks * channels *subarrays;
std::cout<<"mem size is "<<memory_size/(1024*1024)<<"MB"<<std::endl;
}
if( config->KeyExists( "Decoder" ) )
translator = DecoderFactory::CreateNewDecoder( config->GetString( "Decoder" ) );
else
translator = new AddressTranslator( );
method = new TranslationMethod( );
method->SetBitWidths( NVM::mlog2( rows ),
NVM::mlog2( cols ),
NVM::mlog2( banks ),
NVM::mlog2( ranks ),
NVM::mlog2( channels ),
NVM::mlog2( subarrays )
);
method->SetCount( rows, cols, banks, ranks, channels, subarrays );
method->SetAddressMappingScheme( p->AddressMappingScheme );
translator->SetConfig( config, createChildren );
translator->SetTranslationMethod( method );
translator->SetDefaultField( CHANNEL_FIELD );
SetDecoder( translator );
memoryControllers = new MemoryController* [channels];
channelConfig = new Config* [channels];
for( int i = 0; i < channels; i++ )
{
std::stringstream confString;
std::string channelConfigFile;
channelConfig[i] = new Config( *config );
channelConfig[i]->SetSimInterface( config->GetSimInterface( ) );
confString << "CONFIG_CHANNEL" << i;
if( config->GetString( confString.str( ) ) != "" )
{
channelConfigFile = config->GetString( confString.str( ) );
if( channelConfigFile[0] != '/' )
{
channelConfigFile = NVM::GetFilePath( config->GetFileName( ) );
channelConfigFile += config->GetString( confString.str( ) );
}
channelConfig[i]->Read( channelConfigFile );
}
//std::cout<<"NVMain: initialize memory controller"<<std::endl;
/* Initialize memory controller */
memoryControllers[i] =
MemoryControllerFactory::CreateNewController( channelConfig[i]->GetString( "MEM_CTL" ) );
//.........这里部分代码省略.........