[dv/aes] connect alert_agent to AES testbench
Connect alert_esc_agent to drive alert_rx responses when alert
triggered.
This is all the code needed to plug in alert receivers in a IP. If
reviewers are okay with the flow, next PR will update the uvmgen to
automatically genenrate the code as much as possible.
Signed-off-by: Cindy Chen <chencindy@google.com>
diff --git a/hw/ip/aes/dv/env/aes_env_cfg.sv b/hw/ip/aes/dv/env/aes_env_cfg.sv
index c062ba1..afddba3 100644
--- a/hw/ip/aes/dv/env/aes_env_cfg.sv
+++ b/hw/ip/aes/dv/env/aes_env_cfg.sv
@@ -113,8 +113,9 @@
this.csr_addr_map_size = AES_ADDR_MAP_SIZE;
endfunction : initialize_csr_addr_map_size
- virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1);
+ virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1);
super.initialize(csr_base_addr);
+ list_of_alerts = aes_env_pkg::LIST_OF_ALERTS;
endfunction
endclass
diff --git a/hw/ip/aes/dv/env/aes_env_pkg.sv b/hw/ip/aes/dv/env/aes_env_pkg.sv
index 4fef4e9..cdecb82 100644
--- a/hw/ip/aes/dv/env/aes_env_pkg.sv
+++ b/hw/ip/aes/dv/env/aes_env_pkg.sv
@@ -21,8 +21,9 @@
`include "dv_macros.svh"
// parameters
-
- parameter uint AES_ADDR_MAP_SIZE = 128;
+ parameter string LIST_OF_ALERTS[] = {"ctrl_err_update", "ctrl_err_storage"};
+ parameter uint NUM_ALERTS = 2;
+ parameter uint AES_ADDR_MAP_SIZE = 128;
typedef enum int { AES_CFG=0, AES_DATA=1, AES_ERR_INJ=2 } aes_item_type_e;
diff --git a/hw/ip/aes/dv/tb/tb.sv b/hw/ip/aes/dv/tb/tb.sv
index f89f1de..647c589 100644
--- a/hw/ip/aes/dv/tb/tb.sv
+++ b/hw/ip/aes/dv/tb/tb.sv
@@ -16,9 +16,9 @@
wire clk, rst_n;
wire devmode;
wire [NUM_MAX_INTERRUPTS-1:0] interrupts;
- prim_alert_pkg::alert_rx_t [aes_reg_pkg::NumAlerts-1:0] alert_rx;
- assign alert_rx[0] = 4'b0101;
- assign alert_rx[1] = 4'b0101;
+ 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;
// interfaces
clk_rst_if clk_rst_if(.clk(clk), .rst_n(rst_n));
@@ -27,6 +27,15 @@
pins_if #(1) devmode_if(devmode);
tl_if tl_if(.clk(clk), .rst_n(rst_n));
+ 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];
+ initial begin
+ uvm_config_db#(virtual alert_esc_if)::set(null, $sformatf("*.env.m_alert_agent_%0s",
+ LIST_OF_ALERTS[k]), "vif", alert_if[k]);
+ end
+ end
+
// dut
aes dut (
.clk_i (clk ),
@@ -38,7 +47,7 @@
.tl_o (tl_if.d2h ),
.alert_rx_i ( alert_rx ),
- .alert_tx_o ( )
+ .alert_tx_o ( alert_tx )
);
initial begin