[keymgr] dv hook-ups for edn
Signed-off-by: Timothy Chen <timothytim@google.com>
[keymgr] dv update
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/keymgr/dv/env/keymgr_env.core b/hw/ip/keymgr/dv/env/keymgr_env.core
index a4c0b33..7672ca1 100644
--- a/hw/ip/keymgr/dv/env/keymgr_env.core
+++ b/hw/ip/keymgr/dv/env/keymgr_env.core
@@ -9,6 +9,7 @@
depend:
- lowrisc:dv:ralgen
- lowrisc:dv:cip_lib
+ - lowrisc:dv:push_pull_agent
- lowrisc:dv:keymgr_kmac_agent
files:
- keymgr_if.sv
diff --git a/hw/ip/keymgr/dv/env/keymgr_env.sv b/hw/ip/keymgr/dv/env/keymgr_env.sv
index 70d3e22..359f3b8 100644
--- a/hw/ip/keymgr/dv/env/keymgr_env.sv
+++ b/hw/ip/keymgr/dv/env/keymgr_env.sv
@@ -13,6 +13,7 @@
`uvm_component_new
keymgr_kmac_agent m_keymgr_kmac_agent;
+ push_pull_agent#(.DeviceDataWidth(EDN_DATA_SIZE)) m_edn_pull_agent;
function void build_phase(uvm_phase phase);
super.build_phase(phase);
@@ -25,10 +26,18 @@
if (!uvm_config_db#(keymgr_vif)::get(this, "", "keymgr_vif", cfg.keymgr_vif)) begin
`uvm_fatal(`gfn, "failed to get keymgr_vif from uvm_config_db")
end
+
+ // build edn-otp push agent
+ m_edn_pull_agent = push_pull_agent#(.DeviceDataWidth(EDN_DATA_SIZE))::type_id::create("m_edn_pull_agent",
+ this);
+ uvm_config_db#(push_pull_agent_cfg#(.DeviceDataWidth(EDN_DATA_SIZE)))::set(
+ this, "m_edn_pull_agent", "cfg", cfg.m_edn_pull_agent_cfg);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
+ virtual_sequencer.edn_pull_sequencer_h = m_edn_pull_agent.sequencer;
+ m_edn_pull_agent.monitor.req_port.connect(scoreboard.edn_fifo.analysis_export);
endfunction
endclass
diff --git a/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv b/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv
index f08435e..e6147a0 100644
--- a/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv
+++ b/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv
@@ -5,6 +5,7 @@
class keymgr_env_cfg extends cip_base_env_cfg #(.RAL_T(keymgr_reg_block));
rand keymgr_kmac_agent_cfg m_keymgr_kmac_agent_cfg;
+ rand push_pull_agent_cfg#(.DeviceDataWidth(EDN_DATA_SIZE)) m_edn_pull_agent_cfg;
// interface for input data from LC, OTP and flash
keymgr_vif keymgr_vif;
@@ -20,6 +21,10 @@
m_keymgr_kmac_agent_cfg = keymgr_kmac_agent_cfg::type_id::create("m_keymgr_kmac_agent_cfg");
m_keymgr_kmac_agent_cfg.if_mode = dv_utils_pkg::Device;
+ m_edn_pull_agent_cfg = push_pull_agent_cfg#(.DeviceDataWidth(EDN_DATA_SIZE))::type_id::create
+ ("m_edn_pull_agent_cfg");
+ m_edn_pull_agent_cfg.agent_type = PullAgent;
+ m_edn_pull_agent_cfg.if_mode = Device;
// set num_interrupts & num_alerts
begin
diff --git a/hw/ip/keymgr/dv/env/keymgr_env_pkg.sv b/hw/ip/keymgr/dv/env/keymgr_env_pkg.sv
index e59cf67..f63831e 100644
--- a/hw/ip/keymgr/dv/env/keymgr_env_pkg.sv
+++ b/hw/ip/keymgr/dv/env/keymgr_env_pkg.sv
@@ -11,6 +11,7 @@
import tl_agent_pkg::*;
import cip_base_pkg::*;
import csr_utils_pkg::*;
+ import push_pull_agent_pkg::*;
import keymgr_ral_pkg::*;
import keymgr_kmac_agent_pkg::*;
@@ -27,6 +28,8 @@
keymgr_pkg::StOwnerIntKey,
keymgr_pkg::StOwnerKey};
+ parameter uint EDN_DATA_SIZE = edn_pkg::ENDPOINT_BUS_WIDTH + 1;
+
typedef virtual keymgr_if keymgr_vif;
typedef enum {
IntrOpDone,
diff --git a/hw/ip/keymgr/dv/env/keymgr_scoreboard.sv b/hw/ip/keymgr/dv/env/keymgr_scoreboard.sv
index 5a80b0e..257ec38 100644
--- a/hw/ip/keymgr/dv/env/keymgr_scoreboard.sv
+++ b/hw/ip/keymgr/dv/env/keymgr_scoreboard.sv
@@ -12,6 +12,7 @@
// local variables
// TLM agent fifos
+ uvm_tlm_analysis_fifo #(push_pull_item#(.DeviceDataWidth(EDN_DATA_SIZE))) edn_fifo;
// local queues to hold incoming packets pending comparison
@@ -19,6 +20,7 @@
function void build_phase(uvm_phase phase);
super.build_phase(phase);
+ edn_fifo = new("edn_fifo", this);
endfunction
function void connect_phase(uvm_phase phase);
diff --git a/hw/ip/keymgr/dv/env/keymgr_virtual_sequencer.sv b/hw/ip/keymgr/dv/env/keymgr_virtual_sequencer.sv
index 8f76e39..833f91f 100644
--- a/hw/ip/keymgr/dv/env/keymgr_virtual_sequencer.sv
+++ b/hw/ip/keymgr/dv/env/keymgr_virtual_sequencer.sv
@@ -10,5 +10,6 @@
`uvm_component_new
+ push_pull_sequencer#(.DeviceDataWidth(EDN_DATA_SIZE)) edn_pull_sequencer_h;
endclass
diff --git a/hw/ip/keymgr/dv/tb.sv b/hw/ip/keymgr/dv/tb.sv
index 14e44af..bd8d8c7 100644
--- a/hw/ip/keymgr/dv/tb.sv
+++ b/hw/ip/keymgr/dv/tb.sv
@@ -8,6 +8,7 @@
import dv_utils_pkg::*;
import keymgr_env_pkg::*;
import keymgr_test_pkg::*;
+ import push_pull_agent_pkg::*;
// macro includes
`include "uvm_macros.svh"
@@ -24,6 +25,7 @@
tl_if tl_if(.clk(clk), .rst_n(rst_n));
keymgr_if keymgr_if(.clk(clk), .rst_n(rst_n));
keymgr_kmac_intf keymgr_kmac_intf(.clk(clk), .rst_n(rst_n));
+ push_pull_if #(.DeviceDataWidth(EDN_DATA_SIZE)) edn_if(.clk(clk), .rst_n(rst_n));
`DV_ALERT_IF_CONNECT
@@ -31,6 +33,8 @@
keymgr dut (
.clk_i (clk ),
.rst_ni (rst_n ),
+ .clk_edn_i (clk ),
+ .rst_edn_ni (rst_n ),
.aes_key_o (keymgr_if.aes_key),
.hmac_key_o (keymgr_if.hmac_key),
.kmac_key_o (keymgr_if.kmac_key),
@@ -39,7 +43,8 @@
.lc_i (keymgr_if.lc),
.otp_key_i (keymgr_if.otp_key),
.otp_i (keymgr_if.otp),
- .edn_i (keymgr_if.edn_rsp),
+ .edn_o (edn_if.req),
+ .edn_i ({edn_if.ack, edn_if.d_data}),
.flash_i (keymgr_if.flash),
.intr_op_done_o (interrupts[IntrOpDone]),
.intr_err_o (interrupts[IntrErr]),
@@ -60,6 +65,8 @@
uvm_config_db#(virtual keymgr_if)::set(null, "*.env", "keymgr_vif", keymgr_if);
uvm_config_db#(virtual keymgr_kmac_intf)::set(null,
"*env.m_keymgr_kmac_agent*", "vif", keymgr_kmac_intf);
+ uvm_config_db#(virtual push_pull_if#(.DeviceDataWidth(EDN_DATA_SIZE)))::set(null,
+ "*env.m_edn_pull_agent*", "vif", edn_if);
$timeformat(-12, 0, " ps", 12);
run_test();
end