OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
SimValue returnAddressStorage_
 
InstructionAddress programCounterStorage_
 
InstructionAddress irfStartStorage_
 
int branchDelayCycles_
 
std::string outputFormat_
 Indicates which output format is used currently.
 
OperationContext opContext_
 The operation context shared with all operations invoked in the application.
 

Detailed Description

Operation context for the program.

Definition at line 212 of file TestOsal.hh.

Constructor & Destructor Documentation

◆ TesterContext()

TesterContext::TesterContext ( )

Constructor.

Definition at line 412 of file TestOsal.cc.

412 :
418
419}
static const std::string OUTPUT_FORMAT_INT_SIGNED
Definition TestOsal.hh:117
InstructionAddress programCounterStorage_
Definition TestOsal.hh:232
bool continue_
Flag indicating whether program can continue or not.
Definition TestOsal.hh:230
InstructionAddress irfStartStorage_
Definition TestOsal.hh:233
int branchDelayCycles_
Definition TestOsal.hh:234
SimValue returnAddressStorage_
Definition TestOsal.hh:231
std::string outputFormat_
Indicates which output format is used currently.
Definition TestOsal.hh:236
OperationContext opContext_
The operation context shared with all operations invoked in the application.
Definition TestOsal.hh:239

◆ ~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}
InstructionAddress & programCounter()

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}
SimValue & returnAddress()

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}
std::string outputFormat() const
Definition TestOsal.cc:463

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}
float FloatWord
Definition BaseType.hh:160
double DoubleWord
Definition BaseType.hh:166
static const std::string OUTPUT_FORMAT_BIN
Definition TestOsal.hh:124
static const std::string OUTPUT_FORMAT_LONG_SIGNED
Definition TestOsal.hh:119
static const std::string OUTPUT_FORMAT_DOUBLE
Definition TestOsal.hh:121
static const std::string OUTPUT_FORMAT_HALF
Definition TestOsal.hh:123
static const std::string OUTPUT_FORMAT_FLOAT
Definition TestOsal.hh:122
static const std::string OUTPUT_FORMAT_LONG_UNSIGNED
Definition TestOsal.hh:120
static const std::string OUTPUT_FORMAT_HEX
Definition TestOsal.hh:125
static const std::string OUTPUT_FORMAT_INT_UNSIGNED
Definition TestOsal.hh:118
static std::string toString(const T &source)
HalfFloatWord halfFloatWordValue() const
Definition SimValue.cc:1098
ULongWord uLongWordValue() const
Definition SimValue.cc:1027
DoubleWord doubleWordValue() const
Definition SimValue.cc:1052
TCEString hexValue(bool noHexIdentifier=false) const
Definition SimValue.cc:1150
TCEString binaryValue() const
Definition SimValue.cc:1121
FloatWord floatWordValue() const
Definition SimValue.cc:1075
int width() const
Definition SimValue.cc:103
SLongWord sLongWordValue() const
Definition SimValue.cc:997

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: