Skip to content

Commit 2e91c3f

Browse files
committed
ccc: handle multiple continous CCCs
1 parent d6a862e commit 2e91c3f

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/ctrl/ccc.sv

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ module ccc
9696
input logic ccc_valid_i,
9797

9898
output logic done_fsm_o,
99+
output logic next_ccc_o,
99100

100101
// Bus Monitor interface
101102
input logic bus_start_det_i,
@@ -403,7 +404,7 @@ module ccc
403404
TxData,
404405
TxDataTbit,
405406
WaitForBusCond,
406-
WaitForStop,
407+
NextCCC,
407408
DoneCCC,
408409
HandleENTDAA,
409410
HandleTargetENTDAA,
@@ -576,7 +577,7 @@ module ccc
576577
end
577578
TxDirectAddrAck: begin
578579
if (bus_tx_done_i) begin
579-
if (is_byte_rsvd_addr) state_d = WaitForStop;
580+
if (is_byte_rsvd_addr) state_d = NextCCC;
580581
else if ((is_byte_our_addr || is_byte_virtual_addr) && command_rnw) state_d = TxData;
581582
else if ((is_byte_our_addr || is_byte_virtual_addr) && ~command_rnw) begin
582583
if (command_code == `I3C_DIRECT_SETXTIME) state_d = RxSubCmdByte;
@@ -610,8 +611,8 @@ module ccc
610611
WaitForBusCond: begin
611612
if (bus_rstart_det_i) state_d = RxDirectAddr;
612613
end
613-
WaitForStop: begin
614-
state_d = WaitForStop; // Bus stop always goes to DoneCCC
614+
NextCCC: begin
615+
state_d = WaitCCC; // Bus stop always goes to DoneCCC
615616
end
616617
DoneCCC: begin
617618
state_d = Idle;
@@ -632,6 +633,7 @@ module ccc
632633
ccc_tx_sel_od_pp = '0;
633634

634635
done_fsm_o = '0;
636+
next_ccc_o = '0;
635637
unique case (state_q)
636638
Idle: begin
637639

@@ -692,6 +694,9 @@ module ccc
692694
ccc_tx_req_value = {7'h00, ~tx_data_done};
693695
ccc_tx_sel_od_pp = '1;
694696
end
697+
NextCCC: begin
698+
next_ccc_o = '1;
699+
end
695700
DoneCCC: begin
696701
done_fsm_o = '1;
697702
end

src/ctrl/controller_standby_i3c.sv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ module controller_standby_i3c
247247
logic [7:0] ccc;
248248
logic ccc_valid;
249249
logic is_ccc_done;
250+
logic is_next_ccc;
250251
logic is_hotjoin_done;
251252

252253
//
@@ -303,7 +304,7 @@ module controller_standby_i3c
303304
2'b10: xfer_mux_sel <= Ibi;
304305
default: xfer_mux_sel <= Fsm;
305306
endcase
306-
else if (xfer_mux_sel == Ccc && is_ccc_done) xfer_mux_sel <= Fsm;
307+
else if ((xfer_mux_sel == Ccc && is_ccc_done) || (xfer_mux_sel == Ccc && is_next_ccc)) xfer_mux_sel <= Fsm;
307308
else if (xfer_mux_sel == Ibi && ibi_done) xfer_mux_sel <= Fsm;
308309
end
309310

@@ -455,6 +456,7 @@ module controller_standby_i3c
455456
.ccc_o (ccc),
456457
.ccc_valid_o (ccc_valid),
457458
.is_ccc_done_i (is_ccc_done),
459+
.is_next_ccc_i (is_next_ccc),
458460
.is_hotjoin_done_i (is_hotjoin_done),
459461
.last_addr_o (bus_addr_o),
460462
.last_addr_valid_o (bus_addr_valid_o),
@@ -475,6 +477,7 @@ module controller_standby_i3c
475477
.ccc_i (ccc),
476478
.ccc_valid_i (ccc_valid),
477479
.done_fsm_o (is_ccc_done),
480+
.next_ccc_o (is_next_ccc),
478481
.bus_start_det_i (ctrl_bus_i.start_det),
479482
.bus_rstart_det_i (ctrl_bus_i.rstart_det),
480483
.bus_stop_det_i (ctrl_bus_i.stop_det),

src/ctrl/i3c_target_fsm.sv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ module i3c_target_fsm #(
109109
output logic [7:0] ccc_o,
110110
output logic ccc_valid_o,
111111
input logic is_ccc_done_i,
112+
input logic is_next_ccc_i,
112113

113114
input logic is_hotjoin_done_i,
114115

@@ -557,6 +558,7 @@ module i3c_target_fsm #(
557558

558559
DoCCC: begin
559560
if (is_ccc_done_i) state_d = DoneCCC;
561+
else if (is_next_ccc_i) state_d = RxSByte;
560562
end
561563
DoneCCC: begin
562564
state_d = Idle;

verification/cocotb/top/lib_i3c_top/test_ccc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def test_ccc_setdasa(dut):
9090
await ClockCycles(tb.clk, 50)
9191
# set regular device dynamic address
9292
await i3c_controller.i3c_ccc_write(
93-
ccc=CCC.DIRECT.SETDASA, directed_data=[(STATIC_ADDR, [DYNAMIC_ADDR << 1])]
93+
ccc=CCC.DIRECT.SETDASA, directed_data=[(STATIC_ADDR, [DYNAMIC_ADDR << 1])], stop=False
9494
)
9595
# set virtual device dynamic address
9696
await i3c_controller.i3c_ccc_write(

0 commit comments

Comments
 (0)