Skip to content

Commit

Permalink
[hmac,dv] Adpot extern method declarations
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Velay <[email protected]>
  • Loading branch information
martin-velay authored and rswarbrick committed Nov 7, 2024
1 parent c52ee25 commit 35f9a82
Show file tree
Hide file tree
Showing 17 changed files with 2,262 additions and 2,009 deletions.
40 changes: 24 additions & 16 deletions hw/ip/hmac/dv/env/hmac_env.sv
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,31 @@ class hmac_env extends cip_base_env #(.CFG_T (hmac_env_cfg),
.VIRTUAL_SEQUENCER_T (hmac_virtual_sequencer),
.SCOREBOARD_T (hmac_scoreboard));
`uvm_component_utils(hmac_env)
`uvm_component_new

function void build_phase(uvm_phase phase);
super.build_phase(phase);
// Standard SV/UVM methods
extern function new(string name="", uvm_component parent=null);
extern function void build_phase(uvm_phase phase);
extern function void end_of_elaboration_phase(uvm_phase phase);
endclass : hmac_env

// config hmac virtual interface
if (!uvm_config_db#(hmac_vif)::get(this, "", "hmac_vif", cfg.hmac_vif)) begin
`uvm_fatal(`gfn, "failed to get hmac_vif from uvm_config_db")
end
endfunction

virtual function void end_of_elaboration_phase(uvm_phase phase);
dv_base_mem mem;
super.end_of_elaboration_phase(phase);
// hmac mem supports partial write, set it after ral model is locked
`downcast(mem, get_mem_by_addr(cfg.ral, cfg.ral.get_addr_from_offset(HMAC_MSG_FIFO_BASE)))
mem.set_mem_partial_write_support(1);
endfunction
function hmac_env::new(string name="", uvm_component parent=null);
super.new(name, parent);
endfunction : new

endclass
function void hmac_env::build_phase(uvm_phase phase);
super.build_phase(phase);

// config hmac virtual interface
if (!uvm_config_db#(hmac_vif)::get(this, "", "hmac_vif", cfg.hmac_vif)) begin
`uvm_fatal(`gfn, "failed to get hmac_vif from uvm_config_db")
end
endfunction : build_phase

function void hmac_env::end_of_elaboration_phase(uvm_phase phase);
dv_base_mem mem;
super.end_of_elaboration_phase(phase);
// hmac mem supports partial write, set it after ral model is locked
`downcast(mem, get_mem_by_addr(cfg.ral, cfg.ral.get_addr_from_offset(HMAC_MSG_FIFO_BASE)))
mem.set_mem_partial_write_support(1);
endfunction : end_of_elaboration_phase
29 changes: 19 additions & 10 deletions hw/ip/hmac/dv/env/hmac_env_cfg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class hmac_env_cfg extends cip_base_env_cfg #(.RAL_T(hmac_reg_block));
`uvm_object_utils(hmac_env_cfg)
`uvm_object_new

// A flag to nofity scoreboard if digest is corrupted by wipe_secret command.
bit wipe_secret_triggered;
Expand All @@ -25,14 +24,24 @@ class hmac_env_cfg extends cip_base_env_cfg #(.RAL_T(hmac_reg_block));

hmac_vif hmac_vif;

virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1);
list_of_alerts = hmac_env_pkg::LIST_OF_ALERTS;
super.initialize(csr_base_addr);
// set num_interrupts & num_alerts which will be used to create coverage and more
num_interrupts = ral.intr_state.get_n_used_bits();
// Standard SV/UVM methods
extern function new(string name="");

// only support 1 outstanding TL items in tlul_adapter
m_tl_agent_cfg.max_outstanding_req = 1;
endfunction
// Class specific methods
extern function void initialize(bit [TL_AW-1:0] csr_base_addr = '1);
endclass : hmac_env_cfg

endclass

function hmac_env_cfg::new(string name="");
super.new(name);
endfunction : new

function void hmac_env_cfg::initialize(bit [TL_AW-1:0] csr_base_addr = '1);
list_of_alerts = hmac_env_pkg::LIST_OF_ALERTS;
super.initialize(csr_base_addr);
// set num_interrupts & num_alerts which will be used to create coverage and more
num_interrupts = ral.intr_state.get_n_used_bits();

// only support 1 outstanding TL items in tlul_adapter
m_tl_agent_cfg.max_outstanding_req = 1;
endfunction : initialize
34 changes: 19 additions & 15 deletions hw/ip/hmac/dv/env/hmac_env_cov.sv
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,22 @@ class hmac_env_cov extends cip_base_env_cov #(.CFG_T(hmac_env_cfg));
sar_type_x_digest_size : cross save_and_restore_cp, digest_size_cp;
endgroup : save_and_restore_cg

function new(string name, uvm_component parent);
super.new(name, parent);
cfg_cg = new();
status_cg = new();
msg_len_cg = new();
err_code_cg = new();
wr_config_during_hash_cg = new();
wr_key_during_hash_cg = new();
wr_key_during_sha_only_cg = new();
wr_msg_during_hash_cg = new();
trig_rst_during_hash_cg = new();
rd_digest_during_hmac_en_cg = new();
save_and_restore_cg = new();
endfunction : new
endclass
// Standard SV/UVM methods
extern function new(string name, uvm_component parent);
endclass : hmac_env_cov


function hmac_env_cov::new(string name, uvm_component parent);
super.new(name, parent);
cfg_cg = new();
status_cg = new();
msg_len_cg = new();
err_code_cg = new();
wr_config_during_hash_cg = new();
wr_key_during_hash_cg = new();
wr_key_during_sha_only_cg = new();
wr_msg_during_hash_cg = new();
trig_rst_during_hash_cg = new();
rd_digest_during_hmac_en_cg = new();
save_and_restore_cg = new();
endfunction : new
Loading

0 comments on commit 35f9a82

Please sign in to comment.