Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
uvm_test_seq: ac_range_check_smoke_racl_vseq
reseed: 20
}
{
name: ac_range_check_smoke_high_threshold
uvm_test_seq: ac_range_check_smoke_high_threshold_vseq
reseed: 20
}
{
name: ac_range_check_bypass
uvm_test_seq: ac_range_check_bypass_vseq
Expand All @@ -72,12 +77,16 @@
regressions: [
{
name: smoke
tests: ["ac_range_check_smoke", "ac_range_check_smoke_racl"]
tests: ["ac_range_check_smoke",
"ac_range_check_smoke_racl",
"ac_range_check_smoke_high_threshold"
]
}
{
name: normal
tests: ["ac_range_check_smoke",
"ac_range_check_smoke_racl",
"ac_range_check_smoke_high_threshold",
"ac_range_check_bypass",
"ac_range_check_lock_range"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ filesets:
- lowrisc:dv:cip_lib
- lowrisc:dv:dv_base_reg
- lowrisc:dv:dv_lib
- ${instance_vlnv(f"lowrisc:ip:{module_instance_name}:0.1")}
files:
- ac_range_check_env_pkg.sv
- ac_range_check_dut_cfg.sv: {is_include_file: true}
Expand All @@ -26,6 +27,7 @@ filesets:
- seq_lib/ac_range_check_common_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_smoke_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_smoke_racl_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_smoke_high_threshold_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_bypass_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_lock_range_vseq.sv: {is_include_file: true}
- seq_lib/ac_range_check_stress_all_vseq.sv: {is_include_file: true}
Expand Down
145 changes: 129 additions & 16 deletions hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_cov.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_env_cfg));

import ac_range_check_reg_pkg::*;
`uvm_component_utils(ac_range_check_env_cov)

// The base class provides the following handles for use:
Expand All @@ -18,11 +18,11 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
// Holds the type of TLUL transaction being processed by the predictor
ac_range_check_env_pkg::access_type_e access_type_cp;

int idx_cp; // Range Index for which coverage is sampled
bit read_cp; // Read permission from CSR Attr field 1 = enabled, 0 = disabled
bit write_cp; // Write permission from CSR Attr field 1 = enabled, 0 = disabled
bit execute_cp; // Execute permission from CSR Attr field 1 = enabled, 0 = disabled
int role_cp; // Holds RACL Role Identifier
int idx_cp; // Range Index for which coverage is sampled
bit read_cp; // Read permission from CSR Attr field 1 = enabled, 0 = disabled
bit write_cp; // Write permission from CSR Attr field 1 = enabled, 0 = disabled
bit execute_cp; // Execute permission from CSR Attr field 1 = enabled, 0 = disabled
int role_cp; // Holds RACL Role Identifier

bit access_permit_cp; // Access due to permissions 1 = Access permitted, 0 = Access denied
bit racl_cp; // Access due to RACL Check 1 = Access permitted, 0 = Access denied
Expand All @@ -35,6 +35,14 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
bit bypass_cp; // Bypass Mode 1 = enabled, 0 = disabled
bit lock_idx_cp; // Status of lock bit for an index 1 = locked, 0 = unlocked

bit log_enable_cp; // Log enable 1 = enabled, 0 = disabled
bit log_denied_cp; // Log denied access 1 = enabled, 0 = disabled
bit log_written_cp; // Have the log registers been written to? 1 = written, 0 = empty
bit log_denied_access_cp; // Log denied access for range field 1 = enabled, 0 = disabled
int deny_th_cp; // Deny threshold
bit cnt_reached_cp; // deny_cnt >= deny_cnt_threshold? 1 = greater or equal, 0 = lesser
bit intr_state_cp; // intr_state register 1 = greater or equal, 0 = lesser

// Primary covergroup that verifies the operation of AC_RANGE_CHECK module.
// There are 4 parts to the cross in this covergroup.
// - Index that had the address match
Expand All @@ -57,8 +65,6 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
coverpoint read_cp { bins disabled = {0}; bins enabled = {1}; }
coverpoint write_cp { bins disabled = {0}; bins enabled = {1}; }
coverpoint execute_cp { bins disabled = {0}; bins enabled = {1}; }


coverpoint access_permit_cp { bins deny = {0}; bins permit = {1}; }

idx_X_access_type_X_read_X_write_X_execute_X_access_permit:
Expand Down Expand Up @@ -167,7 +173,6 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
coverpoint bypass_cp { bins disabled = {0}; bins enabled = {1}; }
endgroup : bypass_cg


covergroup range_lock_cg;
coverpoint idx_cp
{
Expand All @@ -180,6 +185,82 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
idx_X_enable_X_lock : cross idx_cp, range_en_cp, lock_idx_cp;
endgroup : range_lock_cg

covergroup log_intr_cg;
coverpoint log_enable_cp { bins disabled = {0}; bins enabled = {1}; }
coverpoint log_written_cp { bins empty = {0}; bins written = {1}; }
coverpoint deny_th_cp
{
bins low_range[] = {[0 : 5]};
bins mid_range = {[6 : (1 << DenyCountWidth)-7]};
bins high_range[] = {[(1 << DenyCountWidth)-6 : (1 << DenyCountWidth)-1]};
}
coverpoint cnt_reached_cp { bins lesser = {0}; bins greater_or_equal = {1}; }
coverpoint intr_state_cp { bins lesser = {0}; bins greater_or_equal = {1}; }

log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state :
cross log_enable_cp, log_written_cp, deny_th_cp, cnt_reached_cp, intr_state_cp
{
// If logging is globally disabled, then all the fields should be empty
ignore_bins empty_when_log_enable_is_not_set =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (log_enable_cp == 0 && log_written_cp == 1);

// Interrupt should not be raised if deny_cnt < deny_cnt_threshold
ignore_bins interrupt_when_cnt_not_reached =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (intr_state_cp == 1 && cnt_reached_cp == 0);

// With log_enable = 1, the deny_cnt will never increase and we will
// never see cnt_reached_cp = 1
ignore_bins cnt_reached_for_log_disabled =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (log_enable_cp == 0 && cnt_reached_cp == 1 && deny_th_cp != 0);

// log_written should only happen with cnt_reached
ignore_bins no_log_written_when_cnt_reached =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (log_written_cp == 0 && cnt_reached_cp == 1 && deny_th_cp != 0);

// For the case deny_threshold = 0, there are only two valid scenarios
ignore_bins exclusive_deny_thr_0_scenario =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (deny_th_cp == 0 && (cnt_reached_cp == 0 || intr_state_cp != log_written_cp));

// For the case deny_threshold = 1, there is one illegal scenario
ignore_bins exclusive_deny_thr_1_scenario =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (deny_th_cp == 1 && log_written_cp == 1 && log_enable_cp == 1
&& cnt_reached_cp == 0 && intr_state_cp == 0);

// For the case of deny_threshold = 255, there is one illegal scenario
ignore_bins exclusive_deny_thr_255_scenario =
log_enable_X_log_written_X_deny_th_X_cnt_reached_X_intr_state
with (deny_th_cp == 255 && log_written_cp == 1 && log_enable_cp == 1
&& cnt_reached_cp == 1 && intr_state_cp == 1);
}
endgroup : log_intr_cg

covergroup log_denied_access_cg;
coverpoint idx_cp {
bins index[] = {[0:NUM_RANGES-1]};
}

coverpoint log_denied_access_cp { bins disabled = {0}; bins enabled = {1}; }

idx_X_log_denied_access : cross idx_cp, log_denied_access_cp;
endgroup : log_denied_access_cg

covergroup lock_logging_cg;
coverpoint idx_cp {
bins index[] = {[0:NUM_RANGES-1]};
}

coverpoint log_denied_access_cp { bins disabled = {0}; bins enabled = {1}; }
coverpoint lock_idx_cp { bins unlocked = {0}; bins enabled = {1}; }

idx_X_log_denied_X_lock : cross idx_cp, log_denied_access_cp, lock_idx_cp;
endgroup : lock_logging_cg

// Standard SV/UVM methods
extern function new(string name, uvm_component parent);
extern function void build_phase(uvm_phase phase);
Expand All @@ -197,18 +278,25 @@ class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_en
extern function void sample_all_index_miss_cg();
extern function void sample_bypass_cg(bit bypass_en);
extern function void sample_range_lock_cg(int idx, bit enable, bit lock);
extern function void sample_log_intr_cg(bit log_enable, bit log_written, int deny_th,
bit cnt_reached, bit intr_state);
extern function void sample_log_denied_access_cg(int idx, bit log_denied_access);
extern function void sample_lock_logging_cg(int idx, bit log_denied_access, bit lock);
endclass : ac_range_check_env_cov


function ac_range_check_env_cov::new(string name, uvm_component parent);
super.new(name, parent);
attr_perm_cg = new();
racl_cg = new();
range_cg = new();
addr_match_cg = new();
all_index_miss_cg = new();
bypass_cg = new();
range_lock_cg = new();
attr_perm_cg = new();
racl_cg = new();
range_cg = new();
addr_match_cg = new();
all_index_miss_cg = new();
bypass_cg = new();
range_lock_cg = new();
log_intr_cg = new();
log_denied_access_cg = new();
lock_logging_cg = new();
endfunction : new

function void ac_range_check_env_cov::build_phase(uvm_phase phase);
Expand Down Expand Up @@ -279,3 +367,28 @@ function void ac_range_check_env_cov::sample_range_lock_cg(int idx, bit enable,

range_lock_cg.sample();
endfunction : sample_range_lock_cg

function void ac_range_check_env_cov::sample_log_intr_cg(bit log_enable, bit log_written,
int deny_th, bit cnt_reached,
bit intr_state);
this.log_enable_cp = log_enable;
this.log_written_cp = log_written;
this.deny_th_cp = deny_th;
this.cnt_reached_cp = cnt_reached;
this.intr_state_cp = intr_state;
log_intr_cg.sample();
endfunction : sample_log_intr_cg

function void ac_range_check_env_cov::sample_log_denied_access_cg(int idx, bit log_denied_access);
this.idx_cp = idx;
this.log_denied_access_cp = log_denied_access;
log_denied_access_cg.sample();
endfunction : sample_log_denied_access_cg

function void ac_range_check_env_cov::sample_lock_logging_cg(int idx,
bit log_denied_access, bit lock);
this.idx_cp = idx;
this.log_denied_access_cp = log_denied_access;
this.lock_idx_cp = lock;
lock_logging_cg.sample();
endfunction : sample_lock_logging_cg
Loading
Loading