-
Notifications
You must be signed in to change notification settings - Fork 777
/
pwrmgr_testplan.hjson
369 lines (330 loc) · 13.6 KB
/
pwrmgr_testplan.hjson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
name: "pwrmgr"
import_testplans: ["hw/dv/tools/dvsim/testplans/csr_testplan.hjson",
"hw/dv/tools/dvsim/testplans/intr_test_testplan.hjson",
"hw/dv/tools/dvsim/testplans/tl_device_access_types_testplan.hjson",
"hw/dv/tools/dvsim/testplans/stress_all_with_reset_testplan.hjson",
"hw/dv/tools/dvsim/testplans/sec_cm_count_testplan.hjson",
"hw/dv/tools/dvsim/testplans/sec_cm_fsm_testplan.hjson",
"pwrmgr_sec_cm_testplan.hjson"]
testpoints: [
{
name: smoke
desc: '''
Smoke test exercising the pwrmgr state transitions.
- Brings pwrmgr out of POR.
- Enables wakeup.
- Triggers SW initiated low power transition with reset settings
in `control` CSR.
- Triggers wakeup.
- Enables and triggers a reset.
- Waits for pwrmgr to be out of reset.
**Stimulus**:
- CSR writes to `wakeup_en`, `reset_en`, and `low_power_hint`.
- Needs many input pins to line up correctly in order to prevent the
pwrmgr from waiting forever. Most of these are set in response
to outputs, and are checked by SVA.
**Checks**:
- The fast fsm becomes active when `fetch_en_o` output rises.
- The wakeup and reset causes are as expected reading CSRs
`wake_status` and `reset_status`.
- The output `pwr_rst_req.reset_cause` matches a low power or
reset cause.
- The output `pwr_rst_req.rstreqs` matches the enabled resets.
'''
stage: V1
tests: ["pwrmgr_smoke"]
}
{
name: wakeup
desc: '''
Test random wakeup, wakeup_en, wake_info_capture_dis, and
interrupt.
The different wakeup inputs can be disabled via bits in the
`wakeup_en` CSR. Update of `wakeup_info` can be disabled
via the `wake_info_capture_dis` CSR. Any wakeup causes an
interrupt unless interrupts are disabled.
**Stimulus**:
- Sets `wakeup_en` randomly but don't set it to zero, or the
test will timeout.
- Set `wake_info_capture_dis` randomly on and off.
- Bring pwrmgr to low power.
- Set `wakeups_i` inputs randomly.
- Set `intr_enable` randomly.
**Checks**:
- The fast fsm becomes active when `fetch_en_o` output rises.
- Depending on `wakeups_i`:
- If all wakeups are disabled, wait some time checking the
state remains inactive.
- Set `wakeups_i` so at least one is enabled.
- Checks `wakeup_status` CSR during transition to active state
since the reset involved will clear the wakeups_i input.
- Checks the `wake_info` CSR.
- Checks the output `pwr_rst_req.reset_cause` is `LowPwrEntry`.
- Check that `intr_wakeup_o` is set according to `intr_enable` CSR.
- Coverage collected by `wakeup_cg` and `wakeup_intr_cg`.
'''
stage: V2
tests: ["pwrmgr_wakeup"]
}
{
name: control_clks
desc: '''
Test CSR control of peripheral clocks during low power.
The peripheral clocks can be configured to remain on or be turned
off during low power with bits in the `control` CSR register. The
usb clock can also be configured off in active mode.
**Stimulus**:
- Sets these control bits at random.
- Cause a low power transition and wakeup.
**Checks**:
- The clock enable outputs to the AST clocks during a low
power transition match the control bits.
- The usb clock enable is also checked during active mode against
the control register.
'''
stage: V2
tests: ["pwrmgr_wakeup"]
}
{
name: aborted_low_power
desc: '''
Test aborted low power transitions.
Low power transitions can be aborted in two cases:
- The processor gets an interrupt soon after a low power entry is
triggered.
- OTP, LC, or FLASH are not idle.
This test aborts low power transitions, and disables any wakeups,
so the test would timeout if low power was entered.
**Stimulus**:
- Bring pwrmgr to low power.
- Either disable `pwr_cpu.core_sleeping` or keep some of `lc_idle`,
`otp_idle`, or `flash_idle` inputs off.
- Disable all wakeup enables.
- Randomly set `wakeup_info_capture_dis` CSR.
**Checks**:
- The `ctrl_cfg_regwen` CSR reads as 1 on the first attempt.
- Checks the output `pwr_rst_req.reset_cause` doesn't change for
a bounded amount of time.
- Check that the `wakeup_info` CSR flags either `fall_through` or
`abort` events when capture is enabled.
'''
stage: V2
tests: ["pwrmgr_aborted_low_power", "pwrmgr_lowpower_invalid"]
}
{
name: reset
desc: '''
Test random reset and reset_en.
Conditional reset inputs can be disabled via bits in the `reset_en`
CSR, while escalation and main power are unconditional. Resets can
be triggered either in active or low power state.
**Stimulus**:
- Sets `reset_en` randomly.
- Randomly choose whether to put the unit in low power mode.
- Generate resets randomly in value and time:
- Conditionals via rstreqs_i,
- Main power glitch via rst_main_ni.
- Escalation via `esc_rst_tx_i`.
- Sw reset from rstmgr via `sw_rst_req_i`.
**Checks**:
- The fast fsm becomes active when `fetch_en_o` output rises.
- Checks the `reset_status` CSRs.
- Checks `ip_clk_en` output has a low transition.
- SVA that when `pwr_rst_req.reset_cause` is HwReq, and the output
`pwr_rst_req.rstreqs` matches the unconditional and enabled
conditional resets inputs.
'''
stage: V2
tests: ["pwrmgr_reset", "pwrmgr_reset_invalid"]
}
{
name: main_power_glitch_reset
desc: '''
Test reset due to a glitch in main power.
A power glitch causes an unconditional reset.
**Stimulus**:
- Set the rst_main_ni input low indicating a main power glitch.
**Checks**:
- The fast fsm becomes active when `fetch_en_o` output rises.
- Checks the `reset_status` CSRs.
- Checks `ip_clk_en` output has a low transition.
- Checks the output `pwr_rst_req.reset_cause` matches HwReq.
- Checks the output `pwr_rst_req.rstreqs` matches power glitch.
'''
stage: V2
tests: ["pwrmgr_reset"]
}
{
name: reset_wakeup_race
desc: '''
Test wakeup from low power and reset request almost coinciding.
If a wakeup from low power and a reset occur at nearly the same time
the system handles them one at a time.
**Stimulus**:
- Trigger reset and wakeup from low power as described for other
testpoints.
- Issue reset and wakeup a random number of cycles after the slow
state machine is in LowPower state.
- This also checks them coinciding.
**Check**:
- Similar tests as for the wakeup and reset testpoints, except
making sure they happen per the triggering order.
'''
stage: V2
tests: ["pwrmgr_wakeup_reset"]
}
{
name: lowpower_wakeup_race
desc: '''
Test wakeups coming close to lowpower entry.
If low power entry and a wakeup are closely aligned the hardware
could get confused. Notice this is very unlikely, since wakeup is
only sensed when the slow fsm is in LowPower state.
**Stimulus**:
- Trigger low power entry as described for other testpoints.
- Have all wakeups enabled.
- Assert wakeups_i in the temporal neighborhood of low power
entry.
**Check**:
- No timeout occurs.
- Either pwrmgr remains active or a full low power cycle occurs.
'''
stage: V2
tests: ["pwrmgr_lowpower_wakeup_race"]
}
{
name: disable_rom_integrity_check
desc: '''
Test rom integrity check is disabled under life cycle test states.
While running a series of reset event, at FastPwrStateRomCheck
state,
- Drive lc_hw_debug_en_i and lc_dft_en_i to random value
excluding {lc_ctrl_pkg::On, lc_ctrl_pkg::On} for both ports.
- Set rom_ctrl_i.good = Mubi4False.
- Wait for a while to make sure fsm state check is not FastPwrStateActive.
Then,
- Drive lc_hw_debug_en_i and lc_dft_en_i to {lc_ctrl_pkg::On, lc_ctrl_pkg::On}
- Check test finish gracefully.
Try these steps with different lc_ctrl inputs.
'''
stage: V2
tests: ["pwrmgr_disable_rom_integrity_check"]
}
{
name: escalation_timeout
desc: '''This tests the escalation timeout feature.
If the escalation network doesn't respond to an outgoing "health"
requests within 128 cycles pwrmgr should issue an escalation reset
request.
**Stimulus**:
- Cause the external escalation network to stop responding, either
disabling the clock or jamming the differential pairs.
**Check**:
- After 128 cycles of inactivity an escalation reset should be
triggered.
'''
stage: V3
tests: ["pwrmgr_escalation_timeout"]
}
{
name: stress_all
desc: '''This runs random sequences in succession.
Randomly chooses from the following sequences:
- pwrmgr_aborted_low_power_vseq
- pwrmgr_lowpower_wakeup_race_vseq
- pwrmgr_reset_vseq
- pwrmgr_smoke_vseq
- pwrmgr_wakeup_reset_vseq
- pwrmgr_wakeup_vseq
'''
stage: V2
tests: ["pwrmgr_stress_all"]
}
]
covergroups: [
{
name: wakeup_ctrl_cg
desc: '''
Collects coverage on wakeup enable and capture functionality.
This is collected per individual wakeup bit. Covergroup contains
coverpoints for the `wakeup_en` CSR bit, `wakeup_info_capture_dis`
CSR, `wakeups_i` input bit, and `wakeup_status` CSR bit, and their
cross.
'''
}
{
name: wakeup_intr_cg
desc: '''
Collects coverage on interrupts for wakeup functionality.
This is collected per individual wakeup bit. Covergroup contains
coverpoints for the `intr_en` CSR, the `wakeup_status` CSR bit,
the `intr_status` CSR, the output `intr_wakeup` port, and their
cross.
'''
}
{
name: control_cg
desc: '''
Collects coverage on clock and power bits from `control` CSR during
a lowpower transition and active state.
'''
}
{
name: hw_reset_0_cg
desc: '''
Collects coverage related to external reset `0`.
Covergroup contains coverpoints for the `rstreqs_i[0]` external
reset input, its corresponding bit in `reset_en` CSR, and whether
this reset is asserted during low power state, and suitable crosses.
'''
}
{
name: hw_reset_1_cg
desc: '''
Collects coverage related to external reset `1`.
Covergroup contains coverpoints for the `rstreqs_i[1]` external
reset input, its corresponding bit in `reset_en` CSR, and whether
this reset is asserted during low power state, and suitable crosses.
'''
}
{
name: rstmgr_sw_reset_cg
desc: '''
Collects coverage on the software reset from rstmgr.
Covergroup contains a coverpoint for the input `sw_rst_req_i` from
rstmgr.
'''
}
{
name: main_power_reset_cg
desc: '''
Collects coverage on resets due to a main power glitch.
Covergroup contains a coverpoint for the input `rst_main_i` that
triggers a power glitch reset, and whether this reset is asserted
during low power state.
'''
}
{
name: esc_reset_cg
desc: '''
Collects coverage on resets due to escalation.
Covergroup contains a coverpoint for the input `esc_rst_tx_i` that
triggers an escalation reset, and whether this reset is asserted
during low power state.
'''
}
{
name: reset_wakeup_distance_cg
desc: '''
Covergroup contains a coverpoint for the difference between the
cycles when the reset and the wakeup were received in the inputs.
The difference is positive when reset happened after wakeup, and
zero when the two happened at the same clock cycle.
'''
}
]
}