Skip to content

Commit

Permalink
[entropy_src, dv] Move assertion control code out of sequence
Browse files Browse the repository at this point in the history
This change fixes a build issue seen when trying to run the entropy_src
using VCS simulator. The code to disable assertion from within sequences
using XMR doesnt compile.This is because VCS prohibits SV class inside
a package to have XMRs to code in module outside
The solution implemented in this commit moves the functions containing
assert_off tasks to the entropy_src_path_if.
These functions are then called as appropriate from the sequences using
a handle to the virtual interface

Signed-off-by: Venkat Krishnan <venkateswarank.opentitan@gmail.com>
  • Loading branch information
venkatk-ot committed Oct 8, 2024
1 parent 162d9a3 commit 4b47a96
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 59 deletions.
73 changes: 73 additions & 0 deletions hw/ip/entropy_src/dv/env/entropy_src_path_if.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

// This interface deals with the force paths in ENTROPY_SRC interrupt and error tests

`define CORE \
tb.dut.u_entropy_src_core
`define REPCNT \
u_entropy_src_repcnt_ht.u_prim_max_tree_rep_cntr_max
`define BUCKET \
u_entropy_src_bucket_ht.u_prim_max_tree_bin_cntr_max

interface entropy_src_path_if ();
import uvm_pkg::*;

Expand Down Expand Up @@ -39,4 +46,70 @@ interface entropy_src_path_if ();
end
endcase // case (cntr_name)
endfunction // cntr_err_path
// Disable assertions that we expect to trigger when injecting errors
task assert_off_err();

Check warning on line 50 in hw/ip/entropy_src/dv/env/entropy_src_path_if.sv

View workflow job for this annotation

GitHub Actions / Verible lint

[verible-verilog-lint] reported by reviewdog 🐶 Explicitly define static or automatic lifetime for non-class tasks [Style: function-task-explicit-lifetime] [explicit-task-lifetime] Raw Output: message:"Explicitly define static or automatic lifetime for non-class tasks [Style: function-task-explicit-lifetime] [explicit-task-lifetime]" location:{path:"./hw/ip/entropy_src/dv/env/entropy_src_path_if.sv" range:{start:{line:50 column:8}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
$assertoff(0, tb.dut.AlertTxKnownO_A);
$assertoff(0, tb.dut.IntrEsFifoErrKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsAckKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsBitsKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsFipsKnownO_A);
$assertoff(0, tb.dut.EsXhtEntropyBitKnownO_A);
$assertoff(0, tb.dut.IntrEsEntropyValidKnownO_A);
$assertoff(0, tb.dut.IntrEsHealthTestFailedKnownO_A);
$assertoff(0, tb.dut.tlul_assert_device.dKnown_A);
$assertoff(0, tb.dut.tlul_assert_device.gen_device.dDataKnown_A);
$assertoff(0, tb.dut.gen_alert_tx[0].u_prim_alert_sender.AlertPKnownO_A);
$assertoff(0, tb.dut.gen_alert_tx[0].u_prim_alert_sender.gen_async_assert.DiffEncoding_A);
$assertoff(0, `CORE.AtReset_ValidRngBitsPushedIntoEsrngFifo_A);
$assertoff(0, `CORE.Final_ValidRngBitsPushedIntoEsrngFifo_A);
$assertoff(0, `CORE.AtReset_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.Final_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.AtReset_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.Final_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.AtReset_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, `CORE.Final_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, `CORE.AtReset_PosthtFifoPushedIntoDistrFifo_A);
$assertoff(0, `CORE.Final_PosthtFifoPushedIntoDistrFifo_A);
$assertoff(0, `CORE.AtReset_DistrFifoPushedIntoPreconFifo_A);
$assertoff(0, `CORE.Final_DistrFifoPushedIntoPreconFifo_A);
$assertoff(0, `CORE.AtReset_EsfinalFifoPushed_A);
$assertoff(0, `CORE.Final_EsfinalFifoPushed_A);
$assertoff(0, `CORE.AtReset_EsfinalFifoPushedPostStartup_A);
$assertoff(0, `CORE.Final_EsfinalFifoPushedPostStartup_A);
$assertoff(0, `CORE.AtReset_PreconFifoPushedPostStartup_A);
$assertoff(0, `CORE.Final_PreconFifoPushedPostStartup_A);
$assertoff(0, `CORE.u_sha3.FsmKnown_A);
$assertoff(0, `CORE.u_sha3.MuxSelKnown_A);
$assertoff(0, `CORE.u_entropy_src_main_sm.u_state_regs_A);
$assertoff(0, `CORE.u_entropy_src_ack_sm.u_state_regs_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.DepthKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.RvalidKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.WreadyKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esrng.DataKnown_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_sum.SumComputation_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_sum.SumComputation_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_min.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_max.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_min.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_max.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_sha3.u_keccak.gen_unmask_st_chk.UnmaskValidStates_A);
$assertoff(0, `CORE.`REPCNT.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.`BUCKET.ValidInImpliesValidOut_A);
endtask
function void disable_entroy_drop_assertions();

Check warning on line 99 in hw/ip/entropy_src/dv/env/entropy_src_path_if.sv

View workflow job for this annotation

GitHub Actions / Verible lint

[verible-verilog-lint] reported by reviewdog 🐶 Explicitly define static or automatic lifetime for non-class functions [Style: function-task-explicit-lifetime] [explicit-function-lifetime] Raw Output: message:"Explicitly define static or automatic lifetime for non-class functions [Style: function-task-explicit-lifetime] [explicit-function-lifetime]" location:{path:"./hw/ip/entropy_src/dv/env/entropy_src_path_if.sv" range:{start:{line:99 column:17}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
// Disable assertions which expect that no entropy is dropped between the esrng,
// esbit and postht FIFOs.
$assertoff(0, `CORE.AtReset_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.Final_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.AtReset_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.Final_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.AtReset_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, `CORE.Final_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
// TODO(#24085): Remove this assertoff once the issue is solved.
$assertoff(0, `CORE.FifosEmptyWhenShaProcess_A);
endfunction
endinterface // entropy_src_path_if

`undef CORE
`undef REPCNT
`undef BUCKET
48 changes: 1 addition & 47 deletions hw/ip/entropy_src/dv/env/seq_lib/entropy_src_err_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -218,53 +218,7 @@ class entropy_src_err_vseq extends entropy_src_base_vseq;

// Disable assertions that we expect to trigger when injecting errors
task assert_off_err();
$assertoff(0, tb.dut.AlertTxKnownO_A);
$assertoff(0, tb.dut.IntrEsFifoErrKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsAckKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsBitsKnownO_A);
$assertoff(0, tb.dut.EsHwIfEsFipsKnownO_A);
$assertoff(0, tb.dut.EsXhtEntropyBitKnownO_A);
$assertoff(0, tb.dut.IntrEsEntropyValidKnownO_A);
$assertoff(0, tb.dut.IntrEsHealthTestFailedKnownO_A);
$assertoff(0, tb.dut.tlul_assert_device.dKnown_A);
$assertoff(0, tb.dut.tlul_assert_device.gen_device.dDataKnown_A);
$assertoff(0, tb.dut.gen_alert_tx[0].u_prim_alert_sender.AlertPKnownO_A);
$assertoff(0, tb.dut.gen_alert_tx[0].u_prim_alert_sender.gen_async_assert.DiffEncoding_A);
$assertoff(0, `CORE.AtReset_ValidRngBitsPushedIntoEsrngFifo_A);
$assertoff(0, `CORE.Final_ValidRngBitsPushedIntoEsrngFifo_A);
$assertoff(0, `CORE.AtReset_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.Final_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, `CORE.AtReset_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.Final_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, `CORE.AtReset_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, `CORE.Final_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, `CORE.AtReset_PosthtFifoPushedIntoDistrFifo_A);
$assertoff(0, `CORE.Final_PosthtFifoPushedIntoDistrFifo_A);
$assertoff(0, `CORE.AtReset_DistrFifoPushedIntoPreconFifo_A);
$assertoff(0, `CORE.Final_DistrFifoPushedIntoPreconFifo_A);
$assertoff(0, `CORE.AtReset_EsfinalFifoPushed_A);
$assertoff(0, `CORE.Final_EsfinalFifoPushed_A);
$assertoff(0, `CORE.AtReset_EsfinalFifoPushedPostStartup_A);
$assertoff(0, `CORE.Final_EsfinalFifoPushedPostStartup_A);
$assertoff(0, `CORE.AtReset_PreconFifoPushedPostStartup_A);
$assertoff(0, `CORE.Final_PreconFifoPushedPostStartup_A);
$assertoff(0, `CORE.u_sha3.FsmKnown_A);
$assertoff(0, `CORE.u_sha3.MuxSelKnown_A);
$assertoff(0, `CORE.u_entropy_src_main_sm.u_state_regs_A);
$assertoff(0, `CORE.u_entropy_src_ack_sm.u_state_regs_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.DepthKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.RvalidKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esfinal.WreadyKnown_A);
$assertoff(0, `CORE.u_prim_fifo_sync_esrng.DataKnown_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_sum.SumComputation_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_sum.SumComputation_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_min.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_adaptp_ht.u_max.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_min.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_entropy_src_markov_ht.u_max.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.u_sha3.u_keccak.gen_unmask_st_chk.UnmaskValidStates_A);
$assertoff(0, `CORE.`REPCNT.ValidInImpliesValidOut_A);
$assertoff(0, `CORE.`BUCKET.ValidInImpliesValidOut_A);
cfg.entropy_src_path_vif.assert_off_err();
endtask

endclass : entropy_src_err_vseq
15 changes: 3 additions & 12 deletions hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -854,18 +854,9 @@ class entropy_src_rng_vseq extends entropy_src_base_vseq;
// Don't enable here, let the main loop do that explicitly
endtask

function void disable_assertions();
function void disable_entropy_drop_assertions();
if (cfg.rng_max_delay) begin
// Disable assertions which expect that no entropy is dropped between the esrng,
// esbit and postht FIFOs.
$assertoff(0, tb.dut.u_entropy_src_core.AtReset_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, tb.dut.u_entropy_src_core.Final_EsrngFifoPushedIntoEsbitOrPosthtFifos_A);
$assertoff(0, tb.dut.u_entropy_src_core.AtReset_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, tb.dut.u_entropy_src_core.Final_EsbitFifoPushedIntoPosthtFifo_A);
$assertoff(0, tb.dut.u_entropy_src_core.AtReset_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
$assertoff(0, tb.dut.u_entropy_src_core.Final_PosthtFifoPushedFromEsbitOrEsrngFifos_A);
// TODO(#24085): Remove this assertoff once the issue is solved.
$assertoff(0, tb.dut.u_entropy_src_core.FifosEmptyWhenShaProcess_A);
cfg.entropy_src_path_vif.disable_entroy_drop_assertions();
end
endfunction

Expand All @@ -875,7 +866,7 @@ class entropy_src_rng_vseq extends entropy_src_base_vseq;
continue_sim = 1;
reset_needed = 0;

disable_assertions();
disable_entropy_drop_assertions();
// Start sequences in the background
start_indefinite_seqs();

Expand Down

0 comments on commit 4b47a96

Please sign in to comment.