[dv/alert_handler] Fix esc_receiver_driver behavior
When esc_receiver driver receives a ping_response, while responding to
the ping response, a real escalation signal interrupted.
In this case, design will abort the ping response, and directly jumpped
to escalation response.
Current `esc_receiver_driver` did not do anything but keep toggling the
resp_p/n, this behaivor is fine but makes the sequence harder to manage.
This PR update the behavior: Now the driver will abort the random
resp_p/n drives, and response to the real escalation signal without any
sig_int_err.
Signed-off-by: Cindy Chen <chencindy@google.com>
diff --git a/hw/dv/sv/alert_esc_agent/esc_receiver_driver.sv b/hw/dv/sv/alert_esc_agent/esc_receiver_driver.sv
index c0c8b6c..7d58245 100644
--- a/hw/dv/sv/alert_esc_agent/esc_receiver_driver.sv
+++ b/hw/dv/sv/alert_esc_agent/esc_receiver_driver.sv
@@ -106,11 +106,29 @@
wait_esc();
@(cfg.vif.receiver_cb);
while (get_esc() === 1'b1) toggle_resp_signal(req);
+
+ // drives escalation ping request response according to the above scenarios:
+ // if no sig_int_err: the driver will toggle resp_p/n as design required
+ // if there is sig_int_err: the driver will randomly toggle resp_p/n until ping timeout
+ // if ping is interrupted by real esclation signal: the ping response is aborted
+ // immediately and response to the real escalation signal without sig_int_err
if (is_ping) begin
- int toggle_cycle = 1;
- if (req.int_err) toggle_cycle = $urandom_range(0, cfg.ping_timeout_cycle);
- repeat (toggle_cycle) toggle_resp_signal(req);
+ // `ping_timeout_cycle` is divided by 2 because `toggle_resp_signal` task contains two cycles
+ int toggle_cycle = req.int_err ? cfg.ping_timeout_cycle / 2 : 1;
+ fork
+ begin : isolation_fork
+ fork
+ repeat (toggle_cycle) toggle_resp_signal(req);
+ wait(cfg.probe_vif.get_esc_en());
+ join_any
+ disable fork;
+ end
+ join
is_ping = 0;
+ if (cfg.probe_vif.get_esc_en()) begin
+ req.int_err = 0;
+ while (get_esc() === 1'b1) toggle_resp_signal(req);
+ end
end
if (req.int_err) reset_resp();
end