From ee48f3585ef0f35867cdd37e31837f7811bcbf3e Mon Sep 17 00:00:00 2001 From: Pirmin Vogel Date: Fri, 28 Jun 2024 10:54:37 +0200 Subject: [PATCH 1/2] [csrng/dv] Extend coverage definition for glen This resolves lowRISC/OpenTitan#18350. Signed-off-by: Pirmin Vogel --- hw/dv/sv/csrng_agent/csrng_item.sv | 2 +- hw/ip/csrng/dv/cov/csrng_cov_if.sv | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/dv/sv/csrng_agent/csrng_item.sv b/hw/dv/sv/csrng_agent/csrng_item.sv index 488fb2694e7d9..02f3bdedd3d53 100644 --- a/hw/dv/sv/csrng_agent/csrng_item.sv +++ b/hw/dv/sv/csrng_agent/csrng_item.sv @@ -33,7 +33,7 @@ class csrng_item extends uvm_sequence_item; constraint c_glen { glen dist { - // TODO(#18350): Add a bin for 0 (with 5% chance, like for 4095?). + // Note that 0 isn't supported by the implementation, see #23846. [1:32] :/ 75, [33:128] :/ 10, [129:1024] :/ 5, diff --git a/hw/ip/csrng/dv/cov/csrng_cov_if.sv b/hw/ip/csrng/dv/cov/csrng_cov_if.sv index 9cb74d87748e0..6e0c2552938b7 100644 --- a/hw/ip/csrng/dv/cov/csrng_cov_if.sv +++ b/hw/ip/csrng/dv/cov/csrng_cov_if.sv @@ -326,9 +326,12 @@ interface csrng_cov_if ( } cp_glen: coverpoint glen { - bins one = { 1 }; - bins multiple = { [2:$] }; - ignore_bins zero = { 0 }; + bins one = { 1 }; + bins sml = { [2:32] }; + bins med = { [33:128] }; + bins lrg = { [129:1024] }; + bins xtr = { [1025:4094] }; + bins max = { 4095 }; } // Coverpoint for all of the possible transitions of flag0 that can cause a From cedcca7d8945b0960cfea6d1efa4f3524f0775f3 Mon Sep 17 00:00:00 2001 From: Pirmin Vogel Date: Fri, 28 Jun 2024 15:53:43 +0200 Subject: [PATCH 2/2] [csrng/doc] Correct reference to NIST spec term The NIST SP 800-90A spec uses the term `max_number_of_bits_per_request` whereas our spec was using `max_number_of_bit_per_request`. It's better to align terminology to simplify browsing the specs and comparing them. Signed-off-by: Pirmin Vogel --- hw/ip/csrng/doc/theory_of_operation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ip/csrng/doc/theory_of_operation.md b/hw/ip/csrng/doc/theory_of_operation.md index 5abadc8540e68..89b774f9f39d4 100644 --- a/hw/ip/csrng/doc/theory_of_operation.md +++ b/hw/ip/csrng/doc/theory_of_operation.md @@ -183,7 +183,7 @@ Below is a description of the fields of this header: Each unit represents 128 bits of entropy returned. This field allows values between 1 and 4095. A value of 1 returns 1 * 128 bits of entropy. - A value of 4095 returns 4095 * 128 bits of entropy, which is less than the 219 bits allowed by NIST (referenced to as max_number_of_bit_per_request). + A value of 4095 returns 4095 * 128 bits of entropy, which is less than the 219 bits allowed by NIST (referenced to as max_number_of_bits_per_request).