Skip to content

Conversation

@glaserf
Copy link
Contributor

@glaserf glaserf commented Nov 2, 2025

Follow-up of #28428; removes three more FIFOs which together measure about 13kGE. Apart from everything mentioned in #28428, removal of the affected FIFOs required the following changes:

  • Rework the state db cycle-alternating "arbitration". As there never is a need where both the ctr_drbg_cmd and _gen units want to write to the state db at the same time, the actual arbitration logic can be kept very simple.
  • Introduce a small FSM to ctr_drbg_cmd that handles the bifurcation of the data stream and waits on commands that require the ctr_drbg_upd unit for both it and the cmd_rsp channel being ready before signaling the cmd_req as ready.

Part of #28153.

@glaserf
Copy link
Contributor Author

glaserf commented Nov 2, 2025

Regression results:

CSRNG Simulation Results

Tuesday November 04 2025 09:55:03 UTC

GitHub Revision: d16ce56753

Branch: csrng_sfifo_pr

Testplan

Simulator: XCELIUM

Test Results

Stage Name Tests Max Job Runtime Simulated Time Passing Total Pass Rate
V1 smoke csrng_smoke 9.000s 246.853us 50 50 100.00 %
V1 csr_hw_reset csrng_csr_hw_reset 2.000s 233.282us 5 5 100.00 %
V1 csr_rw csrng_csr_rw 1.000s 13.902us 20 20 100.00 %
V1 csr_bit_bash csrng_csr_bit_bash 11.000s 1.385ms 5 5 100.00 %
V1 csr_aliasing csrng_csr_aliasing 3.000s 273.440us 5 5 100.00 %
V1 csr_mem_rw_with_rand_reset csrng_csr_mem_rw_with_rand_reset 2.000s 294.328us 20 20 100.00 %
V1 regwen_csr_and_corresponding_lockable_csr csrng_csr_rw 1.000s 13.902us 20 20 100.00 %
csrng_csr_aliasing 3.000s 273.440us 5 5 100.00 %
V1 TOTAL 105 105 100.00 %
V2 interrupts csrng_intr 10.000s 313.847us 200 200 100.00 %
V2 alerts csrng_alert 18.000s 2.210ms 500 500 100.00 %
V2 err csrng_err 8.000s 24.949us 500 500 100.00 %
V2 cmds csrng_cmds 3.167m 37.836ms 50 50 100.00 %
V2 life cycle csrng_cmds 3.167m 37.836ms 50 50 100.00 %
V2 stress_all csrng_stress_all 8.217m 84.965ms 49 50 98.00 %
V2 intr_test csrng_intr_test 1.000s 14.493us 50 50 100.00 %
V2 alert_test csrng_alert_test 8.000s 15.735us 50 50 100.00 %
V2 tl_d_oob_addr_access csrng_tl_errors 4.000s 175.366us 20 20 100.00 %
V2 tl_d_illegal_access csrng_tl_errors 4.000s 175.366us 20 20 100.00 %
V2 tl_d_outstanding_access csrng_csr_hw_reset 2.000s 233.282us 5 5 100.00 %
csrng_csr_rw 1.000s 13.902us 20 20 100.00 %
csrng_csr_aliasing 3.000s 273.440us 5 5 100.00 %
csrng_same_csr_outstanding 2.000s 104.462us 20 20 100.00 %
V2 tl_d_partial_access csrng_csr_hw_reset 2.000s 233.282us 5 5 100.00 %
csrng_csr_rw 1.000s 13.902us 20 20 100.00 %
csrng_csr_aliasing 3.000s 273.440us 5 5 100.00 %
csrng_same_csr_outstanding 2.000s 104.462us 20 20 100.00 %
V2 TOTAL 1439 1440 99.93 %
V2S tl_intg_err csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
csrng_tl_intg_err 5.000s 815.392us 20 20 100.00 %
V2S sec_cm_config_regwen csrng_regwen 8.000s 60.852us 50 50 100.00 %
csrng_csr_rw 1.000s 13.902us 20 20 100.00 %
V2S sec_cm_config_mubi csrng_alert 18.000s 2.210ms 500 500 100.00 %
V2S sec_cm_intersig_mubi csrng_stress_all 8.217m 84.965ms 49 50 98.00 %
V2S sec_cm_main_sm_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_updrsp_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_update_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_blk_enc_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_outblk_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_gen_cmd_ctr_redun csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_drbg_upd_ctr_redun csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_drbg_gen_ctr_redun csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_ctrl_mubi csrng_alert 18.000s 2.210ms 500 500 100.00 %
V2S sec_cm_main_sm_ctr_local_esc csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
V2S sec_cm_constants_lc_gated csrng_stress_all 8.217m 84.965ms 49 50 98.00 %
V2S sec_cm_sw_genbits_bus_consistency csrng_alert 18.000s 2.210ms 500 500 100.00 %
V2S sec_cm_tile_link_bus_integrity csrng_tl_intg_err 5.000s 815.392us 20 20 100.00 %
V2S sec_cm_aes_cipher_fsm_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_aes_cipher_fsm_redun csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
V2S sec_cm_aes_cipher_ctrl_sparse csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
V2S sec_cm_aes_cipher_fsm_local_esc csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
V2S sec_cm_aes_cipher_ctr_redun csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
csrng_sec_cm 9.000s 179.763us 5 5 100.00 %
V2S sec_cm_aes_cipher_data_reg_local_esc csrng_intr 10.000s 313.847us 200 200 100.00 %
csrng_err 8.000s 24.949us 500 500 100.00 %
V2S TOTAL 75 75 100.00 %
V3 stress_all_with_rand_reset csrng_stress_all_with_rand_reset 2.583m 12.978ms 10 10 100.00 %
V3 TOTAL 10 10 100.00 %
TOTAL 1629 1630 99.94 %

Coverage Results

Coverage Dashboard

Score Block Branch Statement Expression Toggle Fsm Assertion CoverGroup
97.59 % 98.76 % 96.96 % 99.85 % 96.77 % 92.08 % 100.00 % 95.53 % 90.12 %

Failure Buckets

  • UVM_ERROR (csrng_scoreboard.sv:166) [scoreboard] Check failed intr_pins[i] === (intr_en[i] & item.d_data[i]) (* [*] vs * [*]) Interrupt_pin: EntropyReq has 1 failures:
    • Test csrng_stress_all has 1 failures.
      • 42.csrng_stress_all.7201815913989753525406440744181533782652175777971277456600672816489512363970
        Line 146, in log /scratch/glaserf/opentitan/scratch/csrng_sfifo_pr/csrng-sim-xcelium/42.csrng_stress_all/latest/run.log

          UVM_ERROR @ 5722333422 ps: (csrng_scoreboard.sv:166) [uvm_test_top.env.scoreboard] Check failed intr_pins[i] === (intr_en[i] & item.d_data[i]) (0x1 [1] vs 0x0 [0]) Interrupt_pin: EntropyReq
          UVM_INFO @ 5722333422 ps: (uvm_report_catcher.svh:705) [UVM/REPORT/CATCHER]
          --- UVM Report catcher Summary ---
        

INFO: [FlowCfg] [scratch_path]: [csrng] [/scratch/glaserf/opentitan/scratch/csrng_sfifo_pr/csrng-sim-xcelium]
ERROR: [dvsim] Errors were encountered in this run.

          [   legend    ]: [Q: queued, D: dispatched, P: passed, F: failed, K: killed, T: total]                                                                                                                                                             
00:01:04  [    build    ]: [Q: 0, D: 0, P: 2, F: 0, K: 0, T: 2] 100%                                                                                                                                                                                         
00:17:11  [     run     ]: [Q: 0, D: 0, P: 1629, F: 1, K: 0, T: 1630] 100%                                                                                                                                                                                   
00:17:41  [  cov_merge  ]: [Q: 0, D: 0, P: 1, F: 0, K: 0, T: 1] 100%                                                                                                                                                                                         
00:17:45  [ cov_report  ]: [Q: 0, D: 0, P: 1, F: 0, K: 0, T: 1] 100%

@glaserf glaserf marked this pull request as ready for review November 3, 2025 07:20
@glaserf glaserf requested review from a team as code owners November 3, 2025 07:20
@glaserf glaserf requested review from Razer6, andreaskurth, marnovandermaas, meisnere, moidx, pamaury, rswarbrick and vogelpi and removed request for a team, marnovandermaas and pamaury November 3, 2025 07:20
Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

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

I think there's a nontrivial comment on the first commit, but the later commits basically have comments asking whether you can make it easier for me to review :-) I claim that it's not entirely selfish, because it will also make it easier for future readers to understand the history...

I'm excited by how much can be ripped out though! Very nice!

reseed_cnt_reached_q[ai];
assign reseed_cnt_reached_d[ai] = (state_db_wr_vld && (state_db_wr_data.inst_id == ai)) ?
(state_db_wr_data.rs_ctr >= reg2hw.reseed_interval.q) :
reseed_cnt_reached_q[ai];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think this is a character too far in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

state_db_wr_sts = CMD_STS_SUCCESS;
// ctr_drbg_gen must wait (only in theory, in reality two concurrent
// requests to state db cannot happen anyways)
ctr_drbg_gen_rsp_rdy = 1'b0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you restructure this always_comb block a bit? I've spent some time reading the code and I don't yet understand that it's doing the right thing. In particular, the current version looks like we've got a "ready" signal going into u_csrng_ctr_drbg_gen that depends on the value of its cmd_rsp_data_o port. I don't think that quite looks right to me?

Copy link
Contributor

Choose a reason for hiding this comment

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

My personal preference would be to write this as a ternary. I would first generate the selector signal with appropriate comments e.g.:

// Keep forwarding gen block responses to the state db unless the cmd block has a valid response.
assign gen_rsp_to_db = (ctr_drbg_cmd_rsp_data.cmd != GEN) && (ctr_drbg_cmd_rsp_vld == 1'b1) ? 1'b0 : 1'b1; 

And then the ternary:

assign state_db_wr_vld  = gen_rsp_to_db ? ctr_drbg_gen_rsp_vld  : ctr_drbg_cmd_rsp_vld;
assign state_db_wr_data = gen_rsp_to_db ? ctr_drbg_gen_rsp_data : ctr_drbg_cmd_rsp_data;
...

I think this would be more readable as there is a single line defining the controls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to both of you for the feedback. I agree that the way I had it was hard to follow. The fundamental issue here is that we do a sort-of three-way data stream routing, where the rsp from _cmd can go one of two endpoints, with the state db endpoint having influence on whether the _gen_rsp channel can write to state db or not.

I think @vogelpi suggestion allows for much better readable code. I have implemented it with some slight adaptions. Please have a look again, and let me know if this part is now (somewhat) clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for changing the implementation and the clear comments. That's very helpful.

This bit will stay set until the next reset.
'''
}
{ bits: "7",
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's easy, I'd consider splitting this commit in two, where the first part removes the FIFO (and wires zero to this error signal) and the second part removes the register field. I think the result would probably be a lot easier to follow.

Copy link
Contributor Author

@glaserf glaserf Nov 3, 2025

Choose a reason for hiding this comment

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

Unfortunately, splitting this up would be quite a bit of work, as this affects in total six commits in this and the follow-up PR (which would then become twelve or 13 commits, given your suggestion of splitting one of them into three). Apart from this, I would like to keep the regfile changes together with the rtl and dv changes in a single commit for each FIFO, respectively, for the following reasons:

Of course, please let me know if you feel strongly that the split up would be necessary.

This bit will stay set until the next reset.
'''
}
{ bits: "3",
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit like with the previous commit, can this one be split as well? Here, it would be in three parts. I think the SFIFO_RCSTATE_ERR field could be removed as a later commit (and driven with zero beforehand). Similarly, I think DRBG_CMD_SM_ERR be added as a first commit (driven with zero). That way, all the "register shuffling cruft" gets separated from the real work.

This bit will stay set until the next reset.
'''
}
{ bits: "4",
Copy link
Contributor

Choose a reason for hiding this comment

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

I realise that I'm repeating myself (sorry!), but I think it would make sense to split this commit into two pieces: the first one would remove the fifo and wire zero into the error field; the second would remove the field.

Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

I've reviewed the first commits and will continue later. Thanks for the PR @glaserf !

Comment on lines 1137 to 1138
// ctr_drbg_gen must wait (only in theory, in reality two concurrent
// requests to state db cannot happen anyways)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this really cannot happen (I believe you that it can't happen) we should add an SVA to assert this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Added.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

state_db_wr_sts = CMD_STS_SUCCESS;
// ctr_drbg_gen must wait (only in theory, in reality two concurrent
// requests to state db cannot happen anyways)
ctr_drbg_gen_rsp_rdy = 1'b0;
Copy link
Contributor

Choose a reason for hiding this comment

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

My personal preference would be to write this as a ternary. I would first generate the selector signal with appropriate comments e.g.:

// Keep forwarding gen block responses to the state db unless the cmd block has a valid response.
assign gen_rsp_to_db = (ctr_drbg_cmd_rsp_data.cmd != GEN) && (ctr_drbg_cmd_rsp_vld == 1'b1) ? 1'b0 : 1'b1; 

And then the ternary:

assign state_db_wr_vld  = gen_rsp_to_db ? ctr_drbg_gen_rsp_vld  : ctr_drbg_cmd_rsp_vld;
assign state_db_wr_data = gen_rsp_to_db ? ctr_drbg_gen_rsp_data : ctr_drbg_cmd_rsp_data;
...

I think this would be more readable as there is a single line defining the controls.

Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

I've now also reviewed the final two commits and I have some more questions. But this looks good to me in general.

assign sfifo_rcstage_wvld = req_vld_i && req_rdy_o;
assign sfifo_rcstage_rrdy = sfifo_rcstage_rvld && (update_rsp_vld_i || gen_adata_null_q);
// There are two cases in which we don't need the update unit:
// 1) Generate commands with pdata equal to all-zero
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please add a TODO into your issue to check this behavior (skip update if pdata = 0) is what we really want? Because the NIST spec is a bit ambiguous on this and I have seen software implementations which treat the case of pdata = 0 and pdata_len = 0 differently.

We don't need to change this right now, but I think we should have a discussion on how we want to move forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - added the TODO and a matching item in #28153

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks Florian.


unique case (state_q)
ReqIdle: begin
if (bypass_upd) begin
Copy link
Contributor

Choose a reason for hiding this comment

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

I think some more comments would help here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, added.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect, thanks!

cmd_vld_o = 1'b1;
if (cmd_rdy_i) state_d = MainSmClrAData;
if (cmd_rdy_i) begin
if (cmd_complete_i) begin
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it actually possible for the cmd_complete_i pulse coming in while being in the MainSmClrAData state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With all these FIFOs removed, yes. The latency between the command req_rdy and rsp_vld can now be very small, depending on the command at hand, and hence cmd_rdy_i and cmd_complete_i can be asserted in the same cycle. I actually had some tests being stuck due to a missed cmd_complete_i in the main FSM as the reason for adding this condition.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, thanks for explaining. The code looks a bit complex and I wanted to make sure this complexity is really needed. All good!

Copy link
Contributor Author

@glaserf glaserf left a comment

Choose a reason for hiding this comment

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

Thanks @rswarbrick and @vogelpi for the swift and thorough reviews! I have addressed your comments in individual replies and pushed the appropriate changes.

@rswarbrick I addressed your comments about splitting up the commits in a reply to one of them, I hope that is okay.

reseed_cnt_reached_q[ai];
assign reseed_cnt_reached_d[ai] = (state_db_wr_vld && (state_db_wr_data.inst_id == ai)) ?
(state_db_wr_data.rs_ctr >= reg2hw.reseed_interval.q) :
reseed_cnt_reached_q[ai];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 1137 to 1138
// ctr_drbg_gen must wait (only in theory, in reality two concurrent
// requests to state db cannot happen anyways)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Added.

state_db_wr_sts = CMD_STS_SUCCESS;
// ctr_drbg_gen must wait (only in theory, in reality two concurrent
// requests to state db cannot happen anyways)
ctr_drbg_gen_rsp_rdy = 1'b0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to both of you for the feedback. I agree that the way I had it was hard to follow. The fundamental issue here is that we do a sort-of three-way data stream routing, where the rsp from _cmd can go one of two endpoints, with the state db endpoint having influence on whether the _gen_rsp channel can write to state db or not.

I think @vogelpi suggestion allows for much better readable code. I have implemented it with some slight adaptions. Please have a look again, and let me know if this part is now (somewhat) clear.

This bit will stay set until the next reset.
'''
}
{ bits: "7",
Copy link
Contributor Author

@glaserf glaserf Nov 3, 2025

Choose a reason for hiding this comment

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

Unfortunately, splitting this up would be quite a bit of work, as this affects in total six commits in this and the follow-up PR (which would then become twelve or 13 commits, given your suggestion of splitting one of them into three). Apart from this, I would like to keep the regfile changes together with the rtl and dv changes in a single commit for each FIFO, respectively, for the following reasons:

Of course, please let me know if you feel strongly that the split up would be necessary.


unique case (state_q)
ReqIdle: begin
if (bypass_upd) begin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, added.

assign sfifo_rcstage_wvld = req_vld_i && req_rdy_o;
assign sfifo_rcstage_rrdy = sfifo_rcstage_rvld && (update_rsp_vld_i || gen_adata_null_q);
// There are two cases in which we don't need the update unit:
// 1) Generate commands with pdata equal to all-zero
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - added the TODO and a matching item in #28153

cmd_vld_o = 1'b1;
if (cmd_rdy_i) state_d = MainSmClrAData;
if (cmd_rdy_i) begin
if (cmd_complete_i) begin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With all these FIFOs removed, yes. The latency between the command req_rdy and rsp_vld can now be very small, depending on the command at hand, and hence cmd_rdy_i and cmd_complete_i can be asserted in the same cycle. I actually had some tests being stuck due to a missed cmd_complete_i in the main FSM as the reason for adding this condition.

Replace the toggle-style state db arbitration by a simple valid-based
scheme that leverages the fact that the ctr_drbg_gen and ctr_drbg_cmd
units cannot deadlock or starve each other.

Signed-off-by: Florian Glaser <[email protected]>
This removal requires slight adaptions to the handshaking done with
block_encrypt as well as the removal of a complex SVA from the tb.

No functional or timing impact; the response data from block_encrypt
even still feed into registers.

Signed-off-by: Florian Glaser <[email protected]>
This commit removes another large FIFO from the data path, measuring
about 6kGE. Since the data path bifurcates in ctr_drbg_cmd for all
commands that require processing by ctr_drbg_upd, a simple FSM is now
required to orchestrate handshaking between the upstream requester,
ctr_drbg_upd and the keyvrc FIFO.

This step hence also requires the testing of the added sparse-encoded
FSM in dv, documentation of this SEC.CM, and a corresponding bit in the
ERR_CODE register.

Signed-off-by: Florian Glaser <[email protected]>
This commit removes the last FIFO from the ctr_drbg_cmd module. Since
the request and response ready signals are now in many cases asserted in
the same cycle, slight adaptions to the main FSM are also necessary.

Signed-off-by: Florian Glaser <[email protected]>
Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments, this looks good to me!

@vogelpi
Copy link
Contributor

vogelpi commented Nov 5, 2025

CHANGE AUTHORIZED: hw/ip/csrng/data/csrng.hjson
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_block_encrypt.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_core.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_ctr_drbg_cmd.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_ctr_drbg_upd.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_main_sm.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_reg_pkg.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_reg_top.sv
CHANGE AUTHORIZED: hw/ip/csrng/rtl/csrng_state_db.sv

This PR modifies the RTL of CSRNG to remove more area and simplify the design. The changes are part of a bigger restructuring effort which has been discussed in multiple WG meetings. The pass rate and coverage remain above the V2(S) thresholds. This is fine.

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.

3 participants