rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::interfaces::memory::Slave Class Reference

Memory slave device. More...

#include <Slave.h>

Inheritance diagram for rogue::interfaces::memory::Slave:
rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave > rogue::EnableSharedFromThisBase rogue::hardware::MemMap rogue::hardware::axi::AxiMemMap rogue::interfaces::memory::Emulate rogue::interfaces::memory::Hub rogue::interfaces::memory::SlaveWrap rogue::interfaces::memory::TcpClient rogue::protocols::srp::SrpV0 rogue::protocols::srp::SrpV3

Public Member Functions

 Slave (uint32_t min, uint32_t max)
 Constructs a memory slave.
 
virtual ~Slave ()
 Destroys the memory slave instance.
 
virtual void stop ()
 Stops the memory slave interface.
 
void addTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > transaction)
 Adds a transaction to the internal tracking map.
 
std::shared_ptr< rogue::interfaces::memory::TransactiongetTransaction (uint32_t index)
 Gets a transaction from the internal tracking map.
 
uint32_t min ()
 Returns configured minimum transaction size.
 
uint32_t max ()
 Returns configured maximum transaction size.
 
uint32_t id ()
 Returns unique slave ID.
 
void setName (std::string name)
 Sets slave name.
 
std::string name ()
 Returns slave name.
 
virtual uint32_t doSlaveId ()
 Services SlaveId request from a master.
 
virtual std::string doSlaveName ()
 Services SlaveName request from a master.
 
virtual uint32_t doMinAccess ()
 Services getMinAccess request from an attached master.
 
virtual uint32_t doMaxAccess ()
 Services getMaxAccess request from an attached master.
 
virtual uint64_t doAddress ()
 Services getAddress request from an attached master.
 
virtual void doTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > transaction)
 Services a transaction request from an attached master.
 
void lshiftPy (boost::python::object p)
 Supports << operator usage from Python.
 
std::shared_ptr< rogue::interfaces::memory::Master > & operator<< (std::shared_ptr< rogue::interfaces::memory::Master > &other)
 Connects this slave to a master via chaining operator.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave >
std::shared_ptr< rogue::interfaces::memory::Slaveshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::EnableSharedFromThisBase
virtual ~EnableSharedFromThisBase ()
 Virtual destructor for polymorphic base usage.
 

Static Public Member Functions

static std::shared_ptr< rogue::interfaces::memory::Slavecreate (uint32_t min, uint32_t max)
 Creates a memory slave.
 
static void setup_python ()
 Registers this type with Python bindings.
 

Detailed Description

Memory slave device.

The memory Slave device accepts and services transactions from one or more Master devices. The Slave device is normally sub-classed in either C++ or Python to provide an interfaces to hardware or the next level memory transaction protocol, such as SrpV0 or SrpV3. Examples of Slave sub-class implementations are included elsewhere in this document.

The Slave object provides mechanisms for tracking current transactions.

Definition at line 54 of file Slave.h.

Constructor & Destructor Documentation

◆ Slave()

rogue::interfaces::memory::Slave::Slave ( uint32_t  min,
uint32_t  max 
)

Constructs a memory slave.

Create object.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

min and max are stored as the local access-size contract and returned by default doMinAccess()/doMaxAccess() implementations.

Parameters
minMinimum transaction size this slave can accept, in bytes.
maxMaximum transaction size this slave can accept, in bytes.

Definition at line 51 of file Slave.cpp.

◆ ~Slave()

rogue::interfaces::memory::Slave::~Slave ( )
virtual

Destroys the memory slave instance.

Destroy object.

Definition at line 65 of file Slave.cpp.

Member Function Documentation

◆ addTransaction()

void rogue::interfaces::memory::Slave::addTransaction ( std::shared_ptr< rogue::interfaces::memory::Transaction transaction)

Adds a transaction to the internal tracking map.

Register a master.

This method is called by the sub-class to add a transaction into the local tracking map for later retrieval. This is used when the transaction will be completed later as the result of protocol data being returned to the Slave.

Exposed to Python as _addTransaction().

Parameters
transactionPointer to transaction as TransactionPtr.

Definition at line 71 of file Slave.cpp.

◆ create()

rogue::interfaces::memory::SlavePtr rogue::interfaces::memory::Slave::create ( uint32_t  min,
uint32_t  max 
)
static

Creates a memory slave.

Create a slave container.

Exposed as rogue.interfaces.memory.Slave() to Python. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

min and max define the default access-size contract (in bytes) reported by doMinAccess() and doMaxAccess(). The base Slave class stores and returns these values as provided; higher-level classes may layer additional semantics on top of them.

Parameters
minMinimum transaction size this slave can accept, in bytes.
maxMaximum transaction size this slave can accept, in bytes.
Returns
Shared pointer to the created slave.

Definition at line 45 of file Slave.cpp.

◆ doAddress()

uint64_t rogue::interfaces::memory::Slave::doAddress ( )
virtual

Services getAddress request from an attached master.

Return offset.

Base implementation returns 0. Subclasses may override to contribute an address offset. Exposed as _doAddress() to Python.

Returns
Address offset in bytes.

Reimplemented in rogue::interfaces::memory::Hub, and rogue::interfaces::memory::SlaveWrap.

Definition at line 156 of file Slave.cpp.

◆ doMaxAccess()

uint32_t rogue::interfaces::memory::Slave::doMaxAccess ( )
virtual

Services getMaxAccess request from an attached master.

Return max access size to requesting master.

Base implementation returns local max() value. Subclasses may override. Exposed as _doMaxAccess() to Python.

Returns
Maximum transaction access size in bytes.

Reimplemented in rogue::interfaces::memory::Hub, and rogue::interfaces::memory::SlaveWrap.

Definition at line 151 of file Slave.cpp.

◆ doMinAccess()

uint32_t rogue::interfaces::memory::Slave::doMinAccess ( )
virtual

Services getMinAccess request from an attached master.

Return min access size to requesting master.

Base implementation returns local min() value. Subclasses may override. Exposed as _doMinAccess() to Python.

Returns
Minimum transaction access size in bytes.

Reimplemented in rogue::interfaces::memory::Hub, and rogue::interfaces::memory::SlaveWrap.

Definition at line 146 of file Slave.cpp.

◆ doSlaveId()

uint32_t rogue::interfaces::memory::Slave::doSlaveId ( )
virtual

Services SlaveId request from a master.

Return id to requesting master.

Called by memory Master. Subclasses may override. Base implementation returns local slave ID. Not exposed to Python.

Returns
Unique slave ID.

Reimplemented in rogue::interfaces::memory::Hub.

Definition at line 136 of file Slave.cpp.

◆ doSlaveName()

std::string rogue::interfaces::memory::Slave::doSlaveName ( )
virtual

Services SlaveName request from a master.

Return name to requesting master.

Called by memory Master. Subclasses may override. Base implementation returns local slave name. Not exposed to Python.

Returns
Slave name.

Reimplemented in rogue::interfaces::memory::Hub.

Definition at line 141 of file Slave.cpp.

◆ doTransaction()

void rogue::interfaces::memory::Slave::doTransaction ( std::shared_ptr< rogue::interfaces::memory::Transaction transaction)
virtual

Services a transaction request from an attached master.

Post a transaction.

It is possible for this method to be overridden in either a Python or C++ subclass. Examples of sub-classing a Slave is included elsewhere in this document.

Base implementation reports an unsupported-transaction error. Exposed to Python as _doTransaction().

Parameters
transactionTransaction pointer as TransactionPtr.

Reimplemented in rogue::hardware::axi::AxiMemMap, rogue::hardware::MemMap, rogue::interfaces::memory::TcpClient, rogue::protocols::srp::SrpV0, rogue::protocols::srp::SrpV3, rogue::interfaces::memory::Emulate, rogue::interfaces::memory::Hub, rogue::interfaces::memory::HubWrap, and rogue::interfaces::memory::SlaveWrap.

Definition at line 161 of file Slave.cpp.

◆ getTransaction()

rogue::interfaces::memory::TransactionPtr rogue::interfaces::memory::Slave::getTransaction ( uint32_t  index)

Gets a transaction from the internal tracking map.

Get transaction with index, called by sub classes.

This method is called by the sub-class to retrieve an existing transaction using the unique transaction ID. If the transaction exists in the list the pointer to that transaction will be returned. If not a NULL pointer will be returned. When getTransaction() is called the map will also be checked for stale transactions which will be removed from the map.

Exposed to Python as _getTransaction().

Parameters
indexID of transaction to lookup.
Returns
Pointer to transaction as TransactionPtr or NULL if not found.

Definition at line 78 of file Slave.cpp.

◆ id()

uint32_t rogue::interfaces::memory::Slave::id ( )

Returns unique slave ID.

Get id from slave.

Not exposed to Python.

Returns
Unique slave ID.

Definition at line 121 of file Slave.cpp.

◆ lshiftPy()

void rogue::interfaces::memory::Slave::lshiftPy ( boost::python::object  p)

Supports << operator usage from Python.

Parameters
pPython object expected to provide a memory Master.

Definition at line 270 of file Slave.cpp.

◆ max()

uint32_t rogue::interfaces::memory::Slave::max ( )

Returns configured maximum transaction size.

Get min size from slave.

Not exposed to Python.

Returns
Maximum transaction size in bytes.

Definition at line 116 of file Slave.cpp.

◆ min()

uint32_t rogue::interfaces::memory::Slave::min ( )

Returns configured minimum transaction size.

Get min size from slave.

Not exposed to Python.

Returns
Minimum transaction size in bytes.

Definition at line 111 of file Slave.cpp.

◆ name()

std::string rogue::interfaces::memory::Slave::name ( )

Returns slave name.

Get name from slave.

Not exposed to Python.

Returns
Slave name.

Definition at line 126 of file Slave.cpp.

◆ operator<<()

std::shared_ptr< rogue::interfaces::memory::Master > & rogue::interfaces::memory::Slave::operator<< ( std::shared_ptr< rogue::interfaces::memory::Master > &  other)

Connects this slave to a master via chaining operator.

Equivalent to other->setSlave(this) semantics.

Parameters
otherMemory master to connect.
Returns
Reference to the passed master pointer.

◆ setName()

void rogue::interfaces::memory::Slave::setName ( std::string  name)

Sets slave name.

Set name.

Exposed to Python as setName.

Parameters
nameNew slave name string.

Definition at line 131 of file Slave.cpp.

◆ setup_python()

void rogue::interfaces::memory::Slave::setup_python ( )
static

Registers this type with Python bindings.

Definition at line 165 of file Slave.cpp.

◆ stop()

void rogue::interfaces::memory::Slave::stop ( )
virtual

Stops the memory slave interface.

Stop the interface.

Base implementation is a no-op. Subclasses may override to stop worker threads or transport links.

Reimplemented in rogue::hardware::axi::AxiMemMap, rogue::hardware::MemMap, and rogue::interfaces::memory::TcpClient.

Definition at line 68 of file Slave.cpp.


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