Protocol
- class XibifProtocol(register_width: int)
Implements the protocol to communicate with a Xibif board.
A message can be sent/received to/from a Xibif board only if the data between the board and the client is in accordance to a data format that the board recognizes.
- build_response(header: ndarray, payload: ndarray) Response
Assemble a Response object from a received header and the payload.
- decode(data: bytes | bytearray | memoryview) ndarray[tuple[Any, ...], dtype[uint32]]
Decode data received from a XiBIF board.
Decodes SendableData by ensuring that the data is four-byte aligned and then decoding it using the protocol-defined data-type.
- decode_register_data(data: ndarray[tuple[Any, ...], dtype[uint32]]) int | list[int] | ndarray[tuple[Any, ...], dtype[integer]]
Decode received register data into values of individual registers
- property dtype: dtype
Underlying datatype of the protocol
- encode(msg: Message) bytes | bytearray | memoryview
Convert a Message to SendableData
This implementation avoids Python-level payload expansion (the *payload pattern) by constructing header and payload numpy arrays and concatenating them. That prevents creating a large intermediate Python list/tuple for big payloads.
- encode_register_address(addr: int | list[int] | ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[uint32]]
Encode a register address into a list of register addresses.
Hardware access of addresses always occurs for 32 bits at time. If the register width is larger than 32, multiple accesses need to occur to read/write a single register.
- encode_register_data(data: int | list[int] | ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[uint32]]
Split data into 32-bit chunks according to register width.
- get_command_status_from_header(data: ndarray) ResponseStatus
Read status from a header.
The received header contains information on the status of the command associated with the header.
- get_execution_time_from_header(data: ndarray) int
ATTENTION: not pure execution time. Measures time from complete reception to instant of sending the response.
- get_payload_length_from_header(data: ndarray) int
Read payload length from header.
- property header_size_bytes: int
Size of a header received after sending a command in bytes.
- property register_width: int
Get the register width in bits.
- enum Command(value)
Commands that can be sent to a Xibif board.
A Xibif board offers a set of commands that it can execute. This list must be in agreement with the commands implemented in the C-code running on the hardware.
Valid values are as follows:
- STATUS = <Command.STATUS: 0>
- FLUSH_STREAM = <Command.FLUSH_STREAM: 1>
- READ_REGISTER = <Command.READ_REGISTER: 2>
- WRITE_REGISTER = <Command.WRITE_REGISTER: 3>
- READ_STREAM = <Command.READ_STREAM: 4>
- READ_STREAM_ALL = <Command.READ_STREAM_ALL: 5>
- WRITE_STREAM = <Command.WRITE_STREAM: 6>
- WRITE_BITSTREAM = <Command.WRITE_BITSTREAM: 7>
- UART_PRINT_STATUS = <Command.UART_PRINT_STATUS: 8>
- UART_ENABLE_DBG_OUTPUT = <Command.UART_ENABLE_DBG_OUTPUT: 9>
- RESET = <Command.RESET: 10>
- AXI_READ = <Command.AXI_READ: 11>
- AXI_WRITE = <Command.AXI_WRITE: 12>
- READ_REGISTER_MAP = <Command.READ_REGISTER_MAP: 13>
- PERFORMANCE_TEST = <Command.PERFORMANCE_TEST: 14>
- class Message(uuid: int, id: Command = Command.STATUS, payload: ndarray[tuple[Any, ...], dtype[uint32]] | None = None)
A message that can be sent to a XiBIF board.
The message consists of a UUID for authentication, a COMMAND to specify which function to execute and a XibifPayload which contains the data required to execute the specified command.
- class Response(id: Command = Command.STATUS, status: ResponseStatus = ResponseStatus.OK, payload: ndarray[tuple[Any, ...], dtype[uint32]] | None = None, cycles: int = -1)
A response from a XiBIF board.
The response consists of a UUID, a COMMAND indicating which command execution the response belongs to, a ResponseStatus signaling the status of the execution and an optional payload for commands that require data being returned.
- class XibifStatus(status: list[int] | ndarray[tuple[Any, ...], dtype[uint32]])
Encapsulates the data returned by a XiBIF board when queried for the status of the board. Implements constructor methods from a payload and representation methods for printing.
Helper Types
- enum ResponseStatus(value)
Response information for a sent command.
Values
OK: Command executed successfully.
UNAUTHORIZED: Command execution not authorized.
COMMAND_NOT_IMPLEMENTED: Command is not implemented.
FAILED: Command execution failed due to an error.
INVALID_LENGTH: Command execution failed due to invalid payload length.
Valid values are as follows:
- OK = <ResponseStatus.OK: 0>
- UNAUTHORIZED = <ResponseStatus.UNAUTHORIZED: 1>
- COMMAND_NOT_IMPLEMENTED = <ResponseStatus.COMMAND_NOT_IMPLEMENTED: 2>
- FAILED = <ResponseStatus.FAILED: 3>
- INVALID_LENGTH = <ResponseStatus.INVALID_LENGTH: 4>
- enum AxiAccessStatus(value)
AXI status codes after executing a direct AXI-access
Values
AXI_ACCESS_OK: Access was successful.
AXI_ACCESS_NOT_ALLOWED_RANGE: The address is not within the allowed range. It must be in the range of 0x40000000 to 0x4FFFFFFF for Zynq-7000 platforms or 0xA0000000 to 0xAFFFFFFF for ZynqMP platforms.
AXI_ACCESS_NOT_ALLOWED_XIBIF_RANGE: The address is within the XiBIF reserved range and cannot be accessed.
AXI_FIREWALL_ERROR: The AXI Firewall detected an error.
AXI_FIREWALL_DATA_DEC0DEE3_DEADFA11: The AXI Firewall returned a specific error code indicating a data issue. If you expect to read the value 0xDEADC0DE or 0xDEADFA11 you can disable this error by setting the property disable_axi_check_DEC0DEE3_DEADFA11 to True.
AXI_ACCESS_ADDRESS_NOT_ALIGNED: The address is not aligned to 32-bit values. The address must be a multiple of 4.
Valid values are as follows:
- AXI_ACCESS_OK = <AxiAccessStatus.AXI_ACCESS_OK: 0>
- AXI_ACCESS_NOT_ALLOWED_RANGE = <AxiAccessStatus.AXI_ACCESS_NOT_ALLOWED_RANGE: 1>
- AXI_ACCESS_NOT_ALLOWED_XIBIF_RANGE = <AxiAccessStatus.AXI_ACCESS_NOT_ALLOWED_XIBIF_RANGE: 2>
- AXI_FIREWALL_ERROR = <AxiAccessStatus.AXI_FIREWALL_ERROR: 3>
- AXI_FIREWALL_DATA_DEC0DEE3_DEADFA11 = <AxiAccessStatus.AXI_FIREWALL_DATA_DEC0DEE3_DEADFA11: 4>
- AXI_ACCESS_ADDRESS_NOT_ALIGNED = <AxiAccessStatus.AXI_ACCESS_ADDRESS_NOT_ALIGNED: 5>
- class XibifVersion(value: int)
Encapsulates the version data from a XiBIF board and implements representation methods.
- class XibifFifo(fill: int, depth: int, enabled: bool, axiError: bool, ddrFull: bool)
Represents the status of a XiBIF stream FIFO and implements representation methods.
- class XibifUuid(value)
Unique Identification number of a XiBIF Board.
This dataclass exists to provide proper representations of UUIDs for status printing.