OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
SimulatorCmdLineOptions Class Reference

#include <SimulatorCmdLineOptions.hh>

Inheritance diagram for SimulatorCmdLineOptions:
Inheritance graph
Collaboration diagram for SimulatorCmdLineOptions:
Collaboration graph

Public Member Functions

 SimulatorCmdLineOptions ()
 
virtual ~SimulatorCmdLineOptions ()
 
virtual void printVersion () const
 
virtual void printHelp () const
 
bool debugMode ()
 
std::string scriptString ()
 
std::string machineFile ()
 
std::string programFile ()
 
SimulatorFrontend::SimulationType backendType ()
 
- Public Member Functions inherited from CmdLineOptions
 CmdLineOptions (std::string description, std::string version="")
 
virtual ~CmdLineOptions ()
 
void parse (char *argv[], int argc)
 
void parse (std::string argv[], int argc)
 
void parse (std::vector< std::string > argv)
 
virtual bool isVerboseSwitchDefined () const
 
virtual bool isVerboseSpamSwitchDefined () const
 
- Public Member Functions inherited from CmdLineParser
 CmdLineParser (std::string description)
 
virtual ~CmdLineParser ()
 
virtual void storeOptions (Options &options)
 
virtual int numberOfArguments () const
 
virtual std::string argument (int index) const
 

Private Member Functions

 SimulatorCmdLineOptions (const SimulatorCmdLineOptions &)
 Copying not allowed.
 
SimulatorCmdLineOptionsoperator= (const SimulatorCmdLineOptions &)
 Assignment not allowed.
 

Additional Inherited Members

- Protected Member Functions inherited from CmdLineOptions
bool optionGiven (std::string key) const
 
- Protected Member Functions inherited from CmdLineParser
void addOption (CmdLineOptionParser *opt)
 
CmdLineOptionParserfindOption (std::string name) const
 
bool parseOption (std::string option, std::string &name, std::string &arguments, std::string &prefix, bool &hasArgument) const
 
bool readPrefix (std::string &option, std::string &prefix, bool &longOption) const
 
bool isPrefix (std::string name) const
 
- Protected Attributes inherited from CmdLineParser
std::map< std::string, CmdLineOptionParser * > optionLongNames_
 Database for holding options with their long names as a key.
 
std::map< std::string, CmdLineOptionParser * > optionShortNames_
 Database for holding options with their short names as a key.
 
std::vector< std::string > commandLine_
 Command line is stored here.
 
std::vector< std::string > arguments_
 Command line arguments are stored here.
 
std::vector< std::string > prefixes_
 Legal prefixes are stored here.
 

Detailed Description

Command line option class for Simulator.

Definition at line 45 of file SimulatorCmdLineOptions.hh.

Constructor & Destructor Documentation

◆ SimulatorCmdLineOptions() [1/2]

SimulatorCmdLineOptions::SimulatorCmdLineOptions ( )

Constructor.

Todo:
Use textgenerator in the help texts.

Definition at line 82 of file SimulatorCmdLineOptions.cc.

82 : CmdLineOptions("") {
85 SWL_DEBUG_MODE, "starts simulator in debugging mode (default), "
86 "use --no-debugmode to disable",
90 SWL_EXECUTE_SCRIPT, "executes the given string as a script in the "
91 "simulator control language script interpreter, "
92 "e.g. -e \"stepi 10000\" executes simulation for 10000 cycles",
94
97 SWL_MACHINE_TO_LOAD, "sets the machine file (.adf) to be loaded.",
99
100 addOption(
102 SWL_PROGRAM_TO_LOAD, "sets the program file to be loaded.",
104
105 addOption(
107 SWL_FAST_SIM, "uses the fast simulation engine.",
108 SWS_FAST_SIM));
109
110 addOption(
112 SWL_REMOTE_DBG, "connect to a remote debugging interface on an FPGA or ASIC.",
114
115 addOption(
117 SWL_CUSTOM_DBG, "connect to a custom remote debugger (if implemented).",
119}
const std::string SWL_CUSTOM_DBG
Long switch string for the custom remote debugger target.
const std::string SWS_CUSTOM_DBG
Short switch string for the custom remote debugger target.
const std::string SWS_DEBUG_MODE
Short switch string for setting the debug mode.
const std::string SWL_DEBUG_MODE
Long switch string for setting the debug mode.
const std::string SWS_PROGRAM_TO_LOAD
Short switch string for giving the program file.
const std::string SWL_PROGRAM_TO_LOAD
Long switch string for giving the program file.
const std::string SWS_REMOTE_DBG
Short switch string for the TCE builtin remote debugger target.
const std::string SWS_MACHINE_TO_LOAD
Short switch string for giving a machine file.
const std::string SWL_REMOTE_DBG
Long switch string for the TCE builtin remote debugger target.
const std::string SWL_EXECUTE_SCRIPT
Long switch string for giving a script to be executed.
const std::string SWL_MACHINE_TO_LOAD
Long switch string for giving a machine file.
const std::string SWS_EXECUTE_SCRIPT
Short switch string for giving a script to be executed.
const std::string SWS_FAST_SIM
Short switch string for the fast simulation.
const std::string SWL_FAST_SIM
Long switch string for the fast simulation.
void addOption(CmdLineOptionParser *opt)

References CmdLineParser::addOption(), SWL_CUSTOM_DBG, SWL_DEBUG_MODE, SWL_EXECUTE_SCRIPT, SWL_FAST_SIM, SWL_MACHINE_TO_LOAD, SWL_PROGRAM_TO_LOAD, SWL_REMOTE_DBG, SWS_CUSTOM_DBG, SWS_DEBUG_MODE, SWS_EXECUTE_SCRIPT, SWS_FAST_SIM, SWS_MACHINE_TO_LOAD, SWS_PROGRAM_TO_LOAD, and SWS_REMOTE_DBG.

Here is the call graph for this function:

◆ ~SimulatorCmdLineOptions()

SimulatorCmdLineOptions::~SimulatorCmdLineOptions ( )
virtual

Destructor.

Definition at line 124 of file SimulatorCmdLineOptions.cc.

124 {
125}

◆ SimulatorCmdLineOptions() [2/2]

SimulatorCmdLineOptions::SimulatorCmdLineOptions ( const SimulatorCmdLineOptions )
private

Copying not allowed.

Member Function Documentation

◆ backendType()

SimulatorFrontend::SimulationType SimulatorCmdLineOptions::backendType ( )

Check what sort of simulation user asked for on the command line.

If no value is given in the parsed command line the "normal" simulation, i.e. the interpreted, non-compiled, version is returned.

Returns
type of TTA backend user wants

Definition at line 209 of file SimulatorCmdLineOptions.cc.

209 {
210
211 bool wantCompiled = false;
212 bool wantRemote = false;
213 bool wantCustom = false;
214
215 wantCompiled |= optionGiven(SWL_FAST_SIM);
216 wantCompiled &= findOption(SWL_FAST_SIM)->isFlagOn();
217
218 wantRemote |= optionGiven(SWL_REMOTE_DBG);
219 wantRemote &= findOption(SWL_REMOTE_DBG)->isFlagOn();
220
221 wantCustom |= optionGiven(SWL_CUSTOM_DBG);
222 wantCustom &= findOption(SWL_CUSTOM_DBG)->isFlagOn();
223
224 // TODO: no check for if user requests simultaneously several
225 // versions of TTA backend. Start with the most picky one,
226 // user probably notices it erroring out.
227 if (wantCustom) return SimulatorFrontend::SIM_CUSTOM;
228 if (wantRemote) return SimulatorFrontend::SIM_REMOTE;
229 if (wantCompiled) return SimulatorFrontend::SIM_COMPILED;
231}
virtual bool isFlagOn() const
bool optionGiven(std::string key) const
CmdLineOptionParser * findOption(std::string name) const
@ SIM_REMOTE
Remote debugger, not a simulator at all.
@ SIM_CUSTOM
User-implemented remote HW debugger.
@ SIM_COMPILED
Compiled, faster simulation.
@ SIM_NORMAL
Default, interpreted simulation (debugging engine).

References CmdLineParser::findOption(), CmdLineOptionParser::isFlagOn(), CmdLineOptions::optionGiven(), SimulatorFrontend::SIM_COMPILED, SimulatorFrontend::SIM_CUSTOM, SimulatorFrontend::SIM_NORMAL, SimulatorFrontend::SIM_REMOTE, SWL_CUSTOM_DBG, SWL_FAST_SIM, and SWL_REMOTE_DBG.

Here is the call graph for this function:

◆ debugMode()

bool SimulatorCmdLineOptions::debugMode ( )

Returns true if Simulator should be started in debugging mode.

If no value is given in the parsed command line, default one is returned.

Returns
True if Simulator should be started in debugging mode.

Definition at line 158 of file SimulatorCmdLineOptions.cc.

158 {
160 return true;
161 }
163}

References CmdLineParser::findOption(), CmdLineOptionParser::isFlagOn(), CmdLineOptions::optionGiven(), and SWL_DEBUG_MODE.

Here is the call graph for this function:

◆ machineFile()

std::string SimulatorCmdLineOptions::machineFile ( )

Returns the filename of the given machine (.adf)

Returns
the filename of the given machine (.adf)

Definition at line 186 of file SimulatorCmdLineOptions.cc.

186 {
188}
virtual std::string String(int index=0) const

References CmdLineParser::findOption(), CmdLineOptionParser::String(), and SWS_MACHINE_TO_LOAD.

Here is the call graph for this function:

◆ operator=()

SimulatorCmdLineOptions & SimulatorCmdLineOptions::operator= ( const SimulatorCmdLineOptions )
private

Assignment not allowed.

◆ printHelp()

void SimulatorCmdLineOptions::printHelp ( ) const
virtual

Prints the help menu of the program.

Todo:
Implement using SimulatorTextGenerator.

Reimplemented from CmdLineOptions.

Definition at line 142 of file SimulatorCmdLineOptions.cc.

142 {
143 printVersion();
144 std::cout << std::endl << SimulatorToolbox::textGenerator().text(
145 Texts::TXT_CMD_LINE_HELP).str() << std::endl;
147}
virtual void printHelp() const
static SimulatorTextGenerator & textGenerator()
virtual boost::format text(int textId)

References CmdLineOptions::printHelp(), printVersion(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_CMD_LINE_HELP.

Here is the call graph for this function:

◆ printVersion()

void SimulatorCmdLineOptions::printVersion ( ) const
virtual

Prints the version of the program.

Implements CmdLineOptions.

Definition at line 131 of file SimulatorCmdLineOptions.cc.

131 {
132 std::cout << SIM_CLI_TITLE << " " << Application::TCEVersionString()
133 << std::endl;
134}
#define SIM_CLI_TITLE
The full title name of the CLI application.
static std::string TCEVersionString()

References SIM_CLI_TITLE, and Application::TCEVersionString().

Referenced by printHelp().

Here is the call graph for this function:

◆ programFile()

std::string SimulatorCmdLineOptions::programFile ( )

Returns the filename of the given program

Returns
the filename of the given program

Definition at line 196 of file SimulatorCmdLineOptions.cc.

196 {
198}

References CmdLineParser::findOption(), CmdLineOptionParser::String(), and SWS_PROGRAM_TO_LOAD.

Here is the call graph for this function:

◆ scriptString()

std::string SimulatorCmdLineOptions::scriptString ( )

Returns the script to be executed in the interpreter.

Returns an empty string, if none defined.

Returns
Script string.

Definition at line 173 of file SimulatorCmdLineOptions.cc.

173 {
175 return "";
176 }
178}

References CmdLineParser::findOption(), CmdLineOptions::optionGiven(), CmdLineOptionParser::String(), and SWL_EXECUTE_SCRIPT.

Here is the call graph for this function:

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