OpenASIP  2.0
Public Member Functions | List of all members
StepiCommand Class Reference

#include <StepiCommand.hh>

Inheritance diagram for StepiCommand:
Inheritance graph
Collaboration diagram for StepiCommand:
Collaboration graph

Public Member Functions

 StepiCommand ()
 
virtual ~StepiCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
virtual std::string helpText () const
 
- Public Member Functions inherited from SimControlLanguageCommand
 SimControlLanguageCommand (const std::string &name)
 
virtual ~SimControlLanguageCommand ()
 
SimulatorFrontendsimulatorFrontend ()
 
const SimulatorFrontendsimulatorFrontendConst ()
 
virtual void printNextInstruction ()
 
virtual void printStopInformation ()
 
virtual void printStopReasons ()
 
virtual bool printBreakpointInfo (unsigned int breakpointHandle)
 
virtual void printSimulationTime ()
 
virtual std::ostream & outputStream ()
 
bool checkSimulationInitialized ()
 
bool checkSimulationNotAlreadyRunning ()
 
bool checkSimulationStopped ()
 
bool checkSimulationEnded ()
 
bool checkProgramLoaded ()
 
bool checkMachineLoaded ()
 
InstructionAddress parseInstructionAddressExpression (const std::string &expression)
 
TTAProgram::Address parseDataAddressExpression (const std::string &expression)
 
bool parseBreakpoint (const std::vector< DataObject > &arguments, Breakpoint &target)
 
bool askConditionFromUser (TclConditionScript &target)
 
bool askExpressionFromUser (ExpressionScript &target)
 
bool verifyBreakpointHandles (const std::vector< DataObject > &arguments, std::size_t startIndex=1)
 
void setErrorMessage (const TCEString &errorMsg)
 
- Public Member Functions inherited from CustomCommand
 CustomCommand (std::string name)
 
 CustomCommand (const CustomCommand &cmd)
 
virtual ~CustomCommand ()
 
std::string name () const
 
void setContext (InterpreterContext *context)
 
InterpreterContextcontext () const
 
void setInterpreter (ScriptInterpreter *si)
 
ScriptInterpreterinterpreter () const
 
bool checkArgumentCount (int argumentCount, int minimum, int maximum)
 
bool checkIntegerArgument (const DataObject &argument)
 
bool checkPositiveIntegerArgument (const DataObject &argument)
 
bool checkUnsignedIntegerArgument (const DataObject &argument)
 
bool checkDoubleArgument (const DataObject &argument)
 

Additional Inherited Members

- Protected Member Functions inherited from SimControlLanguageCommand
bool setMemoryAddress (const std::string &addressString, std::string &addressSpaceName, std::size_t &memoryAddress)
 
bool setMemoryPointer (MemorySystem::MemoryPtr &memory, const std::string &addressSpaceName)
 

Detailed Description

Implementation of the "stepi" command of the Simulator Control Language.

Definition at line 47 of file StepiCommand.hh.

Constructor & Destructor Documentation

◆ StepiCommand()

StepiCommand::StepiCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 50 of file StepiCommand.cc.

50  : SimControlLanguageCommand("stepi") {
51 }

◆ ~StepiCommand()

StepiCommand::~StepiCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 58 of file StepiCommand.cc.

58  {
59 }

Member Function Documentation

◆ execute()

bool StepiCommand::execute ( const std::vector< DataObject > &  arguments)
virtual

Executes the "stepi" command.

Executes the user defined count of next TTA instruction and returns control back to user.

Parameters
argumentsThe count of steps (default is one step).
Returns
True in case simulation is initialized and arguments are ok.
Exceptions
NumberFormatExceptionIs never thrown by this command.
Todo:
Use the count for the step.

Implements CustomCommand.

Definition at line 73 of file StepiCommand.cc.

73  {
74  if (!checkArgumentCount(arguments.size() - 1, 0, 1)) {
75  return false;
76  }
77 
78  double stepCount = 1;
79  if (arguments.size() == 2) {
80  if (!checkDoubleArgument(arguments[1])) {
81  return false;
82  }
83  stepCount = arguments[1].doubleValue();
84  }
85 
86  if (!checkSimulationStopped()) {
88  return false;
89  }
90  }
91 
92  simulatorFrontend().step(stepCount);
95  return true;
96 }

References CustomCommand::checkArgumentCount(), CustomCommand::checkDoubleArgument(), SimControlLanguageCommand::checkSimulationInitialized(), SimControlLanguageCommand::checkSimulationStopped(), SimControlLanguageCommand::printNextInstruction(), SimControlLanguageCommand::printSimulationTime(), SimControlLanguageCommand::simulatorFrontend(), and SimulatorFrontend::step().

Here is the call graph for this function:

◆ helpText()

std::string StepiCommand::helpText ( ) const
virtual

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.
Todo:
Use SimulatorTextGenerator to get the help text.

Implements CustomCommand.

Definition at line 107 of file StepiCommand.cc.

107  {
110 }

References Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_INTERP_HELP_STEPI.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
SimControlLanguageCommand::printNextInstruction
virtual void printNextInstruction()
Definition: SimControlLanguageCommand.cc:228
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
Texts::TXT_INTERP_HELP_STEPI
@ TXT_INTERP_HELP_STEPI
Help text for command "stepi" of the CLI.
Definition: SimulatorTextGenerator.hh:71
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
SimulatorFrontend::step
virtual void step(double count=1)
Definition: SimulatorFrontend.cc:1034
CustomCommand::checkDoubleArgument
bool checkDoubleArgument(const DataObject &argument)
Definition: CustomCommand.cc:195
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
SimControlLanguageCommand::printSimulationTime
virtual void printSimulationTime()
Definition: SimControlLanguageCommand.cc:322