i2c_wrap

Demux one AXI-Lite slave onto NUM_I2CS I2C cores and a shared ctrl map.

NumRegMaps is NUM_I2CS plus one for ctrl and one for the error slave. Addresses outside every map reach the error slave, which answers DECERR with read data 0xBADCAB1E. The ctrl map holds one I2C_CTRL register per instance, which drives i2c_en_o, i2c_controller_mode_en_o and that instance's SMBus enable. SMBus, DMA ready, IRQ, and debug ports are vectors with one slice per instance. Each instance's debug nibble matches i2c_core's four-bit debug bus.

Parameters

Table 1. Parameters
NameTypeDefaultDescription
NUM_I2CSint unsigned3Number of I2C instances; 1 to i2c_wrap_pkg::MaxNumI2cs.
CONTROLLER_TX_FIFO_DEPTHint unsigned64Entries in the controller format (FMT) FIFO in each instance; 1 to 4095.
CONTROLLER_RX_FIFO_DEPTHint unsigned64Entries in the controller receive (RX) FIFO in each instance; 1 to 4095.
TARGET_TX_FIFO_DEPTHint unsigned64Entries in the target transmit (TX) FIFO in each instance; 1 to 4095.
TARGET_RX_FIFO_DEPTHint unsigned268Entries in the target acquisition (ACQ) FIFO in each instance; 1 to 4095.
INPUT_DELAY_CYCLESint unsigned0External SCL/SDA input delay in clk_i cycles; lengthens the interference-detection blanking window after each output change.
I2C_CTRL_REG_MAP_BASE_ADDRbit [i2c_wrap_pkg::RegAddrWidth-1:0]0Shared ctrl register-map base.
I2C_CTRL_REG_MAP_SIZEbit [i2c_wrap_pkg::RegAddrWidth-1:0]0Shared ctrl register-map size.
I2C_0__REG_MAP_BASE_ADDRbit [i2c_wrap_pkg::RegAddrWidth-1:0]0Instance 0 register-map base.
I2C_0__REG_MAP_SIZEbit [i2c_wrap_pkg::RegAddrWidth-1:0]0Per-instance register-map size.
I2C_INSTANCE_SPACINGbit [i2c_wrap_pkg::RegAddrWidth-1:0]0Byte spacing between instances.
NumRegMapsint unsignedNUM_I2CS + 2Decode targets: instances + ctrl + error slave.
CtrlRegMapi2c_wrap_reg_map_select_ti2c_wrap_reg_map_select_t'(NumRegMaps - 2)Select index for the ctrl map.
UndefinedRegMapi2c_wrap_reg_map_select_ti2c_wrap_reg_map_select_t'(NumRegMaps - 1)Select index for the error slave.

Ports

Table 2. Ports
NameDirectionTypeDescription
clk_iinputlogicSystem clock.
rst_niinputlogicAsync reset, active-low.
axil_req_iinputi2c_wrap_pkg::axil_req_tShared AXI-Lite request.
axil_resp_ooutputi2c_wrap_pkg::axil_resp_tShared AXI-Lite response.
i2c_en_ooutputlogic [NUM_I2CS-1:0]Per-instance I2C_CTRL.I2C_EN value; not consumed by the I2C instance.
i2c_controller_mode_en_ooutputlogic [NUM_I2CS-1:0]Per-instance I2C_CTRL.I2C_CONTROLLER_MODE_EN value; not consumed by the I2C instance.
scl_iinputlogic [NUM_I2CS-1:0]Per-instance SCL pad input, synchronized to clk_i inside each instance.
scl_ooutputlogic [NUM_I2CS-1:0]Per-instance SCL pad output; 0 pulls the line low, 1 releases it.
sda_iinputlogic [NUM_I2CS-1:0]Per-instance SDA pad input, synchronized to clk_i inside each instance.
sda_ooutputlogic [NUM_I2CS-1:0]Per-instance SDA pad output; 0 pulls the line low, 1 releases it.
smbsus_niinputlogic [NUM_I2CS-1:0]Per-instance SMBus SUS in, active-low; synchronized and reported in SMBUS_STATUS.
smbsus_nooutputlogic [NUM_I2CS-1:0]Per-instance SMBus SUS out, active-low; high unless the instance is in host mode.
smbalert_niinputlogic [NUM_I2CS-1:0]Per-instance SMBus ALERT in, active-low; masked while I2C_CTRL.SMBUS_EN is low.
smbalert_nooutputlogic [NUM_I2CS-1:0]Per-instance SMBus ALERT out, active-low; high unless the instance is in target mode.
controller_tx_ready_ooutputlogic [NUM_I2CS-1:0]Per-instance controller TX DMA ready; low from FMT FIFO full until below threshold.
controller_rx_ready_ooutputlogic [NUM_I2CS-1:0]Per-instance controller RX DMA ready; high from above RX threshold until empty.
target_tx_ready_ooutputlogic [NUM_I2CS-1:0]Per-instance target TX DMA ready; low from TX FIFO full until below threshold.
target_rx_ready_ooutputlogic [NUM_I2CS-1:0]Per-instance target RX DMA ready; high from above ACQ threshold until empty.
i2c_irq_ooutputlogic [NUM_I2CS-1:0]Per-instance level interrupt; OR of the enabled INTR_STATE sources.
i2c_debug_ooutputlogic [NUM_I2CS-1:0][3:0]Per-instance four-bit debug; see i2c_core.