Line Coverage for Module :
alert_handler_ping_timer
| Line No. | Total | Covered | Percent |
TOTAL | | 85 | 85 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 89 | 1 | 1 | 100.00 |
CONT_ASSIGN | 95 | 1 | 1 | 100.00 |
CONT_ASSIGN | 98 | 1 | 1 | 100.00 |
CONT_ASSIGN | 102 | 1 | 1 | 100.00 |
ALWAYS | 106 | 3 | 3 | 100.00 |
CONT_ASSIGN | 113 | 1 | 1 | 100.00 |
CONT_ASSIGN | 123 | 1 | 1 | 100.00 |
CONT_ASSIGN | 124 | 1 | 1 | 100.00 |
CONT_ASSIGN | 125 | 1 | 1 | 100.00 |
CONT_ASSIGN | 139 | 1 | 1 | 100.00 |
CONT_ASSIGN | 140 | 1 | 1 | 100.00 |
CONT_ASSIGN | 141 | 1 | 1 | 100.00 |
CONT_ASSIGN | 144 | 1 | 1 | 100.00 |
CONT_ASSIGN | 145 | 1 | 1 | 100.00 |
CONT_ASSIGN | 149 | 1 | 1 | 100.00 |
CONT_ASSIGN | 150 | 1 | 1 | 100.00 |
ALWAYS | 154 | 28 | 28 | 100.00 |
ALWAYS | 220 | 8 | 8 | 100.00 |
88 for (genvar k = 0; k < 32; k++) begin : gen_perm
89 32/32 assign perm_state[k] = lfsr_state[perm[k]];
90 end
91
92 logic [IdDw-1:0] id_to_ping;
93 logic [PING_CNT_DW-1:0] wait_cyc;
94 // we only use bits up to 23, as IdDw is 8bit maximum
95 1/1 assign id_to_ping = perm_state[16 +: IdDw];
96
97 // to avoid lint warnings
98 1/1 assign unused_perm_state = perm_state[31:16+IdDw];
99
100 // concatenate with constant offset, introduce some stagger
101 // by concatenating the lower bits below
102 1/1 assign wait_cyc = PING_CNT_DW'({perm_state[15:2], 8'h01, perm_state[1:0]}) & wait_cyc_mask_i;
103
104 logic [2**IdDw-1:0] enable_mask;
105 always_comb begin : p_enable_mask
106 1/1 enable_mask = '0; // tie off unused
107 1/1 enable_mask[NAlerts-1:0] = alert_en_i; // alerts
108 1/1 enable_mask[NModsToPing-1:NAlerts] = '1; // escalation senders
109 end
110
111 logic id_vld;
112 // check if the randomly drawn ID is actually valid and the alert is enabled
113 1/1 assign id_vld = enable_mask[id_to_ping];
114
115 /////////////
116 // Counter //
117 /////////////
118
119 logic [PING_CNT_DW-1:0] cnt_d, cnt_q;
120 logic cnt_en, cnt_clr;
121 logic wait_ge, timeout_ge;
122
123 1/1 assign cnt_d = cnt_q + 1'b1;
124 1/1 assign wait_ge = (cnt_q >= wait_cyc);
125 1/1 assign timeout_ge = (cnt_q >= ping_timeout_cyc_i);
126
127 ////////////////////////////
128 // Ping and Timeout Logic //
129 ////////////////////////////
130
131 typedef enum logic [1:0] {Init, RespWait, DoPing} state_e;
132 state_e state_d, state_q;
133 logic ping_en, ping_ok;
134 logic [NModsToPing-1:0] ping_sel;
135 logic [NModsToPing-1:0] spurious_ping;
136 logic spurious_alert_ping, spurious_esc_ping;
137
138 // generate ping enable vector
139 1/1 assign ping_sel = NModsToPing'(ping_en) << id_to_ping;
140 1/1 assign alert_ping_en_o = ping_sel[NAlerts-1:0];
141 1/1 assign esc_ping_en_o = ping_sel[NModsToPing-1:NAlerts];
142
143 // mask out response
144 1/1 assign ping_ok = |({esc_ping_ok_i, alert_ping_ok_i} & ping_sel);
145 1/1 assign spurious_ping = ({esc_ping_ok_i, alert_ping_ok_i} & ~ping_sel);
146 // under normal operation, these signals should never be asserted.
147 // double check that these signals are not optimized away during synthesis.
148 // this may need "don't touch" or "no boundary optimization" constraints
149 1/1 assign spurious_alert_ping = |spurious_ping[NAlerts-1:0];
150 1/1 assign spurious_esc_ping = |spurious_ping[NModsToPing-1:NAlerts];
151
152 always_comb begin : p_fsm
153 // default
154 1/1 state_d = state_q;
155 1/1 cnt_en = 1'b0;
156 1/1 cnt_clr = 1'b0;
157 1/1 lfsr_en = 1'b0;
158 1/1 ping_en = 1'b0;
159 // this captures spurious
160 1/1 alert_ping_fail_o = spurious_alert_ping;
161 1/1 esc_ping_fail_o = spurious_esc_ping;
162
163 1/1 unique case (state_q)
164 // wait until activiated
165 // we never return to this state
166 // once activated!
167 Init: begin
168 1/1 cnt_clr = 1'b1;
169 1/1 if (en_i) begin
170 1/1 state_d = RespWait;
171 end
MISSING_ELSE
172 end
173 // wait for random amount of cycles
174 // draw another ID/wait count if the
175 // peripheral ID is not valid
176 RespWait: begin
177 1/1 if (!id_vld) begin
178 1/1 lfsr_en = 1'b1;
179 1/1 cnt_clr = 1'b1;
180 1/1 end else if (wait_ge) begin
181 1/1 state_d = DoPing;
182 1/1 cnt_clr = 1'b1;
183 end else begin
184 1/1 cnt_en = 1'b1;
185 end
186 end
187 // send out ping request and wait for a ping
188 // response or a ping timeout (whatever comes first)
189 DoPing: begin
190 1/1 cnt_en = 1'b1;
191 1/1 ping_en = 1'b1;
192 1/1 if (timeout_ge || ping_ok) begin
193 1/1 state_d = RespWait;
194 1/1 lfsr_en = 1'b1;
195 1/1 cnt_clr = 1'b1;
196 1/1 if (timeout_ge) begin
197 1/1 if (id_to_ping < NAlerts) begin
198 1/1 alert_ping_fail_o = 1'b1;
199 end else begin
200 1/1 esc_ping_fail_o = 1'b1;
201 end
202 end
MISSING_ELSE
203 end
MISSING_ELSE
204 end
205 // this should never happen
206 // if we for some reason end up in this state (e.g. malicious glitching)
207 // we are going to assert both ping fails continuously
208 default: begin
209 alert_ping_fail_o = 1'b1;
210 esc_ping_fail_o = 1'b1;
211 end
212 endcase
213 end
214
215 ///////////////
216 // Registers //
217 ///////////////
218
219 always_ff @(posedge clk_i or negedge rst_ni) begin : p_regs
220 1/1 if (!rst_ni) begin
221 1/1 state_q <= Init;
222 1/1 cnt_q <= '0;
223 end else begin
224 1/1 state_q <= state_d;
225
226 1/1 if (cnt_clr) begin
227 1/1 cnt_q <= '0;
228 1/1 end else if (cnt_en) begin
229 1/1 cnt_q <= cnt_d;
230 end
==> MISSING_ELSE
Cond Coverage for Module :
alert_handler_ping_timer
| Total | Covered | Percent |
Conditions | 3 | 3 | 100.00 |
Logical | 3 | 3 | 100.00 |
Non-Logical | 0 | 0 | |
Event | 0 | 0 | |
LINE 192
EXPRESSION (timeout_ge || ping_ok)
-----1---- ---2---
-1- | -2- | Status |
0 | 0 | Covered |
0 | 1 | Covered |
1 | 0 | Covered |
FSM Coverage for Module :
alert_handler_ping_timer
Summary for FSM :: state_q
| Total | Covered | Percent | |
States |
3 |
3 |
100.00 |
(Not included in score) |
Transitions |
5 |
4 |
80.00 |
|
Sequences |
0 |
0 |
|
|
State, Transition and Sequence Details for FSM :: state_q
states | Line No. | Covered |
DoPing |
181 |
Covered |
Init |
221 |
Covered |
RespWait |
170 |
Covered |
transitions | Line No. | Covered |
DoPing->Init |
221 |
Not Covered |
DoPing->RespWait |
193 |
Covered |
Init->RespWait |
170 |
Covered |
RespWait->DoPing |
181 |
Covered |
RespWait->Init |
221 |
Covered |
Branch Coverage for Module :
alert_handler_ping_timer
| Line No. | Total | Covered | Percent |
Branches |
|
14 |
13 |
92.86 |
CASE |
163 |
10 |
10 |
100.00 |
IF |
220 |
4 |
3 |
75.00 |
163 unique case (state_q)
-1-
164 // wait until activiated
165 // we never return to this state
166 // once activated!
167 Init: begin
168 cnt_clr = 1'b1;
169 if (en_i) begin
-2-
170 state_d = RespWait;
==>
171 end
MISSING_ELSE
==>
172 end
173 // wait for random amount of cycles
174 // draw another ID/wait count if the
175 // peripheral ID is not valid
176 RespWait: begin
177 if (!id_vld) begin
-3-
178 lfsr_en = 1'b1;
==>
179 cnt_clr = 1'b1;
180 end else if (wait_ge) begin
-4-
181 state_d = DoPing;
==>
182 cnt_clr = 1'b1;
183 end else begin
184 cnt_en = 1'b1;
==>
185 end
186 end
187 // send out ping request and wait for a ping
188 // response or a ping timeout (whatever comes first)
189 DoPing: begin
190 cnt_en = 1'b1;
191 ping_en = 1'b1;
192 if (timeout_ge || ping_ok) begin
-5-
193 state_d = RespWait;
194 lfsr_en = 1'b1;
195 cnt_clr = 1'b1;
196 if (timeout_ge) begin
-6-
197 if (id_to_ping < NAlerts) begin
-7-
198 alert_ping_fail_o = 1'b1;
==>
199 end else begin
200 esc_ping_fail_o = 1'b1;
==>
201 end
202 end
MISSING_ELSE
==>
203 end
MISSING_ELSE
==>
204 end
205 // this should never happen
206 // if we for some reason end up in this state (e.g. malicious glitching)
207 // we are going to assert both ping fails continuously
208 default: begin
209 alert_ping_fail_o = 1'b1;
==>
Branches:
-1- | -2- | -3- | -4- | -5- | -6- | -7- | Status |
Init |
1 |
- |
- |
- |
- |
- |
Covered |
Init |
0 |
- |
- |
- |
- |
- |
Covered |
RespWait |
- |
1 |
- |
- |
- |
- |
Covered |
RespWait |
- |
0 |
1 |
- |
- |
- |
Covered |
RespWait |
- |
0 |
0 |
- |
- |
- |
Covered |
DoPing |
- |
- |
- |
1 |
1 |
1 |
Covered |
DoPing |
- |
- |
- |
1 |
1 |
0 |
Covered |
DoPing |
- |
- |
- |
1 |
0 |
- |
Covered |
DoPing |
- |
- |
- |
0 |
- |
- |
Covered |
default |
- |
- |
- |
- |
- |
- |
Covered |
220 if (!rst_ni) begin
-1-
221 state_q <= Init;
==>
222 cnt_q <= '0;
223 end else begin
224 state_q <= state_d;
225
226 if (cnt_clr) begin
-2-
227 cnt_q <= '0;
==>
228 end else if (cnt_en) begin
-3-
229 cnt_q <= cnt_d;
==>
230 end
MISSING_ELSE
==>
Branches:
-1- | -2- | -3- | Status |
1 |
- |
- |
Covered |
0 |
1 |
- |
Covered |
0 |
0 |
1 |
Covered |
0 |
0 |
0 |
Not Covered |
Assert Coverage for Module :
alert_handler_ping_timer
Assertion Details
Name | Attempts | Real Successes | Failures | Incomplete |
PingOH0_A |
2147483647 |
2147483647 |
0 |
0 |
PingOH_A |
2147483647 |
1345696 |
0 |
0 |