OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
InfoPortsCommand Class Reference
Inheritance diagram for InfoPortsCommand:
Inheritance graph
Collaboration diagram for InfoPortsCommand:
Collaboration graph

Public Member Functions

 InfoPortsCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~InfoPortsCommand ()
 
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 ports".

Definition at line 501 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoPortsCommand()

InfoPortsCommand::InfoPortsCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 506 of file InfoCommand.cc.

◆ ~InfoPortsCommand()

virtual InfoPortsCommand::~InfoPortsCommand ( )
inlinevirtual

Destructor.

Definition at line 513 of file InfoCommand.cc.

513 {
514 }

Member Function Documentation

◆ execute()

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

Executes the "info ports" command.

"info ports" prints info of FU ports.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 524 of file InfoCommand.cc.

524 {
525
526 const int argumentCount = arguments.size() - 2;
527
528 if (!parent().checkMachineLoaded()) {
529 return false;
530 }
531
532 if (!parent().checkArgumentCount(argumentCount, 1, 2)) {
533 return false;
534 }
535 const TTAMachine::Machine& mach =
537
538 const std::string functionUnit = arguments.at(2).stringValue();
539
542
543 TTAMachine::FunctionUnit* fu = NULL;
544 if (nav.hasItem(functionUnit)) {
545 fu = nav.item(functionUnit);
546 } else if (functionUnit == mach.controlUnit()->name()) {
547 fu = mach.controlUnit();
548 }
549
550 if (fu == NULL) {
554 return false;
555 }
556
557 if (argumentCount == 1) {
558 std::string result = "";
559 bool isFirst = true;
560 for (int i = 0; i < fu->portCount(); ++i) {
561 if (!isFirst)
562 result += "\n";
563 std::string portName = fu->port(i)->name();
564 DisassemblyFUPort portString(functionUnit, portName);
566 functionUnit, portName);
568 portString.toString(), portValue);
569 isFirst = false;
570 }
571 parent().interpreter()->setResult(result);
572 return true;
573 } else if (argumentCount == 2) {
574 const std::string portName = arguments.at(3).stringValue();
575 try {
576 // @todo printing of double values (size > 32)
578 functionUnit, portName);
579 parent().interpreter()->setResult(portValue.intValue());
580 return true;
581 } catch (const Exception& e) {
585 return false;
586 }
587 }
588 return false;
589 }
ScriptInterpreter * interpreter() const
static std::string registerDescription(const std::string &regName, const SimValue &value)
virtual void setError(bool state)
virtual void setResult(DataObject *result)
virtual SimControlLanguageCommand & parent()
int intValue() const
Definition SimValue.cc:895
const TTAMachine::Machine & machine() const
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
static SimulatorTextGenerator & textGenerator()
virtual TCEString name() const
virtual BaseFUPort * port(const std::string &name) const
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
virtual std::string name() const
Definition Port.cc:141
virtual int portCount() const
Definition Unit.cc:135

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::functionUnitNavigator(), SimulatorFrontend::FUPortValue(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), CustomCommand::interpreter(), SimValue::intValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Component::name(), TTAMachine::Port::name(), SimControlLanguageSubCommand::parent(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), InfoRegistersCommand::registerDescription(), ScriptInterpreter::setError(), ScriptInterpreter::setResult(), SimControlLanguageCommand::simulatorFrontend(), SimulatorToolbox::textGenerator(), DisassemblyFUPort::toString(), Texts::TXT_FU_NOT_FOUND, and Texts::TXT_FUPORT_NOT_FOUND.

Here is the call graph for this function:

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