Skip to content

Commit 4d38377

Browse files
committed
[alert,fpv] Add stopats and assertions to hit parasitic FSM states
Signed-off-by: Rupert Swarbrick <[email protected]>
1 parent 6c9cf62 commit 4d38377

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

hw/ip/prim/fpv/tb/rxtx_after_load.tcl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,32 @@
55
# This is a TCL file that can be sourced by FPV runs that are doing
66
# some form of "prim_alert_rxtx" verification.
77

8+
proc move_to_task {task_name assert_name} {
9+
task -edit ${task_name} -copy "${assert_name}*"
10+
assert -disable ${assert_name}
11+
}
12+
13+
814
set valid_state_props [get_property_list -regexp -include {"name" "ValidState_A$"}]
915
foreach prop $valid_state_props {
1016
assert -set_helper $prop
1117
}
18+
19+
# The property names in this list are properties that depend on some FSM state register pointing at
20+
# a parasitic state. Use a stopat on various state registers to make the properties say something.
21+
22+
task -create FreeFsm
23+
stopat -task FreeFsm "i_prim_alert_sender.state_q"
24+
stopat -task FreeFsm "i_prim_alert_receiver.state_q"
25+
26+
set parasitic_state_props {SenderStateDValid_A ReceiverStateDValid_A}
27+
28+
foreach psn $parasitic_state_props {
29+
foreach psp [get_property_list -regexp -include [list name "${psn}$"]] {
30+
move_to_task FreeFsm $psp
31+
}
32+
}
33+
34+
# Add FreeFsm to the cov_tasks variable, which is a list of the tasks that will be used for
35+
# check_cov at the end of fpv.tcl if coverage is enabled.
36+
lappend cov_tasks FreeFsm

hw/ip/prim/fpv/vip/prim_alert_rxtx_async_assert_fpv.sv

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,29 @@ module prim_alert_rxtx_async_assert_fpv
221221
##[1:30] sender_is_idle,
222222
clk_i, !rst_ni || error_present)
223223

224+
// There is a single parasitic state in the FSM of prim_alert_sender (because state_e uses 3 bits
225+
// to define 7 states). The sender rather sensibly uses state_d to get back to Idle in that case
226+
// as an escape route. Using a stopat to check this is fiddly because then state_d won't *have*
227+
// any effect. To make this work, assert that state_d is a known state. This shows that the escape
228+
// route has been wired up correctly.
229+
SenderStateDValid_A: assert property (i_prim_alert_sender.state_d inside
230+
{ i_prim_alert_sender.Idle,
231+
i_prim_alert_sender.AlertHsPhase1,
232+
i_prim_alert_sender.AlertHsPhase2,
233+
i_prim_alert_sender.PingHsPhase1,
234+
i_prim_alert_sender.PingHsPhase2,
235+
i_prim_alert_sender.Pause0,
236+
i_prim_alert_sender.Pause1 });
237+
238+
// As with the previous assertion, there are two parasitic states in the FSM of
239+
// prim_alert_receiver (state_e uses 3 bits to define 6 states). Again, assert that state_d is a
240+
// known state.
241+
ReceiverStateDValid_A: assert property (i_prim_alert_receiver.state_d inside
242+
{ i_prim_alert_receiver.Idle,
243+
i_prim_alert_receiver.HsAckWait,
244+
i_prim_alert_receiver.Pause0,
245+
i_prim_alert_receiver.Pause1,
246+
i_prim_alert_receiver.InitReq,
247+
i_prim_alert_receiver.InitAckWait });
248+
224249
endmodule : prim_alert_rxtx_async_assert_fpv

0 commit comments

Comments
 (0)