Skip to content

Commit

Permalink
[kmac/dv] Restore CSR strength value after app interface completion
Browse files Browse the repository at this point in the history
Whenever an application interface starts a new transaction, the
scoreboard overwrites its own copy of the strength config value. Before
this commit, the scoreboard would continue to use the strength value of
the application interface also for following software-initiated
transactions which led to digest mismatches between DUT and DPI model/
scoreboard.

Signed-off-by: Pirmin Vogel <[email protected]>
  • Loading branch information
vogelpi committed Aug 29, 2024
1 parent bb629a9 commit 4d57661
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hw/ip/kmac/dv/env/kmac_scoreboard.sv
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class kmac_scoreboard extends cip_base_scoreboard #(
bit entropy_fast_process;
bit entropy_ready;

// The scoreboard overwrites the value configured by software with the value of the application
// interface. Keep a separate copy of the CSR value to restore it after application interface
// transactions finish.
sha3_pkg::keccak_strength_e strength_csr;

// Set this bit when entropy_ready is 1 and entropy_mode is EntropyModeEdn,
// to indicate that we are now waiting on the EDN to return valid entropy
bit in_edn_fetch = 0;
Expand Down Expand Up @@ -356,6 +361,8 @@ class kmac_scoreboard extends cip_base_scoreboard #(
end

@(posedge sha3_idle);
// Restore the strength value provided by software via CSR interface.
strength = strength_csr;
end
,
wait(cfg.under_reset || kmac_err.code == ErrKeyNotValid ||
Expand Down Expand Up @@ -745,6 +752,7 @@ class kmac_scoreboard extends cip_base_scoreboard #(
hash_mode = sha3_pkg::sha3_mode_e'(item.a_data[KmacModeMSB:KmacModeLSB]);

strength = sha3_pkg::keccak_strength_e'(item.a_data[KmacStrengthMSB:KmacStrengthLSB]);
strength_csr = strength;

entropy_mode = entropy_mode_e'(item.a_data[KmacEntropyModeMSB:KmacEntropyModeLSB]);

Expand Down

0 comments on commit 4d57661

Please sign in to comment.