Skip to content

Commit

Permalink
Fix defining_byte latch - keep rst_action value
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Boronski <[email protected]>
  • Loading branch information
kboronski-ant committed Nov 13, 2024
1 parent 0c68588 commit 76b4fdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/ctrl/ccc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ module ccc
logic defining_byte_valid;
logic [7:0] command_data;
logic clear_command_code;
logic [7:0] rst_action;

always_ff @(posedge clk_i or negedge rst_ni) begin : proc_latch_inputs
if (~rst_ni) begin
command_code <= '0;
defining_byte <= '0;
defining_byte_valid <= '0;
command_data <= '0;
rst_action <= '0;
end else begin
if (clear_command_code) begin
command_code <= '0;
Expand All @@ -54,6 +56,7 @@ module ccc
defining_byte <= defining_byte_valid_i ? defining_byte_i : defining_byte;
defining_byte_valid <= defining_byte_valid_i;
command_data <= command_data_valid_i ? command_data_i : command_data;
rst_action <= write_reset_action ? defining_byte : rst_action;
end
end

Expand All @@ -67,11 +70,12 @@ module ccc
assign rx_data_buffer_size = queue_size_reg_i[23:16];
assign ibi_status_size = queue_size_reg_i[15:8];
assign cr_queue_size = queue_size_reg_i[7:0];
assign rst_action_o = rst_action;

// Decode CCC
logic is_direct_cmd = command_code[7]; // 0 - BCast, 1 - Direct


logic write_reset_action;

always_comb begin
response_valid_o = '0;
Expand All @@ -81,6 +85,7 @@ module ccc
command_min_bytes_o = '0;
command_max_bytes_o = '0;
clear_command_code = '0;
write_reset_action = '0;
unique case (command_code)
// Idle: Wait for command appearance in the Command Queue
`I3C_DIRECT_GETMRL: begin
Expand All @@ -99,7 +104,7 @@ module ccc
command_min_bytes_o = '1;
command_max_bytes_o = '1;
if (defining_byte_valid) begin
rst_action_o = defining_byte;
write_reset_action = '1;
end
end
default: ;
Expand Down
4 changes: 1 addition & 3 deletions src/ctrl/i3c_target_fsm.sv
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,6 @@ module i3c_target_fsm
sda_r <= (ibi_handling & ibi_fifo_rvalid_i) | (~ibi_handling & tx_fifo_rvalid_i);

// Conditional state transition
// TODO: Fix latch
// verilator lint_off LATCH
always_comb begin : state_functions
state_d = state_q;
load_tcount = 1'b0;
Expand All @@ -892,6 +890,7 @@ module i3c_target_fsm
enter_hdr_after_stop_clr = 1'b0;
bus_rstart_det_o = 1'b0;
sel_od_pp_o = 1'b0;
defining_byte_valid = 1'b0;
unique case (state_q)
// Idle: initial state, SDA and SCL are released (high)
Idle: begin
Expand Down Expand Up @@ -1367,7 +1366,6 @@ module i3c_target_fsm
end
end
end
// verilator lint_on LATCH

// Signal the DAA module to perform addres check
always_ff @(posedge clk_i or negedge rst_ni)
Expand Down

0 comments on commit 76b4fdb

Please sign in to comment.