Main simulator class. More...
#include <McNiagara.h>
Data Structures | |
struct | ModelParam |
Structure to hold read-from-file model parameters. | |
struct | Token |
Token type structure for MC or trace tokens. | |
Public Member Functions | |
McNiagara (void) | |
Constructor: initializes lots of stuff. | |
void | init (const char *in_file, OffCpuIF *extif, const char *instProbFile, const char *perfCountFile, const char *tracefile=0, unsigned long seed=0) |
Initialize model. | |
void | un_init (void) |
int | sim_cycle (unsigned long current_cycle) |
Simulate one CPU cycle. | |
int | generate_instruction (Token *token) |
Generate an instruction token. | |
int | sim_instruction (Token *token) |
Simulation one instruction. | |
int | fini (const char *outfile) |
Finalize a model execution. | |
Data Fields | |
bool | convergence |
flag for model CPI convergence | |
bool | traceEnded |
flag for trace file end |
Main simulator class.
One object of this class is instantiated for each CPU that should be simulated (SST needs to be able to simulate multiple separate CPU's). See the main() function in McNiagara.cc for stand-alone execution.
McNiagara::McNiagara | ( | void | ) |
Constructor: initializes lots of stuff.
Basically all of the old global var initializations are here now.
References convergence, and traceEnded.
int McNiagara::fini | ( | const char * | outfile | ) |
Finalize a model execution.
outfile | is the name of the output file |
References MemoryModel::getDataLoadStats(), MemoryModel::getInstLoadStats(), and MemoryModel::getStoreStats().
int McNiagara::generate_instruction | ( | Token * | token | ) |
Generate an instruction token.
This generates a probabilistic instruction token in the Monte Carlo mode, or reads the next instruction from a trace file in the trace-driven mode. It sets all appropriate instruction parameters for the needs of the simulation.
token | is a pointer to the token type to fill in |
References traceEnded.
Referenced by sim_cycle().
void McNiagara::init | ( | const char * | in_file, | |
OffCpuIF * | extif, | |||
const char * | instProbFile, | |||
const char * | perfCountFile, | |||
const char * | tracefile = 0 , |
|||
unsigned long | seed = 0 | |||
) |
Initialize model.
This function reads in parameter and CDF files and initializes the variables (probabilities)
in_file | is the input CDF file | |
extif | is an off-cpu interface object (for SST reporting of mem/nic events, but might be useful elsewhere too) | |
tracefile | is an instruction trace file if a trace-driven simulation is wanted (otherwise, pure Monte Carlo) |
References MemoryModel::initLatencies(), and MemoryModel::initProbabilities().
int McNiagara::sim_cycle | ( | unsigned long | current_cycle | ) |
Simulate one CPU cycle.
Run the simulation for one cycle; with multiple issue this will simulate multiple instructions
current_cycle | is the current cycle count |
References generate_instruction(), and sim_instruction().
int McNiagara::sim_instruction | ( | Token * | token | ) |
Simulation one instruction.
This simulates and accounts for one instruction as represented by the token argument
token | is the instruction token |
References DependencyTracker::addDependency(), convergence, DependencyTracker::isDependent(), MemoryModel::serveILoad(), MemoryModel::serveLoad(), and MemoryModel::serveStore().
Referenced by sim_cycle().