Skip to content

Recovery Interface Restructure - #121

Merged
clayton8 merged 41 commits into
chipsalliance:v1p5from
clayton8:v1p5-ri-fixes
Feb 5, 2026
Merged

clayton8 merged 41 commits into
chipsalliance:v1p5from
clayton8:v1p5-ri-fixes

Conversation

@clayton8

Copy link
Copy Markdown
Collaborator
1. Merge 3 Recovery interface FSMs into a single recovery_handler FSM
2. Fix many issues regarding B2B transactions with Sr
3. Properly handle protocol errors
4. Add RI error interrupt controls
5. Add some additional tests that will need a new cocotbext-i3c these will be disabled until that repo has been updated. 

- Add new RI test that does complext reads and writes
- Add new capabilities to COCOCTB source repo for start/stop capabilities
1. Merge 3 FSMs into one
2. Fix many issues reguarding B2B transactions with Sr
3. Properly handle protocol errors
4. Add RI error interrupt controls
[884]     W425                          N.A                 error     i3c-core/src/ctrl/bus_tx_flow.sv                                                           68    5    Function uses a global variable: data
[885]     W425                          N.A                 error     i3c-core/src/ctrl/bus_tx_flow.sv                                                           69    5    Function uses a global variable: tx_req_i.req_bit
[882]     W121                          N.A                 error     i3c-core/src/ctrl/bus_tx_flow.sv                                                           65    5    Name 'req_value_d' is not unique - may shadow another variable(Previously used at line no. 46 in i3c-core/src/ctrl/bus_tx_flow.sv)
[883]     W121                          N.A                 error     i3c-core/src/ctrl/bus_tx_flow.sv                                                           66    5    Name 'bit_counter_en' is not unique - may shadow another variable(Previously used at line no. 41 in i3c-core/src/ctrl/bus_tx_flow.sv)
Comment thread src/recovery/recovery_receiver.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Resolved
- RI detects and reports INDIRECT_FIFO overflow error
- RI detects and reports RX_FIFO overflow error
- RI detects and reports invalid write length to CSR

@mkj121 mkj121 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these (Python) are stylistic and we can probably ignore those

Comment thread src/csr/I3CCSR.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Outdated
};

assign indirect_fifo_status_0 = {
16'd0, 5'd0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason that this is not also '0 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this one...

Comment thread src/recovery/recovery_receiver.sv Resolved

@mkj121 mkj121 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more

Comment thread src/recovery/recovery_receiver.sv Resolved
HDR was not exiting properly due to us not validating the address
with an addr_valid signal. Also the addr_valid signal wasn't getting
cleared properly from a stop or entering HDR mode.

RI now properly handles HDR mode + invalid command sequences like
Write + Sr + CCC or Write + Sr + Write (invalid)
RI write was broken due to error logic incorrectly detecting an error
- Add many different error scenario tests
- Add override classes for the cocotbext_i3c classes to fix some functions
  and add additional functionality
- Remove a ton of timers to reduce runtime

@glaserf glaserf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the excellent refactoring, especially of the FSMs and merging them! I am still not fully done looking through all the changes around the recovery handler/receiver and will continue tomorrow.

For now I have a couple of minor and cosmetic comments, and a general one regarding the recovery receiver. state_q is used around 30 times outside of the FSM to calculate all kinds of signals, which are essentially all FSM outputs (often solely depending on the state).

While I think this makes sense for some signals (like output data mux), it often distributes core FSM functionality around the file, which makes following and understanding the functionality sometimes really tricky. IMHO we should include more functionality into the main FSM process, but I'll let you be the judge if you want to go through this trouble at the current state of the project.

Comment thread src/recovery/recovery_handler.sv Resolved
Comment on lines +467 to +471
//============================================================================
//
// SECTION 4: RECOVERY MODE CONTROL
//
//============================================================================

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of always_ff in this section which mostly only provide delayed versions of one signal each. I suggest to merge these into a single process to avoid the syntactical overhead for every signal.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix.

Comment thread src/ctrl/controller_standby_i3c.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Outdated
// Command validation - Raw detection (evaluated in CmdDispatch)
// Read-only commands: PROT_CAP, DEVICE_ID, DEVICE_STATUS, HW_STATUS, INDIRECT_STATUS, INDIRECT_FIFO_STATUS
assign readonly_err_raw = !cmd_is_rd && (
(cmd_cmd == CMD_PROT_CAP) ||

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be replaced by a more readable inside {..}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so let me try that.

Comment thread src/recovery/recovery_receiver.sv Outdated
(cmd_len != csr_length_next);

// CSR write length validation - Enabled error
assign csr_length_err_en = csr_length_err_raw && length_err_det_en_i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to change the suffix of the LHS to _masked or drop it, as _en suggest its the enable signal for said error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I like this suggestion.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +688 to +689
end
else if (rx_flow) begin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end else if is handled inconsistently within the FSM (sometimes broken across two lines).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me clean this up.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +964 to +966
if (!rst_ni) cmd_is_rd <= 1'b0;
else if (state_q == Idle) cmd_is_rd <= 1'b0;
else if (set_cmd_is_rd) cmd_is_rd <= 1'b1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_cmd_is_rd is only set in one place inside the FSM, and only read here. Instead, cmd_is_rd_d could directly get set inside the FSM.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are suggesting having:
if (!rst_ni) cmd_is_rd <= 1'b0;
else cmd_is_rd <= cmd_is_rd_d;
?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and in the FSM just set cmd_is_rd_d = 1 in a particular state?

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +951 to +958
if (!rst_ni) len_lsb <= '0;
else if (latch_pec_from_len) len_lsb <= '0;
else if (capture_len_lsb) len_lsb <= rx_data_i;

always_ff @(posedge clk_i or negedge rst_ni)
if (!rst_ni) len_msb <= '0;
else if (latch_pec_from_len) len_msb <= '0;
else if (capture_len_msb) len_msb <= rx_data_i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to merge these three very similar capture processes into one.

@clayton8 clayton8 Feb 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging these into 1 always_ff would look like

  always_ff @(posedge clk_i or negedge rst_ni) begin
    if (!rst_ni) begin
      len_lsb <= '0;
      len_msb <= '0;
      cmd_cmd <= command_e'('0);
    end else if (latch_pec_from_len) begin
      len_lsb <= '0;
      len_msb <= '0;
    end else begin
      if (capture_cmd) begin
        cmd_cmd <= command_e'(rx_data_i);
      end

      if (capture_len_lsb) begin
        len_lsb <= rx_data_i;
      end

      if (capture_len_msb) begin
        len_msb <= rx_data_i;
      end
  end

My concern is if the latch_pec_from_len is set in the same state as capture_cmd this could easily turn into a bug. hence why I kept the FF controls separate to be as safe as possible.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +546 to +547
assign length_underrun_err_raw = (payload_byte_cnt < cmd_len) || pec_rx_byte_cnt == 0;
assign length_overrun_err_raw = (pec_rx_byte_cnt > 1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These conditions only apply to certain states at all, and for example pec_rx_byte_cnt == 0 is checked again in the RxPec state before setting the respective error flag. The whole under/overrun error calculation seems to be gated/split across 3-4 places within this file, and I find it very hard to follow, even though the actual logic is IIUC not that complicated.
I suggest to perform the 'raw' calculation fully within the respective states and then gate the error setting there with the length_err_det_en_i flag.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think at the time I was worried these check would be happening in multiple places within the file so I wanted a central check that could be used to avoid typos. But now that the design is complete this doesn't seem to be the case... I can update these and remove the raw/err_en signals.

Comment thread src/recovery/recovery_receiver.sv Resolved

@mkj121 mkj121 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment

Comment thread src/recovery/recovery_receiver.sv Resolved
@hcallahan-lowrisc

Copy link
Copy Markdown
Contributor

Could you run a whitespace cleanup over this? There is quite a bit of trailing whitespace, in test_recovery.py in particular. Thanks!

@glaserf glaserf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more small points in regards to the recovery receiver, more to follow.

Comment thread src/recovery/recovery_receiver.sv Outdated
if (!rst_ni) rx_data_queue_select_reg <= 1'b1;
else if (state_q == Idle) rx_data_queue_select_reg <= 1'b1;
else if (state_q == RxLenH && rx_flow) rx_data_queue_select_reg <= 1'b0;
else if (state_q == RxPec) rx_data_queue_select_reg <= 1'b1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are equivalent to

else if ((state_q == RxPec) || (state_d == RxPec))  rx_data_queue_select_reg <= 1'b1;

and directly assigning rx_data_queue_select_reg to rx_data_queue_select_o. Again, I think this would be better handled as a direct FSM output, but probably not the right time to change this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked the waves and this can definitely come directly from the FSM without any additional flops. I think I inherited some legacy code and built upon it and didn't fully think this can easily be driven by the FSM.

Comment thread src/recovery/recovery_receiver.sv Resolved
Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +1088 to +1089
assign rx_fifo_overflow_err_raw = rx_fifo_overflow_raw_i;
assign rx_fifo_overflow_err_en = rx_fifo_overflow_err_raw && rx_fifo_overflow_err_det_en_i;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rx_fifo_overflow_err_raw is only used here (one line below its assignment).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved this code into the FSM. No dedicated err_raw and err_en signal. Just the raw_i and rx_fifo_overflow_err

Comment thread src/recovery/recovery_receiver.sv Resolved
hwif_rec_o.RECOVERY_CTRL.CMS.next = tti_rx_rdata_i[7:0];
hwif_rec_o.INDIRECT_FIFO_CTRL_0.RESET.next = bypass_i3c_core_i ? sw_indirect_fifo_ctrl_reset_value : tti_rx_rdata_i[15:8];
hwif_rec_o.INDIRECT_FIFO_CTRL_0.CMS.next = tti_rx_rdata_i[7:0];
hwif_rec_o.INDIRECT_FIFO_CTRL_1.IMAGE_SIZE.next = {tti_rx_rdata_i[15:0], prev_tti_rx_rdata[31:16]};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because we have to get the remaining size in two cycles due to the MSB/LSB split?

@clayton8 clayton8 Feb 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is their legacy code, it has to do with what bits the IMAGE_SIZE lives in within the INDIRECT_FIFO_CTRL command. I did some testing around this code and it works correct.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +1413 to +1415
always_ff @(posedge clk_i or negedge rst_ni)
if (!rst_ni) fifo_ptr_top <= '0;
else fifo_ptr_top <= fifo_size - 32'h1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we need to keep a flopped version of this instead of directly using size - 1?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is legacy code. This seems overkill. We can probably just do fifo_size - 1 in the code. I can fix this.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines +1422 to +1425
always_ff @(posedge clk_i or negedge rst_ni)
if (!rst_ni) fifo_reg_reset_clear <= 1'b0;
else if (|hwif_rec_i.INDIRECT_FIFO_CTRL_0.RESET.value) fifo_reg_reset_clear <= 1'b1;
else fifo_reg_reset_clear <= 1'b0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question as before, do we really need a 1-cycle delayed/flopped version of |hwif_rec_i.INDIRECT_FIFO_CTRL_0.RESET.value ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also was legacy code. Let me double check timing to ensure it clears the reset signal.

Comment on lines +1460 to +1478
sw_device_reset_ctrl_swmod <= 1'b0;
sw_recovery_ctrl_activate_rec_img_swmod <= 1'b0;
sw_indirect_fifo_ctrl_reset_swmod <= 1'b0;
end
else begin
sw_device_reset_ctrl_swmod <= hwif_socmgmt_i.REC_INTF_REG_W1C_ACCESS.DEVICE_RESET_CTRL.swmod;
sw_recovery_ctrl_activate_rec_img_swmod <= hwif_socmgmt_i.REC_INTF_REG_W1C_ACCESS.RECOVERY_CTRL_ACTIVATE_REC_IMG.swmod;
sw_indirect_fifo_ctrl_reset_swmod <= hwif_socmgmt_i.REC_INTF_REG_W1C_ACCESS.INDIRECT_FIFO_CTRL_RESET.swmod;
end
end

assign cmd_len_o = {len_msb, len_lsb};
// Gate PEC error detection at source - when disabled, never report error
assign cmd_error_o = pec_err_det_en_i && !pec_match;
always_comb begin : clear_bypassed_regs
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.DEVICE_RESET_CTRL.we = sw_device_reset_ctrl_swmod;
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.DEVICE_RESET_CTRL.next = '0;
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.RECOVERY_CTRL_ACTIVATE_REC_IMG.we = sw_recovery_ctrl_activate_rec_img_swmod;
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.RECOVERY_CTRL_ACTIVATE_REC_IMG.next= '0;
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.INDIRECT_FIFO_CTRL_RESET.we = sw_indirect_fifo_ctrl_reset_swmod;
hwif_socmgmt_o.REC_INTF_REG_W1C_ACCESS.INDIRECT_FIFO_CTRL_RESET.next = '0;
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this takes the swmod fields of the hwif_socmgmt_i struct, delays them by one cycle and unconditionally feeds them back to the respective we field. I don't understand why this is done (but haven't looked deeper into it, maybe there is a good reason).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a timing thing. If you don't delay the swmod and we will fight each other.

Comment on lines +1484 to +1512
// Read-only registers - no write enable
hwif_rec_o.PROT_CAP_2.REC_PROT_VERSION.we = '0;
hwif_rec_o.PROT_CAP_2.AGENT_CAPS.we = '0;
hwif_rec_o.PROT_CAP_3.NUM_OF_CMS_REGIONS.we = '0;
hwif_rec_o.PROT_CAP_3.MAX_RESP_TIME.we = '0;
hwif_rec_o.PROT_CAP_3.HEARTBEAT_PERIOD.we = '0;
hwif_rec_o.DEVICE_ID_0.DESC_TYPE.we = '0;
hwif_rec_o.DEVICE_ID_0.VENDOR_SPECIFIC_STR_LENGTH.we = '0;
hwif_rec_o.DEVICE_ID_0.DATA.we = '0;
hwif_rec_o.DEVICE_ID_1.DATA.we = '0;
hwif_rec_o.DEVICE_ID_2.DATA.we = '0;
hwif_rec_o.DEVICE_ID_3.DATA.we = '0;
hwif_rec_o.DEVICE_ID_4.DATA.we = '0;
hwif_rec_o.DEVICE_ID_5.DATA.we = '0;
hwif_rec_o.DEVICE_STATUS_1.HEARTBEAT.we = '0;
hwif_rec_o.DEVICE_STATUS_1.VENDOR_STATUS_LENGTH.we = '0;
hwif_rec_o.DEVICE_STATUS_1.VENDOR_STATUS.we = '0;
hwif_rec_o.RECOVERY_STATUS.DEV_REC_STATUS.we = '0;
hwif_rec_o.RECOVERY_STATUS.REC_IMG_INDEX.we = '0;
hwif_rec_o.RECOVERY_STATUS.VENDOR_SPECIFIC_STATUS.we = '0;
hwif_rec_o.HW_STATUS.TEMP_CRITICAL.we = '0;
hwif_rec_o.HW_STATUS.SOFT_ERR.we = '0;
hwif_rec_o.HW_STATUS.FATAL_ERR.we = '0;
hwif_rec_o.HW_STATUS.RESERVED_7_3.we = '0;
hwif_rec_o.HW_STATUS.VENDOR_HW_STATUS.we = '0;
hwif_rec_o.HW_STATUS.CTEMP.we = '0;
hwif_rec_o.HW_STATUS.VENDOR_HW_STATUS_LEN.we = '0;
hwif_rec_o.INDIRECT_FIFO_STATUS_0.REGION_TYPE.we = '0;
hwif_rec_o.INDIRECT_FIFO_RESERVED.DATA.we = '0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to declare these registers as hw-readonly in RDL and avoid all these manual 0-assigns?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should in the future but I didn't takt the time to go through each register and determine if it was used or now.

Comment on lines +1663 to +1664
hwif_socmgmt_o.REC_INTF_CFG.REC_PAYLOAD_DONE.we = fifo_xfer_done;
hwif_socmgmt_o.REC_INTF_CFG.REC_PAYLOAD_DONE.next = 1'b0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to write 0 as value into a register that should indicate "done", when a done-condition is high? Maybe I am missing something here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third times the charm... Clearing is the correct action; SW writes this register to indicate the last bit of data has been transferred and HW clears the register. This will then trigger the payload_available_q to be set.

If you look at this section there seems to be a lot of redundancy here between the payload_done and the image_activated_o usage. This part of the code has been heavily tested by our FW team so I hesitate to change this logic since we know it works for their use case.

1. Changed rx_data_queue_select_o to be driven directly from FSM
2. All _err_raw/err_en now direct checks in FSM
3. Changes many checks to 'inside (..)'
4. added begin ends everywhere
5. Fixed bug with REC_PAYLOAD_DON not set when fifo_xfer_done asserted

@mkj121 mkj121 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the most recent changes have significantly improved the legibility.

Nice work

@glaserf glaserf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final round of minor comments, mostly in regards to the recovery handler.

logic tti_tx_desc_queue_ack;
logic [ TtiTxDescDataWidth-1:0] tti_tx_desc_queue_data;
logic [ TtiTxDescThldWidth-1:0] tti_tx_desc_queue_ready_thld_i;
logic [ TtiTxDescThldWidth-1:0] tti_tx_desc_queue_ready_thld_o;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe get rid of the local _i and _o signals as part of this big restructuring effort? The _i ones are fully superfluous and can just be replaced by the respective actual input signal. For _o and cases where they are more than a feed-through from some lower hierarchy, we should either create a local signal without the _o suffix or use the actual output everywhere.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the idea but for right now I'm going to skip I need to start focusing on some other work in I3C that is more critical.

Comment thread src/recovery/recovery_handler.sv Outdated
Comment on lines +480 to +491
//----------------------------------------------------------------------------
// Virtual Device Selection Delay
// Shift register delays PEC init after virtual device selection
//----------------------------------------------------------------------------
always @(posedge clk_i or negedge rst_ni)
if (~rst_ni) begin
virtual_device_cec_shreg <= 2'b10;
end else if (virtual_device_sel_i) begin
virtual_device_cec_shreg <= {1'b0, virtual_device_cec_shreg[1]};
end else begin
virtual_device_cec_shreg <= 2'b10;
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a really convoluted way to get the PEC to start its calculation when receiving the bus address, to take it into account? I really have a hard time understanding what exactly is going on here.
In your nice comment at the beginning of the receiver, you say that the bus address is not taken into account for the PEC (only starting at the cmd), but I think it is? There is a data mux at the input of the PEC which selects the address during the init phase. But then again, if we have the init signal during address-valid, do we need this shift register at all?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is legacy... Let me see if I can clean this up by using the FSM....

Comment thread src/recovery/recovery_handler.sv Outdated
assign ctl_bus_any_start = ctl_bus_start_i | ctl_bus_rstart_i;

always @(posedge clk_i or negedge rst_ni)
always @(posedge clk_i or negedge rst_ni) begin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be always_ff, and I think there is one more occurrence of this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch let me fix that.

Comment on lines +1150 to +1161
.virtual_target_start_i(virtual_target_start),
.other_target_start_i(other_target_start),

.pec_err_o(pec_err_o),
.length_err_o(length_err_o),
.readonly_err_o(readonly_err_o),
.unsupported_err_o(unsupported_err_o),
.rx_fifo_overflow_err_o(rx_fifo_overflow_err_o),
.indirect_fifo_overflow_err_o(indirect_fifo_overflow_err_o),
.exec_pending_o(recovery_exec_pending),
.recovery_mode_enter_o(recovery_mode_enter_o)
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these (and some other) ports are pure feed-throughs. I think changing the port map style to .port, would make it clearer to spot that, given the signal complexity of this module.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

always_comb begin
// Only write to FIFO if not full - reject writes when full
indirect_rx_wvalid_o = (state_q == ExecFifoWrite) && tti_rx_rack_i && indirect_rx_wready_i;
indirect_rx_wdata_o = tti_rx_rdata_i;

@glaserf glaserf Feb 4, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feed-through obfuscates that in the recovery handler there is some unnecessary muxing going on for the indirect FIFO wdata in bypass mode.
There is a direct path through the indirect_rx_wdata_muxed signal in Section 11, and one through the R3MUX and the exec_tti_rx_data_data signal, which ends up as tti_rx_rdata_i here. Both in the end mux tti_tx_data_queue_rdata to the wdata of the indirect FIFO (the former FIFO in Section 11 has the same signal on both of its inputs in bypass mode).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, had a wrong signal there in the first version, now corrected.

Comment thread src/recovery/recovery_receiver.sv Outdated
Comment on lines 125 to 127
input logic desc_valid_i,
output logic desc_ready_o,
input logic [TtiRxDescDataWidth-1:0] desc_data_i,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are unused (ready tied to 1, inputs not read).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, these were used but cleaned up in this file and the handler file.

@clayton8
clayton8 merged commit 029ed60 into chipsalliance:v1p5 Feb 5, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants