i2c_controller_fsm

Drive the I2C controller FSM from the FMT FIFO onto SCL and SDA.

Issues START and STOP around fmt_byte_i per FMT flags, waits while the target stretches SCL, and reports NAK, arbitration-loss, and stretch-timeout events.

Parameters

Table 1. Parameters
NameTypeDefaultDescription
CONTROLLER_TX_FIFO_DEPTHint unsigned64FMT FIFO depth.
ControllerTxFifoDepthWidthint unsigned$clog2(CONTROLLER_TX_FIFO_DEPTH + 1)clog2(depth+1) for FMT fill.

Ports

Table 2. Ports
NameDirectionTypeDescription
clk_iinputlogicSystem clock.
rst_niinputlogicAsync reset, active-low.
scl_iinputlogicSCL pad input.
scl_ooutputlogicSCL pad output.
sda_iinputlogicSDA pad input.
sda_ooutputlogicSDA pad output.
bus_free_iinputlogicBus free for a new transfer.
transmitting_ooutputlogicController is driving SDA.
host_enable_iinputlogicHost/controller enable.
halt_controller_iinputlogicHalt the controller FSM in IDLE.
fmt_fifo_rvalid_iinputlogicFMT FIFO has valid data.
fmt_fifo_depth_iinputlogic [ControllerTxFifoDepthWidth-1:0]FMT FIFO fill level.
fmt_fifo_rready_ooutputlogicPop FMT FIFO.
fmt_byte_iinputlogic [7:0]Byte in FMT FIFO to send to the target.
fmt_flag_start_before_iinputlogicIssue START before sending the byte.
fmt_flag_stop_after_iinputlogicIssue STOP after sending the byte.
fmt_flag_read_bytes_iinputlogicByte is a number of reads; zero means 256.
fmt_flag_read_continue_iinputlogicHost sends Ack to the final read byte.
fmt_flag_nak_ok_iinputlogicNo ACK is expected.
unhandled_unexp_nak_iinputlogicUnexpected-NACK IRQ still pending.
unhandled_nak_timeout_iinputlogicNACK-handler timeout event not cleared.
rx_fifo_wvalid_ooutputlogicPush a read byte into the RX FIFO.
rx_fifo_wdata_ooutputlogic [CONTROLLER_RX_FIFO_WIDTH-1:0]Byte read from the target for the RX FIFO.
host_idle_ooutputlogicHost is idle.
thigh_iinputlogic [12:0]SCL high period in clock units.
tlow_iinputlogic [12:0]SCL low period in clock units.
t_r_iinputlogic [12:0]Rise time of SDA and SCL in clock units.
t_f_iinputlogic [12:0]Fall time of SDA and SCL in clock units.
thd_sta_iinputlogic [12:0]Hold time for (repeated) START in clock units.
tsu_sta_iinputlogic [12:0]Setup time for repeated START in clock units.
tsu_sto_iinputlogic [12:0]Setup time for STOP in clock units.
thd_dat_iinputlogic [12:0]Data hold time in clock units.
sda_interference_iinputlogicSCL high and SDA does not match while transmitting.
bus_timeout_iinputlogicSCL held low past the bus timeout.
stretch_timeout_iinputlogic [29:0]Max clocks a target may stretch the clock.
timeout_enable_iinputlogicEnables event_stretch_timeout_o.
host_nack_handler_timeout_iinputlogic [30:0]Clocks the FSM may stay halted on an unhandled Host-Mode NACK before it issues a STOP.
host_nack_handler_timeout_en_iinputlogicEnable unhandled-NACK timeout.
event_nak_ooutputlogicTarget did not Ack when expected.
event_unhandled_nak_timeout_ooutputlogicSW did not handle the NACK in time; held while the FSM stays halted.
event_arbitration_lost_ooutputlogicSDA unstable, SDA interference, or a failed START or STOP symbol.
event_scl_interference_ooutputlogicOther device forcing SCL low.
event_stretch_timeout_ooutputlogicTarget stretches clock past max time.
event_sda_unstable_ooutputlogicSDA is not constant during an SCL pulse.
event_cmd_complete_ooutputlogicCommand is complete.