Skip to content

Commit

Permalink
[hmac, rtl] Do not skip padding after a hash stop command
Browse files Browse the repository at this point in the history
This commit removes some conditional FSM states transition that were
deemed undesirable in `prim_sha2_pad`, see #23936. It made it possible
to cancel an ongoing padding operation, which is disallowed by the
HMAC module. As a side-effect, the removal plugs some existing FSM
transition coverage holes in `prim_sha2_pad` whose manual exclusions
can be removed as well.

This change makes it impossible to transition into the `StFifoReceive`
state from either `StPad80`, `StPad00`, `StLenHi` or `StLenLo` by
asserting the `hash_go` signal.

Signed-off-by: Andrea Caforio <[email protected]>
  • Loading branch information
andrea-caforio committed Dec 11, 2024
1 parent b70973d commit f2b230b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
25 changes: 0 additions & 25 deletions hw/ip/hmac/dv/cov/hmac_cov_excl.el

This file was deleted.

3 changes: 1 addition & 2 deletions hw/ip/hmac/dv/hmac_sim_cfg.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
reseed: 50

// Add HMAC specific exclusion files.
vcs_cov_excl_files: ["{proj_root}/hw/ip/hmac/dv/cov/hmac_unr_excl.el",
"{proj_root}/hw/ip/hmac/dv/cov/hmac_cov_excl.el"]
vcs_cov_excl_files: ["{proj_root}/hw/ip/hmac/dv/cov/hmac_unr_excl.el"]

// Default UVM test and seq class name.
uvm_test: hmac_base_test
Expand Down
9 changes: 7 additions & 2 deletions hw/ip/prim/rtl/prim_sha2_pad.sv
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,13 @@ module prim_sha2_pad import prim_sha2_pkg::*;
end
endcase

if (!sha_en_i) st_d = StIdle;
else if (hash_go) st_d = StFifoReceive;
if (!sha_en_i) begin
st_d = StIdle;
// We do not allow the cancellation of an ongoing padding operation, i.e., reverting back to the
// `StFifoReceive` state while being in the states `StPad80`, `StPad00`, `StLenHi` or `StLenLo`.
end else if (hash_go && (st_q == StIdle || st_q == StFifoReceive)) begin
st_d = StFifoReceive;
end
end

// tx_count
Expand Down

0 comments on commit f2b230b

Please sign in to comment.