OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
TesterContext Class Reference

#include <TestOsal.hh>

Inheritance diagram for TesterContext:
Inheritance graph
Collaboration diagram for TesterContext:
Collaboration graph

Public Member Functions

 TesterContext ()
 
virtual ~TesterContext ()
 
void stop ()
 
bool cont () const
 
OperationContextoperationContext ()
 
std::string outputFormat () const
 
void setOutputFormat (std::string outputFormat)
 
std::string toOutputFormat (SimValue *value)
 
InstructionAddressprogramCounter ()
 
SimValuereturnAddress ()
 
SimValuesyscallHandler ()
 
SimValuesyscallNumber ()
 
- Public Member Functions inherited from InterpreterContext
 InterpreterContext ()
 
virtual ~InterpreterContext ()
 

Private Attributes

bool continue_
 Flag indicating whether program can continue or not. More...
 
SimValue returnAddressStorage_
 
InstructionAddress programCounterStorage_
 
InstructionAddress irfStartStorage_
 
int branchDelayCycles_
 
std::string outputFormat_
 Indicates which output format is used currently. More...
 
OperationContext opContext_
 The operation context shared with all operations invoked in the application. More...
 

Detailed Description

Operation context for the program.

Definition at line 212 of file TestOsal.hh.

Constructor & Destructor Documentation

◆ TesterContext()

TesterContext::TesterContext ( )

◆ ~TesterContext()

TesterContext::~TesterContext ( )
virtual

Destructor.

Definition at line 424 of file TestOsal.cc.

424  {
425 }

Member Function Documentation

◆ cont()

bool TesterContext::cont ( ) const

Return true, if program can continue, false otherwise.

Returns
True if program can continue, false otherwise.

Definition at line 441 of file TestOsal.cc.

441  {
442  return continue_;
443 }

References continue_.

Referenced by main().

◆ operationContext()

OperationContext & TesterContext::operationContext ( )

Returns the operation context shared with all operations invoked in the application.

Returns
The operations context shared with all operations invoked in the application.

Definition at line 453 of file TestOsal.cc.

453  {
454  return opContext_;
455 }

References opContext_.

Referenced by main(), and OsalInterpreter::operation().

◆ outputFormat()

string TesterContext::outputFormat ( ) const

Returns the output format currently in use.

Returns
The output format currently in use.

Definition at line 463 of file TestOsal.cc.

463  {
464  return outputFormat_;
465 }

References outputFormat_.

Referenced by setOutputFormat().

◆ programCounter()

InstructionAddress & TesterContext::programCounter ( )

Returns the program counter as SimValue.

Returns
Program counter as SimValue.

Definition at line 527 of file TestOsal.cc.

527  {
528  return opContext_.programCounter();
529 }

References opContext_, and OperationContext::programCounter().

Here is the call graph for this function:

◆ returnAddress()

SimValue & TesterContext::returnAddress ( )

Returns the return address as SimValue.

Returns
Return address as SimValue.

Definition at line 537 of file TestOsal.cc.

537  {
538  return opContext_.returnAddress();
539 }

References opContext_, and OperationContext::returnAddress().

Here is the call graph for this function:

◆ setOutputFormat()

void TesterContext::setOutputFormat ( std::string  outputFormat)

Sets the output format to be used in the future.

Parameters
Theoutput format to be used in the future.

Definition at line 473 of file TestOsal.cc.

473  {
475 }

References outputFormat(), and outputFormat_.

Here is the call graph for this function:

◆ stop()

void TesterContext::stop ( )

Sets the continue_ flag off.

Definition at line 431 of file TestOsal.cc.

431  {
432  continue_ = false;
433 }

References continue_.

Referenced by CmdQuit::execute().

◆ syscallHandler()

SimValue& TesterContext::syscallHandler ( )

◆ syscallNumber()

SimValue& TesterContext::syscallNumber ( )

◆ toOutputFormat()

string TesterContext::toOutputFormat ( SimValue value)

Converts given SimValue to output string.

Parameters
valueValue to be converted.
Returns
The value of SimValue as a string.

Definition at line 484 of file TestOsal.cc.

484  {
485  string output = "";
486 
487  // If output format is in hex or the value is wider than 64 bits
488  // convert the SimValue to hex using the full
489  // width of the value. This means that leading zeroes are included in
490  // the output result (e.g. 32 bit value 0x15 = 0x00000015).
492  value->width() > 64) {
493  output = value->hexValue();
496  output = Conversion::toString(value->sLongWordValue());
497 
500  output = Conversion::toString(value->uLongWordValue());
501 
503  DoubleWord doubleWord = value->doubleWordValue();
504  output = Conversion::toString(doubleWord);
505 
507  FloatWord floatWord = value->floatWordValue();
508  output = Conversion::toString(floatWord);
509 
511  HalfFloatWord halfFloatWord = value->halfFloatWordValue();
512  output = Conversion::toString(FloatWord(float(halfFloatWord)));
513 
515  output = value->binaryValue();
516  output += 'b';
517  }
518  return output;
519 }

References SimValue::binaryValue(), SimValue::doubleWordValue(), SimValue::floatWordValue(), SimValue::halfFloatWordValue(), SimValue::hexValue(), CmdOutput::OUTPUT_FORMAT_BIN, CmdOutput::OUTPUT_FORMAT_DOUBLE, CmdOutput::OUTPUT_FORMAT_FLOAT, CmdOutput::OUTPUT_FORMAT_HALF, CmdOutput::OUTPUT_FORMAT_HEX, CmdOutput::OUTPUT_FORMAT_INT_SIGNED, CmdOutput::OUTPUT_FORMAT_INT_UNSIGNED, CmdOutput::OUTPUT_FORMAT_LONG_SIGNED, CmdOutput::OUTPUT_FORMAT_LONG_UNSIGNED, outputFormat_, SimValue::sLongWordValue(), Conversion::toString(), SimValue::uLongWordValue(), and SimValue::width().

Here is the call graph for this function:

Member Data Documentation

◆ branchDelayCycles_

int TesterContext::branchDelayCycles_
private

Definition at line 234 of file TestOsal.hh.

◆ continue_

bool TesterContext::continue_
private

Flag indicating whether program can continue or not.

Definition at line 230 of file TestOsal.hh.

Referenced by cont(), and stop().

◆ irfStartStorage_

InstructionAddress TesterContext::irfStartStorage_
private

Definition at line 233 of file TestOsal.hh.

◆ opContext_

OperationContext TesterContext::opContext_
private

The operation context shared with all operations invoked in the application.

Definition at line 239 of file TestOsal.hh.

Referenced by operationContext(), programCounter(), and returnAddress().

◆ outputFormat_

std::string TesterContext::outputFormat_
private

Indicates which output format is used currently.

Definition at line 236 of file TestOsal.hh.

Referenced by outputFormat(), setOutputFormat(), and toOutputFormat().

◆ programCounterStorage_

InstructionAddress TesterContext::programCounterStorage_
private

Definition at line 232 of file TestOsal.hh.

◆ returnAddressStorage_

SimValue TesterContext::returnAddressStorage_
private

Definition at line 231 of file TestOsal.hh.


The documentation for this class was generated from the following files:
SimValue::doubleWordValue
DoubleWord doubleWordValue() const
Definition: SimValue.cc:1052
SimValue::sLongWordValue
SLongWord sLongWordValue() const
Definition: SimValue.cc:997
CmdOutput::OUTPUT_FORMAT_DOUBLE
static const std::string OUTPUT_FORMAT_DOUBLE
Definition: TestOsal.hh:121
CmdOutput::OUTPUT_FORMAT_BIN
static const std::string OUTPUT_FORMAT_BIN
Definition: TestOsal.hh:124
TesterContext::outputFormat_
std::string outputFormat_
Indicates which output format is used currently.
Definition: TestOsal.hh:236
HalfFloatWord
Definition: HalfFloatWord.hh:41
CmdOutput::OUTPUT_FORMAT_HALF
static const std::string OUTPUT_FORMAT_HALF
Definition: TestOsal.hh:123
Conversion::toString
static std::string toString(const T &source)
TesterContext::continue_
bool continue_
Flag indicating whether program can continue or not.
Definition: TestOsal.hh:230
TesterContext::opContext_
OperationContext opContext_
The operation context shared with all operations invoked in the application.
Definition: TestOsal.hh:239
FloatWord
float FloatWord
Definition: BaseType.hh:160
SimValue::floatWordValue
FloatWord floatWordValue() const
Definition: SimValue.cc:1075
SimValue::uLongWordValue
ULongWord uLongWordValue() const
Definition: SimValue.cc:1027
DoubleWord
double DoubleWord
Definition: BaseType.hh:166
CmdOutput::OUTPUT_FORMAT_FLOAT
static const std::string OUTPUT_FORMAT_FLOAT
Definition: TestOsal.hh:122
CmdOutput::OUTPUT_FORMAT_HEX
static const std::string OUTPUT_FORMAT_HEX
Definition: TestOsal.hh:125
TesterContext::branchDelayCycles_
int branchDelayCycles_
Definition: TestOsal.hh:234
TesterContext::irfStartStorage_
InstructionAddress irfStartStorage_
Definition: TestOsal.hh:233
SimValue::hexValue
TCEString hexValue(bool noHexIdentifier=false) const
Definition: SimValue.cc:1150
SimValue::width
int width() const
Definition: SimValue.cc:103
OperationContext::programCounter
InstructionAddress & programCounter()
Definition: OperationContext.cc:152
SimValue::binaryValue
TCEString binaryValue() const
Definition: SimValue.cc:1121
InterpreterContext::InterpreterContext
InterpreterContext()
Definition: InterpreterContext.cc:37
CmdOutput::OUTPUT_FORMAT_LONG_SIGNED
static const std::string OUTPUT_FORMAT_LONG_SIGNED
Definition: TestOsal.hh:119
CmdOutput::OUTPUT_FORMAT_LONG_UNSIGNED
static const std::string OUTPUT_FORMAT_LONG_UNSIGNED
Definition: TestOsal.hh:120
TesterContext::outputFormat
std::string outputFormat() const
Definition: TestOsal.cc:463
CmdOutput::OUTPUT_FORMAT_INT_SIGNED
static const std::string OUTPUT_FORMAT_INT_SIGNED
Definition: TestOsal.hh:117
OperationContext::returnAddress
SimValue & returnAddress()
Definition: OperationContext.cc:207
TesterContext::returnAddressStorage_
SimValue returnAddressStorage_
Definition: TestOsal.hh:231
CmdOutput::OUTPUT_FORMAT_INT_UNSIGNED
static const std::string OUTPUT_FORMAT_INT_UNSIGNED
Definition: TestOsal.hh:118
SimValue::halfFloatWordValue
HalfFloatWord halfFloatWordValue() const
Definition: SimValue.cc:1098
TesterContext::programCounterStorage_
InstructionAddress programCounterStorage_
Definition: TestOsal.hh:232