Skip to content

Commit c8fdceb

Browse files
committed
Handle arbitration_lost on SCL posedge
Signed-off-by: Karol Gugala <kgugala@antmicro.com>
1 parent 9edf604 commit c8fdceb

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/ctrl/ccc_entdaa.sv

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,16 @@ module ccc_entdaa
127127
end
128128
end
129129
SendIDBit: begin
130-
if (bus_tx_done_i) begin
131-
// our Id was overwritten by some other device
132-
if (arbitration_lost_i) begin
133-
state_d = LostArbitration;
134-
end
135-
if (id_bit_count == '0) begin
136-
state_d = ReceiveAddr;
137-
end else begin
138-
state_d = PrepareIDBit;
130+
// our Id was overwritten by some other device
131+
if (arbitration_lost_i) begin
132+
state_d = LostArbitration;
133+
end else begin
134+
if (bus_tx_done_i) begin
135+
if (id_bit_count == '0) begin
136+
state_d = ReceiveAddr;
137+
end else begin
138+
state_d = PrepareIDBit;
139+
end
139140
end
140141
end
141142
end

src/ctrl/controller.sv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ module controller
199199
output logic bus_start_o,
200200
output logic bus_rstart_o,
201201
output logic bus_stop_o,
202+
output logic bus_scl_posedge_o,
202203

203204
// I2C/I3C received address (with RnW# bit) for the recovery handler
204205
output logic [7:0] bus_addr_o,
@@ -310,6 +311,8 @@ module controller
310311
.state_o (bus)
311312
);
312313

314+
assign bus_scl_posedge_o = bus.scl.pos_edge;
315+
313316
// 4:1 multiplexer for signals between PHY and controllers.
314317
// Needed, because there are 4 controllers in the design (i2c/i3c + active/standby).
315318
bus_state_t ctrl_bus_i[4];

src/i3c.sv

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,11 @@ module i3c
540540
logic virtual_device_sel;
541541
logic xfer_in_progress;
542542

543-
logic arbitration_lost;
543+
logic arbitration_lost, arbitration_lost_q;
544+
logic bus_scl_posedge;
544545

545-
assign arbitration_lost = i3c_sda_i != i3c_sda_o;
546+
assign arbitration_lost = phy2ctrl_sda != i3c_sda_o;
547+
assign arbitration_lost_q = arbitration_lost & bus_scl_posedge;
546548

547549
// HCI
548550
I3CCSR_pkg::I3CCSR__I3C_EC__TTI__out_t hwif_tti_out;
@@ -573,7 +575,7 @@ module i3c
573575
.scl_o(ctrl2phy_scl),
574576
.sda_o(ctrl2phy_sda),
575577
.sel_od_pp_o(ctrl_sel_od_pp),
576-
.arbitration_lost_i(arbitration_lost),
578+
.arbitration_lost_i(arbitration_lost_q),
577579

578580
// HCI Response queue
579581
.hci_resp_queue_empty_i(hci_resp_empty),
@@ -692,6 +694,7 @@ module i3c
692694
.bus_start_o (bus_start),
693695
.bus_rstart_o(bus_rstart),
694696
.bus_stop_o (bus_stop),
697+
.bus_scl_posedge_o(bus_scl_posedge),
695698

696699
// I2C/I3C received address (with RnW# bit) for the recovery handler
697700
.bus_addr_o(rx_bus_addr),

0 commit comments

Comments
 (0)