Master
The memory interface Master class is the interface for initiating a memory transaction. Each Master class object will be coupled with one or more Slave objects.
Master objects in C++ are referenced by the following shared pointer typedef:
-
typedef std::shared_ptr<rogue::interfaces::memory::Master> rogue::interfaces::memory::MasterPtr
Alias for using shared pointer as MasterPtr.
The class description is shown below:
-
class Master
Master for a memory transaction interface.
The Master class is the initiator for any Memory transactions on a bus. Each master is connected to a single next level Slave or Hub class. Multiple Hub levels are allowed in a memory tree. Each Hub has an offset which will be applied to the memory transaction address as it flows down to the lowest level Slave device.
Subclassed by rogue::interfaces::memory::Block, rogue::interfaces::memory::Hub, rogue::interfaces::memory::TcpServer
Public Functions
-
virtual void stop()
Stop the interface.
Set slave or Hub device.
The Master will pass the transaction data to this Slave or Hub device. This slave may be the lowest level Slave or a Hub which forwards transactions on to the lower Slave.
Exposed to python as _setSlave()
- Parameters:
slave – Slave device pointer SlavePtr
-
std::shared_ptr<rogue::interfaces::memory::Slave> getSlave()
Get next level Slave or Hub device.
Exposed to python as _getSlave()
- Returns:
Slave device pointer SlavePtr
-
uint32_t reqSlaveId()
Query the slave ID.
-
std::string reqSlaveName()
Query the slave Name.
-
uint32_t reqMinAccess()
Query the minimum access size in bytes for interface.
This function will query the lowest level Slave device to determine the minimum size for a transaction.
Exposed to python as _reqMinAccess()
- Returns:
Minimum transaction size
-
uint32_t reqMaxAccess()
Query the maximum access size in bytes for interface.
This function will query the lowest level Slave device to determine the maximum size for a transaction.
Exposed to python as _reqMaxAccess()
- Returns:
Maximum transaction size
-
uint64_t reqAddress()
Query the address of the next layer down.
This method will return the relative offset of the next level Slave or Hub this Master is attached to. This does not included the local Master offset.
Exposed to python as _reqAddress()
- Returns:
Address of next layer this Master is attached to
-
std::string getError()
Get error of last Transaction.
This method returns the error value of the last set of transactions initiated by this master.
Exposed to python as _getError()
- Returns:
Error value
-
void clearError()
Clear the error value.
This method clears the error value for this master.
Exposed to python as _clearError()
-
void setTimeout(uint64_t timeout)
Set timeout value for transactions.
Sets the timeout value for future transactions. THis is the amount of time to wait for a transaction to complete.
Exposed to python as _setTimeout()
- Parameters:
timeout – Timeout value
-
uint32_t reqTransaction(uint64_t address, uint32_t size, void *data, uint32_t type)
Start a new transaction.
This method generates the creation of a Transaction object which is then forwarded to the lowest level Slave in the memory bus tree. The passed address is relative to the next layer in the memory tree. (local offset). More than one transaction can be pending for this Master.
Not exposed to Python (see reqTransactionPy)
- Parameters:
address – Relative 64-bit transaction offset address
size – Transaction size in bytes
data – Pointer to data array used for transaction.
type – Transaction type
- Returns:
32-bit transaction id
-
uint32_t reqTransactionPy(uint64_t address, boost::python::object p, uint32_t size, uint32_t offset, uint32_t type)
Python version of reqTransaction. Takes a byte array instead of a data pointer.
This method generates the creation of a Transaction object which is then forwarded to the lowest level Slave in the memory bus tree. The passed address is relative to the next layer in the memory tree. (local offset). More than one transaction can be pending for this Master.
Exposed to Python as _reqTransaction()
- Parameters:
address – Relative 64-bit transaction offset address
p – Byte array used for transaction data
size – Transaction size in bytes
offset – Offset within byte array for transaction
type – Transaction type
- Returns:
32-bit transaction id
-
void rshiftPy(boost::python::object p)
Support >> operator in python.
Support >> operator in C++.
-
void waitTransaction(uint32_t id)
Wait for one or more transactions to complete.
This method is called to wait on transaction completion or timeout. Passing an id of zero will wait for all current pending transactions to complete.
Exposed as _waitTransaction to Python
- Parameters:
id – Id of transaction to wait for, 0 to wait for all
Public Static Functions
-
static std::shared_ptr<rogue::interfaces::memory::Master> create()
Class factory which returns a pointer to a Master (MasterPtr)
Exposed as rogue.interfaces.memory.Master() to Python
-
static void copyBits(uint8_t *dstData, uint32_t dstLsb, uint8_t *srcData, uint32_t srcLsb, uint32_t size)
Helper function to optimize bit copies between byte arrays.
This method will copy bits between two byte arrays.
Exposed to python as _copyBits
- Parameters:
dst – Destination Python byte array
dstLsb – Least significant bit in destination byte array for copy
src – Source Python byte array
srcLsb – Least significant bit in source byte array for copy
size – Number of bits to copy
-
static void setBits(uint8_t *dstData, uint32_t lsb, uint32_t size)
Helper function to optimize bit setting in a byte array.
This method will set a range of bits in a byte array
Exposed to python as _setBits
- Parameters:
dst – Destination Python byte array
lsb – Least significant bit in destination byte array for set
size – Number of bits to set
-
static bool anyBits(uint8_t *srcData, uint32_t lsb, uint32_t size)
Helper function to detect bits being set in a byte array.
This method will return true if any bits in a range are set
Exposed to python as _anyBits
- Parameters:
src – Source Python byte array to check
lsb – Least significant bit in source byte array to check
size – Number of bits to check
-
virtual void stop()