Module axi_lite_regs

AXI4-Lite registers with optional read-only and protection features.

This module contains a parametrizable number of bytes in flip-flops (FFs) and makes them

accessible on two interfaces:

Address Map

The address range covered by this module is defined by RegNumBytes. The base address of this

module must be aligned to RegNumBytes. The first byte is accessible at offset 0, the last

byte is accessible at offset RegNumBytes-1. The slice [$clog2(RegNumBytes)-1:0] of a given

address is used to decode the accessed byte within this module. Address bits outside that slice

are ignored. Accesses to addresses within the slice but with an offset above the last byte are

responded with SLVERR.

Read-Only Bytes

Any set of bytes can be configured as read-only by setting the AxiReadOnly parameter

accordingly. A read-only byte cannot be written via the AXI interface, but it can be changed

from the logic interface.

When one or multiple bytes in a write transaction are read-only, they are not modified. A write

transaction is responded with OKAY if it wrote at least one byte. Write transactions / that

have wstrb set only for read-only bytes are responded with SLVERR.

This read-only mechanism can be used to expose constants (lookup-table data) as follows.

Exposing Constants

To make a byte with constant value (e.g., implemented as LUT instead of FF after synthesis)

readable from the AXI4-Lite port:

Protection

This module can be configured to only allow privileged and/or secure accesses (see A4.7

of the AXI4 specification) by setting the PrivProtOnly and/or SecuProtOnly parameter,

respectively.

Parameters

RegNumBytes: int unsigned

The size of the register field in bytes.

AxiAddrWidth: int unsigned

Address width of the AXI4-Lite port.

The minimum value of this parameter is $clog2(RegNumBytes).

AxiDataWidth: int unsigned

Data width of the AXI4-Lite port.

PrivProtOnly: bit

Only allow privileged accesses on the AXI4-Lite port.

If this parameter is set to 1, this module only allows reads and writes that have the

AxProt[0] bit set. If a transaction does not have the AxProt[0] bit set, this module

replies with SLVERR and does not read or write register data.

SecuProtOnly: bit

Only allow secure accesses on the AXI4-Lite port.

If this parameter is set to 1, this module only allows reads and writes that have the

AxProt[1] bit set. If a transaction does not have the AxProt[1] bit set, this module

replies with SLVERR and does not read or write register data.

AxiReadOnly: logic [RegNumBytes-1:0]

Define individual bytes as read-only from the AXI4-Lite port.

This parameter is an array with one bit for each byte. If that bit is 0, the byte can be

read and written on the AXI4-Lite port; if that bit is 1, the byte can only be read on the

AXI4-Lite port.

byte_t: type

Constant (=do not overwrite!); type of a byte is 8 bit.

RegRstVal: byte_t [RegNumBytes-1:0]

Reset value for the whole register array.

This parameter is an array with one byte value for each byte. At reset, each byte is

assigned its value from this array.

req_lite_t: type

Request struct of the AXI4-Lite port.

resp_lite_t: type

Response struct of the AXI4-Lite port.

AxiStrbWidth: int unsigned

NumChunks: int unsigned

ChunkIdxWidth: int unsigned

AddrWidth: int unsigned

Ports

clk_i: input logic

Rising-edge clock of all ports

rst_ni: input logic

Asynchronous reset, active low

axi_req_i: input req_lite_t

AXI4-Lite slave request

axi_resp_o: output resp_lite_t

AXI4-Lite slave response

wr_active_o: output logic [RegNumBytes-1:0]

Signals that a byte is being written from the AXI4-Lite port in the current clock cycle. This

signal is asserted regardless of the value of AxiReadOnly and can therefore be used by

surrounding logic to react to write-on-read-only-byte errors.

rd_active_o: output logic [RegNumBytes-1:0]

Signals that a byte is being read from the AXI4-Lite port in the current clock cycle.

reg_d_i: input byte_t [RegNumBytes-1:0]

Input value of each byte. If reg_load_i is 1 for a byte in the current clock cycle, the

byte register in this module is set to the value of the byte in reg_d_i at the next clock

edge.

reg_load_i: input logic [RegNumBytes-1:0]

Load enable of each byte.

If reg_load_i is 1 for a byte defined as non-read-only in a clock cycle, an AXI4-Lite

write transaction is stalled when it tries to write the same byte. That is, a write

transaction is stalled if all of the following conditions are true for the byte at index i:

If unused, set this input to '0.

reg_q_o: output byte_t [RegNumBytes-1:0]

The registered value of each byte.

Types

chunk_idx_t
addr_t
axi_rule_t
axi_data_t
b_chan_lite_t
r_chan_lite_t

Signals

aw_chunk_idx: chunk_idx_t

b_chan: b_chan_lite_t

byte_w_addr: addr_t

reg_w_idx: addr_t

ar_chunk_idx: chunk_idx_t

r_chan: r_chan_lite_t