Skip to content

Commit f032ebb

Browse files
committed
[clkmgr,dv] Gate more extclk test logic
Signed-off-by: Robert Schilling <[email protected]>
1 parent 53a706e commit f032ebb

File tree

12 files changed

+40
-22
lines changed

12 files changed

+40
-22
lines changed

hw/ip_templates/clkmgr/dv/env/clkmgr_env.core.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ filesets:
2424
- seq_lib/clkmgr_base_vseq.sv: {is_include_file: true}
2525
- seq_lib/clkmgr_clk_status_vseq.sv: {is_include_file: true}
2626
- seq_lib/clkmgr_common_vseq.sv: {is_include_file: true}
27+
% if len(derived_clks) > 0:
2728
- seq_lib/clkmgr_extclk_vseq.sv: {is_include_file: true}
29+
% endif
2830
- seq_lib/clkmgr_frequency_timeout_vseq.sv: {is_include_file: true}
2931
- seq_lib/clkmgr_frequency_vseq.sv: {is_include_file: true}
3032
- seq_lib/clkmgr_peri_vseq.sv: {is_include_file: true}

hw/ip_templates/clkmgr/dv/env/clkmgr_if.sv.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ interface clkmgr_if (
7777
clk_enables_csr = '{
7878
% for clk in [c for c in reversed(typed_clocks['sw_clks'].values())]:
7979
<% sep = "" if loop.last else "," %>\
80+
% if len(typed_clocks['sw_clks']) == 1:
81+
${clk['src_name']}_peri_en: `CLKMGR_HIER.reg2hw.clk_enables.q${sep}
82+
% else:
8083
${clk['src_name']}_peri_en: `CLKMGR_HIER.reg2hw.clk_enables.clk_${clk['src_name']}_peri_en.q${sep}
84+
% endif
8185
% endfor
8286
};
8387

@@ -178,6 +182,7 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
178182
io_clk_byp_ack = value;
179183
endfunction
180184

185+
% endif
181186
function automatic void force_high_starting_count(clk_mesr_e clk);
182187
`uvm_info("clkmgr_if", $sformatf("Forcing count of %0s to all 1.", clk.name()), UVM_MEDIUM)
183188
case (clk)
@@ -188,7 +193,6 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
188193
endcase
189194
endfunction
190195

191-
% endif
192196
task automatic init(mubi_hintables_t idle, prim_mubi_pkg::mubi4_t scanmode,
193197
% if len(derived_clks) > 0:
194198
lc_ctrl_pkg::lc_tx_t lc_debug_en = lc_ctrl_pkg::Off,

hw/ip_templates/clkmgr/dv/env/seq_lib/clkmgr_base_vseq.sv.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ class clkmgr_base_vseq extends cip_base_vseq #(
8585
`uvm_info(`gfn, "In clkmgr_if initialize_on_start", UVM_MEDIUM)
8686
idle = {NUM_TRANS{MuBi4True}};
8787
scanmode = MuBi4False;
88+
% if len(derived_clks) > 0:
8889
cfg.clkmgr_vif.init(.idle(idle), .scanmode(scanmode), .lc_debug_en(Off));
90+
% else:
91+
cfg.clkmgr_vif.init(.idle(idle), .scanmode(scanmode));
92+
% endif
8993
% for clk_name in non_aon_src_names:
9094
${clk_name}_ip_clk_en = 1'b1;
9195
% endfor
@@ -120,7 +124,11 @@ ${spc}ral.${src}_meas_ctrl_shadowed.lo};
120124
mubi_mode = ClkmgrMubiNone;
121125
`DV_GET_ENUM_PLUSARG(clkmgr_mubi_e, mubi_mode, clkmgr_mubi_mode)
122126
`uvm_info(`gfn, $sformatf("mubi_mode = %s", mubi_mode.name), UVM_MEDIUM)
127+
% if len(derived_clks) > 0:
123128
cfg.clkmgr_vif.init(.idle({NUM_TRANS{MuBi4True}}), .scanmode(scanmode), .lc_debug_en(Off));
129+
% else:
130+
cfg.clkmgr_vif.init(.idle({NUM_TRANS{MuBi4True}}), .scanmode(scanmode));
131+
% endif
124132
% for src in sorted(src_clks.values(), key=lambda v: v['name']):
125133
% if not src['aon']:
126134
cfg.clkmgr_vif.update_${src['name']}_ip_clk_en(1'b1);

hw/ip_templates/clkmgr/dv/env/seq_lib/clkmgr_regwen_vseq.sv renamed to hw/ip_templates/clkmgr/dv/env/seq_lib/clkmgr_regwen_vseq.sv.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class clkmgr_regwen_vseq extends clkmgr_base_vseq;
2424
`uvm_info(`gfn, "Check jitter_regwen done", UVM_MEDIUM)
2525
endtask : check_jitter_regwen
2626

27+
% if len(derived_clks) > 0:
2728
task check_extclk_regwen();
2829
bit enable;
2930
int prev_value;
@@ -37,6 +38,7 @@ class clkmgr_regwen_vseq extends clkmgr_base_vseq;
3738
`uvm_info(`gfn, "Check extclk_ctrl regwen done", UVM_MEDIUM)
3839
endtask : check_extclk_regwen
3940

41+
% endif
4042
// This must be careful to turn measurements off right after checking the updates
4143
// to avoid measurement errors. We could set the thresholds correctly, but we
4244
// might as well set them randomly for good measure. Carefully masks only the
@@ -86,14 +88,18 @@ class clkmgr_regwen_vseq extends clkmgr_base_vseq;
8688
`uvm_info(`gfn, $sformatf("Will run %0d rounds", num_trans), UVM_MEDIUM)
8789
for (int i = 0; i < num_trans; ++i) begin
8890
check_jitter_regwen();
91+
% if len(derived_clks) > 0:
8992
check_extclk_regwen();
93+
% endif
9094
check_meas_ctrl_regwen();
9195
apply_reset("HARD");
9296
// This is to make sure we don't start writes immediately after reset,
9397
// otherwise the tl_agent could mistakenly consider the following read
9498
// happens during reset.
9599
cfg.clk_rst_vif.wait_clks(4);
100+
% if len(derived_clks) > 0:
96101
csr_rd_check(.ptr(ral.extclk_ctrl_regwen), .compare_value(1));
102+
% endif
97103
csr_rd_check(.ptr(ral.measure_ctrl_regwen), .compare_value(1));
98104
end
99105
endtask : body

hw/ip_templates/clkmgr/dv/env/seq_lib/clkmgr_vseq_list.sv renamed to hw/ip_templates/clkmgr/dv/env/seq_lib/clkmgr_vseq_list.sv.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
`include "clkmgr_common_vseq.sv"
88
`include "clkmgr_frequency_timeout_vseq.sv"
99
`include "clkmgr_frequency_vseq.sv"
10+
% if len(derived_clks) > 0:
1011
`include "clkmgr_extclk_vseq.sv"
12+
% endif
1113
`include "clkmgr_peri_vseq.sv"
1214
`include "clkmgr_regwen_vseq.sv"
1315
`include "clkmgr_smoke_vseq.sv"

hw/ip_templates/clkmgr/dv/tb.sv.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ module tb;
8383
.clk_enables({
8484
% for clk in [c for c in reversed(typed_clocks['sw_clks'].values())]:
8585
<% sep = "})," if loop.last else "," %>\
86+
% if len(typed_clocks['sw_clks']) == 1:
87+
reg2hw.clk_enables.q${sep}
88+
% else:
8689
reg2hw.clk_enables.clk_${clk['src_name']}_peri_en.q${sep}
90+
% endif
8791
% endfor
8892
.clk_hints({
8993
reg2hw.clk_hints.clk_main_otbn_hint.q,

hw/top_darjeeling/ip_autogen/clkmgr/dv/env/clkmgr_env.core

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ filesets:
2424
- seq_lib/clkmgr_base_vseq.sv: {is_include_file: true}
2525
- seq_lib/clkmgr_clk_status_vseq.sv: {is_include_file: true}
2626
- seq_lib/clkmgr_common_vseq.sv: {is_include_file: true}
27-
- seq_lib/clkmgr_extclk_vseq.sv: {is_include_file: true}
2827
- seq_lib/clkmgr_frequency_timeout_vseq.sv: {is_include_file: true}
2928
- seq_lib/clkmgr_frequency_vseq.sv: {is_include_file: true}
3029
- seq_lib/clkmgr_peri_vseq.sv: {is_include_file: true}

hw/top_darjeeling/ip_autogen/clkmgr/dv/env/clkmgr_if.sv

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface clkmgr_if (
4848
clk_enables_t clk_enables_csr;
4949
always_comb
5050
clk_enables_csr = '{
51-
io_peri_en: `CLKMGR_HIER.reg2hw.clk_enables.clk_io_peri_en.q
51+
io_peri_en: `CLKMGR_HIER.reg2hw.clk_enables.q
5252
};
5353

5454
clk_hints_t clk_hints_csr;
@@ -119,6 +119,15 @@ interface clkmgr_if (
119119
scanmode_i = value;
120120
endfunction
121121

122+
function automatic void force_high_starting_count(clk_mesr_e clk);
123+
`uvm_info("clkmgr_if", $sformatf("Forcing count of %0s to all 1.", clk.name()), UVM_MEDIUM)
124+
case (clk)
125+
ClkMesrIo: `CLKMGR_HIER.u_io_meas.u_meas.cnt = '1;
126+
ClkMesrMain: `CLKMGR_HIER.u_main_meas.u_meas.cnt = '1;
127+
default: ;
128+
endcase
129+
endfunction
130+
122131
task automatic init(mubi_hintables_t idle, prim_mubi_pkg::mubi4_t scanmode,
123132
prim_mubi_pkg::mubi4_t calib_rdy = prim_mubi_pkg::MuBi4True);
124133
`uvm_info("clkmgr_if", "In clkmgr_if init", UVM_MEDIUM)

hw/top_darjeeling/ip_autogen/clkmgr/dv/env/seq_lib/clkmgr_base_vseq.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class clkmgr_base_vseq extends cip_base_vseq #(
7373
`uvm_info(`gfn, "In clkmgr_if initialize_on_start", UVM_MEDIUM)
7474
idle = {NUM_TRANS{MuBi4True}};
7575
scanmode = MuBi4False;
76-
cfg.clkmgr_vif.init(.idle(idle), .scanmode(scanmode), .lc_debug_en(Off));
76+
cfg.clkmgr_vif.init(.idle(idle), .scanmode(scanmode));
7777
io_ip_clk_en = 1'b1;
7878
main_ip_clk_en = 1'b1;
7979
start_ip_clocks();
@@ -103,7 +103,7 @@ class clkmgr_base_vseq extends cip_base_vseq #(
103103
mubi_mode = ClkmgrMubiNone;
104104
`DV_GET_ENUM_PLUSARG(clkmgr_mubi_e, mubi_mode, clkmgr_mubi_mode)
105105
`uvm_info(`gfn, $sformatf("mubi_mode = %s", mubi_mode.name), UVM_MEDIUM)
106-
cfg.clkmgr_vif.init(.idle({NUM_TRANS{MuBi4True}}), .scanmode(scanmode), .lc_debug_en(Off));
106+
cfg.clkmgr_vif.init(.idle({NUM_TRANS{MuBi4True}}), .scanmode(scanmode));
107107
cfg.clkmgr_vif.update_io_ip_clk_en(1'b1);
108108
cfg.clkmgr_vif.update_main_ip_clk_en(1'b1);
109109

hw/top_darjeeling/ip_autogen/clkmgr/dv/env/seq_lib/clkmgr_regwen_vseq.sv

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ class clkmgr_regwen_vseq extends clkmgr_base_vseq;
2424
`uvm_info(`gfn, "Check jitter_regwen done", UVM_MEDIUM)
2525
endtask : check_jitter_regwen
2626

27-
task check_extclk_regwen();
28-
bit enable;
29-
int prev_value;
30-
int new_value = {extclk_ctrl_high_speed_sel, extclk_ctrl_sel};
31-
`DV_CHECK_STD_RANDOMIZE_FATAL(enable)
32-
`uvm_info(`gfn, $sformatf("Check extclk_ctrl regwen = %b", enable), UVM_MEDIUM)
33-
csr_wr(.ptr(ral.extclk_ctrl_regwen), .value(enable));
34-
csr_rd(.ptr(ral.extclk_ctrl), .value(prev_value));
35-
csr_wr(.ptr(ral.extclk_ctrl), .value(new_value));
36-
csr_rd_check(.ptr(ral.extclk_ctrl), .compare_value(enable ? new_value : prev_value));
37-
`uvm_info(`gfn, "Check extclk_ctrl regwen done", UVM_MEDIUM)
38-
endtask : check_extclk_regwen
39-
4027
// This must be careful to turn measurements off right after checking the updates
4128
// to avoid measurement errors. We could set the thresholds correctly, but we
4229
// might as well set them randomly for good measure. Carefully masks only the
@@ -86,14 +73,12 @@ class clkmgr_regwen_vseq extends clkmgr_base_vseq;
8673
`uvm_info(`gfn, $sformatf("Will run %0d rounds", num_trans), UVM_MEDIUM)
8774
for (int i = 0; i < num_trans; ++i) begin
8875
check_jitter_regwen();
89-
check_extclk_regwen();
9076
check_meas_ctrl_regwen();
9177
apply_reset("HARD");
9278
// This is to make sure we don't start writes immediately after reset,
9379
// otherwise the tl_agent could mistakenly consider the following read
9480
// happens during reset.
9581
cfg.clk_rst_vif.wait_clks(4);
96-
csr_rd_check(.ptr(ral.extclk_ctrl_regwen), .compare_value(1));
9782
csr_rd_check(.ptr(ral.measure_ctrl_regwen), .compare_value(1));
9883
end
9984
endtask : body

0 commit comments

Comments
 (0)