OpenASIP  2.0
Public Member Functions | List of all members
InfoSegmentsCommand Class Reference
Inheritance diagram for InfoSegmentsCommand:
Inheritance graph
Collaboration diagram for InfoSegmentsCommand:
Collaboration graph

Public Member Functions

 InfoSegmentsCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~InfoSegmentsCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
- Public Member Functions inherited from SimControlLanguageSubCommand
 SimControlLanguageSubCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~SimControlLanguageSubCommand ()
 
virtual SimControlLanguageCommandparent ()
 

Detailed Description

Implementation of "info segments".

Definition at line 595 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoSegmentsCommand()

InfoSegmentsCommand::InfoSegmentsCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 600 of file InfoCommand.cc.

600  :
601  SimControlLanguageSubCommand(parentCommand) {
602  }

◆ ~InfoSegmentsCommand()

virtual InfoSegmentsCommand::~InfoSegmentsCommand ( )
inlinevirtual

Destructor.

Definition at line 607 of file InfoCommand.cc.

607  {
608  }

Member Function Documentation

◆ execute()

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

Executes the "info segments" command.

Prints the values of segments in the given bus.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 618 of file InfoCommand.cc.

618  {
619 
620  const int argumentCount = arguments.size() - 2;
621 
622  if (!parent().checkArgumentCount(argumentCount, 1, 2)) {
623  return false;
624  }
625  if (!parent().checkMachineLoaded()) {
626  return false;
627  }
628  const TTAMachine::Machine& mach =
630 
631  const std::string busName = arguments.at(2).stringValue();
632 
634  mach.busNavigator();
635 
636  if (!nav.hasItem(busName)) {
639  Texts::TXT_BUS_NOT_FOUND).str());
640  return false;
641  }
642 
643  TTAMachine::Bus* bus = nav.item(busName);
644  assert(bus != NULL);
646 
647  if (argumentCount == 1) {
648  std::string result = "";
649  BusState& busState = state.busState(busName);
650  parent().interpreter()->setResult(busState.value().intValue());
651  return true;
652  } else if (argumentCount == 2) {
654  "Segmented busses not yet supported.");
655  return false;
656  }
657  return false;
658  }

References assert, TTAMachine::Machine::busNavigator(), MachineState::busState(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), CustomCommand::interpreter(), SimValue::intValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), SimulatorFrontend::machineState(), SimControlLanguageSubCommand::parent(), ScriptInterpreter::setError(), ScriptInterpreter::setResult(), SimControlLanguageCommand::simulatorFrontend(), SimulatorToolbox::textGenerator(), Texts::TXT_BUS_NOT_FOUND, and RegisterState::value().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
SimValue::intValue
int intValue() const
Definition: SimValue.cc:895
SimControlLanguageSubCommand::parent
virtual SimControlLanguageCommand & parent()
Definition: SimControlLanguageCommand.cc:842
SimControlLanguageSubCommand::SimControlLanguageSubCommand
SimControlLanguageSubCommand(SimControlLanguageCommand &parentCommand)
Definition: SimControlLanguageCommand.cc:824
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
TTAMachine::Bus
Definition: Bus.hh:53
BusState
Definition: BusState.hh:48
assert
#define assert(condition)
Definition: Application.hh:86
RegisterState::value
virtual const SimValue & value() const
Definition: RegisterState.cc:92
Texts::TXT_BUS_NOT_FOUND
@ TXT_BUS_NOT_FOUND
Definition: SimulatorTextGenerator.hh:57
MachineState
Definition: MachineState.hh:61
MachineState::busState
BusState & busState(const std::string &name)
Definition: MachineState.cc:116
TTAMachine::Machine::Navigator::hasItem
bool hasItem(const std::string &name) const
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
ScriptInterpreter::setResult
virtual void setResult(DataObject *result)
Definition: ScriptInterpreter.cc:128
SimulatorFrontend::machineState
MachineState & machineState(int core=-1)
Definition: SimulatorFrontend.cc:2138
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
ScriptInterpreter::setError
virtual void setError(bool state)
Definition: ScriptInterpreter.cc:205
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::Machine
Definition: Machine.hh:73