Block

The memory interface Block class provides a mirror for the hardware register space as well as serving as a translater between python types and hardware bits and bytes.

For a usage-focused overview of how blocks are used within the PyRogue tree, see Block.

Block objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::interfaces::memory::Block> rogue::interfaces::memory::BlockPtr

Shared pointer alias for Block.

The class description is shown below:

class Block : public rogue::interfaces::memory::Master

Memory interface block device.

Bridges higher-level variable access to lower-level memory transactions.

A Block owns staged byte storage for a register region and one or more Variable objects that map bit fields into that storage. Typed access methods (setUInt, getString, setFloat, etc.) are not selected directly by users of Block; instead, each Variable binds to the appropriate Block method pair according to its model (UInt, Int, Bool, String, Float, Double, Fixed, Bytes, PyFunc) and width constraints.

Conversion and transport are separated:

  • Conversion methods (set*/get*) pack/unpack values between native types and staged bytes using variable metadata (bit offsets, bit widths, byte order, list indexing/stride).

  • Transaction methods (write, read, startTransaction, checkTransaction) move staged bytes to/from hardware and handle verify/retry/update behavior.

Typical usage is through Variable APIs, which call the matching Block conversion method and then issue read/write transactions.

Public Functions

Block(uint64_t offset, uint32_t size)

Constructs a block device with a given offset and size.

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

Parameters:
  • offset – Memory offset of the block.

  • size – Memory size (footprint) of the block.

std::string path()

Returns the path of the block in the device tree.

Exposed as path property in Python.

Returns:

Full path of the block.

std::string mode()

Returns the block access mode.

Supported modes include "RW", "RO", and "WO". Exposed as mode property in Python.

Returns:

Mode string.

bool bulkOpEn()

Returns whether this block participates in bulk operations.

Exposed as bulkOpEn property in Python.

Returns:

Bulk-operation enable flag.

void setEnable(bool enable)

Sets the block enable state.

Exposed as setEnable() in Python.

Parameters:

enable – Set to true to enable block operations.

inline void setLogLevel(uint32_t level)

Sets logging verbosity level for this block.

Parameters:

level – Logging level value.

uint64_t offset()

Returns the local offset of this block.

Exposed as offset property in Python.

Returns:

64-bit address offset.

uint64_t address()

Returns the full address of this block.

Includes parent address plus local offset. Exposed as address property in Python.

Returns:

64-bit address.

uint32_t size()

Returns block size in bytes.

Exposed as size property in Python.

Returns:

32-bit block size.

bool blockPyTrans()

Returns whether Python transaction callbacks are blocked.

void startTransaction(uint32_t type, bool forceWr, bool check, rogue::interfaces::memory::Variable *var, int32_t index = -1)

Starts a C++ transaction for this block.

Parameters:
  • typeTransaction type.

  • forceWr – Forces write even when block is not stale.

  • check – Requests immediate result checking, meaning wait for the transaction to complete before returning.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

void startTransactionPy(uint32_t type, bool forceWr, bool check, std::shared_ptr<rogue::interfaces::memory::Variable> var, int32_t index)

Starts a block transaction from Python.

Exposed as startTransaction() in Python.

Parameters:
  • typeTransaction type.

  • forceWr – Forces write even when block is not stale.

  • check – Requests immediate result checking, meaning wait for the transaction to complete before returning.

  • var – Variable associated with transaction, or None for block scope.

  • index – Variable index for list variables, or -1 for full variable.

bool checkTransaction()

Checks transaction result in C++ mode.

Throws an exception if an error occurred.

void checkTransactionPy()

Checks transaction result.

Python version of checkTransaction(), with variable update calls. Throws an exception if an error occurred. Exposed as checkTransaction() in Python.

void write(rogue::interfaces::memory::Variable *var, int32_t index = -1)

Issues write/verify/check sequence from C++.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

void read(rogue::interfaces::memory::Variable *var, int32_t index = -1)

Issues read/check sequence from C++.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

void addVariables(std::vector<std::shared_ptr<rogue::interfaces::memory::Variable>> variables)

Adds variables to this block (C++ API).

Exposed as addVariables() in Python.

Parameters:

variables – Variable list.

void addVariablesPy(boost::python::object variables)

Adds variables to this block (Python API).

Parameters:

variables – Python list/iterable of variables.

std::vector<std::shared_ptr<rogue::interfaces::memory::Variable>> variables()

Returns the variable list associated with this block (C++ API).

boost::python::object variablesPy()

Returns the variable list associated with this block (Python API).

Exposed as variables property in Python.

void rateTest()

Runs block rate-test helper for performance testing.

Python: Exposed as rateTest to python users.

void setPyFunc(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets variable data using a Python callback/value.

Used for PyFunc variables and Python fallback paths for large-width integer variables where direct scalar conversion is not used. Calls model-specific toBytes() conversion before writing staged bytes.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getPyFunc(rogue::interfaces::memory::Variable *var, int32_t index)

Gets variable data using a Python callback/value conversion.

Used for PyFunc variables and Python fallback paths for large-width integer variables where direct scalar conversion is not used. Reads staged bytes and calls model-specific fromBytes() conversion.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object representing the variable value.

void setByteArrayPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets variable data from Python byte-array-like input.

Primary Python path for Bytes variables. Also used by some large-width numeric model paths when values are represented as raw bytes.

Parameters:
  • value – Python source buffer.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getByteArrayPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets variable data as a Python byte-array-like object.

Primary Python path for Bytes variables. Also used by some large-width numeric model paths when values are represented as raw bytes.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing the variable bytes.

void setByteArray(const uint8_t *value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets variable data from C++ byte array input.

Primary C++ path for Bytes variables and width-overflow fallback path for numeric models that cannot be represented in native scalar types.

Parameters:
  • value – Source byte buffer.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

void getByteArray(uint8_t *value, rogue::interfaces::memory::Variable *var, int32_t index)

Gets variable data into a C++ byte array buffer.

Primary C++ path for Bytes variables and width-overflow fallback path for numeric models that cannot be represented in native scalar types.

Parameters:
  • value – Destination byte buffer.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

void setUIntPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets unsigned-integer variable data from Python input.

Python path for UInt variables when width is 64 bits or less. Supports scalar values and array/list updates for list variables.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getUIntPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets unsigned-integer variable data as Python output.

Python path for UInt variables when width is 64 bits or less. Returns either a scalar or an array/list-like object for list variables.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing unsigned-integer value.

void setUInt(const uint64_t &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets unsigned-integer variable data from C++ input.

C++ path for UInt variables when width is 64 bits or less. Wider UInt values are handled through byte-array conversion paths.

Parameters:
  • value – Source unsigned-integer value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

uint64_t getUInt(rogue::interfaces::memory::Variable *var, int32_t index)

Gets unsigned-integer variable data as C++ output.

C++ path for UInt variables when width is 64 bits or less. Wider UInt values are handled through byte-array conversion paths.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Unsigned-integer value.

void setIntPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets signed-integer variable data from Python input.

Python path for Int variables when width is 64 bits or less. Supports scalar values and array/list updates for list variables.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getIntPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets signed-integer variable data as Python output.

Python path for Int variables when width is 64 bits or less. Returns either a scalar or an array/list-like object for list variables.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing signed-integer value.

void setInt(const int64_t &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets signed-integer variable data from C++ input.

C++ path for Int variables when width is 64 bits or less. Wider Int values are handled through byte-array conversion paths.

Parameters:
  • value – Source signed-integer value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

int64_t getInt(rogue::interfaces::memory::Variable *var, int32_t index)

Gets signed-integer variable data as C++ output.

C++ path for Int variables when width is 64 bits or less. Wider Int values are handled through byte-array conversion paths.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Signed-integer value.

void setBoolPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets boolean variable data from Python input.

Python path for Bool variables.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getBoolPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets boolean variable data as Python output.

Python path for Bool variables.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing boolean value.

void setBool(const bool &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets boolean variable data from C++ input.

C++ path for Bool variables.

Parameters:
  • value – Source boolean value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

bool getBool(rogue::interfaces::memory::Variable *var, int32_t index)

Gets boolean variable data as C++ output.

C++ path for Bool variables.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Boolean value.

void setStringPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets string variable data from Python input.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getStringPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets string variable data as Python output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing string value.

void setString(const std::string &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets string variable data from C++ input.

Parameters:
  • value – Source string value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

std::string getString(rogue::interfaces::memory::Variable *var, int32_t index)

Gets string variable data as C++ output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

String value.

void getString(rogue::interfaces::memory::Variable *var, std::string &valueRet, int32_t index)

Gets string variable data into an output string reference.

Parameters:
  • var – Variable associated with the transaction.

  • valueRet – Destination string reference.

  • index – Variable index for list variables, or -1 for full variable.

inline void getValue(rogue::interfaces::memory::Variable *var, std::string &valueRet, int32_t index)

Alias to getString(var, valueRet, index).

Parameters:
  • var – Variable associated with the transaction.

  • valueRet – Destination string reference.

  • index – Variable index for list variables, or -1 for full variable.

void setFloatPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets float variable data from Python input.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getFloatPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets float variable data as Python output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing float value.

void setFloat(const float &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets float variable data from C++ input.

Parameters:
  • value – Source float value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

float getFloat(rogue::interfaces::memory::Variable *var, int32_t index)

Gets float variable data as C++ output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Float value.

void setDoublePy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets double variable data from Python input.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getDoublePy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets double variable data as Python output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing double value.

void setDouble(const double &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets double variable data from C++ input.

Parameters:
  • value – Source double value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

double getDouble(rogue::interfaces::memory::Variable *var, int32_t index)

Gets double variable data as C++ output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Double value.

void setFixedPy(boost::python::object &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets fixed-point variable data from Python input.

Parameters:
  • value – Python source value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

boost::python::object getFixedPy(rogue::interfaces::memory::Variable *var, int32_t index)

Gets fixed-point variable data as Python output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Python object containing fixed-point value.

void setFixed(const double &value, rogue::interfaces::memory::Variable *var, int32_t index)

Sets fixed-point variable data from C++ input.

Parameters:
  • value – Source fixed-point value.

  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

double getFixed(rogue::interfaces::memory::Variable *var, int32_t index)

Gets fixed-point variable data as C++ output.

Parameters:
  • var – Variable associated with the transaction.

  • index – Variable index for list variables, or -1 for full variable.

Returns:

Fixed-point value.

Public Static Functions

static std::shared_ptr<rogue::interfaces::memory::Block> create(uint64_t offset, uint32_t size)

Creates a memory block.

Exposed to Python as rogue.interfaces.memory.Block(). 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.

Parameters:
  • offset – Memory offset of the block.

  • size – Memory size (footprint) of the block.

Returns:

Shared pointer to the created block.