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

#include <UntilCommand.hh>

Inheritance diagram for UntilCommand:
Inheritance graph
Collaboration diagram for UntilCommand:
Collaboration graph

Public Member Functions

 UntilCommand ()
 
virtual ~UntilCommand ()
 
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 "until" command of the Simulator Control Language.

Definition at line 47 of file UntilCommand.hh.

Constructor & Destructor Documentation

◆ UntilCommand()

UntilCommand::UntilCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 53 of file UntilCommand.cc.

53  : SimControlLanguageCommand("until") {
54 }

◆ ~UntilCommand()

UntilCommand::~UntilCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 61 of file UntilCommand.cc.

61  {
62 }

Member Function Documentation

◆ execute()

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

Executes the "until" command.

Run until the program location specified by arg is reached and stop before executing the instruction at specified address. Any valid argument that applies to command break is also a valid argument for until.

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.

Implements CustomCommand.

Definition at line 76 of file UntilCommand.cc.

76  {
77  boost::timer time;
78 
79  const int argumentCount = arguments.size() - 1;
80  if (!checkArgumentCount(argumentCount, 0, 1)) {
81  return false;
82  }
83 
85  return false;
86  }
87 
88  try {
89  const std::string argument =
90  ((argumentCount == 1)?(arguments[1].stringValue()):(""));
91 
92  const int instructionAddress =
94  simulatorFrontend().runUntil(instructionAddress);
97  } catch (const IllegalParameters&) {
98  return false;
99  }
100  return true;
101 }

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

Here is the call graph for this function:

◆ helpText()

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

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.

Implements CustomCommand.

Definition at line 111 of file UntilCommand.cc.

111  {
114 }

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

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
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
IllegalParameters
Definition: Exception.hh:113
SimControlLanguageCommand::parseInstructionAddressExpression
InstructionAddress parseInstructionAddressExpression(const std::string &expression)
Definition: SimControlLanguageCommand.cc:378
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
SimulatorFrontend::runUntil
virtual void runUntil(UIntWord address)
Definition: SimulatorFrontend.cc:1014
Texts::TXT_INTERP_HELP_UNTIL
@ TXT_INTERP_HELP_UNTIL
Help text for command "stepi" of the CLI.
Definition: SimulatorTextGenerator.hh:75
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
SimControlLanguageCommand::printSimulationTime
virtual void printSimulationTime()
Definition: SimControlLanguageCommand.cc:322