switchboard package

switchboard pybind11 plugin

Classes:

PySbPacket(self[, destination, flags, data])

PySbRx(self[, uri, fresh, max_rate])

PySbRxPcie(self[, uri, idx, bar_num, bdf])

PySbTx(self[, uri, fresh, max_rate])

PySbTxPcie(self[, uri, idx, bar_num, bdf])

PyUmi(self[, tx_uri, rx_uri, fresh, max_rate])

PyUmiPacket(self[, cmd, dstaddr, srcaddr, data])

UmiAtomic(self, value)

Members:

UmiCmd(self, value)

Members:

Functions:

delete_queue(arg0)

Deletes an old queue.

delete_queues(arg0)

Deletes a old queues specified in a list.

umi_atype(arg0)

umi_eof(arg0)

umi_eom(arg0)

umi_ex(arg0)

umi_len(arg0)

umi_opcode(arg0)

umi_opcode_to_str(arg0)

Returns a string representation of a UMI opcode

umi_pack([opcode, atype, size, len, eom, ...])

Returns a UMI command with the given parameters.

umi_prot(arg0)

umi_qos(arg0)

umi_size(arg0)

class _switchboard.PySbPacket(self: _switchboard.PySbPacket, destination: int = 0, flags: int = 0, data: numpy.ndarray[numpy.uint8] | None = None)

Bases: pybind11_object

property data
property destination
property flags
class _switchboard.PySbRx(self: _switchboard.PySbRx, uri: str = '', fresh: bool = False, max_rate: float = -1)

Bases: pybind11_object

init(self: _switchboard.PySbRx, uri: str = '', fresh: bool = False, max_rate: float = -1) None
Parameters:
  • uri (str Name of the queue for the Rx object)

  • fresh (bool, optional) – If True, the queue specified by the uri parameter will get cleared before executing the simulation.

recv(self: _switchboard.PySbRx, blocking: bool = True) _switchboard.PySbPacket
Parameters:

blocking (bool, optional) – If true, the function will pause execution until a packetcan be read. If false, the function will return None if a packetcannot be read immediately

Returns:

Returns a UMI packet. If blocking is false, None will be returned If a packet cannot be read immediately.

Return type:

PySbPacket

class _switchboard.PySbRxPcie(self: _switchboard.PySbRxPcie, uri: str = '', idx: int = 0, bar_num: int = 0, bdf: str = '')

Bases: pybind11_object

init(self: _switchboard.PySbRxPcie, uri: str = '', idx: int = 0, bar_num: int = 0, bdf: str = '') None
class _switchboard.PySbTx(self: _switchboard.PySbTx, uri: str = '', fresh: bool = False, max_rate: float = -1)

Bases: pybind11_object

init(self: _switchboard.PySbTx, uri: str = '', fresh: bool = False, max_rate: float = -1) None
Parameters:
  • uri (str) – Name of the queue for the Tx object

  • fresh (bool, optional) – If True, the queue specified by the uri parameter will get cleared before executing the simulation.

send(self: _switchboard.PySbTx, py_packet: _switchboard.PySbPacket, blocking: bool = True) bool
Parameters:
  • py_packet (PySbPacket) – UMI packet to send

  • blocking (bool, optional) – If true, the function will pause execution until the packet has been successfully sent.

class _switchboard.PySbTxPcie(self: _switchboard.PySbTxPcie, uri: str = '', idx: int = 0, bar_num: int = 0, bdf: str = '')

Bases: pybind11_object

init(self: _switchboard.PySbTxPcie, uri: str = '', idx: int = 0, bar_num: int = 0, bdf: str = '') None
class _switchboard.PyUmi(self: _switchboard.PyUmi, tx_uri: str = '', rx_uri: str = '', fresh: bool = False, max_rate: float = -1)

Bases: pybind11_object

atomic(self: _switchboard.PyUmi, addr: int, data: numpy.ndarray[numpy.uint8], opcode: int, srcaddr: int = 0, qos: int = 0, prot: int = 0, error: bool = True) numpy.ndarray
Parameters:
  • addr (int) – 64-bit address atomic operation will be applied to.

  • data (np.uint8, np.uint16, np.uint32, np.uint64) – must so that the size of the atomic operation can be determined.

  • opcode (str or switchboard.UmiAtomic value) – Supported string values are ‘add’, ‘and’, ‘or’, ‘xor’, ‘max’, ‘min’, ‘minu’, ‘maxu’, and ‘swap’ (case-insensitive).

  • srcaddr (int, optional) – The UMI source address used for the atomic transaction. This is sometimes needed to make sure the response get routed to the right place.

  • qos (int, optional) – 4-bit Quality of Service field in UMI Command

  • prot (int, optional) – 2-bit protection mode field in UMI command

  • error (bool, optional) – If true, error out upon receiving an unexpected UMI response.

Returns:

The value returned by this function is the original value at addr, immediately before the atomic operation is applied. The numpy dtype of the returned value will be the same as for data.

Return type:

np.uint8, np.uint16, np.uint32, np.uint64

init(self: _switchboard.PyUmi, tx_uri: str = '', rx_uri: str = '', fresh: bool = False, max_rate: float = -1) None
Parameters:
  • tx_uri (str, optional) – Name of the switchboard queue that write() and send() will send UMI packets to. Defaults to None, meaning “unused”.

  • rx_uri (str, optional) – Name of the switchboard queue that read() and recv() will receive UMI packets from. Defaults to None, meaning “unused”.

  • fresh (bool, optional) – If true, the tx_uri and rx_uri will be cleared prior to running

read(self: _switchboard.PyUmi, addr: int, num: int, bytes_per_elem: int = 1, srcaddr: int = 0, max_bytes: int = 32, qos: int = 0, prot: int = 0, error: bool = True) numpy.ndarray
Parameters:
  • addr (int) – The 64-bit address read from

  • num_or_dtype (int or numpy integer datatype) – If a plain int, num_or_datatype specifies the number of bytes to be read.If a numpy integer datatype (np.uint8, np.uint16, etc.), num_or_datatypespecifies the data type to be returned.

  • dtype (numpy integer datatype, optional) – If num_or_dtype is a plain integer, the value returned by this functionwill be a numpy array of type dtype. On the other hand, if num_or_dtypeis a numpy datatype, the value returned will be a scalar of that datatype.

  • srcaddr (int, optional) – The UMI source address used for the read transaction. Thisis sometimes needed to make sure that reads get routed to the right place.

  • max_bytes (int, optional) – Indicates the maximum number of bytes that can be used for any individualUMI transaction. num_or_dtype can be larger than max_bytes, in whichcase the read will automatically be split into multiple transactions. Currently,the data payload size used by switchboard is 32 bytes, which is reflected in thedefault value of max_bytes.

  • qos (int, optional) – 4-bit Quality of Service field in UMI Command

  • prot (int, optional) – 2-bit protection mode field in UMI command

  • error (bool, optional) – If true, error out upon receiving an unexpected UMI response.

recv(self: _switchboard.PyUmi, blocking: bool = True) _switchboard.PyUmiPacket
Parameters:

blocking (bool, optional) – If true, the function will pause execution until a packetcan be read. If false, the function will return None if a packetcannot be read immediately

Returns:

Returns a UMI packet. If blocking is false, None will be returned If a packet cannot be read immediately.

Return type:

PySbPacket

send(self: _switchboard.PyUmi, py_packet: _switchboard.PyUmiPacket, blocking: bool = True) bool
Parameters:
  • py_packet (PySbPacket) – UMI packet to send

  • blocking (bool, optional) – If true, the function will pause execution until the packet has been successfully sent.

write(self: _switchboard.PyUmi, addr: int, data: numpy.ndarray, srcaddr: int = 0, max_bytes: int = 32, posted: bool = False, qos: int = 0, prot: int = 0, progressbar: bool = False, error: bool = True) None
Parameters:
  • addr (int) – 64-bit address that will be written to

  • data (np.uint8, np.uint16, np.uint32, np.uint64, or np.array) – Can be either a numpy integer type (e.g., np.uint32) or an numpy array of integer types (np.uint8, np.uin16, np.uint32, np.uint64, etc.). The data input may contain more than max_bytes, in which case the write will automatically be split into multiple transactions.

  • srcaddr (int, optional) – UMI source address used for the write transaction. This is sometimes needed to make the write response gets routed to the right place.

  • max_bytes (int, optional) – Indicates the maximum number of bytesthat can be used for any individual UMI transaction in bytes. Currently, the data payload size used by switchboard is 32 bytes, which is reflected in the default value of max_bytes.

  • posted (bool, optional) – If True, a write response will be received.

  • qos (int, optional) – 4-bit Quality of Service field in UMI Command

  • prot (int, optional) – 2-bit protection mode field in UMI command

  • progressbar (bool, optional) – If True, the number of packets written will be displayed via a progressbarin the terminal.

  • error (bool, optional) – If true, error out upon receiving an unexpected UMI response.

class _switchboard.PyUmiPacket(self: _switchboard.PyUmiPacket, cmd: int = 0, dstaddr: int = 0, srcaddr: int = 0, data: numpy.ndarray | None = None)

Bases: pybind11_object

property cmd
property data
property dstaddr
merge(self: _switchboard.PyUmiPacket, arg0: _switchboard.PyUmiPacket) bool
property srcaddr
class _switchboard.UmiAtomic(self: _switchboard.UmiAtomic, value: int)

Bases: pybind11_object

Members:

UMI_REQ_ATOMICADD

UMI_REQ_ATOMICAND

UMI_REQ_ATOMICOR

UMI_REQ_ATOMICXOR

UMI_REQ_ATOMICMAX

UMI_REQ_ATOMICMIN

UMI_REQ_ATOMICMAXU

UMI_REQ_ATOMICMINU

UMI_REQ_ATOMICSWAP

UMI_REQ_ATOMICADD = <UmiAtomic.UMI_REQ_ATOMICADD: 0>
UMI_REQ_ATOMICAND = <UmiAtomic.UMI_REQ_ATOMICAND: 1>
UMI_REQ_ATOMICMAX = <UmiAtomic.UMI_REQ_ATOMICMAX: 4>
UMI_REQ_ATOMICMAXU = <UmiAtomic.UMI_REQ_ATOMICMAXU: 6>
UMI_REQ_ATOMICMIN = <UmiAtomic.UMI_REQ_ATOMICMIN: 5>
UMI_REQ_ATOMICMINU = <UmiAtomic.UMI_REQ_ATOMICMINU: 7>
UMI_REQ_ATOMICOR = <UmiAtomic.UMI_REQ_ATOMICOR: 2>
UMI_REQ_ATOMICSWAP = <UmiAtomic.UMI_REQ_ATOMICSWAP: 8>
UMI_REQ_ATOMICXOR = <UmiAtomic.UMI_REQ_ATOMICXOR: 3>
property name
property value
class _switchboard.UmiCmd(self: _switchboard.UmiCmd, value: int)

Bases: pybind11_object

Members:

UMI_INVALID

UMI_REQ_READ

UMI_REQ_WRITE

UMI_REQ_POSTED

UMI_REQ_RDMA

UMI_REQ_ATOMIC

UMI_REQ_USER0

UMI_REQ_FUTURE0

UMI_REQ_ERROR

UMI_REQ_LINK

UMI_RESP_READ

UMI_RESP_WRITE

UMI_RESP_USER0

UMI_RESP_USER1

UMI_RESP_FUTURE0

UMI_RESP_FUTURE1

UMI_RESP_LINK

UMI_INVALID = <UmiCmd.UMI_INVALID: 0>
UMI_REQ_ATOMIC = <UmiCmd.UMI_REQ_ATOMIC: 9>
UMI_REQ_ERROR = <UmiCmd.UMI_REQ_ERROR: 15>
UMI_REQ_FUTURE0 = <UmiCmd.UMI_REQ_FUTURE0: 13>
UMI_REQ_POSTED = <UmiCmd.UMI_REQ_POSTED: 5>
UMI_REQ_RDMA = <UmiCmd.UMI_REQ_RDMA: 7>
UMI_REQ_READ = <UmiCmd.UMI_REQ_READ: 1>
UMI_REQ_USER0 = <UmiCmd.UMI_REQ_USER0: 11>
UMI_REQ_WRITE = <UmiCmd.UMI_REQ_WRITE: 3>
UMI_RESP_FUTURE0 = <UmiCmd.UMI_RESP_FUTURE0: 10>
UMI_RESP_FUTURE1 = <UmiCmd.UMI_RESP_FUTURE1: 12>
UMI_RESP_READ = <UmiCmd.UMI_RESP_READ: 2>
UMI_RESP_USER0 = <UmiCmd.UMI_RESP_USER0: 6>
UMI_RESP_USER1 = <UmiCmd.UMI_RESP_USER1: 8>
UMI_RESP_WRITE = <UmiCmd.UMI_RESP_WRITE: 4>
property name
property value
_switchboard.delete_queue(arg0: str) None

Deletes an old queue.

_switchboard.delete_queues(arg0: list[str]) None

Deletes a old queues specified in a list.

_switchboard.umi_atype(arg0: int) int
_switchboard.umi_eof(arg0: int) int
_switchboard.umi_eom(arg0: int) int
_switchboard.umi_ex(arg0: int) int
_switchboard.umi_len(arg0: int) int
_switchboard.umi_opcode(arg0: int) int
_switchboard.umi_opcode_to_str(arg0: int) str

Returns a string representation of a UMI opcode

_switchboard.umi_pack(opcode: int = 0, atype: int = 0, size: int = 0, len: int = 0, eom: int = 1, eof: int = 1, qos: int = 0, prot: int = 0, ex: int = 0) int

Returns a UMI command with the given parameters.

_switchboard.umi_prot(arg0: int) int
_switchboard.umi_qos(arg0: int) int
_switchboard.umi_size(arg0: int) int

Submodules