orca-sim
|
The Signal class models a generic bus of width equals to the sizeof(T) More...
#include <Signal.hpp>
Public Member Functions | |
Signal (T *t_ptr, uint32_t addr, std::string name) | |
Constructor. More... | |
Signal (uint32_t addr, std::string name) | |
Constructor. More... | |
Signal (std::string name) | |
Constructor. More... | |
~Signal () | |
Destructor. More... | |
T | Read () |
Get the last value writen to the bus. More... | |
void | MapTo (bool keep_val=true) |
Maps current Signal to the internal storage. More... | |
void | MapTo (MemoryType *memptr, MemoryAddr address, bool keep_val=true) |
Maps current Signal to an external storage, updates internal reference and sets a new address. More... | |
void | Write (T val) |
Writes some value to the bus. More... | |
void | Inc (T val) |
Increments the value of the bus by the given value. More... | |
void | Dec (T val) |
Descrements the value of the bus by the given value. More... | |
uint32_t | GetAddress () |
Return the addres to which this Signal is mapped. More... | |
void | SetAddress (MemoryAddr) |
Set an address for this signal. More... | |
std::string | GetName () |
Return the name of the Signal. More... | |
Private Attributes | |
volatile T * | _t_ptr |
pointer to the place where the bus data will be stored More... | |
volatile T | _t_storage |
internal storage (necessary when mmio is not used) More... | |
std::string | _t_name |
an optional name to identify this bus during runtime More... | |
volatile uint32_t | _t_addr |
a memory address in case this is mapped using mmio More... | |
The Signal class models a generic bus of width equals to the sizeof(T)
Definition at line 45 of file Signal.hpp.
Signal::Signal | ( | T * | t_ptr, |
uint32_t | addr, | ||
std::string | name | ||
) |
Constructor.
Instiate a new bus with external storage (can be changed later via "MapTo()")
Creates a new Signal using external storage
t_ptr | pointer to the location of the value of the bus. |
name | (optional) An arbitrary name for the instance. |
addre | (optinal) Address to which the bus is mapped in memory. |
t_ptr | |
addr | |
name |
Definition at line 61 of file Signal.cpp.
Signal::Signal | ( | uint32_t | addr, |
std::string | name | ||
) |
Constructor.
Create new Signal using internal storage
name | (optional) An arbitrary name for the instance. |
addr | (optinal) Address to which the bus is mapped in memory. |
Definition at line 68 of file Signal.cpp.
|
explicit |
Constructor.
Instiate a new bus with external storage (can be changed later via "MapTo(&)")
Create new Signal using internal storage
name | (optional) An arbitrary name for the instance. |
name | A unique name to the bus (optional) |
default_value | A value to be read in case none has been set yet |
addr | A memory base to be used within memory mapping |
Definition at line 46 of file Signal.cpp.
Signal::~Signal | ( | ) |
Destructor.
Dtor.
Definition at line 111 of file Signal.cpp.
void Signal::Dec | ( | T | val | ) |
Descrements the value of the bus by the given value.
Set the value of the bus.
val | Value to besubtracted from the current value of the bus |
val | the value |
Definition at line 145 of file Signal.cpp.
uint32_t Signal::GetAddress | ( | ) |
Return the addres to which this Signal is mapped.
Get the memory mapping address.
Definition at line 154 of file Signal.cpp.
std::string Signal::GetName | ( | ) |
Return the name of the Signal.
Get the name of the Signal.
Definition at line 163 of file Signal.cpp.
void Signal::Inc | ( | T | val | ) |
Increments the value of the bus by the given value.
Set the value of the bus.
val | Value to be added to the current value of the bus |
val | the value |
Definition at line 136 of file Signal.cpp.
void Signal::MapTo | ( | bool | keep_val = true | ) |
Maps current Signal to the internal storage.
keep_val | Copies current value to internal storage |
Definition at line 79 of file Signal.cpp.
void Signal::MapTo | ( | MemoryType * | memptr, |
MemoryAddr | address, | ||
bool | keep_val = true |
||
) |
Maps current Signal to an external storage, updates internal reference and sets a new address.
Maps current Signal to an external storage and updates internal reference.
memptr | External storage memory place |
address | Memory address if using memory maps |
keep_val | Set to true to keep current signal val |
memptr | Location to shadown the access in |
address | to be used if mapping to memory |
keep_val | set to true to keep current signal value |
Definition at line 98 of file Signal.cpp.
T Signal::Read | ( | ) |
Get the last value writen to the bus.
Read the value stored into the bus.
Definition at line 118 of file Signal.cpp.
void Signal::SetAddress | ( | MemoryAddr | addr | ) |
Set an address for this signal.
Set an address for the signal.
Definition at line 171 of file Signal.cpp.
void Signal::Write | ( | T | val | ) |
Writes some value to the bus.
Set the value of the bus.
val | Value to be writen to the bus |
val | the value |
Definition at line 127 of file Signal.cpp.
|
private |
a memory address in case this is mapped using mmio
Definition at line 57 of file Signal.hpp.
|
private |
an optional name to identify this bus during runtime
Definition at line 54 of file Signal.hpp.
|
private |
pointer to the place where the bus data will be stored
Definition at line 48 of file Signal.hpp.
|
private |
internal storage (necessary when mmio is not used)
Definition at line 51 of file Signal.hpp.