Skip to content

Commit

Permalink
[dv,cip] DV alert macro should work with size zero
Browse files Browse the repository at this point in the history
At the moment VCS complains that the size of the arrays in
DV_ALERT_IF_CONNECT must not be zero or negative. To solve this I
instantiate one of each when NUM_ALERTS is zero but the for loop that
connects things up doesn't run.

Signed-off-by: Marno van der Maas <[email protected]>
  • Loading branch information
marnovandermaas committed Feb 12, 2025
1 parent 0541d73 commit 3760387
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hw/dv/sv/cip_lib/cip_macros.svh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
`define __CIP_MACROS_SVH__

// Declare array of alert interface, using parameter NUM_ALERTS and LIST_OF_ALERTS, and connect to
// arrays of wires (alert_tx and alert_rx). User need to manually connect these wires to DUT
// arrays of wires (alert_tx and alert_rx). User need to manually connect these wires to DUT.
// Also set each alert_if to uvm_config_db to use in env.
// When NUM_ALERTS is zero still instantiate one interface to avoid zero size
// array warnings.
`ifndef DV_ALERT_IF_CONNECT
`define DV_ALERT_IF_CONNECT(CLK_ = clk, RST_N_ = rst_n) \
alert_esc_if alert_if[NUM_ALERTS](.clk(CLK_), .rst_n(RST_N_)); \
prim_alert_pkg::alert_rx_t [NUM_ALERTS-1:0] alert_rx; \
prim_alert_pkg::alert_tx_t [NUM_ALERTS-1:0] alert_tx; \
localparam uint dv_alert_if_connect_param = (NUM_ALERTS == 0) ? 1 : NUM_ALERTS; \
alert_esc_if alert_if[dv_alert_if_connect_param](.clk(CLK_), .rst_n(RST_N_)); \
prim_alert_pkg::alert_rx_t [dv_alert_if_connect_param-1:0] alert_rx; \
prim_alert_pkg::alert_tx_t [dv_alert_if_connect_param-1:0] alert_tx; \
for (genvar k = 0; k < NUM_ALERTS; k++) begin : connect_alerts_pins \
assign alert_rx[k] = alert_if[k].alert_rx; \
assign alert_if[k].alert_tx = alert_tx[k]; \
Expand Down

0 comments on commit 3760387

Please sign in to comment.