The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::memory::TranslationIF Class Reference

Blocking translation interface with 1:1 translation unless subclassed. More...

#include <TranslationIF.hpp>

Inheritance diagram for sparta::memory::TranslationIF:

Public Member Functions

Construction
TranslationIFoperator= (const TranslationIF &)=delete
 
 TranslationIF (const TranslationIF &)=delete
 
 TranslationIF (const std::string &input_type, const std::string &output_type)
 Constructor.
 
 TranslationIF ()
 Default Constructor.
 
virtual ~TranslationIF ()
 Virtual Destructor.
 
Debug Memory Access
const std::string & getInputType () const
 gets the name of the input address type (e.g. virtual)
 
const std::string & getOutputType () const
 gets the name of the output address type (e.g. physical)
 
Translation
bool tryTranslate (const addr_t &addr, Translation *trans=nullptr) const
 Perform a translation from input-type to output-type.
 
addr_t translate (const addr_t &addr, Translation *trans=nullptr) const
 Perform a translation from input-type to output-type.
 

Detailed Description

Blocking translation interface with 1:1 translation unless subclassed.

Class that will perform 1-directional address translations from some arbitrary input address space to some output.

This is noncopyable and nonassignable

This class is NOT pure-virtual and has a default implementation which will return the input address when a translation is performed.

Definition at line 30 of file TranslationIF.hpp.

Constructor & Destructor Documentation

◆ TranslationIF() [1/2]

sparta::memory::TranslationIF::TranslationIF ( const std::string &  input_type,
const std::string &  output_type 
)
inline

Constructor.

Parameters
input_typeName of input memory address type
output_typeName of output memory address type

Definition at line 46 of file TranslationIF.hpp.

◆ TranslationIF() [2/2]

sparta::memory::TranslationIF::TranslationIF ( )
inline

Default Constructor.

Parameters
input_typeName of input memory address type
output_typeName of output memory address type

Definition at line 57 of file TranslationIF.hpp.

◆ ~TranslationIF()

virtual sparta::memory::TranslationIF::~TranslationIF ( )
inlinevirtual

Virtual Destructor.

Definition at line 64 of file TranslationIF.hpp.

Member Function Documentation

◆ getInputType()

const std::string & sparta::memory::TranslationIF::getInputType ( ) const
inline

gets the name of the input address type (e.g. virtual)

Definition at line 76 of file TranslationIF.hpp.

◆ getOutputType()

const std::string & sparta::memory::TranslationIF::getOutputType ( ) const
inline

gets the name of the output address type (e.g. physical)

Definition at line 81 of file TranslationIF.hpp.

◆ translate()

addr_t sparta::memory::TranslationIF::translate ( const addr_t addr,
Translation trans = nullptr 
) const
inline

Perform a translation from input-type to output-type.

Parameters
addrAddress to translate from input-type to output-type
transOptional translation attributes. Can be null [default] to ignore this parameter
Returns
address result of the translation (if succeeded)
Exceptions
MemoryTranslationError
Todo:
Determine failure cause.

Definition at line 118 of file TranslationIF.hpp.

Here is the call graph for this function:

◆ tryTranslate()

bool sparta::memory::TranslationIF::tryTranslate ( const addr_t addr,
Translation trans = nullptr 
) const
inline

Perform a translation from input-type to output-type.

Parameters
addrAddress to translate from input-type to output-type
transOptional translation attributes. Can be null [default] to ignore this parameter
Returns
true if the tranlation succeeded, false if it failed
Exceptions
MemoryTranslationError

Definition at line 98 of file TranslationIF.hpp.


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