@@ -137,9 +137,9 @@ module i3c_target_fsm import i3c_pkg::*; (
137137 // Target specific variables
138138 logic nack_transaction_q, nack_transaction_d;
139139 logic rx_overflow_err_q, rx_overflow_err_d;
140+ logic tx_pr_start_q, tx_pr_start_d;
140141 logic rx_fifo_wvalid_raw;
141142
142-
143143 i3c_byte_t last_byte;
144144
145145 logic bus_tx_req_bit;
@@ -402,6 +402,9 @@ module i3c_target_fsm import i3c_pkg::*; (
402402 assign rx_last_byte_o = (state_q inside { RxPWriteData, RxPWriteTbit} ) &&
403403 (state_d inside { RxFByte, Idle} );
404404
405+ // Output the delayed version to align with virtual_device_sel
406+ assign tx_pr_start_o = tx_pr_start_q;
407+
405408 // Logic for latching CCC code
406409 always_ff @ (posedge clk_i or negedge rst_ni) begin : latch_ccc_data
407410 if (~ rst_ni) begin
@@ -453,7 +456,7 @@ module i3c_target_fsm import i3c_pkg::*; (
453456
454457 // Main FSM
455458 always_comb begin : fsm_target_main
456- tx_pr_start_o = 1'b0 ;
459+ tx_pr_start_d = 1'b0 ;
457460 tx_pr_abort_o = 1'b0 ;
458461 te2_err_priv_wr = 1'b0 ;
459462
@@ -640,7 +643,7 @@ module i3c_target_fsm import i3c_pkg::*; (
640643 end
641644 CheckFByte: begin
642645 // Signal begin of a private read
643- tx_pr_start_o = is_any_addr_match && bus_rnw_q;
646+ tx_pr_start_d = is_any_addr_match && bus_rnw_q;
644647
645648 if (is_rsvd_byte_match || is_any_addr_match) begin
646649 // Do not ACK transaction if it is a read and we don't have data to send
@@ -697,7 +700,7 @@ module i3c_target_fsm import i3c_pkg::*; (
697700 CheckSByte: begin
698701 if (is_any_addr_match) begin
699702 // Signal begin of a private read
700- tx_pr_start_o = bus_rnw_q;
703+ tx_pr_start_d = bus_rnw_q;
701704 if (! bus_rnw_q || tx_desc_avail_i) begin
702705 // Either private write or private read and data available
703706 state_d = TxAckSByte;
@@ -856,10 +859,12 @@ module i3c_target_fsm import i3c_pkg::*; (
856859 state_q <= Idle;
857860 ibi_retry_cnt_q <= 3'd0 ;
858861 ibi_inhibit_q <= InhibitNone;
862+ tx_pr_start_q <= 1'b0 ;
859863 end else begin
860864 state_q <= state_d;
861865 ibi_retry_cnt_q <= ibi_retry_cnt_d;
862866 ibi_inhibit_q <= ibi_inhibit_d;
867+ tx_pr_start_q <= tx_pr_start_d;
863868 end
864869 end
865870
@@ -871,16 +876,12 @@ module i3c_target_fsm import i3c_pkg::*; (
871876 end else if (bus_any_start_det || bus_stop_det_i) begin
872877 // Clear on Start/Repeated Start/Stop - transaction boundary
873878 virtual_device_sel_o <= '0 ;
874- end else unique case (state_q)
875- CheckFByte:
876- if (! is_rsvd_byte_match && virtual_device_sel_o != is_virtual_addr_match)
877- virtual_device_sel_o <= is_virtual_addr_match;
878- CheckSByte:
879- if (! is_rsvd_byte_match && virtual_device_sel_o != is_virtual_addr_match)
880- virtual_device_sel_o <= is_virtual_addr_match;
881- default :
882- virtual_device_sel_o <= virtual_device_sel_o;
883- endcase
879+ end else if (state_q inside { CheckFByte, CheckSByte} ) begin
880+ // Set on match of address header on either "first" or "second" byte
881+ virtual_device_sel_o <= is_virtual_addr_match;
882+ end else begin
883+ virtual_device_sel_o <= virtual_device_sel_o;
884+ end
884885 end
885886
886887 always_ff @ (posedge clk_i or negedge rst_ni) begin
0 commit comments