From 0c30e162382ab1ebf776dfe4b2a4f1f9dcbf406f Mon Sep 17 00:00:00 2001 From: Andreas Kurth Date: Tue, 21 Mar 2023 20:40:07 +0000 Subject: [PATCH 1/4] [entropy_src/dv] Add knob to keep default XHT rsp When this knob is enabled, the default XHT response is always provided to `entropy_src`. Signed-off-by: Andreas Kurth --- hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv | 3 +++ hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv index d97e323f9f56b..3aee2054825e9 100644 --- a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv +++ b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv @@ -112,6 +112,9 @@ class entropy_src_env_cfg extends cip_base_env_cfg #(.RAL_T(entropy_src_reg_bloc // alert within alert_max_delay clock cycles. int alert_max_delay; + // Whether to keep the default response on the XHT interface at all time. + bit xht_only_default_rsp = 0; + /////////////////////// // Randomized fields // /////////////////////// diff --git a/hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv b/hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv index ae68f3cf71820..39e0f040e2297 100644 --- a/hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv +++ b/hw/ip/entropy_src/dv/env/seq_lib/entropy_src_rng_vseq.sv @@ -425,7 +425,9 @@ class entropy_src_rng_vseq extends entropy_src_base_vseq; fork m_rng_push_seq.start(p_sequencer.rng_sequencer_h); m_csrng_pull_seq.start(p_sequencer.csrng_sequencer_h); - m_xht_seq.start(p_sequencer.xht_sequencer); + if (!cfg.xht_only_default_rsp) begin + m_xht_seq.start(p_sequencer.xht_sequencer); + end join_none endtask From a62d494154061f194348f9d5b7b89b78ba9fe9d1 Mon Sep 17 00:00:00 2001 From: Andreas Kurth Date: Tue, 21 Mar 2023 20:44:43 +0000 Subject: [PATCH 2/4] [entropy_src/dv] Check default XHT rsp if enabled This commit extends `entropy_src_scoreboard` to check that the default XHT response is indeed always applied if the corresponding knob is set. Signed-off-by: Andreas Kurth --- .../entropy_src/dv/env/entropy_src_scoreboard.sv | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/ip/entropy_src/dv/env/entropy_src_scoreboard.sv b/hw/ip/entropy_src/dv/env/entropy_src_scoreboard.sv index 10ece2091288b..c22e1d1670f33 100644 --- a/hw/ip/entropy_src/dv/env/entropy_src_scoreboard.sv +++ b/hw/ip/entropy_src/dv/env/entropy_src_scoreboard.sv @@ -183,6 +183,7 @@ class entropy_src_scoreboard extends cip_base_scoreboard#( process_interrupts(); process_fifo_exceptions(); health_test_scoring_thread(); + process_xht(); join_none end endtask @@ -1107,6 +1108,21 @@ class entropy_src_scoreboard extends cip_base_scoreboard#( end endtask + task process_xht(); + // Process XHT transactions. + forever begin + @(cfg.m_xht_agent_cfg.vif.mon_cb); + if (cfg.under_reset) continue; + + if (cfg.xht_only_default_rsp) begin + // If the environment is configured to maintain the default XHT response at all time, ensure + // that this is really the case. + `DV_CHECK_EQ(cfg.m_xht_agent_cfg.vif.mon_cb.rsp, + entropy_src_pkg::ENTROPY_SRC_XHT_RSP_DEFAULT) + end + end + endtask + // All the HT threshold registers are one-way: they can only become more strict unless // the DUT is reset. This function encapsulates this behavior. // From 2e7e815c59e96f8179c6373b5e66fca055f86b1d Mon Sep 17 00:00:00 2001 From: Andreas Kurth Date: Tue, 21 Mar 2023 20:43:54 +0000 Subject: [PATCH 3/4] [entropy_src/dv] Create separate test for RNG with XHT rsp This commit changes the default value of the knob that tells tests to always provide the default XHT response to 1 (true). The rationale is that this is the same behavior as in the current top-level design, so we want to make sure that all existing tests work in an environment in which `entropy_src` is always given the default XHT response. The only test affected by this is `entropy_src_rng`. In order to not completely remove any test that provides time-varying XHT responses, this commit creates a new test, `entropy_src_rng_with_xht_rsps`, in which the `xht_only_default_rsp` knob is set to zero. This test is equivalent to the `entropy_src_rng` test before this commit. Signed-off-by: Andreas Kurth --- hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson | 7 +++++++ hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv | 2 +- hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson b/hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson index 84f1c582c8c75..20e0616cfcb74 100644 --- a/hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson +++ b/hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson @@ -73,6 +73,13 @@ uvm_test_seq: entropy_src_rng_vseq } + { + name: entropy_src_rng_with_xht_rsps + uvm_test: entropy_src_rng_test + uvm_test_seq: entropy_src_rng_vseq + run_opts: ["+xht_only_default_rsp=0"] + } + { name: entropy_src_stress_all uvm_test: entropy_src_stress_all_test diff --git a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv index 3aee2054825e9..337fdd00513ed 100644 --- a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv +++ b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv @@ -113,7 +113,7 @@ class entropy_src_env_cfg extends cip_base_env_cfg #(.RAL_T(entropy_src_reg_bloc int alert_max_delay; // Whether to keep the default response on the XHT interface at all time. - bit xht_only_default_rsp = 0; + bit xht_only_default_rsp = 1; /////////////////////// // Randomized fields // diff --git a/hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv b/hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv index 9a163490a35b2..a0f47761f87ae 100644 --- a/hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv +++ b/hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv @@ -27,6 +27,13 @@ class entropy_src_base_test extends cip_base_test #( // Overrides should happen in the specific testcase. virtual function void configure_env(); + // Take plusargs into account. + bit xht_only_default_rsp; + if ($value$plusargs("xht_only_default_rsp=%0b", xht_only_default_rsp)) begin + `uvm_info(`gfn, $sformatf("+xht_only_default_rsp specified"), UVM_MEDIUM) + cfg.xht_only_default_rsp = xht_only_default_rsp; + end + // seed_cnt only used by smoke test // so there is no need to randomize it. cfg.seed_cnt = 1; From ec3e4b2cbed07cb4fca8aed240794ce71a6f11b3 Mon Sep 17 00:00:00 2001 From: Andreas Kurth Date: Wed, 22 Mar 2023 10:20:36 +0000 Subject: [PATCH 4/4] [entropy_src,dv] Add testpoint for external health tests Signed-off-by: Andreas Kurth --- hw/ip/entropy_src/data/entropy_src_testplan.hjson | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/ip/entropy_src/data/entropy_src_testplan.hjson b/hw/ip/entropy_src/data/entropy_src_testplan.hjson index e2f224f2437d4..bbd701d4d09d9 100644 --- a/hw/ip/entropy_src/data/entropy_src_testplan.hjson +++ b/hw/ip/entropy_src/data/entropy_src_testplan.hjson @@ -118,6 +118,15 @@ stage: V2 tests: ["entropy_src_functional_errors"] } + { + name: external_health_tests + desc: ''' + Verify the external health test (XHT) interface and functionality, including continuous + and windowed functionality and different high/low thresholds and watermarks. + ''' + stage: V3 + tests: ["entropy_src_rng_with_xht_rsps"], // TODO(#16276): Complete XHT verification + } ] covergroups: [ {