PandA-2024.02
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
SimulationTool Class Referenceabstract

#include <SimulationTool.hpp>

Inheritance diagram for SimulationTool:
Inheritance graph
[legend]
Collaboration diagram for SimulationTool:
Collaboration graph
[legend]

Public Types

using type_t = enum { UNKNOWN=0, MODELSIM, XSIM, VERILATOR }
 supported synthesis tools More...
 

Public Member Functions

 SimulationTool (const ParameterConstRef &Param, const std::string &top_fname, const std::string &inc_dirs)
 Constructor. More...
 
virtual ~SimulationTool ()
 Destructor. More...
 
virtual void CheckExecution ()
 Checks if the current specification can be executed or not. More...
 
virtual std::string GenerateSimulationScript (const std::string &top_filename, std::list< std::string > file_list)
 Generates the proper simulation script. More...
 
virtual void Simulate (unsigned long long &accum_cycles, unsigned long long &n_testcases)
 Performs the simulation and returns the number of cycles. More...
 
void DetermineCycles (unsigned long long int &accum_cycles, unsigned long long &n_testcases)
 Determines the average number of cycles for the simulation(s) More...
 
virtual void Clean () const
 Remove files created during simulation FIXME: this should become pure virtual. More...
 

Static Public Member Functions

static type_t to_sim_type (const std::string &str)
 
static SimulationToolRef CreateSimulationTool (type_t type, const ParameterConstRef &Param, const std::string &suffix, const std::string &top_fname, const std::string &inc_dirs)
 Factory method. More...
 

Protected Member Functions

virtual std::string GenerateScript (std::ostream &script, const std::string &top_filename, const std::list< std::string > &file_list)=0
 Performs the actual writing. More...
 
std::string GenerateLibraryBuildScript (std::ostream &script, const std::string &libtb_filename, std::string &beh_cflags) const
 

Protected Attributes

const ParameterConstRef Param
 class containing all the parameters More...
 
int debug_level
 debug level of the class More...
 
unsigned int output_level
 verbosity level of the class More...
 
const std::string top_fname
 
std::string generated_script
 generated script More...
 
std::string log_file
 log file More...
 
const std::string inc_dirs
 comma separated list of include dirs More...
 

Detailed Description

Definition at line 53 of file SimulationTool.hpp.

Member Typedef Documentation

◆ type_t

using SimulationTool::type_t = enum { UNKNOWN = 0, MODELSIM, XSIM, VERILATOR }

supported synthesis tools

Definition at line 57 of file SimulationTool.hpp.

Constructor & Destructor Documentation

◆ SimulationTool()

SimulationTool::SimulationTool ( const ParameterConstRef Param,
const std::string &  top_fname,
const std::string &  inc_dirs 
)
explicit

Constructor.

Definition at line 85 of file SimulationTool.cpp.

References ~SimulationTool().

Here is the call graph for this function:

◆ ~SimulationTool()

SimulationTool::~SimulationTool ( )
virtualdefault

Destructor.

Referenced by SimulationTool().

Here is the caller graph for this function:

Member Function Documentation

◆ CheckExecution()

void SimulationTool::CheckExecution ( )
virtual

Checks if the current specification can be executed or not.

for default, nothing to do

Reimplemented in VIVADO_xsim_wrapper, modelsimWrapper, and VerilatorWrapper.

Definition at line 122 of file SimulationTool.cpp.

◆ Clean()

void SimulationTool::Clean ( ) const
virtual

Remove files created during simulation FIXME: this should become pure virtual.

Reimplemented in VIVADO_xsim_wrapper, modelsimWrapper, and VerilatorWrapper.

Definition at line 468 of file SimulationTool.cpp.

◆ CreateSimulationTool()

SimulationToolRef SimulationTool::CreateSimulationTool ( type_t  type,
const ParameterConstRef Param,
const std::string &  suffix,
const std::string &  top_fname,
const std::string &  inc_dirs 
)
static

Factory method.

this point should never be reached

Definition at line 97 of file SimulationTool.cpp.

References THROW_ERROR, and UNKNOWN.

Referenced by GenerateSimulationScripts::Exec().

Here is the caller graph for this function:

◆ DetermineCycles()

void SimulationTool::DetermineCycles ( unsigned long long int &  accum_cycles,
unsigned long long &  n_testcases 
)

Determines the average number of cycles for the simulation(s)

Parameters
accum_cyclesis the total number of accumulated cycles
n_testcasesis the number of testcases simulated

Definition at line 159 of file SimulationTool.cpp.

References output_level, OUTPUT_LEVEL_PEDANTIC, OUTPUT_LEVEL_VERBOSE, Param, PRINT_OUT_MEX, SplitString(), THROW_ASSERT, THROW_ERROR, and times().

Referenced by Simulate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GenerateLibraryBuildScript()

std::string SimulationTool::GenerateLibraryBuildScript ( std::ostream &  script,
const std::string &  libtb_filename,
std::string &  beh_cflags 
) const
protected

◆ GenerateScript()

virtual std::string SimulationTool::GenerateScript ( std::ostream &  script,
const std::string &  top_filename,
const std::list< std::string > &  file_list 
)
protectedpure virtual

Performs the actual writing.

Implemented in VIVADO_xsim_wrapper, modelsimWrapper, and VerilatorWrapper.

Referenced by GenerateSimulationScript().

Here is the caller graph for this function:

◆ GenerateSimulationScript()

std::string SimulationTool::GenerateSimulationScript ( const std::string &  top_filename,
std::list< std::string >  file_list 
)
virtual

Generates the proper simulation script.

Definition at line 280 of file SimulationTool.cpp.

References add(), generated_script, GenerateScript(), GetCurrentPath(), GetPath(), Param, relocate_compiler_path(), and starts_with().

Here is the call graph for this function:

◆ Simulate()

void SimulationTool::Simulate ( unsigned long long &  accum_cycles,
unsigned long long &  n_testcases 
)
virtual

Performs the simulation and returns the number of cycles.

remove previous simulation results

Definition at line 127 of file SimulationTool.cpp.

References ToolManager::configure(), DetermineCycles(), ToolManager::execute(), generated_script, Param, test_panda::parameters, and THROW_ERROR.

Here is the call graph for this function:

◆ to_sim_type()

SimulationTool::type_t SimulationTool::to_sim_type ( const std::string &  str)
static

Definition at line 64 of file SimulationTool.cpp.

References THROW_ERROR.

Referenced by GenerateSimulationScripts::Exec().

Here is the caller graph for this function:

Field Documentation

◆ debug_level

int SimulationTool::debug_level
protected

◆ generated_script

std::string SimulationTool::generated_script
protected

generated script

Definition at line 74 of file SimulationTool.hpp.

Referenced by GenerateSimulationScript(), and Simulate().

◆ inc_dirs

const std::string SimulationTool::inc_dirs
protected

comma separated list of include dirs

Definition at line 80 of file SimulationTool.hpp.

Referenced by VerilatorWrapper::GenerateScript(), modelsimWrapper::GenerateScript(), and VIVADO_xsim_wrapper::GenerateScript().

◆ log_file

std::string SimulationTool::log_file
protected

◆ output_level

unsigned int SimulationTool::output_level
protected

verbosity level of the class

Definition at line 69 of file SimulationTool.hpp.

Referenced by DetermineCycles(), and modelsimWrapper::GenerateScript().

◆ Param

const ParameterConstRef SimulationTool::Param
protected

◆ top_fname

const std::string SimulationTool::top_fname
protected

Definition at line 71 of file SimulationTool.hpp.

Referenced by GenerateLibraryBuildScript().


The documentation for this class was generated from the following files:

Generated on Mon Feb 12 2024 13:04:03 for PandA-2024.02 by doxygen 1.8.13