Skip to content

Commit ddbd8d3

Browse files
committed
[hw,clkmgr,rtl] Remove unneeded bypass interfaces
Signed-off-by: Robert Schilling <[email protected]>
1 parent b7804ce commit ddbd8d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+258
-1553
lines changed

hw/ip_templates/clkmgr/data/clkmgr.hjson.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
117117
{ name: "CLKMGR.MEAS_CTRL.RECOV_ERR",
118118
desc: "Frequency and timeout measurements can flag recoverable errors."
119119
}
120+
% if len(derived_clks) > 0:
120121
{ name: "CLKMGR.LC_EXTCLK.SPEED",
121122
desc: "Speed of LC controlled modification of external clock."
122123
}
@@ -129,6 +130,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
129130
{ name: "CLKMGR.SW_EXTCLK.LOW_SPEED",
130131
desc: "Software configuration of external clock running at 48 MHz."
131132
}
133+
% endif
132134
{ name: "CLKMGR.JITTER.REGWEN",
133135
desc: "Control modification of clock jitter enable."
134136
}
@@ -154,6 +156,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
154156
act: "req",
155157
package: "clkmgr_pkg",
156158
},
159+
% if len(derived_clks) > 0:
157160

158161
{ struct: "lc_tx",
159162
type: "uni",
@@ -217,6 +220,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
217220
act: "req",
218221
package: "lc_ctrl_pkg",
219222
},
223+
% endif
220224

221225
{ struct: "mubi4",
222226
type: "uni",
@@ -275,6 +279,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
275279
{ name: "IDLE.INTERSIG.MUBI",
276280
desc: "Idle inputs are multibit encoded."
277281
}
282+
% if len(derived_clks) > 0:
278283
{ name: "LC_CTRL.INTERSIG.MUBI",
279284
desc: "The life cycle control signals are multibit encoded."
280285
}
@@ -287,6 +292,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
287292
{ name: "DIV.INTERSIG.MUBI",
288293
desc: "Divider step down request is multibit encoded."
289294
}
295+
% endif
290296
{ name: "JITTER.CONFIG.MUBI",
291297
desc: "The jitter enable configuration is multibit encoded."
292298
}
@@ -303,6 +309,7 @@ rg_srcs = get_rg_srcs(typed_clocks)
303309
]
304310

305311
registers: [
312+
% if len(derived_clks) > 0:
306313
{ name: "EXTCLK_CTRL_REGWEN",
307314
desc: "External clock control write enable",
308315
swaccess: "rw0c",
@@ -398,6 +405,10 @@ rg_srcs = get_rg_srcs(typed_clocks)
398405
},
399406
]
400407
},
408+
% else:
409+
// Skip 3 registers for SW compatibility on the register layout if no derived clocks are in use
410+
{ reserved: "3" }
411+
% endif
401412

402413
{ name: "JITTER_REGWEN",
403414
desc: "Jitter write enable",

hw/ip_templates/clkmgr/data/clkmgr_sec_cm_testplan.hjson renamed to hw/ip_templates/clkmgr/data/clkmgr_sec_cm_testplan.hjson.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
stage: V2S
9191
tests: ["clkmgr_idle_intersig_mubi"]
9292
}
93+
% if len(derived_clks) > 0:
9394
{
9495
name: sec_cm_lc_ctrl_intersig_mubi
9596
desc: '''Verify the countermeasure(s) LC_CTRL.INTERSIG.MUBI.
@@ -147,6 +148,7 @@
147148
stage: V2S
148149
tests: ["clkmgr_div_intersig_mubi"]
149150
}
151+
% endif
150152
{
151153
name: sec_cm_jitter_config_mubi
152154
desc: '''Verify the countermeasure(s) JITTER.CONFIG.MUBI.

hw/ip_templates/clkmgr/data/clkmgr_testplan.hjson renamed to hw/ip_templates/clkmgr/data/clkmgr_testplan.hjson.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
stage: V2
9393
tests: ["clkmgr_trans"]
9494
}
95+
% if len(derived_clks) > 0:
9596
{
9697
name: extclk
9798
desc: '''
@@ -144,6 +145,7 @@
144145
stage: V2
145146
tests: ["clkmgr_extclk"]
146147
}
148+
% endif
147149
{
148150
name: clk_status
149151
desc: '''
@@ -270,7 +272,9 @@
270272
desc: '''This runs random sequences in succession.
271273
272274
Randomly chooses from the following sequences:
275+
% if len(derived_clks) > 0:
273276
- clkmgr_extclk_vseq,
277+
% endif
274278
- clkmgr_frequency_timeout_vseq,
275279
- clkmgr_frequency_vseq,
276280
- clkmgr_peri_vseq,
@@ -310,6 +314,7 @@
310314
but the dvsim coverage flow doesn't yet support arrays.
311315
'''
312316
}
317+
% if len(derived_clks) > 0:
313318
{
314319
name: extclk_cg
315320
desc: '''
@@ -321,6 +326,7 @@
321326
collects their cross.
322327
'''
323328
}
329+
% endif
324330
{
325331
name: freq_measure_cg
326332
desc: '''

hw/ip_templates/clkmgr/doc/theory_of_operation.md.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ There are two occasions where this is required:
204204
- Life cycle transition from `RAW` / `TEST_LOCKED*` to `TEST_UNLOCKED*` [states](../../../../ip/lc_ctrl/README.md#clk_byp_req).
205205
- Software request for external clocks during normal functional mode.
206206

207-
207+
% if len(derived_clks) > 0:
208208
<%text>#### Life Cycle Requested External Clock</%text>
209209

210210
The life cycle controller only requests the io clock input to be switched.
@@ -264,6 +264,7 @@ This table also assumes that high speed external clock is 96MHz, while low speed
264264

265265
As can be seen from the table, the external clock switch scheme prioritizes the stability of the divided clocks, while allowing the undivided clocks to slow down.
266266

267+
% endif
267268

268269
<%text>### Clock Frequency / Time-out Measurements</%text>
269270

hw/ip_templates/clkmgr/dv/README.md.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ They depend on the `clk_hints` CSR, which has a separate bit for each, `main_ip_
108108
They also depend on the `idle_i` input, which also has a separate multi-bit value for each unit.
109109
Units are considered busy when their corresponding `idle_i` value is not `mubi_pkg::MuBi4True`, and this prevents its clock turning off until it becomes idle.
110110

111+
% if len(derived_clks) > 0:
111112
${"####"} clkmgr_extclk_vseq
112113

113114
The sequence `clkmgr_extclk_vseq` randomizes the stimuli that drive the external clock selection.
@@ -117,6 +118,7 @@ When the external clock is selected and `scanmode_i` is not set to `prim_mubi_pk
117118
* If `lc_ctrl_byp_req_i` is on, or
118119
* If `extclk_ctrl.hi_speed_sel` CSR is `prim_mubi_pkg::MuBi4True`, when the selection is enabled by software.
119120

121+
% endif
120122
${"####"} clkmgr_frequency_vseq
121123

122124
The sequence `clkmgr_frequency_vseq` randomly programs the frequency measurement for each clock so its measurement is either okay, slow, or fast.
@@ -145,7 +147,9 @@ The following covergroups have been developed to prove that the test intent has
145147
These are wrapped in class `clkmgr_trans_cg_wrap` and instantiated in `clkmgr_env_cov`.
146148
* Covergroups for the outcome of each clock measurement.
147149
These are wrapped in class `freq_measure_cg_wrap` and instantiated in `clkmgr_env_cov`.
150+
% if len(derived_clks) > 0:
148151
* Covergroup for the external clock selection logic: `extclk_cg` in `clkmgr_env_cov`.
152+
% endif
149153

150154
See more detailed description at `hw/top_${topname}/ip_autogen/clkmgr/data/clkmgr_testplan.hjson`.
151155

hw/ip_templates/clkmgr/dv/clkmgr_sim_cfg.hjson.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070
name: clkmgr_smoke
7171
uvm_test_seq: clkmgr_smoke_vseq
7272
}
73+
% if len(derived_clks) > 0:
7374
{
7475
name: clkmgr_extclk
7576
uvm_test_seq: clkmgr_extclk_vseq
7677
}
78+
% endif
7779
{
7880
name: clkmgr_frequency
7981
uvm_test_seq: clkmgr_frequency_vseq
@@ -99,6 +101,7 @@
99101
uvm_test_seq: clkmgr_trans_vseq
100102
run_opts: ["+clkmgr_mubi_mode=ClkmgrMubiIdle"]
101103
}
104+
% if len(derived_clks) > 0:
102105
{
103106
name: clkmgr_lc_ctrl_intersig_mubi
104107
uvm_test_seq: clkmgr_extclk_vseq
@@ -119,6 +122,7 @@
119122
uvm_test_seq: clkmgr_extclk_vseq
120123
run_opts: ["+clkmgr_mubi_mode=ClkmgrMubiDiv"]
121124
}
125+
% endif
122126
{
123127
name: clkmgr_regwen
124128
uvm_test_seq: clkmgr_regwen_vseq

hw/ip_templates/clkmgr/dv/cov/clkmgr_cov_bind.sv.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module clkmgr_cov_bind;
1212
);
1313
% endfor
1414

15+
% if len(derived_clks) > 0:
1516
bind clkmgr cip_lc_tx_cov_if u_lc_hw_debug_en_mubi_cov_if (
1617
.rst_ni (rst_ni),
1718
.val (lc_hw_debug_en_i)
@@ -37,4 +38,5 @@ module clkmgr_cov_bind;
3738
.mubi (div_step_down_req_i)
3839
);
3940

41+
% endif
4042
endmodule // clkmgr_cov_bind

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class clkmgr_env_cov extends cip_base_env_cov #(
114114
// These covergroups collect outcomes of clock frequency measurements.
115115
freq_measure_cg_wrap freq_measure_cg_wrap[${len(rg_srcs)}];
116116

117+
% if len(derived_clks) > 0:
117118
// This embeded covergroup collects coverage for the external clock functionality.
118119
covergroup extclk_cg with function sample (
119120
bit csr_sel, bit csr_low_speed, bit hw_debug_en, bit byp_req, bit scanmode
@@ -127,6 +128,7 @@ class clkmgr_env_cov extends cip_base_env_cov #(
127128
extclk_cross: cross csr_sel_cp, csr_low_speed_cp, hw_debug_en_cp, byp_req_cp, scanmode_cp;
128129
endgroup
129130

131+
% endif
130132
// This collects coverage for recoverable errors.
131133
covergroup recov_err_cg with function sample (
132134
% for src in reversed(rg_srcs):
@@ -171,7 +173,9 @@ class clkmgr_env_cov extends cip_base_env_cov #(
171173
clk_mesr_e clk_mesr = clk_mesr_e'(i);
172174
freq_measure_cg_wrap[i] = new(clk_mesr.name);
173175
end
176+
% if len(derived_clks) > 0:
174177
extclk_cg = new();
178+
% endif
175179
recov_err_cg = new();
176180
fatal_err_cg = new();
177181
endfunction : new

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface clkmgr_if (
3838
// scanmode_i == MuBi4True defeats all clock gating.
3939
prim_mubi_pkg::mubi4_t scanmode_i;
4040

41+
% if len(derived_clks) > 0:
4142
// Life cycle enables clock bypass functionality.
4243
lc_ctrl_pkg::lc_tx_t lc_hw_debug_en_i;
4344

@@ -53,11 +54,14 @@ interface clkmgr_if (
5354

5455
prim_mubi_pkg::mubi4_t div_step_down_req;
5556

57+
% endif
5658
prim_mubi_pkg::mubi4_t jitter_en_o;
5759
clkmgr_pkg::clkmgr_out_t clocks_o;
5860

5961
prim_mubi_pkg::mubi4_t calib_rdy;
62+
% if len(derived_clks) > 0:
6063
prim_mubi_pkg::mubi4_t hi_speed_sel;
64+
% endif
6165

6266
// Internal DUT signals.
6367
// ICEBOX(lowrisc/opentitan#18379): This is a core env component (i.e. reusable entity) that
@@ -94,6 +98,7 @@ interface clkmgr_if (
9498
${target}: `CLKMGR_HIER.u_reg.clk_hints_status_clk_main_${target}_val_qs${sep}
9599
% endfor
96100
};
101+
% if len(derived_clks) > 0:
97102

98103
prim_mubi_pkg::mubi4_t extclk_ctrl_csr_sel;
99104
always_comb begin
@@ -106,6 +111,7 @@ interface clkmgr_if (
106111
`CLKMGR_HIER.reg2hw.extclk_ctrl.hi_speed_sel.q);
107112
end
108113

114+
% endif
109115
prim_mubi_pkg::mubi4_t jitter_enable_csr;
110116
always_comb begin
111117
jitter_enable_csr = prim_mubi_pkg::mubi4_t'(`CLKMGR_HIER.reg2hw.jitter_enable.q);
@@ -147,6 +153,7 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
147153
scanmode_i = value;
148154
endfunction
149155

156+
% if len(derived_clks) > 0:
150157
function automatic void update_lc_debug_en(lc_ctrl_pkg::lc_tx_t value);
151158
lc_hw_debug_en_i = value;
152159
endfunction
@@ -181,17 +188,24 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
181188
endcase
182189
endfunction
183190

191+
% endif
184192
task automatic init(mubi_hintables_t idle, prim_mubi_pkg::mubi4_t scanmode,
193+
% if len(derived_clks) > 0:
185194
lc_ctrl_pkg::lc_tx_t lc_debug_en = lc_ctrl_pkg::Off,
186195
lc_ctrl_pkg::lc_tx_t lc_clk_byp_req = lc_ctrl_pkg::Off,
196+
% endif
187197
prim_mubi_pkg::mubi4_t calib_rdy = prim_mubi_pkg::MuBi4True);
188198
`uvm_info("clkmgr_if", "In clkmgr_if init", UVM_MEDIUM)
189199
update_calib_rdy(calib_rdy);
190200
update_idle(idle);
201+
% if len(derived_clks) > 0:
191202
update_lc_clk_byp_req(lc_clk_byp_req);
192203
update_lc_debug_en(lc_debug_en);
204+
% endif
193205
update_scanmode(scanmode);
206+
% if len(derived_clks) > 0:
194207
update_all_clk_byp_ack(prim_mubi_pkg::MuBi4False);
208+
% endif
195209
endtask
196210

197211
// Pipeline signals that go through synchronizers with the target clock domain's clock.
@@ -248,6 +262,7 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
248262
input idle_i;
249263
endclocking
250264

265+
% if len(derived_clks) > 0:
251266
// Pipelining and clocking block for external clock bypass. The divisor control is
252267
// triggered by an ast ack, which goes through synchronizers.
253268
logic step_down_ff;
@@ -259,14 +274,17 @@ ${spc}fast: `CLKMGR_HIER.u_${src}_meas.u_meas.fast_o};
259274
end
260275
end
261276

277+
% endif
262278
clocking clk_cb @(posedge clk);
263279
input calib_rdy;
280+
% if len(derived_clks) > 0:
264281
input extclk_ctrl_csr_sel;
265282
input extclk_ctrl_csr_step_down;
266283
input lc_hw_debug_en_i;
267284
input io_clk_byp_req;
268285
input lc_clk_byp_req;
269286
input step_down = step_down_ff;
287+
% endif
270288
input jitter_enable_csr;
271289
endclocking
272290

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class clkmgr_scoreboard extends cip_base_scoreboard #(
1818
`uvm_component_utils(clkmgr_scoreboard)
1919

2020
// local variables
21+
% if len(derived_clks) > 0:
2122
logic extclk_ctrl_regwen;
23+
% endif
2224
logic measure_ctrl_regwen;
2325

2426
// TLM agent fifos
@@ -39,8 +41,10 @@ class clkmgr_scoreboard extends cip_base_scoreboard #(
3941
task run_phase(uvm_phase phase);
4042
super.run_phase(phase);
4143
fork
44+
% if len(derived_clks) > 0:
4245
monitor_all_clk_byp();
4346
monitor_io_clk_byp();
47+
% endif
4448
monitor_jitter_en();
4549
sample_peri_covs();
4650
sample_trans_covs();
@@ -50,6 +54,7 @@ class clkmgr_scoreboard extends cip_base_scoreboard #(
5054
join_none
5155
endtask
5256

57+
% if len(derived_clks) > 0:
5358
task monitor_all_clk_byp();
5459
mubi4_t prev_all_clk_byp_req = MuBi4False;
5560
forever
@@ -95,6 +100,7 @@ class clkmgr_scoreboard extends cip_base_scoreboard #(
95100
end
96101
endtask
97102

103+
% endif
98104
task monitor_jitter_en();
99105
fork
100106
forever
@@ -268,6 +274,7 @@ ${spc}cfg.clkmgr_vif.scanmode_i == MuBi4True);
268274
"alert_test": begin
269275
// FIXME
270276
end
277+
% if len(derived_clks) > 0:
271278
"extclk_ctrl_regwen": begin
272279
if (addr_phase_write) extclk_ctrl_regwen = item.a_data;
273280
end
@@ -282,6 +289,7 @@ ${spc}cfg.clkmgr_vif.scanmode_i == MuBi4True);
282289
"extclk_status": begin
283290
do_read_check = 1'b0;
284291
end
292+
% endif
285293
"jitter_regwen": begin
286294
end
287295
"jitter_enable": begin
@@ -341,7 +349,9 @@ ${spc}cfg.clkmgr_vif.scanmode_i == MuBi4True);
341349
virtual function void reset(string kind = "HARD");
342350
super.reset(kind);
343351
// reset local fifos queues and variables
352+
% if len(derived_clks) > 0:
344353
extclk_ctrl_regwen = ral.extclk_ctrl_regwen.get_reset();
354+
% endif
345355
measure_ctrl_regwen = ral.measure_ctrl_regwen.get_reset();
346356
endfunction
347357

0 commit comments

Comments
 (0)