diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/parameters/caliptra_top_parameters_pkg.sv b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/parameters/caliptra_top_parameters_pkg.sv index 5652f4e6b..514477d8f 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/parameters/caliptra_top_parameters_pkg.sv +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/parameters/caliptra_top_parameters_pkg.sv @@ -45,6 +45,7 @@ package caliptra_top_parameters_pkg; parameter string soc_ifc_subenv_cptra_ctrl_agent_BFM = "soc_ifc_subenv_cptra_ctrl_agent_BFM"; /* [3] */ parameter string soc_ifc_subenv_soc_ifc_status_agent_BFM = "soc_ifc_subenv_soc_ifc_status_agent_BFM"; /* [4] */ parameter string soc_ifc_subenv_cptra_status_agent_BFM = "soc_ifc_subenv_cptra_status_agent_BFM"; /* [5] */ + parameter string soc_ifc_subenv_mbox_sram_agent_BFM = "soc_ifc_subenv_mbox_sram_agent_BFM"; /* [6] */ // pragma uvmf custom package_item_additional begin // pragma uvmf custom package_item_additional end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/caliptra_top_sequences_pkg.sv b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/caliptra_top_sequences_pkg.sv index 93d8bb71e..d83fd278f 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/caliptra_top_sequences_pkg.sv +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/caliptra_top_sequences_pkg.sv @@ -47,6 +47,8 @@ package caliptra_top_sequences_pkg; import soc_ifc_status_pkg_hdl::*; import cptra_status_pkg::*; import cptra_status_pkg_hdl::*; + import mbox_sram_pkg::*; + import mbox_sram_pkg_hdl::*; import caliptra_top_parameters_pkg::*; import caliptra_top_env_pkg::*; import qvip_ahb_lite_slave_params_pkg::*; diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_bench_sequence_base.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_bench_sequence_base.svh index d0303bd74..cf13af914 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_bench_sequence_base.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_bench_sequence_base.svh @@ -57,6 +57,8 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq; typedef soc_ifc_status_responder_sequence soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t; soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t soc_ifc_subenv_soc_ifc_status_agent_responder_seq; + typedef mbox_sram_responder_sequence soc_ifc_subenv_mbox_sram_agent_responder_seq_t; + soc_ifc_subenv_mbox_sram_agent_responder_seq_t soc_ifc_subenv_mbox_sram_agent_responder_seq; // pragma uvmf custom sequences end // Sequencer handles for each active interface in the environment @@ -64,6 +66,8 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; uvm_sequencer #(soc_ifc_subenv_soc_ifc_ctrl_agent_transaction_t) soc_ifc_subenv_soc_ifc_ctrl_agent_sequencer; typedef soc_ifc_status_transaction soc_ifc_subenv_soc_ifc_status_agent_transaction_t; uvm_sequencer #(soc_ifc_subenv_soc_ifc_status_agent_transaction_t) soc_ifc_subenv_soc_ifc_status_agent_sequencer; + typedef mbox_sram_transaction soc_ifc_subenv_mbox_sram_agent_transaction_t; + uvm_sequencer #(soc_ifc_subenv_mbox_sram_agent_transaction_t) soc_ifc_subenv_mbox_sram_agent_sequencer; // Sequencer handles for each QVIP interface mvc_sequencer uvm_test_top_environment_soc_ifc_subenv_qvip_ahb_lite_slave_subenv_ahb_lite_slave_0_sqr; @@ -77,6 +81,7 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; cptra_ctrl_configuration soc_ifc_subenv_cptra_ctrl_agent_config; soc_ifc_status_configuration soc_ifc_subenv_soc_ifc_status_agent_config; cptra_status_configuration soc_ifc_subenv_cptra_status_agent_config; + mbox_sram_configuration soc_ifc_subenv_mbox_sram_agent_config; // pragma uvmf custom class_item_additional begin // pragma uvmf custom class_item_additional end @@ -101,10 +106,13 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; `uvm_fatal("CFG" , "uvm_config_db #( soc_ifc_status_configuration )::get cannot find resource soc_ifc_subenv_soc_ifc_status_agent_BFM" ) if( !uvm_config_db #( cptra_status_configuration )::get( null , UVMF_CONFIGURATIONS , soc_ifc_subenv_cptra_status_agent_BFM , soc_ifc_subenv_cptra_status_agent_config ) ) `uvm_fatal("CFG" , "uvm_config_db #( cptra_status_configuration )::get cannot find resource soc_ifc_subenv_cptra_status_agent_BFM" ) + if( !uvm_config_db #( mbox_sram_configuration )::get( null , UVMF_CONFIGURATIONS , soc_ifc_subenv_mbox_sram_agent_BFM , soc_ifc_subenv_mbox_sram_agent_config ) ) + `uvm_fatal("CFG" , "uvm_config_db #( mbox_sram_configuration )::get cannot find resource soc_ifc_subenv_mbox_sram_agent_BFM" ) // Assign the sequencer handles from the handles within agent configurations soc_ifc_subenv_soc_ifc_ctrl_agent_sequencer = soc_ifc_subenv_soc_ifc_ctrl_agent_config.get_sequencer(); soc_ifc_subenv_soc_ifc_status_agent_sequencer = soc_ifc_subenv_soc_ifc_status_agent_config.get_sequencer(); + soc_ifc_subenv_mbox_sram_agent_sequencer = soc_ifc_subenv_mbox_sram_agent_config.get_sequencer(); // Retrieve QVIP sequencer handles from the uvm_config_db if( !uvm_config_db #(mvc_sequencer)::get( null,UVMF_SEQUENCERS,"uvm_test_top.environment.soc_ifc_subenv.qvip_apb5_slave_subenv.apb5_master_0", uvm_test_top_environment_soc_ifc_subenv_qvip_apb5_slave_subenv_apb5_master_0_sqr) ) @@ -124,17 +132,20 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; caliptra_top_env_seq = caliptra_top_env_sequence_base_t::type_id::create("caliptra_top_env_seq"); - soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq = soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq"); - soc_ifc_subenv_soc_ifc_status_agent_responder_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_status_agent_responder_seq"); + soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq = soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq"); + soc_ifc_subenv_soc_ifc_status_agent_responder_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_status_agent_responder_seq"); + soc_ifc_subenv_mbox_sram_agent_responder_seq = soc_ifc_subenv_mbox_sram_agent_responder_seq_t::type_id::create("soc_ifc_subenv_mbox_sram_agent_responder_seq"); fork soc_ifc_subenv_soc_ifc_ctrl_agent_config.wait_for_reset(); soc_ifc_subenv_cptra_ctrl_agent_config.wait_for_reset(); soc_ifc_subenv_soc_ifc_status_agent_config.wait_for_reset(); soc_ifc_subenv_cptra_status_agent_config.wait_for_reset(); + soc_ifc_subenv_mbox_sram_agent_config.wait_for_reset(); join // Start RESPONDER sequences here fork soc_ifc_subenv_soc_ifc_status_agent_responder_seq.start(soc_ifc_subenv_soc_ifc_status_agent_sequencer); + soc_ifc_subenv_mbox_sram_agent_responder_seq.start(soc_ifc_subenv_mbox_sram_agent_sequencer); join_none // Start INITIATOR sequences here fork @@ -151,6 +162,7 @@ caliptra_top_env_seq.start(top_configuration.vsqr); soc_ifc_subenv_cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_soc_ifc_status_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_cptra_status_agent_config.wait_for_num_clocks(400); + soc_ifc_subenv_mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_cmdline_sequence.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_cmdline_sequence.svh index a92b05136..7b45d983f 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_cmdline_sequence.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_cmdline_sequence.svh @@ -85,6 +85,7 @@ class caliptra_top_cmdline_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq = soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq"); soc_ifc_subenv_soc_ifc_status_agent_responder_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_status_agent_responder_seq"); + soc_ifc_subenv_mbox_sram_agent_responder_seq = soc_ifc_subenv_mbox_sram_agent_responder_seq_t::type_id::create("soc_ifc_subenv_mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq; @@ -95,6 +96,7 @@ class caliptra_top_cmdline_sequence extends caliptra_top_bench_sequence_base; // Start RESPONDER sequences here fork soc_ifc_subenv_soc_ifc_status_agent_responder_seq.start(soc_ifc_subenv_soc_ifc_status_agent_sequencer); + soc_ifc_subenv_mbox_sram_agent_responder_seq.start(soc_ifc_subenv_mbox_sram_agent_sequencer); join_none fork @@ -151,6 +153,7 @@ class caliptra_top_cmdline_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_soc_ifc_status_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_cptra_status_agent_config.wait_for_num_clocks(400); + soc_ifc_subenv_mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rand_sequence.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rand_sequence.svh index d8447b61e..57248b29d 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rand_sequence.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rand_sequence.svh @@ -167,6 +167,8 @@ class caliptra_top_rand_sequence extends caliptra_top_bench_sequence_base; bit pauser_valid_initialized = 1'b0; uvm_object obj; int ii; + int unsigned mbox_ecc_single_error_burst; + int unsigned mbox_ecc_single_error_delay_clocks; caliptra_top_env_seq = caliptra_top_env_sequence_base_t::type_id::create("caliptra_top_env_seq"); soc_ifc_env_bringup_seq = soc_ifc_env_bringup_sequence_t::type_id::create("soc_ifc_env_bringup_seq"); @@ -176,6 +178,7 @@ class caliptra_top_rand_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq = soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq"); soc_ifc_subenv_soc_ifc_status_agent_responder_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_status_agent_responder_seq"); + soc_ifc_subenv_mbox_sram_agent_responder_seq = soc_ifc_subenv_mbox_sram_agent_responder_seq_t::type_id::create("soc_ifc_subenv_mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq; @@ -193,11 +196,27 @@ class caliptra_top_rand_sequence extends caliptra_top_bench_sequence_base; // Start RESPONDER sequences here fork soc_ifc_subenv_soc_ifc_status_agent_responder_seq.start(soc_ifc_subenv_soc_ifc_status_agent_sequencer); + soc_ifc_subenv_mbox_sram_agent_responder_seq.start(soc_ifc_subenv_mbox_sram_agent_sequencer); join_none // // Start INITIATOR sequences here // fork // repeat (25) soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq.start(soc_ifc_subenv_soc_ifc_ctrl_agent_sequencer); // join + fork + forever begin + if (!std::randomize(mbox_ecc_single_error_burst,mbox_ecc_single_error_delay_clocks) with {mbox_ecc_single_error_burst dist {1 :/ 1000, [2:5] :/ 100, [6:31] :/ 20, [32:131071] :/ 1, [131072:524288] :/ 1}; + mbox_ecc_single_error_delay_clocks dist {1 :/ 1, [2:31] :/ 3, [32:127] :/ 5, [128:1023] :/ 3, [1024:131072] :/ 1}; }) + `uvm_fatal("CALIPTRA_TOP_RAND_TEST", "Failed to randomize mbox ecc bit flip injection parameters") + else + `uvm_info("CALIPTRA_TOP_RAND_TEST", $sformatf("Randomized mbox ecc bit flip injection parameters: burst [%0d] delay [%0d clocks]", mbox_ecc_single_error_burst, mbox_ecc_single_error_delay_clocks), UVM_DEBUG) + soc_ifc_subenv_soc_ifc_ctrl_agent_config.wait_for_num_clocks(mbox_ecc_single_error_delay_clocks); + `uvm_info("CALIPTRA_TOP_RAND_TEST", $sformatf("Injecting mbox ecc error with burst [%0d]", mbox_ecc_single_error_burst), UVM_DEBUG) + repeat(mbox_ecc_single_error_burst) begin + soc_ifc_subenv_mbox_sram_agent_config.inject_ecc_error |= 2'b01; + @soc_ifc_subenv_mbox_sram_agent_responder_seq.new_rsp; + end + end + join_none fork forever @(soc_ifc_subenv_soc_ifc_status_agent_responder_seq.new_rsp) sts_rsp_count++; join_none @@ -347,6 +366,7 @@ class caliptra_top_rand_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_soc_ifc_status_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_cptra_status_agent_config.wait_for_num_clocks(400); + soc_ifc_subenv_mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rom_sequence.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rom_sequence.svh index 2498b50af..237d56ff4 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rom_sequence.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/sequences/src/caliptra_top_rom_sequence.svh @@ -70,6 +70,7 @@ class caliptra_top_rom_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq = soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_ctrl_agent_random_seq"); soc_ifc_subenv_soc_ifc_status_agent_responder_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_subenv_soc_ifc_status_agent_responder_seq"); + soc_ifc_subenv_mbox_sram_agent_responder_seq = soc_ifc_subenv_mbox_sram_agent_responder_seq_t::type_id::create("soc_ifc_subenv_mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_subenv_soc_ifc_status_agent_responder_seq; @@ -79,6 +80,7 @@ class caliptra_top_rom_sequence extends caliptra_top_bench_sequence_base; // Start RESPONDER sequences here fork soc_ifc_subenv_soc_ifc_status_agent_responder_seq.start(soc_ifc_subenv_soc_ifc_status_agent_sequencer); + soc_ifc_subenv_mbox_sram_agent_responder_seq.start(soc_ifc_subenv_mbox_sram_agent_sequencer); join_none fork @@ -108,6 +110,7 @@ class caliptra_top_rom_sequence extends caliptra_top_bench_sequence_base; soc_ifc_subenv_cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_soc_ifc_status_agent_config.wait_for_num_clocks(400); soc_ifc_subenv_cptra_status_agent_config.wait_for_num_clocks(400); + soc_ifc_subenv_mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv index c4884273f..6135cfbfe 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv @@ -109,11 +109,13 @@ import uvmf_base_pkg_hdl::*; logic jtag_trst_n = '0; // JTAG Reset logic jtag_tdo; // JTAG TDO - logic mbox_sram_cs; - logic mbox_sram_we; - logic [14:0] mbox_sram_addr; - logic [MBOX_DATA_AND_ECC_W-1:0] mbox_sram_wdata; - logic [MBOX_DATA_AND_ECC_W-1:0] mbox_sram_rdata; + mbox_sram_req_t mbox_sram_req; + mbox_sram_resp_t mbox_sram_resp; + logic mbox_sram_cs_stub_inactive; + logic mbox_sram_we_stub_inactive; + logic [14:0] mbox_sram_addr_stub_inactive; + logic [MBOX_DATA_AND_ECC_W-1:0] mbox_sram_wdata_stub_inactive; + logic [MBOX_DATA_AND_ECC_W-1:0] mbox_sram_rdata_stub_inactive; logic imem_cs; logic [`CALIPTRA_IMEM_ADDR_WIDTH-1:0] imem_addr; @@ -153,12 +155,19 @@ import uvmf_base_pkg_hdl::*; .clk(clk), .dummy(1'b1) // pragma uvmf custom soc_ifc_subenv_cptra_status_agent_bus_connections end ); + mbox_sram_if soc_ifc_subenv_mbox_sram_agent_bus( + // pragma uvmf custom soc_ifc_subenv_mbox_sram_agent_bus_connections begin + .clk(clk), .dummy(1'b1) + // pragma uvmf custom soc_ifc_subenv_mbox_sram_agent_bus_connections end + ); soc_ifc_ctrl_monitor_bfm soc_ifc_subenv_soc_ifc_ctrl_agent_mon_bfm(soc_ifc_subenv_soc_ifc_ctrl_agent_bus.monitor_port); cptra_ctrl_monitor_bfm soc_ifc_subenv_cptra_ctrl_agent_mon_bfm(soc_ifc_subenv_cptra_ctrl_agent_bus.monitor_port); soc_ifc_status_monitor_bfm soc_ifc_subenv_soc_ifc_status_agent_mon_bfm(soc_ifc_subenv_soc_ifc_status_agent_bus.monitor_port); cptra_status_monitor_bfm soc_ifc_subenv_cptra_status_agent_mon_bfm(soc_ifc_subenv_cptra_status_agent_bus.monitor_port); + mbox_sram_monitor_bfm soc_ifc_subenv_mbox_sram_agent_mon_bfm(soc_ifc_subenv_mbox_sram_agent_bus.monitor_port); soc_ifc_ctrl_driver_bfm soc_ifc_subenv_soc_ifc_ctrl_agent_drv_bfm(soc_ifc_subenv_soc_ifc_ctrl_agent_bus.initiator_port); soc_ifc_status_driver_bfm soc_ifc_subenv_soc_ifc_status_agent_drv_bfm(soc_ifc_subenv_soc_ifc_status_agent_bus.responder_port); + mbox_sram_driver_bfm soc_ifc_subenv_mbox_sram_agent_drv_bfm(soc_ifc_subenv_mbox_sram_agent_bus.responder_port); // pragma uvmf custom dut_instantiation begin // AHB Clock/reset @@ -207,11 +216,11 @@ import uvmf_base_pkg_hdl::*; .ready_for_fw_push(soc_ifc_subenv_soc_ifc_status_agent_bus.ready_for_fw_push ), .ready_for_runtime(soc_ifc_subenv_soc_ifc_status_agent_bus.ready_for_runtime ), - .mbox_sram_cs (mbox_sram_cs ), - .mbox_sram_we (mbox_sram_we ), - .mbox_sram_addr (mbox_sram_addr ), - .mbox_sram_wdata(mbox_sram_wdata), - .mbox_sram_rdata(mbox_sram_rdata), + .mbox_sram_cs (mbox_sram_req.cs ), + .mbox_sram_we (mbox_sram_req.we ), + .mbox_sram_addr (mbox_sram_req.addr ), + .mbox_sram_wdata(mbox_sram_req.wdata), + .mbox_sram_rdata(mbox_sram_resp.rdata), .imem_cs (imem_cs ), .imem_addr (imem_addr ), @@ -234,7 +243,7 @@ import uvmf_base_pkg_hdl::*; .generic_output_wires(soc_ifc_subenv_soc_ifc_status_agent_bus.generic_output_wires), .security_state(soc_ifc_subenv_soc_ifc_ctrl_agent_bus.security_state), - .scan_mode (1'b0) + .scan_mode (1'b0) // TODO ); assign uvm_test_top_environment_soc_ifc_subenv_qvip_apb5_slave_subenv_qvip_hdl.apb5_master_0_PWUSER = 0; assign uvm_test_top_environment_soc_ifc_subenv_qvip_apb5_slave_subenv_qvip_hdl.apb5_master_0_PRUSER = 0; @@ -297,6 +306,9 @@ import uvmf_base_pkg_hdl::*; assign soc_ifc_subenv_cptra_ctrl_agent_bus.iccm_axs_blocked = caliptra_top_dut.ahb_lite_resp_access_blocked[`CALIPTRA_SLAVE_SEL_IDMA]; assign soc_ifc_subenv_cptra_ctrl_agent_bus.rv_ecc_sts = caliptra_top_dut.rv_ecc_sts; + assign soc_ifc_subenv_mbox_sram_agent_bus.mbox_sram_req = mbox_sram_req; + assign mbox_sram_resp = soc_ifc_subenv_mbox_sram_agent_bus.mbox_sram_resp; + //=========================================================================- // Services for SRAM exports, STDOUT, etc //=========================================================================- @@ -311,11 +323,11 @@ import uvmf_base_pkg_hdl::*; .el2_mem_export (el2_mem_export), //SRAM interface for mbox - .mbox_sram_cs (mbox_sram_cs ), - .mbox_sram_we (mbox_sram_we ), - .mbox_sram_addr (mbox_sram_addr ), - .mbox_sram_wdata(mbox_sram_wdata), - .mbox_sram_rdata(mbox_sram_rdata), + .mbox_sram_cs (mbox_sram_cs_stub_inactive ), + .mbox_sram_we (mbox_sram_we_stub_inactive ), + .mbox_sram_addr (mbox_sram_addr_stub_inactive ), + .mbox_sram_wdata(mbox_sram_wdata_stub_inactive), + .mbox_sram_rdata(mbox_sram_rdata_stub_inactive), //SRAM interface for imem .imem_cs (imem_cs ), @@ -346,8 +358,10 @@ import uvmf_base_pkg_hdl::*; uvm_config_db #( virtual cptra_ctrl_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_cptra_ctrl_agent_BFM , soc_ifc_subenv_cptra_ctrl_agent_mon_bfm ); uvm_config_db #( virtual soc_ifc_status_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_soc_ifc_status_agent_BFM , soc_ifc_subenv_soc_ifc_status_agent_mon_bfm ); uvm_config_db #( virtual cptra_status_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_cptra_status_agent_BFM , soc_ifc_subenv_cptra_status_agent_mon_bfm ); + uvm_config_db #( virtual mbox_sram_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_mbox_sram_agent_BFM , soc_ifc_subenv_mbox_sram_agent_mon_bfm ); uvm_config_db #( virtual soc_ifc_ctrl_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_soc_ifc_ctrl_agent_BFM , soc_ifc_subenv_soc_ifc_ctrl_agent_drv_bfm ); uvm_config_db #( virtual soc_ifc_status_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_soc_ifc_status_agent_BFM , soc_ifc_subenv_soc_ifc_status_agent_drv_bfm ); + uvm_config_db #( virtual mbox_sram_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_subenv_mbox_sram_agent_BFM , soc_ifc_subenv_mbox_sram_agent_drv_bfm ); end endmodule diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src/test_top.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src/test_top.svh index d7b840b4a..1d0b78285 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src/test_top.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src/test_top.svh @@ -52,7 +52,8 @@ qvip_memory_message_handler message_handler; soc_ifc_subenv_soc_ifc_ctrl_agent_BFM /* soc_ifc_subenv_soc_ifc_ctrl_agent [2] */ , soc_ifc_subenv_cptra_ctrl_agent_BFM /* soc_ifc_subenv_cptra_ctrl_agent [3] */ , soc_ifc_subenv_soc_ifc_status_agent_BFM /* soc_ifc_subenv_soc_ifc_status_agent [4] */ , - soc_ifc_subenv_cptra_status_agent_BFM /* soc_ifc_subenv_cptra_status_agent [5] */ + soc_ifc_subenv_cptra_status_agent_BFM /* soc_ifc_subenv_cptra_status_agent [5] */ , + soc_ifc_subenv_mbox_sram_agent_BFM /* soc_ifc_subenv_mbox_sram_agent [6] */ }; uvmf_active_passive_t interface_activities[] = { @@ -61,7 +62,8 @@ uvmf_active_passive_t interface_activities[] = { ACTIVE /* soc_ifc_subenv_soc_ifc_ctrl_agent [2] */ , PASSIVE /* soc_ifc_subenv_cptra_ctrl_agent [3] */ , ACTIVE /* soc_ifc_subenv_soc_ifc_status_agent [4] */ , - PASSIVE /* soc_ifc_subenv_cptra_status_agent [5] */ }; + PASSIVE /* soc_ifc_subenv_cptra_status_agent [5] */ , + ACTIVE /* soc_ifc_subenv_mbox_sram_agent [6] */ }; // pragma uvmf custom class_item_additional begin // pragma uvmf custom class_item_additional end diff --git a/src/integration/uvmf_caliptra_top/uvmf_template_output/verification_ip/environment_packages/caliptra_top_env_pkg/src/caliptra_top_env_configuration.svh b/src/integration/uvmf_caliptra_top/uvmf_template_output/verification_ip/environment_packages/caliptra_top_env_pkg/src/caliptra_top_env_configuration.svh index 8c57ff4c2..52763e73d 100644 --- a/src/integration/uvmf_caliptra_top/uvmf_template_output/verification_ip/environment_packages/caliptra_top_env_pkg/src/caliptra_top_env_configuration.svh +++ b/src/integration/uvmf_caliptra_top/uvmf_template_output/verification_ip/environment_packages/caliptra_top_env_pkg/src/caliptra_top_env_configuration.svh @@ -130,11 +130,11 @@ rand soc_ifc_subenv_config_t soc_ifc_subenv_config; super.initialize(sim_level, environment_path, interface_names, register_model, interface_activity); // Interface initialization for sub-environments - soc_ifc_subenv_interface_names = new[6]; - soc_ifc_subenv_interface_activity = new[6]; + soc_ifc_subenv_interface_names = new[7]; + soc_ifc_subenv_interface_activity = new[7]; - soc_ifc_subenv_interface_names = interface_names[0:5]; - soc_ifc_subenv_interface_activity = interface_activity[0:5]; + soc_ifc_subenv_interface_names = interface_names[0:6]; + soc_ifc_subenv_interface_activity = interface_activity[0:6]; diff --git a/src/soc_ifc/uvmf_soc_ifc/config/compile.yml b/src/soc_ifc/uvmf_soc_ifc/config/compile.yml index 02b0c1f87..1f9cf8295 100644 --- a/src/soc_ifc/uvmf_soc_ifc/config/compile.yml +++ b/src/soc_ifc/uvmf_soc_ifc/config/compile.yml @@ -16,6 +16,8 @@ targets: - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/soc_ifc_status_pkg/src - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/cptra_status_pkg - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/cptra_status_pkg/src + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers files: @@ -39,6 +41,11 @@ targets: - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/cptra_status_pkg/src/cptra_status_driver_bfm.sv - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/cptra_status_pkg/src/cptra_status_if.sv - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/cptra_status_pkg/src/cptra_status_monitor_bfm.sv + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.sv + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.sv + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver_bfm.sv + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_if.sv + - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor_bfm.sv - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_model_top_pkg.sv - ${COMPILE_ROOT}/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.sv --- diff --git a/src/soc_ifc/uvmf_soc_ifc/mbox_sram_interface.yaml b/src/soc_ifc/uvmf_soc_ifc/mbox_sram_interface.yaml new file mode 100644 index 000000000..52470e489 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/mbox_sram_interface.yaml @@ -0,0 +1,67 @@ +uvmf: + interfaces: + mbox_sram: + clock: clk + reset: dummy + reset_assertion_level: 'False' + + config_constraints: [] + config_vars: + - name: "inject_ecc_error" + type: "bit [1:0]" + isrand: "False" + value: "2'b00" + comment: "Controls injection of ECC errors for write transactions. Bit[0]: Single Bit Error. Bit[1]: Double Bit Error" + - name: "auto_clear_ecc_error_injection" + type: "bit" + isrand: "False" + value: "1'b1" + comment: "When set, causes the mbox_sram_responder_sequence to clear the variable 'inject_ecc_error' after a single ECC error is injected" + + hdl_typedefs: [] + hvl_typedefs: [] + + # NOTE: This agent will be in RESPONDER mode, which inverts + # all port's polarities + ports: + - name: mbox_sram_req + dir: output + width: '$bits(mbox_sram_req_t)' + # cs (1) + we (1) + addr (15) + data (32) + ecc (7) = 56 + - name: mbox_sram_resp + dir: input + width: '$bits(mbox_sram_resp_t)' + # data (32) + ecc (7) = 39 + + transaction_constraints: [] +# - name: wait_cycles_c +# value: '{ wait_cycles dist {[1:25] := 80, [25:100] := 15, [100:500] := 5}; }' + + transaction_vars: + - name: is_read + type: bit + iscompare: 'True' + isrand: 'True' + - name: address + type: bit [MBOX_ADDR_W-1:0] + iscompare: 'True' + isrand: 'True' + - name: data + type: bit [MBOX_DATA_W-1:0] + iscompare: 'True' + isrand: 'True' + # ECC would be generated based on data, post_randomize, in the case where + # this transaction is generated as stimulus. + # We mostly expect to use this i/f as an observer though. + - name: data_ecc + type: bit [MBOX_ECC_DATA_W-1:0] + iscompare: 'True' + isrand: 'False' + - name: ecc_single_bit_error + type: bit + iscompare: 'True' + isrand: 'True' + - name: ecc_double_bit_error + type: bit + iscompare: 'True' + isrand: 'True' diff --git a/src/soc_ifc/uvmf_soc_ifc/run_yaml_uvmf_scripts.sh b/src/soc_ifc/uvmf_soc_ifc/run_yaml_uvmf_scripts.sh index 80497eeda..f0597c4d7 100755 --- a/src/soc_ifc/uvmf_soc_ifc/run_yaml_uvmf_scripts.sh +++ b/src/soc_ifc/uvmf_soc_ifc/run_yaml_uvmf_scripts.sh @@ -4,6 +4,7 @@ python ${UVMF_HOME}/scripts/yaml2uvmf.py --merge_source uvmf_template_output \ soc_ifc_global.yaml \ soc_ifc_ctrl_interface.yaml \ soc_ifc_status_interface.yaml \ + mbox_sram_interface.yaml \ soc_ifc_util_comp_soc_ifc_predictor.yaml \ soc_ifc_util_comp_soc_ifc_scoreboard.yaml \ ../../libs/uvmf/qvip_ahb_lite_slave_dir/uvmf/qvip_ahb_lite_slave_subenv_config.yaml \ diff --git a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_bench.yaml b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_bench.yaml index 5b35bf45d..a5b3fbc4c 100755 --- a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_bench.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_bench.yaml @@ -18,6 +18,8 @@ uvmf: value: ACTIVE - bfm_name: cptra_status_agent value: ACTIVE + - bfm_name: mbox_sram_agent + value: ACTIVE clock_half_period: 5ns clock_phase_offset: 0ns diff --git a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_environment.yaml b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_environment.yaml index ca462f3c2..468989270 100755 --- a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_environment.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_environment.yaml @@ -17,6 +17,9 @@ uvmf: - name: cptra_status_agent type: cptra_status initiator_responder: "RESPONDER" + - name: mbox_sram_agent + type: mbox_sram + initiator_responder: "RESPONDER" analysis_components: - name: soc_ifc_pred @@ -66,6 +69,8 @@ uvmf: receiver: soc_ifc_pred.soc_ifc_ctrl_agent_ae # - driver: cptra_ctrl_agent.monitored_ap # Caliptra Control receiver: soc_ifc_pred.cptra_ctrl_agent_ae # + - driver: mbox_sram_agent.monitored_ap # Mailbox SRAM i/f + receiver: soc_ifc_pred.mbox_sram_agent_ae # # - driver: qvip_ahb_lite_master_subenv.ahb_master_0.export_rw # AHB # receiver: soc_ifc_pred.ahb_master_0_ae # # - driver: qvip_apb5_master_subenv.apb5_master_0.export_rw # APB diff --git a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_util_comp_soc_ifc_predictor.yaml b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_util_comp_soc_ifc_predictor.yaml index 692d4f915..8d8ce87cb 100755 --- a/src/soc_ifc/uvmf_soc_ifc/soc_ifc_util_comp_soc_ifc_predictor.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/soc_ifc_util_comp_soc_ifc_predictor.yaml @@ -7,6 +7,8 @@ uvmf: type: 'soc_ifc_ctrl_transaction' - name: cptra_ctrl_agent_ae type: 'cptra_ctrl_transaction' + - name: mbox_sram_agent_ae + type: 'mbox_sram_transaction' - name: ahb_slave_0_ae type: 'mvc_sequence_item_base' # type: 'ahb_master_burst_transfer #(ahb_lite_slave_0_params::AHB_NUM_MASTERS, diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/docs/interfaces.csv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/docs/interfaces.csv index dd76c8f8e..e411f7a9a 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/docs/interfaces.csv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/docs/interfaces.csv @@ -27,4 +27,5 @@ soc_ifc_ctrl_agent, soc_ifc_ctrl_driver_bfm soc_ifc_ctrl_monitor_bfm, soc_ifc_ct cptra_ctrl_agent, cptra_ctrl_driver_bfm cptra_ctrl_monitor_bfm, cptra_ctrl_transaction, cptra_ctrl_pkg_cptra_ctrl_agent_BFM, soc_ifc_status_agent, soc_ifc_status_driver_bfm soc_ifc_status_monitor_bfm, soc_ifc_status_transaction, soc_ifc_status_pkg_soc_ifc_status_agent_BFM, cptra_status_agent, cptra_status_driver_bfm cptra_status_monitor_bfm, cptra_status_transaction, cptra_status_pkg_cptra_status_agent_BFM, +mbox_sram_agent, mbox_sram_driver_bfm mbox_sram_monitor_bfm, mbox_sram_transaction, mbox_sram_pkg_mbox_sram_agent_BFM, diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/Makefile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/Makefile index 1b5fcb327..6c3120c72 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/Makefile +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/Makefile @@ -87,6 +87,7 @@ include $(UVMF_VIP_LIBRARY_HOME)/interface_packages/soc_ifc_ctrl_pkg/Makefile include $(UVMF_VIP_LIBRARY_HOME)/interface_packages/cptra_ctrl_pkg/Makefile include $(UVMF_VIP_LIBRARY_HOME)/interface_packages/soc_ifc_status_pkg/Makefile include $(UVMF_VIP_LIBRARY_HOME)/interface_packages/cptra_status_pkg/Makefile +include $(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/Makefile # Include all requisite environment package targets for this bench include $(UVMF_VIP_LIBRARY_HOME)/environment_packages/soc_ifc_env_pkg/Makefile @@ -196,7 +197,7 @@ comp_hvl : comp_hvl_core comp_hvl_core : comp_qvip comp_qvip_utils_pkg \ - comp_soc_ifc_ctrl_pkg comp_cptra_ctrl_pkg comp_soc_ifc_status_pkg comp_cptra_status_pkg \ + comp_soc_ifc_ctrl_pkg comp_cptra_ctrl_pkg comp_soc_ifc_status_pkg comp_cptra_status_pkg comp_mbox_sram_pkg \ comp_soc_ifc_env_pkg \ comp_soc_ifc_parameters_pkg comp_soc_ifc_sequence_pkg comp_soc_ifc_tests_pkg @@ -204,7 +205,7 @@ comp_uvmf_core : comp_uvm_pkg comp_uvmf_base_pkg make_build: comp_soc_ifc_dut comp_uvmf_core comp_hvl comp_test_bench -hvl_build: q_comp_soc_ifc_ctrl_pkg q_comp_cptra_ctrl_pkg q_comp_soc_ifc_status_pkg q_comp_cptra_status_pkg comp_soc_ifc_env_pkg comp_soc_ifc_sequence_pkg comp_soc_ifc_tests_pkg hvl_comp_testbench link optimize +hvl_build: q_comp_soc_ifc_ctrl_pkg q_comp_cptra_ctrl_pkg q_comp_soc_ifc_status_pkg q_comp_cptra_status_pkg q_comp_mbox_sram_pkg comp_soc_ifc_env_pkg comp_soc_ifc_sequence_pkg comp_soc_ifc_tests_pkg hvl_comp_testbench link optimize vinfo_build: comp_qvip comp_soc_ifc_vhdl_dut build_hdl_vinfo build_hvl_vinfo $(VINFO_TGT) diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/compile.do b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/compile.do index ea7be28a2..f45e56a43 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/compile.do +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/compile.do @@ -58,6 +58,7 @@ do $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/soc_ifc_ctrl_pkg/compile.do do $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/cptra_ctrl_pkg/compile.do do $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/soc_ifc_status_pkg/compile.do do $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/cptra_status_pkg/compile.do +do $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/compile.do ################################################################### ## UVMF ENVIRONMENT COMPILATION diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/viswave.do b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/viswave.do index 7fb0d70b7..58934106e 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/viswave.do +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/viswave.do @@ -28,6 +28,12 @@ wave group cptra_status_agent_bus wave add -group cptra_status_agent_bus hdl_top.cptra_status_agent_bus.* -radix hexadecimal -tag F0 wave group cptra_status_agent_bus -collapse wave insertion [expr [wave index insertpoint] +1] +wave spacer -backgroundcolor Salmon { mbox_sram_agent } +wave add uvm_test_top.environment.mbox_sram_agent.mbox_sram_agent_monitor.txn_stream -radix string -tag F0 +wave group mbox_sram_agent_bus +wave add -group mbox_sram_agent_bus hdl_top.mbox_sram_agent_bus.* -radix hexadecimal -tag F0 +wave group mbox_sram_agent_bus -collapse +wave insertion [expr [wave index insertpoint] +1] wave update on WaveSetStreamView diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/wave.do b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/wave.do index 7e0fc1e33..1ba8a1615 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/wave.do +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/sim/wave.do @@ -15,6 +15,9 @@ add wave -noupdate -group soc_ifc_status_agent_bus /hdl_top/soc_ifc_status_agent add wave -noupdate -divider cptra_status_agent add wave -noupdate /uvm_root/uvm_test_top/environment/cptra_status_agent/cptra_status_agent_monitor/txn_stream add wave -noupdate -group cptra_status_agent_bus /hdl_top/cptra_status_agent_bus/* +add wave -noupdate -divider mbox_sram_agent +add wave -noupdate /uvm_root/uvm_test_top/environment/mbox_sram_agent/mbox_sram_agent_monitor/txn_stream +add wave -noupdate -group mbox_sram_agent_bus /hdl_top/mbox_sram_agent_bus/* TreeUpdate [SetDefaultTree] quietly wave cursor active 0 diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/soc_ifc_sve.F b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/soc_ifc_sve.F index c88496249..2114f41e2 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/soc_ifc_sve.F +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/soc_ifc_sve.F @@ -12,6 +12,7 @@ -F ${UVMF_VIP_LIBRARY_HOME}/interface_packages/cptra_ctrl_pkg/cptra_ctrl_pkg_sve.F -F ${UVMF_VIP_LIBRARY_HOME}/interface_packages/soc_ifc_status_pkg/soc_ifc_status_pkg_sve.F -F ${UVMF_VIP_LIBRARY_HOME}/interface_packages/cptra_status_pkg/cptra_status_pkg_sve.F +-F ${UVMF_VIP_LIBRARY_HOME}/interface_packages/mbox_sram_pkg/mbox_sram_pkg_sve.F // Environment Files -F ${UVMF_VIP_LIBRARY_HOME}/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg_sve.F diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/parameters/soc_ifc_parameters_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/parameters/soc_ifc_parameters_pkg.sv index d6e073e1e..af3cb9a50 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/parameters/soc_ifc_parameters_pkg.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/parameters/soc_ifc_parameters_pkg.sv @@ -45,6 +45,7 @@ package soc_ifc_parameters_pkg; parameter string cptra_ctrl_agent_BFM = "cptra_ctrl_agent_BFM"; /* [3] */ parameter string soc_ifc_status_agent_BFM = "soc_ifc_status_agent_BFM"; /* [4] */ parameter string cptra_status_agent_BFM = "cptra_status_agent_BFM"; /* [5] */ + parameter string mbox_sram_agent_BFM = "mbox_sram_agent_BFM"; /* [6] */ // pragma uvmf custom package_item_additional begin // pragma uvmf custom package_item_additional end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.compile index 1243f5665..943dc7955 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.compile +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.compile @@ -4,6 +4,7 @@ needs: - ../../../../verification_ip/interface_packages/cptra_ctrl_pkg/cptra_ctrl.compile - ../../../../verification_ip/interface_packages/soc_ifc_status_pkg/soc_ifc_status.compile - ../../../../verification_ip/interface_packages/cptra_status_pkg/cptra_status.compile + - ../../../../verification_ip/interface_packages/mbox_sram_pkg/mbox_sram.compile - ../../../../verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile - ../parameters/soc_ifc_parameters_pkg.compile src: diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.sv index f109f898e..2c25d7490 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.sv @@ -47,6 +47,8 @@ package soc_ifc_sequences_pkg; import soc_ifc_status_pkg_hdl::*; import cptra_status_pkg::*; import cptra_status_pkg_hdl::*; + import mbox_sram_pkg::*; + import mbox_sram_pkg_hdl::*; import soc_ifc_parameters_pkg::*; import soc_ifc_env_pkg::*; import qvip_ahb_lite_slave_params_pkg::*; diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.vinfo index fea3885f7..035e660ea 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.vinfo +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/soc_ifc_sequences_pkg.vinfo @@ -3,6 +3,7 @@ @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_ctrl_pkg/cptra_ctrl_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/soc_ifc_status_pkg/soc_ifc_status_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_status_pkg/cptra_status_pkg.vinfo +@use $UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo @use $UVMF_PROJECT_DIR/tb/parameters/soc_ifc_parameters_pkg.vinfo +incdir+@vinfodir diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/register_test_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/register_test_sequence.svh index 09993ee2a..85a802e5d 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/register_test_sequence.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/register_test_sequence.svh @@ -55,6 +55,7 @@ class register_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_config.wait_for_reset(); soc_ifc_status_agent_config.wait_for_reset(); cptra_status_agent_config.wait_for_reset(); + mbox_sram_agent_config.wait_for_reset(); // pragma uvmf custom register_test_reset end join diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_bench_sequence_base.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_bench_sequence_base.svh index d3465bf39..3dfaeaac9 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_bench_sequence_base.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_bench_sequence_base.svh @@ -56,6 +56,8 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; soc_ifc_status_agent_responder_seq_t soc_ifc_status_agent_responder_seq; typedef cptra_status_responder_sequence cptra_status_agent_responder_seq_t; cptra_status_agent_responder_seq_t cptra_status_agent_responder_seq; + typedef mbox_sram_responder_sequence mbox_sram_agent_responder_seq_t; + mbox_sram_agent_responder_seq_t mbox_sram_agent_responder_seq; // pragma uvmf custom sequences end // Sequencer handles for each active interface in the environment @@ -67,6 +69,8 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; uvm_sequencer #(soc_ifc_status_agent_transaction_t) soc_ifc_status_agent_sequencer; typedef cptra_status_transaction cptra_status_agent_transaction_t; uvm_sequencer #(cptra_status_agent_transaction_t) cptra_status_agent_sequencer; + typedef mbox_sram_transaction mbox_sram_agent_transaction_t; + uvm_sequencer #(mbox_sram_agent_transaction_t) mbox_sram_agent_sequencer; // Sequencer handles for each QVIP interface mvc_sequencer uvm_test_top_environment_qvip_ahb_lite_slave_subenv_ahb_lite_slave_0_sqr; @@ -80,6 +84,7 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; cptra_ctrl_configuration cptra_ctrl_agent_config; soc_ifc_status_configuration soc_ifc_status_agent_config; cptra_status_configuration cptra_status_agent_config; + mbox_sram_configuration mbox_sram_agent_config; // Local handle to register model for convenience soc_ifc_reg_model_top reg_model; uvm_status_e status; @@ -107,12 +112,15 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; `uvm_fatal("CFG" , "uvm_config_db #( soc_ifc_status_configuration )::get cannot find resource soc_ifc_status_agent_BFM" ) if( !uvm_config_db #( cptra_status_configuration )::get( null , UVMF_CONFIGURATIONS , cptra_status_agent_BFM , cptra_status_agent_config ) ) `uvm_fatal("CFG" , "uvm_config_db #( cptra_status_configuration )::get cannot find resource cptra_status_agent_BFM" ) + if( !uvm_config_db #( mbox_sram_configuration )::get( null , UVMF_CONFIGURATIONS , mbox_sram_agent_BFM , mbox_sram_agent_config ) ) + `uvm_fatal("CFG" , "uvm_config_db #( mbox_sram_configuration )::get cannot find resource mbox_sram_agent_BFM" ) // Assign the sequencer handles from the handles within agent configurations soc_ifc_ctrl_agent_sequencer = soc_ifc_ctrl_agent_config.get_sequencer(); cptra_ctrl_agent_sequencer = cptra_ctrl_agent_config.get_sequencer(); soc_ifc_status_agent_sequencer = soc_ifc_status_agent_config.get_sequencer(); cptra_status_agent_sequencer = cptra_status_agent_config.get_sequencer(); + mbox_sram_agent_sequencer = mbox_sram_agent_config.get_sequencer(); // Retrieve QVIP sequencer handles from the uvm_config_db if( !uvm_config_db #(mvc_sequencer)::get( null,UVMF_SEQUENCERS,"uvm_test_top.environment.qvip_ahb_lite_slave_subenv.ahb_lite_slave_0", uvm_test_top_environment_qvip_ahb_lite_slave_subenv_ahb_lite_slave_0_sqr) ) @@ -139,17 +147,20 @@ rand soc_ifc_env_sequence_base_t soc_ifc_env_seq; cptra_ctrl_agent_random_seq = cptra_ctrl_agent_random_seq_t::type_id::create("cptra_ctrl_agent_random_seq"); soc_ifc_status_agent_responder_seq = soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_status_agent_responder_seq"); cptra_status_agent_responder_seq = cptra_status_agent_responder_seq_t::type_id::create("cptra_status_agent_responder_seq"); + mbox_sram_agent_responder_seq = mbox_sram_agent_responder_seq_t::type_id::create("mbox_sram_agent_responder_seq"); fork soc_ifc_ctrl_agent_config.wait_for_reset(); cptra_ctrl_agent_config.wait_for_reset(); soc_ifc_status_agent_config.wait_for_reset(); cptra_status_agent_config.wait_for_reset(); + mbox_sram_agent_config.wait_for_reset(); join reg_model.reset(); // Start RESPONDER sequences here fork soc_ifc_status_agent_responder_seq.start(soc_ifc_status_agent_sequencer); cptra_status_agent_responder_seq.start(cptra_status_agent_sequencer); + mbox_sram_agent_responder_seq.start(mbox_sram_agent_sequencer); join_none // Start INITIATOR sequences here fork @@ -167,6 +178,7 @@ soc_ifc_env_seq.start(top_configuration.vsqr); cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_status_agent_config.wait_for_num_clocks(400); cptra_status_agent_config.wait_for_num_clocks(400); + mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_cmdline_test_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_cmdline_test_sequence.svh index 2d04e5be8..5d0f2e5e7 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_cmdline_test_sequence.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_cmdline_test_sequence.svh @@ -57,6 +57,7 @@ class soc_ifc_cmdline_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_random_seq = cptra_ctrl_agent_random_seq_t::type_id::create("cptra_ctrl_agent_random_seq"); soc_ifc_status_agent_responder_seq = soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_status_agent_responder_seq"); cptra_status_agent_responder_seq = cptra_status_agent_responder_seq_t::type_id::create("cptra_status_agent_responder_seq"); + mbox_sram_agent_responder_seq = mbox_sram_agent_responder_seq_t::type_id::create("mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_status_agent_responder_seq; @@ -67,6 +68,7 @@ class soc_ifc_cmdline_test_sequence extends soc_ifc_bench_sequence_base; fork soc_ifc_status_agent_responder_seq.start(soc_ifc_status_agent_sequencer); cptra_status_agent_responder_seq.start(cptra_status_agent_sequencer); + mbox_sram_agent_responder_seq.start(mbox_sram_agent_sequencer); join_none // Start INITIATOR sequences here @@ -115,6 +117,7 @@ class soc_ifc_cmdline_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_status_agent_config.wait_for_num_clocks(400); cptra_status_agent_config.wait_for_num_clocks(400); + mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_rand_test_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_rand_test_sequence.svh index ebe212e74..ff964db95 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_rand_test_sequence.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_rand_test_sequence.svh @@ -119,6 +119,8 @@ class soc_ifc_rand_test_sequence extends soc_ifc_bench_sequence_base; uvm_object obj; int ii; bit do_pauser_init; + int unsigned mbox_ecc_single_error_burst; + int unsigned mbox_ecc_single_error_delay_clocks; soc_ifc_env_bringup_seq = soc_ifc_env_bringup_sequence_t::type_id::create("soc_ifc_env_bringup_seq"); soc_ifc_env_cptra_rst_wait_seq = soc_ifc_env_cptra_rst_wait_sequence_t::type_id::create("soc_ifc_env_cptra_rst_wait_seq"); @@ -129,6 +131,7 @@ class soc_ifc_rand_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_random_seq = cptra_ctrl_agent_random_seq_t::type_id::create("cptra_ctrl_agent_random_seq"); soc_ifc_status_agent_responder_seq = soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_status_agent_responder_seq"); cptra_status_agent_responder_seq = cptra_status_agent_responder_seq_t::type_id::create("cptra_status_agent_responder_seq"); + mbox_sram_agent_responder_seq = mbox_sram_agent_responder_seq_t::type_id::create("mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_status_agent_responder_seq; @@ -146,9 +149,25 @@ class soc_ifc_rand_test_sequence extends soc_ifc_bench_sequence_base; fork soc_ifc_status_agent_responder_seq.start(soc_ifc_status_agent_sequencer); cptra_status_agent_responder_seq.start(cptra_status_agent_sequencer); + mbox_sram_agent_responder_seq.start(mbox_sram_agent_sequencer); join_none // Start INITIATOR sequences here + fork + forever begin + if (!std::randomize(mbox_ecc_single_error_burst,mbox_ecc_single_error_delay_clocks) with {mbox_ecc_single_error_burst dist {1 :/ 1000, [2:5] :/ 100, [6:31] :/ 20, [32:131071] :/ 1, [131072:524288] :/ 1}; + mbox_ecc_single_error_delay_clocks dist {1 :/ 1, [2:31] :/ 3, [32:127] :/ 5, [128:1023] :/ 3, [1024:131072] :/ 1}; }) + `uvm_fatal("SOC_IFC_RAND_TEST", "Failed to randomize mbox ecc bit flip injection parameters") + else + `uvm_info("SOC_IFC_RAND_TEST", $sformatf("Randomized mbox ecc bit flip injection parameters: burst [%0d] delay [%0d clocks]", mbox_ecc_single_error_burst, mbox_ecc_single_error_delay_clocks), UVM_DEBUG) + soc_ifc_ctrl_agent_config.wait_for_num_clocks(mbox_ecc_single_error_delay_clocks); + `uvm_info("SOC_IFC_RAND_TEST", $sformatf("Injecting mbox ecc error with burst [%0d]", mbox_ecc_single_error_burst), UVM_DEBUG) + repeat(mbox_ecc_single_error_burst) begin + mbox_sram_agent_config.inject_ecc_error |= 2'b01; + @mbox_sram_agent_responder_seq.new_rsp; + end + end + join_none fork begin // Bringup (set pwrgood, deassert cptra_rst_b, write fuses) @@ -243,6 +262,7 @@ class soc_ifc_rand_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_status_agent_config.wait_for_num_clocks(400); cptra_status_agent_config.wait_for_num_clocks(400); + mbox_sram_agent_config.wait_for_num_clocks(400); join // pragma uvmf custom body end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_trng_test_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_trng_test_sequence.svh index 0e838834a..4c9999757 100755 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_trng_test_sequence.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/sequences/src/soc_ifc_trng_test_sequence.svh @@ -75,8 +75,6 @@ class soc_ifc_trng_test_sequence extends soc_ifc_bench_sequence_base; // **************************************************************************** virtual task body(); - // pragma uvmf custom body begin - // Construct sequences here uvm_object obj; int ii; @@ -89,6 +87,7 @@ class soc_ifc_trng_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_random_seq = cptra_ctrl_agent_random_seq_t::type_id::create("cptra_ctrl_agent_random_seq"); soc_ifc_status_agent_responder_seq = soc_ifc_status_agent_responder_seq_t::type_id::create("soc_ifc_status_agent_responder_seq"); cptra_status_agent_responder_seq = cptra_status_agent_responder_seq_t::type_id::create("cptra_status_agent_responder_seq"); + mbox_sram_agent_responder_seq = mbox_sram_agent_responder_seq_t::type_id::create("mbox_sram_agent_responder_seq"); // Handle to the responder sequence for getting response transactions soc_ifc_env_bringup_seq.soc_ifc_status_agent_rsp_seq = soc_ifc_status_agent_responder_seq; @@ -100,6 +99,7 @@ class soc_ifc_trng_test_sequence extends soc_ifc_bench_sequence_base; fork soc_ifc_status_agent_responder_seq.start(soc_ifc_status_agent_sequencer); cptra_status_agent_responder_seq.start(cptra_status_agent_sequencer); + mbox_sram_agent_responder_seq.start(mbox_sram_agent_sequencer); join_none // Start INITIATOR sequences here @@ -148,6 +148,7 @@ class soc_ifc_trng_test_sequence extends soc_ifc_bench_sequence_base; cptra_ctrl_agent_config.wait_for_num_clocks(400); soc_ifc_status_agent_config.wait_for_num_clocks(400); cptra_status_agent_config.wait_for_num_clocks(400); + mbox_sram_agent_config.wait_for_num_clocks(400); join if (1) // TODO -- how to properly choose which to print? diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.compile index 9c923c2dc..408eb4545 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.compile +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.compile @@ -8,5 +8,6 @@ needs: - ../../../../verification_ip/interface_packages/cptra_ctrl_pkg/cptra_ctrl_hdl.compile - ../../../../verification_ip/interface_packages/soc_ifc_status_pkg/soc_ifc_status_hdl.compile - ../../../../verification_ip/interface_packages/cptra_status_pkg/cptra_status_hdl.compile + - ../../../../verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hdl.compile src: - hdl_top.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.sv index 06de1efdb..872fc4970 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.sv @@ -82,28 +82,6 @@ import uvmf_base_pkg_hdl::*; // pragma uvmf custom reset_generator end // pragma uvmf custom module_item_additional begin -import soc_ifc_pkg::*; - mbox_sram_req_t mbox_sram_req; - mbox_sram_resp_t mbox_sram_resp; - - //SRAM for mbox - caliptra_sram - #( - .DATA_WIDTH(MBOX_DATA_AND_ECC_W), - .DEPTH(MBOX_DEPTH) - ) - i_mbox_ram - ( - .clk_i(clk), - - .cs_i (mbox_sram_req.cs ), - .we_i (mbox_sram_req.we ), - .addr_i (mbox_sram_req.addr ), - .wdata_i(mbox_sram_req.wdata), - - .rdata_o(mbox_sram_resp.rdata) - ); - initial i_mbox_ram.ram = '{default:8'h0}; // pragma uvmf custom module_item_additional end // Instantiate the signal bundle, monitor bfm and driver bfm for each interface. @@ -130,14 +108,21 @@ import soc_ifc_pkg::*; .clk(clk), .dummy(1'b1) // pragma uvmf custom cptra_status_agent_bus_connections end ); + mbox_sram_if mbox_sram_agent_bus( + // pragma uvmf custom mbox_sram_agent_bus_connections begin + .clk(clk), .dummy(1'b1) + // pragma uvmf custom mbox_sram_agent_bus_connections end + ); soc_ifc_ctrl_monitor_bfm soc_ifc_ctrl_agent_mon_bfm(soc_ifc_ctrl_agent_bus.monitor_port); cptra_ctrl_monitor_bfm cptra_ctrl_agent_mon_bfm(cptra_ctrl_agent_bus.monitor_port); soc_ifc_status_monitor_bfm soc_ifc_status_agent_mon_bfm(soc_ifc_status_agent_bus.monitor_port); cptra_status_monitor_bfm cptra_status_agent_mon_bfm(cptra_status_agent_bus.monitor_port); + mbox_sram_monitor_bfm mbox_sram_agent_mon_bfm(mbox_sram_agent_bus.monitor_port); soc_ifc_ctrl_driver_bfm soc_ifc_ctrl_agent_drv_bfm(soc_ifc_ctrl_agent_bus.initiator_port); cptra_ctrl_driver_bfm cptra_ctrl_agent_drv_bfm(cptra_ctrl_agent_bus.initiator_port); soc_ifc_status_driver_bfm soc_ifc_status_agent_drv_bfm(soc_ifc_status_agent_bus.responder_port); cptra_status_driver_bfm cptra_status_agent_drv_bfm(cptra_status_agent_bus.responder_port); + mbox_sram_driver_bfm mbox_sram_agent_drv_bfm(mbox_sram_agent_bus.responder_port); // pragma uvmf custom dut_instantiation begin // AHB Clock/reset @@ -177,8 +162,8 @@ import soc_ifc_pkg::*; .generic_output_wires(soc_ifc_status_agent_bus.generic_output_wires), //SRAM interface - .mbox_sram_req(mbox_sram_req), - .mbox_sram_resp(mbox_sram_resp), + .mbox_sram_req(mbox_sram_agent_bus.mbox_sram_req), + .mbox_sram_resp(mbox_sram_agent_bus.mbox_sram_resp), //APB Interface with SoC .paddr_i (uvm_test_top_environment_qvip_apb5_slave_subenv_qvip_hdl.apb5_master_0_PADDR[17:0]), @@ -280,10 +265,12 @@ import soc_ifc_pkg::*; uvm_config_db #( virtual cptra_ctrl_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , cptra_ctrl_agent_BFM , cptra_ctrl_agent_mon_bfm ); uvm_config_db #( virtual soc_ifc_status_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_status_agent_BFM , soc_ifc_status_agent_mon_bfm ); uvm_config_db #( virtual cptra_status_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , cptra_status_agent_BFM , cptra_status_agent_mon_bfm ); + uvm_config_db #( virtual mbox_sram_monitor_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , mbox_sram_agent_BFM , mbox_sram_agent_mon_bfm ); uvm_config_db #( virtual soc_ifc_ctrl_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_ctrl_agent_BFM , soc_ifc_ctrl_agent_drv_bfm ); uvm_config_db #( virtual cptra_ctrl_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , cptra_ctrl_agent_BFM , cptra_ctrl_agent_drv_bfm ); uvm_config_db #( virtual soc_ifc_status_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , soc_ifc_status_agent_BFM , soc_ifc_status_agent_drv_bfm ); uvm_config_db #( virtual cptra_status_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , cptra_status_agent_BFM , cptra_status_agent_drv_bfm ); + uvm_config_db #( virtual mbox_sram_driver_bfm )::set( null , UVMF_VIRTUAL_INTERFACES , mbox_sram_agent_BFM , mbox_sram_agent_drv_bfm ); end endmodule diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.vinfo index 684e5069f..b4204c2c8 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.vinfo +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/testbench/hdl_top.vinfo @@ -5,4 +5,5 @@ @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_ctrl_pkg/cptra_ctrl_bfm.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/soc_ifc_status_pkg/soc_ifc_status_bfm.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_status_pkg/cptra_status_bfm.vinfo +@use $UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_bfm.vinfo hdl_top.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.compile index a98a9e77e..863735d42 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.compile +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.compile @@ -4,6 +4,7 @@ needs: - ../../../../verification_ip/interface_packages/cptra_ctrl_pkg/cptra_ctrl.compile - ../../../../verification_ip/interface_packages/soc_ifc_status_pkg/soc_ifc_status.compile - ../../../../verification_ip/interface_packages/cptra_status_pkg/cptra_status.compile + - ../../../../verification_ip/interface_packages/mbox_sram_pkg/mbox_sram.compile - ../../../../verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile - ../parameters/soc_ifc_parameters_pkg.compile - ../sequences/soc_ifc_sequences_pkg.compile diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.sv index 65cac7397..b06dc5f37 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.sv @@ -47,6 +47,8 @@ package soc_ifc_tests_pkg; import soc_ifc_status_pkg_hdl::*; import cptra_status_pkg::*; import cptra_status_pkg_hdl::*; + import mbox_sram_pkg::*; + import mbox_sram_pkg_hdl::*; import qvip_ahb_lite_slave_pkg::*; import qvip_apb5_slave_pkg::*; import QUESTA_MVC::*; diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.vinfo index f8d3f85bb..a9a3e891c 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.vinfo +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/soc_ifc_tests_pkg.vinfo @@ -3,6 +3,7 @@ @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_ctrl_pkg/cptra_ctrl_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/soc_ifc_status_pkg/soc_ifc_status_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_status_pkg/cptra_status_pkg.vinfo +@use $UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo @use $UVMF_PROJECT_DIR/tb/parameters/soc_ifc_parameters_pkg.vinfo @use $UVMF_PROJECT_DIR/tb/sequences/soc_ifc_sequences_pkg.vinfo diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/src/test_top.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/src/test_top.svh index fa64454af..b5d8893a9 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/src/test_top.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/tb/tests/src/test_top.svh @@ -52,7 +52,8 @@ qvip_memory_message_handler message_handler; soc_ifc_ctrl_agent_BFM /* soc_ifc_ctrl_agent [2] */ , cptra_ctrl_agent_BFM /* cptra_ctrl_agent [3] */ , soc_ifc_status_agent_BFM /* soc_ifc_status_agent [4] */ , - cptra_status_agent_BFM /* cptra_status_agent [5] */ + cptra_status_agent_BFM /* cptra_status_agent [5] */ , + mbox_sram_agent_BFM /* mbox_sram_agent [6] */ }; uvmf_active_passive_t interface_activities[] = { @@ -61,7 +62,8 @@ uvmf_active_passive_t interface_activities[] = { ACTIVE /* soc_ifc_ctrl_agent [2] */ , ACTIVE /* cptra_ctrl_agent [3] */ , ACTIVE /* soc_ifc_status_agent [4] */ , - ACTIVE /* cptra_status_agent [5] */ }; + ACTIVE /* cptra_status_agent [5] */ , + ACTIVE /* mbox_sram_agent [6] */ }; // pragma uvmf custom class_item_additional begin // pragma uvmf custom class_item_additional end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/yaml/soc_ifc_bench.yaml b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/yaml/soc_ifc_bench.yaml index 956ac2c87..755953538 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/yaml/soc_ifc_bench.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/project_benches/soc_ifc/yaml/soc_ifc_bench.yaml @@ -10,6 +10,8 @@ uvmf: value: ACTIVE - bfm_name: cptra_status_agent value: ACTIVE + - bfm_name: mbox_sram_agent + value: ACTIVE active_passive_default: ACTIVE clock_half_period: 5ns clock_phase_offset: 0ns diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base.svh index 8c17daba4..1005be095 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base.svh @@ -46,6 +46,9 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base extends uvm_r input uvm_reg_map map); soc_ifc_reg_delay_job_intr_block_rf_ext delay_job; uvm_reg_block rm; + soc_ifc_reg__intr_block_t_ext sir_intr_rm; + sha512_acc_csr__intr_block_t_ext sac_intr_rm; + bit fld_hwset_active = 1'b0; uvm_reg sts_reg; string event_name ; uvm_reg en_reg ; @@ -58,6 +61,17 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base extends uvm_r delay_job.map = map; sts_reg = fld.get_parent(); rm = sts_reg.get_parent(); /* intr_block_rf_ext */ + if (rm.get_parent().get_name() == "sha512_acc_csr_rm") begin + if (!$cast(sac_intr_rm,rm)) `uvm_fatal("SOC_IFC_REG_CBS", {"Failed to get handle of expected sub-type for parent uvm_reg_block. ", fld.get_full_name()}) + fld_hwset_active = sac_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()]; + end + else if (rm.get_parent().get_name() == "soc_ifc_reg_rm") begin + if (!$cast(sir_intr_rm,rm)) `uvm_fatal("SOC_IFC_REG_CBS", {"Failed to get handle of expected sub-type for parent uvm_reg_block. ", fld.get_full_name()}) + fld_hwset_active = sir_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()]; + end + else begin + `uvm_fatal("SOC_IFC_REG_CBS", "Callback is registered to an unrecognized register block!") + end // Get a base-name for the event by truncating the '_sts' suffix event_name = fld.get_name().substr(0,fld.get_name().len()-5); en_reg = rm.get_reg_by_name("error_intr_en_r"); @@ -77,42 +91,87 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_error_internal_intr_r_base extends uvm_r // Predict an increment to event interrupt counter // regardless of interrupt enablement (the sts reg being // set is all that is tracked by the interrupt counter) + // FIXME if a new interrupt event occurs while the interrupt sts is already 1, + // this won't increment the counter, even though it should. if (value & ~previous) begin - `uvm_info("SOC_IFC_REG_CBS", $sformatf("Write to %s triggers increment on %s from %d to %d", fld.get_name(), cnt_fld.get_name(), cnt_fld.get_mirrored_value(), cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)), UVM_HIGH) + `uvm_info("SOC_IFC_REG_CBS", $sformatf("hwset to %s triggers increment on %s from %d to %d", fld.get_name(), cnt_fld.get_name(), cnt_fld.get_mirrored_value(), cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)), UVM_HIGH) cnt_fld.predict(cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)); end + // Anytime an access intr sts register predicts a value of 1, we can treat + // that as a hwset (even if it's just an AHB/APB read) because we _know_ a + // W1C won't result in value=1, which is the case we're protecting against + // by tracking this hwset flag. + // We must track the hwset flag for all value=1 (not just the transitions + // where previous=0) because occasionally an actual hwset will occur when + // the interrupt is already pending, and we still must protect against W1C + // in that case. + if (value) begin + if (sir_intr_rm != null) begin + sir_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b1; + fork + begin + uvm_wait_for_nba_region(); + sir_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b0; + end + join_none + end + else if (sac_intr_rm != null) begin + sac_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b1; + fork + begin + uvm_wait_for_nba_region(); + sac_intr_rm.error_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b0; + end + join_none + end + else + `uvm_fatal("SOC_IFC_REG_CBS", "Bad handle") + end + // On rising edge of field value, schedule a delay job to check if the // interrupt output pin will // transition to high. // Global interrupt pin "agg_sts" is non-sticky if ((value & ~previous)) begin - `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin assertion"}, UVM_MEDIUM) + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin check delay job"}, UVM_MEDIUM) delay_job.req_fld = fld; delay_job.sts_reg = sts_reg; delay_job.en_reg = en_reg; delay_job.sts_glb = sts_glb; delay_job.en_glb = en_glb; + delay_job.grab_values(); delay_jobs.push_back(delay_job); end + // On falling edge of field value, caused by W1C, check if another thread + // is already attempting to perform hwset to this interrupt field (hwset is + // higher priority than W1C). + else if ((~value & previous) && fld_hwset_active) + begin + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " attempts to clear the interrupt bit but is preempted by an active hwset"}, UVM_MEDIUM) + value = previous; + // NOTE: No delay job is scheduled because no changes are predicted to + // other interrupt register fields based on this activity + end // On falling edge of field value, schedule a delay job to // check if the interrupt output pin will // transition from high to low. // Global interrupt pin "agg_sts" is non-sticky else if ((~value & previous)) begin - `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin deassertion"}, UVM_MEDIUM) + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin check delay job"}, UVM_MEDIUM) delay_job.req_fld = fld; delay_job.sts_reg = sts_reg; delay_job.en_reg = en_reg; delay_job.sts_glb = sts_glb; delay_job.en_glb = en_glb; + delay_job.grab_values(); delay_jobs.push_back(delay_job); end else begin `uvm_info("SOC_IFC_REG_CBS", - $sformatf("Write to %s does not trigger interrupt output transition due to %s: [%x], %s: [%x], masked %s: [%x], and %s: [%x]", + $sformatf("Access to %s does not trigger interrupt output transition due to %s: [%x], %s: [%x], masked %s: [%x], and %s: [%x]", fld.get_name(), en_glb.get_name(), en_glb.get_mirrored_value(), diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base.svh index b58f537ee..90c992874 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base.svh @@ -46,6 +46,9 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base extends uvm_r input uvm_reg_map map); soc_ifc_reg_delay_job_intr_block_rf_ext delay_job; uvm_reg_block rm; + soc_ifc_reg__intr_block_t_ext sir_intr_rm; + sha512_acc_csr__intr_block_t_ext sac_intr_rm; + bit fld_hwset_active = 1'b0; uvm_reg sts_reg; string event_name ; uvm_reg en_reg ; @@ -58,6 +61,17 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base extends uvm_r delay_job.map = map; sts_reg = fld.get_parent(); rm = sts_reg.get_parent(); /* intr_block_rf_ext */ + if (rm.get_parent().get_name() == "sha512_acc_csr_rm") begin + if (!$cast(sac_intr_rm,rm)) `uvm_fatal("SOC_IFC_REG_CBS", {"Failed to get handle of expected sub-type for parent uvm_reg_block. ", fld.get_full_name()}) + fld_hwset_active = sac_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()]; + end + else if (rm.get_parent().get_name() == "soc_ifc_reg_rm") begin + if (!$cast(sir_intr_rm,rm)) `uvm_fatal("SOC_IFC_REG_CBS", {"Failed to get handle of expected sub-type for parent uvm_reg_block. ", fld.get_full_name()}) + fld_hwset_active = sir_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()]; + end + else begin + `uvm_fatal("SOC_IFC_REG_CBS", "Callback is registered to an unrecognized register block!") + end // Get a base-name for the event by truncating the '_sts' suffix event_name = fld.get_name().substr(0,fld.get_name().len()-5); en_reg = rm.get_reg_by_name("notif_intr_en_r"); @@ -77,42 +91,87 @@ class soc_ifc_reg_cbs_intr_block_rf_ext_notif_internal_intr_r_base extends uvm_r // Predict an increment to event interrupt counter // regardless of interrupt enablement (the sts reg being // set is all that is tracked by the interrupt counter) + // FIXME if a new interrupt event occurs while the interrupt sts is already 1, + // this won't increment the counter, even though it should. if (value & ~previous) begin - `uvm_info("SOC_IFC_REG_CBS", $sformatf("Write to %s triggers increment on %s from %d to %d", fld.get_name(), cnt_fld.get_name(), cnt_fld.get_mirrored_value(), cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)), UVM_HIGH) + `uvm_info("SOC_IFC_REG_CBS", $sformatf("hwset to %s triggers increment on %s from %d to %d", fld.get_name(), cnt_fld.get_name(), cnt_fld.get_mirrored_value(), cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)), UVM_HIGH) cnt_fld.predict(cnt_fld.get_mirrored_value() + uvm_reg_data_t'(1)); end + // Anytime an access intr sts register predicts a value of 1, we can treat + // that as a hwset (even if it's just an AHB/APB read) because we _know_ a + // W1C won't result in value=1, which is the case we're protecting against + // by tracking this hwset flag. + // We must track the hwset flag for all value=1 (not just the transitions + // where previous=0) because occasionally an actual hwset will occur when + // the interrupt is already pending, and we still must protect against W1C + // in that case. + if (value) begin + if (sir_intr_rm != null) begin + sir_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b1; + fork + begin + uvm_wait_for_nba_region(); + sir_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b0; + end + join_none + end + else if (sac_intr_rm != null) begin + sac_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b1; + fork + begin + uvm_wait_for_nba_region(); + sac_intr_rm.notif_internal_intr_r_hwset_active[fld.get_lsb_pos()] = 1'b0; + end + join_none + end + else + `uvm_fatal("SOC_IFC_REG_CBS", "Bad handle") + end + // On rising edge of field value, schedule a delay job to check if the // interrupt output pin will // transition to high. // Global interrupt pin "agg_sts" is non-sticky if ((value & ~previous)) begin - `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin assertion"}, UVM_MEDIUM) + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin check delay job"}, UVM_MEDIUM) delay_job.req_fld = fld; delay_job.sts_reg = sts_reg; delay_job.en_reg = en_reg; delay_job.sts_glb = sts_glb; delay_job.en_glb = en_glb; + delay_job.grab_values(); delay_jobs.push_back(delay_job); end + // On falling edge of field value, caused by W1C, check if another thread + // is already attempting to perform hwset to this interrupt field (hwset is + // higher priority than W1C). + else if ((~value & previous) && fld_hwset_active) + begin + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " attempts to clear the interrupt bit but is preempted by an active hwset"}, UVM_MEDIUM) + value = previous; + // NOTE: No delay job is scheduled because no changes are predicted to + // other interrupt register fields based on this activity + end // On falling edge of field value, schedule a delay job to // check if the interrupt output pin will // transition from high to low. // Global interrupt pin "agg_sts" is non-sticky else if ((~value & previous)) begin - `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin deassertion"}, UVM_MEDIUM) + `uvm_info("SOC_IFC_REG_CBS", {"Predicted update to ", fld.get_name(), " triggers interrupt output pin check delay job"}, UVM_MEDIUM) delay_job.req_fld = fld; delay_job.sts_reg = sts_reg; delay_job.en_reg = en_reg; delay_job.sts_glb = sts_glb; delay_job.en_glb = en_glb; + delay_job.grab_values(); delay_jobs.push_back(delay_job); end else begin `uvm_info("SOC_IFC_REG_CBS", - $sformatf("Write to %s does not trigger interrupt output transition due to %s: [%x], %s: [%x], masked %s: [%x], and %s: [%x]", + $sformatf("Access to %s does not trigger interrupt output transition due to %s: [%x], %s: [%x], masked %s: [%x], and %s: [%x]", fld.get_name(), en_glb.get_name(), en_glb.get_mirrored_value(), diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_delay_job_intr_block_rf_ext.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_delay_job_intr_block_rf_ext.svh index 104250200..23cc84cec 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_delay_job_intr_block_rf_ext.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_delay_job_intr_block_rf_ext.svh @@ -25,24 +25,44 @@ class soc_ifc_reg_delay_job_intr_block_rf_ext extends soc_ifc_reg_delay_job; uvm_reg_field sts_glb; uvm_reg_map map; + uvm_reg_data_t val_sts_reg; + uvm_reg_data_t val_en_reg ; + uvm_reg_data_t val_en_glb ; + uvm_reg_data_t val_sts_glb; + + virtual function void grab_values(); + fork + begin + // Wait for all predictor callbacks to run for every intr bit accessed + // during the current clock cycle, so mirrors are up to date + uvm_wait_for_nba_region(); + // Snapshot of current value, since next cycle may see value changes again + val_sts_reg = sts_reg.get_mirrored_value(); + val_en_reg = en_reg .get_mirrored_value(); + val_en_glb = en_glb .get_mirrored_value(); + val_sts_glb = sts_glb.get_mirrored_value(); + end + join_none + endfunction + virtual task do_job(); `uvm_info("SOC_IFC_REG_DELAY_JOB", $sformatf("Running delayed job for %s", req_fld.get_full_name()), UVM_MEDIUM) - if (~sts_glb.get_mirrored_value() && |(sts_reg.get_mirrored_value() & en_reg.get_mirrored_value()) && en_glb.get_mirrored_value()) begin + if (!/*val_sts_glb*/sts_glb.get_mirrored_value() && |(val_sts_reg/*sts_reg.get_mirrored_value()*/ & val_en_reg/*en_reg.get_mirrored_value()*/) && val_en_glb/*en_glb.get_mirrored_value()*/) begin sts_glb.predict(1'b1); - `uvm_info("SOC_IFC_REG_DELAY_JOB", $sformatf("post_predict called through map [%p] on %s results in interrupt status bit being set.", map.get_name(), req_fld.get_full_name()), UVM_HIGH) + `uvm_info("SOC_IFC_REG_DELAY_JOB", $sformatf("post_predict called through map [%p] on %s results in interrupt status bit being set to 0x%0x.", map.get_name(), req_fld.get_full_name(), sts_glb.get_mirrored_value()), UVM_HIGH) end - else if (sts_glb.get_mirrored_value() && ~(|(sts_reg.get_mirrored_value() & en_reg.get_mirrored_value()) && en_glb.get_mirrored_value())) begin + else if (/*val_sts_glb*/sts_glb.get_mirrored_value() && !(|(val_sts_reg/*sts_reg.get_mirrored_value()*/ & val_en_reg/*en_reg.get_mirrored_value()*/) && val_en_glb/*en_glb.get_mirrored_value()*/)) begin sts_glb.predict(1'b0); - `uvm_info("SOC_IFC_REG_DELAY_JOB", $sformatf("post_predict called through map [%p] on %s results in interrupt status bit being cleared.", map.get_name(), req_fld.get_full_name()), UVM_HIGH) + `uvm_info("SOC_IFC_REG_DELAY_JOB", $sformatf("post_predict called through map [%p] on %s results in interrupt status bit being cleared to 0x%0x.", map.get_name(), req_fld.get_full_name(), sts_glb.get_mirrored_value()), UVM_HIGH) end else begin `uvm_info("SOC_IFC_REG_DELAY_JOB", - $sformatf("Delay job for %s does not predict any changes due to: en_reg [%d] sts_reg [%d] en_glb [%d] sts_glb [%d]", + $sformatf("Delay job for %s does not predict any changes due to: en_reg(latched) [0x%x(0x%x)] sts_reg [0x%x(0x%x)] en_glb [0x%x(0x%x)] sts_glb [0x%x(0x%x)]", req_fld.get_full_name(), - en_reg.get_mirrored_value(), - sts_reg.get_mirrored_value(), - en_glb.get_mirrored_value(), - sts_glb.get_mirrored_value()), + en_reg.get_mirrored_value(), val_en_reg , + sts_reg.get_mirrored_value(), val_sts_reg, + en_glb.get_mirrored_value(), val_en_glb , + sts_glb.get_mirrored_value(), val_sts_glb), UVM_MEDIUM) end endtask diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_model_top_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_model_top_pkg.sv index dd60ba190..442be3e18 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_model_top_pkg.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/registers/soc_ifc_reg_model_top_pkg.sv @@ -74,6 +74,11 @@ package soc_ifc_reg_model_top_pkg; uvm_reg_map soc_ifc_reg_intr_AHB_map; uvm_reg_map soc_ifc_reg_intr_APB_map; + // HWSET has precedence over SW W1C, so use these variables to track + // active hwset activity in case contention must be resolved + bit [31:0] notif_internal_intr_r_hwset_active = 0; + bit [31:0] error_internal_intr_r_hwset_active = 0; + function new(string name = "soc_ifc_reg__intr_block_t_ext"); super.new(name); endfunction : new @@ -381,6 +386,11 @@ package soc_ifc_reg_model_top_pkg; uvm_reg_map sha512_acc_csr_intr_AHB_map; uvm_reg_map sha512_acc_csr_intr_APB_map; + // HWSET has precedence over SW W1C, so use these variables to track + // active hwset activity in case contention must be resolved + bit [31:0] notif_internal_intr_r_hwset_active = 0; + bit [31:0] error_internal_intr_r_hwset_active = 0; + function new(string name = "sha512_acc_csr__intr_block_t_ext"); super.new(name); endfunction : new diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile index 8f6852326..57aedbdc2 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.compile @@ -4,6 +4,7 @@ needs: - ../../../verification_ip/interface_packages/cptra_ctrl_pkg/cptra_ctrl_hvl.compile - ../../../verification_ip/interface_packages/soc_ifc_status_pkg/soc_ifc_status_hvl.compile - ../../../verification_ip/interface_packages/cptra_status_pkg/cptra_status_hvl.compile + - ../../../verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hvl.compile src: - registers/soc_ifc_reg_model_top_pkg.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.sv index 311abaebb..ccae6401a 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.sv +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.sv @@ -50,6 +50,8 @@ package soc_ifc_env_pkg; import soc_ifc_status_pkg_hdl::*; import cptra_status_pkg::*; import cptra_status_pkg_hdl::*; + import mbox_sram_pkg::*; + import mbox_sram_pkg_hdl::*; import soc_ifc_reg_model_top_pkg::*; import qvip_ahb_lite_slave_pkg::*; import qvip_ahb_lite_slave_params_pkg::*; @@ -58,6 +60,7 @@ package soc_ifc_env_pkg; `uvm_analysis_imp_decl(_soc_ifc_ctrl_agent_ae) `uvm_analysis_imp_decl(_cptra_ctrl_agent_ae) + `uvm_analysis_imp_decl(_mbox_sram_agent_ae) `uvm_analysis_imp_decl(_ahb_slave_0_ae) `uvm_analysis_imp_decl(_apb5_slave_0_ae) `uvm_analysis_imp_decl(_expected_analysis_export) @@ -75,6 +78,7 @@ package soc_ifc_env_pkg; `uvm_analysis_imp_decl(_cov_cptra_ctrl_ae) `uvm_analysis_imp_decl(_cov_cptra_status_ae) `uvm_analysis_imp_decl(_cov_ahb_ae) + `uvm_analysis_imp_decl(_cov_mbox_sram_ae) // pragma uvmf custom package_imports_additional begin import soc_ifc_pkg::*; diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo index e54e883b1..ae707c7ab 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/soc_ifc_env_pkg.vinfo @@ -3,6 +3,7 @@ @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_ctrl_pkg/cptra_ctrl_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/soc_ifc_status_pkg/soc_ifc_status_pkg.vinfo @use $UVMF_VIP_LIBRARY_HOME/interface_packages/cptra_status_pkg/cptra_status_pkg.vinfo +@use $UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo registers/soc_ifc_reg_model_top_pkg.sv +incdir+@vinfodir soc_ifc_env_pkg.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_configuration.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_configuration.svh index ee9cd8f47..fbf7ef959 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_configuration.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_configuration.svh @@ -57,6 +57,9 @@ extends uvmf_environment_configuration_base; typedef cptra_status_configuration cptra_status_agent_config_t; rand cptra_status_agent_config_t cptra_status_agent_config; + typedef mbox_sram_configuration mbox_sram_agent_config_t; + rand mbox_sram_agent_config_t mbox_sram_agent_config; + qvip_ahb_lite_slave_env_configuration qvip_ahb_lite_slave_subenv_config; @@ -90,6 +93,7 @@ extends uvmf_environment_configuration_base; cptra_ctrl_agent_config = cptra_ctrl_agent_config_t::type_id::create("cptra_ctrl_agent_config"); soc_ifc_status_agent_config = soc_ifc_status_agent_config_t::type_id::create("soc_ifc_status_agent_config"); cptra_status_agent_config = cptra_status_agent_config_t::type_id::create("cptra_status_agent_config"); + mbox_sram_agent_config = mbox_sram_agent_config_t::type_id::create("mbox_sram_agent_config"); qvip_ahb_lite_slave_subenv_config = qvip_ahb_lite_slave_env_configuration::type_id::create("qvip_ahb_lite_slave_subenv_config"); qvip_apb5_slave_subenv_config = qvip_apb5_slave_env_configuration::type_id::create("qvip_apb5_slave_subenv_config"); @@ -133,6 +137,7 @@ extends uvmf_environment_configuration_base; "\n", cptra_ctrl_agent_config.convert2string, "\n", soc_ifc_status_agent_config.convert2string, "\n", cptra_status_agent_config.convert2string, + "\n", mbox_sram_agent_config.convert2string, "\n", qvip_ahb_lite_slave_subenv_config.convert2string, "\n", qvip_apb5_slave_subenv_config.convert2string @@ -186,6 +191,9 @@ extends uvmf_environment_configuration_base; cptra_status_agent_config.initialize( interface_activity[5], {environment_path,".cptra_status_agent"}, interface_names[5]); cptra_status_agent_config.initiator_responder = RESPONDER; cptra_status_agent_config.has_coverage = 1; + mbox_sram_agent_config.initialize( interface_activity[6], {environment_path,".mbox_sram_agent"}, interface_names[6]); + mbox_sram_agent_config.initiator_responder = RESPONDER; + mbox_sram_agent_config.has_coverage = 1; // pragma uvmf custom reg_model_config_initialize begin // Register model creation and configuation diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_cov_subscriber.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_cov_subscriber.svh index 6a2b74050..d5084d7e2 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_cov_subscriber.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_cov_subscriber.svh @@ -429,6 +429,7 @@ class soc_ifc_env_cov_subscriber #( uvm_analysis_imp_cov_cptra_ctrl_ae #(cptra_ctrl_transaction, this_type) cptra_ctrl_ae; uvm_analysis_imp_cov_cptra_status_ae #(cptra_status_transaction, this_type) cptra_status_ae; uvm_analysis_imp_cov_ahb_ae #(mvc_sequence_item_base, this_type) ahb_ae; + uvm_analysis_imp_cov_mbox_sram_ae #(mbox_sram_transaction, this_type) mbox_sram_ae; //------------------------------------------------------------------------------------------ // Constructor @@ -449,6 +450,7 @@ class soc_ifc_env_cov_subscriber #( cptra_ctrl_ae = new("cptra_ctrl_ae" , this); cptra_status_ae = new("cptra_status_ae" , this); ahb_ae = new("ahb_ae" , this); + mbox_sram_ae = new("mbox_sram_ae" , this); c_soc_ifc_rm = configuration.soc_ifc_rm; soc_ifc_env_mbox_steps_cg.set_inst_name($sformatf("soc_ifc_env_mbox_steps_cg_%s",get_full_name())); @@ -489,6 +491,13 @@ class soc_ifc_env_cov_subscriber #( // `uvm_fatal("FIXME", "FIXME") endfunction + //------------------------------------------------------------------------------------------ + // MBOX SRAM - write + //------------------------------------------------------------------------------------------ + virtual function void write_cov_mbox_sram_ae(mbox_sram_transaction txn); +// `uvm_fatal("FIXME", "FIXME") + endfunction + //------------------------------------------------------------------------------------------ // AHB - write //------------------------------------------------------------------------------------------ diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_sequence_base.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_sequence_base.svh index 3a7ba5eb4..1cb88c7da 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_sequence_base.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_env_sequence_base.svh @@ -55,6 +55,7 @@ class soc_ifc_env_sequence_base #( // Responder agent sequencers in soc_ifc_environment: // configuration.soc_ifc_status_agent_config.sequencer // configuration.cptra_status_agent_config.sequencer + // configuration.mbox_sram_agent_config.sequencer typedef soc_ifc_ctrl_random_sequence soc_ifc_ctrl_agent_random_sequence_t; @@ -76,6 +77,18 @@ class soc_ifc_env_sequence_base #( `uvm_info(this.get_type_name(), "In: pre_start() for sequence", UVM_NONE) endtask + virtual function get_mbox_sram_ecc_error_injection(); + return this.configuration.mbox_sram_agent_config.inject_ecc_error; + endfunction + virtual function set_mbox_sram_ecc_single_error_injection(); + this.configuration.mbox_sram_agent_config.inject_ecc_error |= 2'b01; + endfunction + virtual function set_mbox_sram_ecc_double_error_injection(); + this.configuration.mbox_sram_agent_config.inject_ecc_error |= 2'b10; + endfunction + virtual function clr_mbox_sram_ecc_error_injection(); + this.configuration.mbox_sram_agent_config.inject_ecc_error = 2'b00; + endfunction // pragma uvmf custom class_item_additional end function new(string name = "" ); diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_environment.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_environment.svh index f3685d805..2be6c1251 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_environment.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_environment.svh @@ -54,6 +54,9 @@ class soc_ifc_environment extends uvmf_environment_base #( typedef cptra_status_agent cptra_status_agent_t; cptra_status_agent_t cptra_status_agent; + typedef mbox_sram_agent mbox_sram_agent_t; + mbox_sram_agent_t mbox_sram_agent; + @@ -172,6 +175,8 @@ class soc_ifc_environment extends uvmf_environment_base #( soc_ifc_status_agent.set_config(configuration.soc_ifc_status_agent_config); cptra_status_agent = cptra_status_agent_t::type_id::create("cptra_status_agent",this); cptra_status_agent.set_config(configuration.cptra_status_agent_config); + mbox_sram_agent = mbox_sram_agent_t::type_id::create("mbox_sram_agent",this); + mbox_sram_agent.set_config(configuration.mbox_sram_agent_config); soc_ifc_pred = soc_ifc_pred_t::type_id::create("soc_ifc_pred",this); soc_ifc_pred.configuration = configuration; soc_ifc_sb = soc_ifc_sb_t::type_id::create("soc_ifc_sb",this); @@ -210,6 +215,7 @@ class soc_ifc_environment extends uvmf_environment_base #( super.connect_phase(phase); soc_ifc_ctrl_agent.monitored_ap.connect(soc_ifc_pred.soc_ifc_ctrl_agent_ae); cptra_ctrl_agent.monitored_ap.connect(soc_ifc_pred.cptra_ctrl_agent_ae); + mbox_sram_agent.monitored_ap.connect(soc_ifc_pred.mbox_sram_agent_ae); soc_ifc_pred.soc_ifc_sb_ap.connect(soc_ifc_sb.expected_analysis_export); soc_ifc_pred.cptra_sb_ap.connect(soc_ifc_sb.expected_cptra_analysis_export); soc_ifc_pred.soc_ifc_sb_ahb_ap.connect(soc_ifc_sb.expected_ahb_analysis_export); @@ -232,6 +238,7 @@ class soc_ifc_environment extends uvmf_environment_base #( soc_ifc_pred.cptra_cov_ap .connect (soc_ifc_env_cov_sub.cptra_ctrl_ae ); soc_ifc_status_agent.monitored_ap.connect (soc_ifc_env_cov_sub.soc_ifc_status_ae); cptra_status_agent .monitored_ap.connect (soc_ifc_env_cov_sub.cptra_status_ae ); + mbox_sram_agent .monitored_ap.connect (soc_ifc_env_cov_sub.mbox_sram_ae ); qvip_ahb_lite_slave_subenv_ahb_lite_slave_0_ap["burst_transfer_cov"].connect(soc_ifc_env_cov_sub.ahb_ae ); qvip_apb5_slave_subenv_apb5_master_0_ap ["trans_ap_cov"] .connect(soc_ifc_env_cov_sub.apb_ae ); end:connect_coverage @@ -316,6 +323,9 @@ task soc_ifc_environment::handle_reset(string kind = "HARD"); this.cptra_status_agent.handle_reset(kind); this.soc_ifc_status_agent.handle_reset(kind); + // Reset mbox_sram agent (needed to reset the ECC error injection) + this.mbox_sram_agent.handle_reset(kind); + // Reset scoreboard according to kind this.soc_ifc_sb.handle_reset(kind); diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_predictor.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_predictor.svh index 00d56bd37..ac0f07d8e 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_predictor.svh +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/src/soc_ifc_predictor.svh @@ -29,6 +29,7 @@ // // soc_ifc_ctrl_agent_ae receives transactions of type soc_ifc_ctrl_transaction // cptra_ctrl_agent_ae receives transactions of type cptra_ctrl_transaction +// mbox_sram_agent_ae receives transactions of type mbox_sram_transaction // ahb_slave_0_ae receives transactions of type mvc_sequence_item_base // apb5_slave_0_ae receives transactions of type mvc_sequence_item_base // @@ -81,6 +82,11 @@ class soc_ifc_predictor #( .BASE_T(BASE_T) ) ) cptra_ctrl_agent_ae; + uvm_analysis_imp_mbox_sram_agent_ae #(mbox_sram_transaction, soc_ifc_predictor #( + .CONFIG_T(CONFIG_T), + .BASE_T(BASE_T) + ) +) mbox_sram_agent_ae; uvm_analysis_imp_ahb_slave_0_ae #(mvc_sequence_item_base, soc_ifc_predictor #( .CONFIG_T(CONFIG_T), .BASE_T(BASE_T) @@ -146,6 +152,7 @@ class soc_ifc_predictor #( // Define transaction handles for debug visibility soc_ifc_ctrl_transaction soc_ifc_ctrl_agent_ae_debug; cptra_ctrl_transaction cptra_ctrl_agent_ae_debug; + mbox_sram_transaction mbox_sram_agent_ae_debug; mvc_sequence_item_base ahb_slave_0_ae_debug; mvc_sequence_item_base apb5_slave_0_ae_debug; @@ -241,6 +248,7 @@ class soc_ifc_predictor #( soc_ifc_ctrl_agent_ae = new("soc_ifc_ctrl_agent_ae", this); cptra_ctrl_agent_ae = new("cptra_ctrl_agent_ae", this); + mbox_sram_agent_ae = new("mbox_sram_agent_ae", this); ahb_slave_0_ae = new("ahb_slave_0_ae", this); apb5_slave_0_ae = new("apb5_slave_0_ae", this); soc_ifc_sb_ap = new("soc_ifc_sb_ap", this ); @@ -400,7 +408,6 @@ class soc_ifc_predictor #( soc_ifc_sb_ap.write(soc_ifc_sb_ap_output_transaction); `uvm_info("PRED_SOC_IFC_CTRL", "Transaction submitted through soc_ifc_sb_ap", UVM_MEDIUM) end - // TODO // Code for sending output transaction out through cptra_sb_ap // Please note that each broadcasted transaction should be a different object than previously // broadcasted transactions. Creation of a different object is done by constructing the transaction @@ -530,6 +537,80 @@ class soc_ifc_predictor #( // pragma uvmf custom cptra_ctrl_agent_ae_predictor end endfunction + // FUNCTION: write_mbox_sram_agent_ae + // Transactions received through mbox_sram_agent_ae initiate the execution of this function. + // This function performs prediction of DUT output values based on DUT input, configuration and state + virtual function void write_mbox_sram_agent_ae(mbox_sram_transaction t); + // pragma uvmf custom mbox_sram_agent_ae_predictor begin + // Flags control whether each transaction is sent to scoreboard + bit send_soc_ifc_sts_txn = 0; + bit send_cptra_sts_txn = 0; + bit send_ahb_txn = 0; + bit send_apb_txn = 0; + + mbox_sram_agent_ae_debug = t; + `uvm_info("PRED_MBOX_SRAM", "Transaction Received through mbox_sram_agent_ae", UVM_MEDIUM) + `uvm_info("PRED_MBOX_SRAM", {" Data: ",t.convert2string()}, UVM_FULL) + // Construct one of each output transaction type. + soc_ifc_sb_ap_output_transaction = soc_ifc_sb_ap_output_transaction_t::type_id::create("soc_ifc_sb_ap_output_transaction"); + cptra_sb_ap_output_transaction = cptra_sb_ap_output_transaction_t::type_id::create("cptra_sb_ap_output_transaction"); + soc_ifc_sb_ahb_ap_output_transaction = soc_ifc_sb_ahb_ap_output_transaction_t::type_id::create("soc_ifc_sb_ahb_ap_output_transaction"); + soc_ifc_sb_apb_ap_output_transaction = soc_ifc_sb_apb_ap_output_transaction_t::type_id::create("soc_ifc_sb_apb_ap_output_transaction"); + + if (t.is_read && t.ecc_double_bit_error) begin + p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.error_internal_intr_r.error_mbox_ecc_unc_sts.predict(1'b1, -1, UVM_PREDICT_READ, UVM_PREDICT, p_soc_ifc_AHB_map); /* AHB-access only, use AHB map*/ + `uvm_info("PRED_MBOX_SRAM", "Received read transaction with Double bit ECC corruption, triggering the err interrupt", UVM_MEDIUM) + end + else if (t.is_read && t.ecc_single_bit_error) begin + p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.notif_internal_intr_r.notif_mbox_ecc_cor_sts.predict(1'b1, -1, UVM_PREDICT_READ, UVM_PREDICT, p_soc_ifc_AHB_map); /* AHB-access only, use AHB map*/ + `uvm_info("PRED_MBOX_SRAM", "Received read transaction with Single bit ECC corruption, triggering the notification interrupt", UVM_MEDIUM) + end + else begin + `uvm_info("PRED_MBOX_SRAM", "Received mailbox SRAM transaction does not cause a system state change prediction", UVM_FULL) + end + // TODO HW_ERROR_NON_FATAL activity? + + // Code for sending output transaction out through soc_ifc_sb_ap + // Please note that each broadcasted transaction should be a different object than previously + // broadcasted transactions. Creation of a different object is done by constructing the transaction + // using either new() or create(). Broadcasting a transaction object more than once to either the + // same subscriber or multiple subscribers will result in unexpected and incorrect behavior. + if (send_soc_ifc_sts_txn) begin + populate_expected_soc_ifc_status_txn(soc_ifc_sb_ap_output_transaction); + soc_ifc_sb_ap.write(soc_ifc_sb_ap_output_transaction); + `uvm_error("PRED_MBOX_SRAM", "NULL Transaction submitted through soc_ifc_sb_ap") + end + // Code for sending output transaction out through cptra_sb_ap + // Please note that each broadcasted transaction should be a different object than previously + // broadcasted transactions. Creation of a different object is done by constructing the transaction + // using either new() or create(). Broadcasting a transaction object more than once to either the + // same subscriber or multiple subscribers will result in unexpected and incorrect behavior. + if (send_cptra_sts_txn) begin + populate_expected_cptra_status_txn(cptra_sb_ap_output_transaction); + cptra_sb_ap.write(cptra_sb_ap_output_transaction); + `uvm_error("PRED_MBOX_SRAM", "NULL Transaction submitted through cptra_sb_ap") + end + // Code for sending output transaction out through soc_ifc_sb_ahb_ap + // Please note that each broadcasted transaction should be a different object than previously + // broadcasted transactions. Creation of a different object is done by constructing the transaction + // using either new() or create(). Broadcasting a transaction object more than once to either the + // same subscriber or multiple subscribers will result in unexpected and incorrect behavior. + if (send_ahb_txn) begin + soc_ifc_sb_ahb_ap.write(soc_ifc_sb_ahb_ap_output_transaction); + `uvm_error("PRED_MBOX_SRAM", "NULL Transaction submitted through soc_ifc_sb_ahb_ap") + end + // Code for sending output transaction out through soc_ifc_sb_apb_ap + // Please note that each broadcasted transaction should be a different object than previously + // broadcasted transactions. Creation of a different object is done by constructing the transaction + // using either new() or create(). Broadcasting a transaction object more than once to either the + // same subscriber or multiple subscribers will result in unexpected and incorrect behavior. + if (send_apb_txn) begin + soc_ifc_sb_apb_ap.write(soc_ifc_sb_apb_ap_output_transaction); + `uvm_error("PRED_MBOX_SRAM", "NULL Transaction submitted through soc_ifc_sb_apb_ap") + end + // pragma uvmf custom mbox_sram_agent_ae_predictor end + endfunction + // FUNCTION: write_ahb_slave_0_ae // Transactions received through ahb_slave_0_ae initiate the execution of this function. // This function performs prediction of DUT output values based on DUT input, configuration and state @@ -1054,7 +1135,7 @@ class soc_ifc_predictor #( end end "CPTRA_DBG_MANUF_SERVICE_REG": begin - `uvm_info("PRED_APB", $sformatf("Handling access to %s. Nothing to do.", axs_reg.get_name()), UVM_DEBUG) + `uvm_info("PRED_AHB", $sformatf("Handling access to %s. Nothing to do.", axs_reg.get_name()), UVM_DEBUG) end "CPTRA_CLK_GATING_EN": begin if (ahb_txn.RnW == AHB_WRITE) begin @@ -1087,9 +1168,9 @@ class soc_ifc_predictor #( 32'hfc: `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES [Clear the isr_active bit]", UVM_MEDIUM) 32'hfd: - `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES [Toggle random SRAM single bit error injection]", UVM_MEDIUM) + `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES [Toggle random SRAM single bit flip injection]", UVM_MEDIUM) 32'hfe: - `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES [Toggle random SRAM double bit error injection]", UVM_MEDIUM) + `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES [Toggle random SRAM double bit flip injection]", UVM_MEDIUM) 32'hff: `uvm_info("PRED_AHB", "Observed write to CPTRA_GENERIC_OUTPUT_WIRES to End the simulation with a Success status", UVM_LOW) endcase @@ -1263,6 +1344,7 @@ class soc_ifc_predictor #( "error_intr_trig_r", "notif_intr_trig_r": begin if (ahb_txn.RnW == AHB_WRITE) begin + // FIXME --- I think this is broken, since this logic predates the callback/delay_job paradigm send_cptra_sts_txn = (!this.soc_ifc_error_intr_pending && p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.error_global_intr_r.agg_sts.get_mirrored_value()) || (!this.soc_ifc_notif_intr_pending && p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.notif_global_intr_r.agg_sts.get_mirrored_value()); this.soc_ifc_error_intr_pending = p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.error_global_intr_r.agg_sts.get_mirrored_value(); @@ -1282,8 +1364,6 @@ class soc_ifc_predictor #( // but this does not result in a cptra status transaction because we only // capture rising edges as a transaction `uvm_info("PRED_AHB", {"Write to ", axs_reg.get_name(), " attempts to clear an interrupt"}, UVM_HIGH) - this.soc_ifc_error_intr_pending = p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.error_global_intr_r.agg_sts.get_mirrored_value(); - this.soc_ifc_notif_intr_pending = p_soc_ifc_rm.soc_ifc_reg_rm.intr_block_rf_ext.notif_global_intr_r.agg_sts.get_mirrored_value(); end end "error_internal_intr_count_r", @@ -1357,8 +1437,6 @@ class soc_ifc_predictor #( // but this does not result in a cptra status transaction because we only // capture rising edges as a transaction `uvm_info("PRED_AHB", {"Write to ", axs_reg.get_name(), " attempts to clear an interrupt"}, UVM_HIGH) - this.sha_err_intr_pending = p_soc_ifc_rm.sha512_acc_csr_rm.intr_block_rf_ext.error_global_intr_r.agg_sts.get_mirrored_value(); - this.sha_notif_intr_pending = p_soc_ifc_rm.sha512_acc_csr_rm.intr_block_rf_ext.notif_global_intr_r.agg_sts.get_mirrored_value(); end end "error0_intr_count_r", @@ -2208,7 +2286,7 @@ function void soc_ifc_predictor::send_delayed_expected_transactions(); if (!sha_notif_intr_pending && p_soc_ifc_rm.sha512_acc_csr_rm.intr_block_rf_ext.notif_global_intr_r.agg_sts.get_mirrored_value()) begin sha_notif_intr_pending = p_soc_ifc_rm.sha512_acc_csr_rm.intr_block_rf_ext.notif_global_intr_r.agg_sts.get_mirrored_value(); if (sha_notif_intr_pending) begin - `uvm_info("PRED_AHB", "Delay job triggers sha_notif_intr_pending transition", UVM_HIGH) + `uvm_info("PRED_DLY", "Delay job triggers sha_notif_intr_pending transition", UVM_HIGH) send_cptra_sts_txn = 1'b1; end end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_environment.yaml b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_environment.yaml index a8ba2df23..111d254aa 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_environment.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_environment.yaml @@ -14,6 +14,9 @@ uvmf: - initiator_responder: RESPONDER name: cptra_status_agent type: cptra_status + - initiator_responder: RESPONDER + name: mbox_sram_agent + type: mbox_sram analysis_components: - name: soc_ifc_pred parameters: [] @@ -67,6 +70,9 @@ uvmf: - driver: cptra_ctrl_agent.monitored_ap receiver: soc_ifc_pred.cptra_ctrl_agent_ae validate: 'True' + - driver: mbox_sram_agent.monitored_ap + receiver: soc_ifc_pred.mbox_sram_agent_ae + validate: 'True' - driver: soc_ifc_pred.soc_ifc_sb_ap receiver: soc_ifc_sb.expected_analysis_export validate: 'True' diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_util_comp_soc_ifc_predictor.yaml b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_util_comp_soc_ifc_predictor.yaml index ed86e0948..9b07c8789 100644 --- a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_util_comp_soc_ifc_predictor.yaml +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/environment_packages/soc_ifc_env_pkg/yaml/soc_ifc_util_comp_soc_ifc_predictor.yaml @@ -6,6 +6,8 @@ uvmf: type: soc_ifc_ctrl_transaction - name: cptra_ctrl_agent_ae type: cptra_ctrl_transaction + - name: mbox_sram_agent_ae + type: mbox_sram_transaction - name: ahb_slave_0_ae type: mvc_sequence_item_base - name: apb5_slave_0_ae diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.project b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.project new file mode 100644 index 000000000..25262dcd1 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.project @@ -0,0 +1,30 @@ + + + mbox_sram_pkg + + + + + + org.python.pydev.PyDevBuilder + + + + + net.sf.sveditor.core.SVProjectBuilder + + + + + + net.sf.sveditor.core.SVNature + org.python.pydev.pythonNature + + + + UVMF_VIP_LIBRARY_HOME + $%7BPARENT-2-PROJECT_LOC%7D + + + + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.svproject b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.svproject new file mode 100644 index 000000000..82ebbab03 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/.svproject @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/Makefile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/Makefile new file mode 100644 index 000000000..60c82949b --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/Makefile @@ -0,0 +1,66 @@ +# mbox_sram interface packages source +# pragma uvmf custom additional begin +# pragma uvmf custom additional end + +mbox_sram_PKG = \ + +incdir+$(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f + +mbox_sram_PKG_HDL = \ + +incdir+$(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f + +mbox_sram_PKG_XRTL = \ + +incdir+$(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_xrtl.f + +COMP_mbox_sram_PKG_TGT_0 = q_comp_mbox_sram_pkg +COMP_mbox_sram_PKG_TGT_1 = v_comp_mbox_sram_pkg +COMP_mbox_sram_PKG_TGT = $(COMP_mbox_sram_PKG_TGT_$(USE_VELOCE)) + +comp_mbox_sram_pkg: $(COMP_mbox_sram_PKG_TGT) + +q_comp_mbox_sram_pkg: + $(HDL_COMP_CMD) $(mbox_sram_PKG_HDL) + $(HVL_COMP_CMD) $(mbox_sram_PKG) + $(HDL_COMP_CMD) $(mbox_sram_PKG_XRTL) + +v_comp_mbox_sram_pkg: + $(HVL_COMP_CMD) $(mbox_sram_PKG_HDL) + $(HVL_COMP_CMD) $(mbox_sram_PKG) + $(VELANALYZE_CMD) $(mbox_sram_PKG_HDL) + $(VELANALYZE_HVL_CMD) $(mbox_sram_PKG) + $(HDL_COMP_CMD) $(mbox_sram_PKG_XRTL) + +ifeq ($(MTI_VCO_MODE),64) + GCC_COMP_ARCH = -m64 +else + GCC_COMP_ARCH = -m32 +endif + +export mbox_sram_IF_DPI_SRC ?= $(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/dpi + +C_FILE_COMPILE_LIST_mbox_sram_pkg = \ + +O_FILE_COMPILE_LIST_mbox_sram_pkg = $(notdir $(C_FILE_COMPILE_LIST_mbox_sram_pkg:.c=.o)) + +GCC_COMP_ARGS_mbox_sram_pkg += -I$(mbox_sram_IF_DPI_SRC) \ + -fPIC + +GCC_COMP_ARGS_mbox_sram_pkg += $(mbox_sram_IF_GCC_COMP_ARGUMENTS) + +GCC_LINK_ARGS_mbox_sram_pkg += \ + \ + -o .so + +comp_mbox_sram_pkg_c_files: + @echo "--------------------------------" + @echo "Compiling Interface C source" + @echo "--------------------------------" + gcc $(GCC_COMP_ARCH) $(GCC_COMP_ARGS_mbox_sram_pkg) $(C_FILE_COMPILE_LIST_mbox_sram_pkg) + @echo "--------------------------------" + @echo "Linking Interface C objects into a shared object" + @echo "--------------------------------" + gcc $(GCC_COMP_ARCH) $(GCC_LINK_ARGS_mbox_sram_pkg) $(O_FILE_COMPILE_LIST_mbox_sram_pkg) + @echo "--------------------------------" + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/compile.do b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/compile.do new file mode 100644 index 000000000..e20bed409 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/compile.do @@ -0,0 +1,14 @@ +# Tcl do file for compile of mbox_sram interface + +# pragma uvmf custom additional begin +# pragma uvmf custom additional end + + +vlog -sv -timescale 1ps/1ps -suppress 2223,2286 +incdir+$env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f + +vlog -sv -timescale 1ps/1ps -suppress 2223,2286 +incdir+$env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f + +vlog -sv -timescale 1ps/1ps -suppress 2223,2286 +incdir+$env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg \ + -F $env(UVMF_VIP_LIBRARY_HOME)/interface_packages/mbox_sram_pkg/mbox_sram_filelist_xrtl.f \ No newline at end of file diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram.compile new file mode 100644 index 000000000..b0b806055 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram.compile @@ -0,0 +1,3 @@ +needs: + - mbox_sram_hvl.compile + - mbox_sram_hdl.compile diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_bfm.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_bfm.vinfo new file mode 100644 index 000000000..a738c1152 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_bfm.vinfo @@ -0,0 +1,6 @@ +@use $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg_hdl.vinfo +@use mbox_sram_pkg_hdl.vinfo ++incdir+@vinfodir +src/mbox_sram_if.sv +src/mbox_sram_driver_bfm.sv +src/mbox_sram_monitor_bfm.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_common.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_common.compile new file mode 100644 index 000000000..f701a7be2 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_common.compile @@ -0,0 +1,7 @@ +needs: + - $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg_hdl.compile +incdir: + - . + - ${uvm_path}/src +src: + - mbox_sram_pkg_hdl.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f new file mode 100644 index 000000000..91803d05e --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f @@ -0,0 +1 @@ +$UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f new file mode 100644 index 000000000..f4fb8adc1 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f @@ -0,0 +1 @@ +$UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/mbox_sram_pkg.sv \ No newline at end of file diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_xrtl.f b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_xrtl.f new file mode 100644 index 000000000..85b63fa2f --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_filelist_xrtl.f @@ -0,0 +1,3 @@ +$UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/src/mbox_sram_if.sv +$UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor_bfm.sv +$UVMF_VIP_LIBRARY_HOME/interface_packages/mbox_sram_pkg/src/mbox_sram_driver_bfm.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hdl.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hdl.compile new file mode 100644 index 000000000..032a5e03c --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hdl.compile @@ -0,0 +1,9 @@ +needs: + - $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg_hdl.compile + - ./mbox_sram_common.compile +incdir: + - . +src: + - src/mbox_sram_if.sv + - src/mbox_sram_monitor_bfm.sv + - src/mbox_sram_driver_bfm.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hvl.compile b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hvl.compile new file mode 100644 index 000000000..da9f7fe81 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_hvl.compile @@ -0,0 +1,7 @@ +needs: + - $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg.compile + - ./mbox_sram_common.compile +incdir: + - . +src: + - mbox_sram_pkg.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.sv new file mode 100644 index 000000000..3d9b7ecf4 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.sv @@ -0,0 +1,93 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// PACKAGE: This file defines all of the files contained in the +// interface package that will run on the host simulator. +// +// CONTAINS: +// - +// - +// - + +// - +// - +// - + +// - +// - +// - + +// - +// - +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +package mbox_sram_pkg; + + import uvm_pkg::*; + import uvmf_base_pkg_hdl::*; + import uvmf_base_pkg::*; + import mbox_sram_pkg_hdl::*; + + `include "uvm_macros.svh" + + // pragma uvmf custom package_imports_additional begin + import soc_ifc_pkg::*; + // pragma uvmf custom package_imports_additional end + `include "src/mbox_sram_macros.svh" + + export mbox_sram_pkg_hdl::*; + + + + // Parameters defined as HVL parameters + + `include "src/mbox_sram_typedefs.svh" + `include "src/mbox_sram_transaction.svh" + + `include "src/mbox_sram_configuration.svh" + `include "src/mbox_sram_driver.svh" + `include "src/mbox_sram_monitor.svh" + + `include "src/mbox_sram_transaction_coverage.svh" + `include "src/mbox_sram_sequence_base.svh" + `include "src/mbox_sram_random_sequence.svh" + + `include "src/mbox_sram_responder_sequence.svh" + `include "src/mbox_sram2reg_adapter.svh" + + `include "src/mbox_sram_agent.svh" + + // pragma uvmf custom package_item_additional begin + // UVMF_CHANGE_ME : When adding new interface sequences to the src directory + // be sure to add the sequence file here so that it will be + // compiled as part of the interface package. Be sure to place + // the new sequence after any base sequences of the new sequence. + typedef mbox_sram_responder_sequence mbox_sram_agent_responder_seq_t; + // pragma uvmf custom package_item_additional end + +endpackage + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo new file mode 100644 index 000000000..2d5289a09 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg.vinfo @@ -0,0 +1,4 @@ +@use $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg.vinfo +@use mbox_sram_pkg_hdl.vinfo ++incdir+@vinfodir +mbox_sram_pkg.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.sv new file mode 100644 index 000000000..82e9bb46a --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.sv @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// PACKAGE: This file defines all of the files contained in the +// interface package that needs to be compiled and synthesized +// for running on Veloce. +// +// CONTAINS: +// - +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +package mbox_sram_pkg_hdl; + + import uvmf_base_pkg_hdl::*; + + // pragma uvmf custom package_imports_additional begin + // pragma uvmf custom package_imports_additional end + + // Parameters defined as HDL parameters + + `include "src/mbox_sram_typedefs_hdl.svh" + `include "src/mbox_sram_macros.svh" + + // pragma uvmf custom package_item_additional begin + // pragma uvmf custom package_item_additional end + +endpackage + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.vinfo b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.vinfo new file mode 100644 index 000000000..b490cd934 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_hdl.vinfo @@ -0,0 +1,2 @@ +@use $UVMF_HOME/uvmf_base_pkg/uvmf_base_pkg_hdl.vinfo +mbox_sram_pkg_hdl.sv diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_sve.F b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_sve.F new file mode 100644 index 000000000..690a04c08 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/mbox_sram_pkg_sve.F @@ -0,0 +1,10 @@ +// UVM ++incdir+${UVM_HOME}/src +${UVM_HOME}/src/uvm_pkg.sv + +// Common UVMF files +-f ${UVMF_HOME}/common/common_sve.f + ++incdir+. +-f ${UVMF_VIP_LIBRARY_HOME}/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hdl.f +-f ${UVMF_VIP_LIBRARY_HOME}/interface_packages/mbox_sram_pkg/mbox_sram_filelist_hvl.f diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram2reg_adapter.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram2reg_adapter.svh new file mode 100644 index 000000000..deba1e67c --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram2reg_adapter.svh @@ -0,0 +1,112 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: +// This file contains the UVM register adapter for the mbox_sram interface. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram2reg_adapter extends uvm_reg_adapter; + + `uvm_object_utils( mbox_sram2reg_adapter ) + + // pragma uvmf custom class_item_additional begin + // pragma uvmf custom class_item_additional end + + //-------------------------------------------------------------------- + // new + //-------------------------------------------------------------------- + function new (string name = "mbox_sram2reg_adapter" ); + super.new(name); + // pragma uvmf custom new begin + // UVMF_CHANGE_ME : Configure the adapter regarding byte enables and provides response. + + // Does the protocol the Agent is modeling support byte enables? + // 0 = NO + // 1 = YES + supports_byte_enable = 0; + + // Does the Agent's Driver provide separate response sequence items? + // i.e. Does the driver call seq_item_port.put() + // and do the sequences call get_response()? + // 0 = NO + // 1 = YES + provides_responses = 0; + // pragma uvmf custom new end + + endfunction: new + + //-------------------------------------------------------------------- + // reg2bus + //-------------------------------------------------------------------- + virtual function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op rw); + + mbox_sram_transaction trans_h = mbox_sram_transaction ::type_id::create("trans_h"); + + // pragma uvmf custom reg2bus begin + // UVMF_CHANGE_ME : Fill in the reg2bus adapter mapping registe fields to protocol fields. + + //Adapt the following for your sequence item type + // trans_h.op = (rw.kind == UVM_READ) ? WB_READ : WB_WRITE; + //Copy over address + // trans_h.addr = rw.addr; + //Copy over write data + // trans_h.data = rw.data; + + // pragma uvmf custom reg2bus end + + // Return the adapted transaction + return trans_h; + + endfunction: reg2bus + + //-------------------------------------------------------------------- + // bus2reg + //-------------------------------------------------------------------- + virtual function void bus2reg(uvm_sequence_item bus_item, + ref uvm_reg_bus_op rw); + mbox_sram_transaction trans_h; + if (!$cast(trans_h, bus_item)) begin + `uvm_fatal("ADAPT","Provided bus_item is not of the correct type") + return; + end + // pragma uvmf custom bus2reg begin + // UVMF_CHANGE_ME : Fill in the bus2reg adapter mapping protocol fields to register fields. + //Adapt the following for your sequence item type + //Copy over instruction type + // rw.kind = (trans_h.op == WB_WRITE) ? UVM_WRITE : UVM_READ; + //Copy over address + // rw.addr = trans_h.addr; + //Copy over read data + // rw.data = trans_h.data; + //Check for errors on the bus and return UVM_NOT_OK if there is an error + // rw.status = UVM_IS_OK; + // pragma uvmf custom bus2reg end + + endfunction: bus2reg + +endclass : mbox_sram2reg_adapter + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_agent.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_agent.svh new file mode 100644 index 000000000..ba0eb1e33 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_agent.svh @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: Protocol specific agent class definition +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_agent extends uvmf_parameterized_agent #( + .CONFIG_T(mbox_sram_configuration ), + .DRIVER_T(mbox_sram_driver ), + .MONITOR_T(mbox_sram_monitor ), + .COVERAGE_T(mbox_sram_transaction_coverage ), + .TRANS_T(mbox_sram_transaction ) + ); + + `uvm_component_utils( mbox_sram_agent ) + +// pragma uvmf custom class_item_additional begin + extern task handle_reset(string kind = "HARD"); +// pragma uvmf custom class_item_additional end + +// **************************************************************************** +// FUNCTION : new() +// This function is the standard SystemVerilog constructor. +// + function new( string name = "", uvm_component parent = null ); + super.new( name, parent ); + endfunction + +// **************************************************************************** + // FUNCTION: build_phase + virtual function void build_phase(uvm_phase phase); +// pragma uvmf custom build_phase_pre_super begin +// pragma uvmf custom build_phase_pre_super end + super.build_phase(phase); + if (configuration.active_passive == ACTIVE) begin + // Place sequencer handle into configuration object + // so that it may be retrieved from configuration + // rather than using uvm_config_db + configuration.sequencer = this.sequencer; + end + endfunction + +endclass + +// pragma uvmf custom external begin +task mbox_sram_agent::handle_reset(string kind = "HARD"); + configuration.handle_reset(kind); +endtask +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_configuration.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_configuration.svh new file mode 100644 index 000000000..4b3c2e2c3 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_configuration.svh @@ -0,0 +1,203 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class contains all variables and functions used +// to configure the mbox_sram agent and its bfm's. It gets the +// bfm's from the uvm_config_db for use by the agent. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_configuration extends uvmf_parameterized_agent_configuration_base #( + .DRIVER_BFM_BIND_T(virtual mbox_sram_driver_bfm ), + .MONITOR_BFM_BIND_T( virtual mbox_sram_monitor_bfm )); + + `uvm_object_utils( mbox_sram_configuration ) + + // Controls injection of ECC errors for write transactions. Bit[0]: Single Bit Error. Bit[1]: Double Bit Error + bit [1:0] inject_ecc_error = 2'b00; + // When set, causes the mbox_sram_responder_sequence to clear the variable 'inject_ecc_error' after a single ECC error is injected + bit auto_clear_ecc_error_injection = 1'b1; + + // Sequencer handle populated by agent + uvm_sequencer #(mbox_sram_transaction ) sequencer; + + //Constraints for the configuration variables: + + // pragma uvmf custom class_item_additional begin + extern task handle_reset(string kind = "HARD"); + // pragma uvmf custom class_item_additional end + + covergroup mbox_sram_configuration_cg; + // pragma uvmf custom covergroup begin + option.auto_bin_max=1024; + coverpoint inject_ecc_error; + coverpoint auto_clear_ecc_error_injection; + // pragma uvmf custom covergroup end + endgroup + + //******************************************************************* + //******************************************************************* + // Structure used to pass configuration variables to monitor and driver BFM's. + // Use to_struct function to pack variables into structure. + // Use from_struct function to unpack variables from structure. + // This structure is defined in mbox_sram_macros.svh + `mbox_sram_CONFIGURATION_STRUCT + mbox_sram_configuration_s mbox_sram_configuration_struct; + //******************************************************************* + // FUNCTION: to_struct() + // This function packs variables into a mbox_sram_configuration_s + // structure. The function returns the handle to the mbox_sram_configuration_struct. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_CONFIGURATION_TO_STRUCT_FUNCTION + //******************************************************************* + // FUNCTION: from_struct() + // This function unpacks the struct provided as an argument into + // variables of this class. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_CONFIGURATION_FROM_STRUCT_FUNCTION + + // **************************************************************************** + // FUNCTION : new() + // This function is the standard SystemVerilog constructor. + // + function new( string name = "" ); + super.new( name ); + // Construct the covergroup for this configuration class + mbox_sram_configuration_cg = new; + endfunction + + // **************************************************************************** + // FUNCTION: post_randomize() + // This function is automatically called after the randomize() function + // is executed. + // + function void post_randomize(); + super.post_randomize(); + mbox_sram_configuration_cg.sample(); + endfunction + + // **************************************************************************** + // FUNCTION: initialize + // This function causes the configuration to retrieve + // its virtual interface handle from the uvm_config_db. + // This function also makes itself available to its + // agent through the uvm_config_db. + // + // ARGUMENTS: + // uvmf_active_passive_t activity: + // This argument identifies the simulation level + // as either BLOCK, CHIP, SIMULATION, etc. + // + // AGENT_PATH: + // This argument identifies the path to this + // configurations agent. This configuration + // makes itself available to the agent specified + // by agent_path by placing itself into the + // uvm_config_db. + // + // INTERFACE_NAME: + // This argument identifies the string name of + // this configurations BFM's. This string + // name is used to retrieve the driver and + // monitor BFM from the uvm_config_db. + // + virtual function void initialize(uvmf_active_passive_t activity, + string agent_path, + string interface_name); + + super.initialize( activity, agent_path, interface_name); + // The covergroup is given the same name as the interface + mbox_sram_configuration_cg.set_inst_name(interface_name); + + // This configuration places itself into the uvm_config_db for the agent, identified by the agent_path variable, to retrieve. + uvm_config_db #( mbox_sram_configuration + )::set( null ,agent_path,UVMF_AGENT_CONFIG, this ); + + // This configuration also places itself in the config db using the same identifier used by the interface. This allows users to access + // configuration variables and the interface through the bfm api class rather than directly accessing the BFM. This is useful for + // accessingthe BFM when using Veloce + uvm_config_db #( mbox_sram_configuration + )::set( null ,UVMF_CONFIGURATIONS, interface_name, this ); + + mbox_sram_configuration_cg.set_inst_name($sformatf("mbox_sram_configuration_cg_%s",get_full_name())); + +// This code is to aid in debugging parameter mismatches between the BFM and its corresponding agent. +// Enable this debug by setting UVM_VERBOSITY to UVM_DEBUG +// Setting UVM_VERBOSITY to UVM_DEBUG causes all BFM's and all agents to display their parameter settings. +// All of the messages from this feature have a UVM messaging id value of "CFG" +// The transcript or run.log can be parsed to ensure BFM parameter settings match its corresponding agents parameter settings. + `uvm_info("CFG", + $psprintf("The agent at '%s' is using interface named %s has the following parameters: ", agent_path, interface_name, ), + UVM_DEBUG) + + // pragma uvmf custom initialize begin + // This controls whether or not the agent returns a transaction handle in the driver when calling + // item_done() back into the sequencer or not. If set to 1, a transaction is sent back which means + // the sequence on the other end must use the get_response() part of the driver/sequence API. If + // this doesn't occur, there will eventually be response_queue overflow errors during the test. + return_transaction_response = 1'b1; + + // pragma uvmf custom initialize end + + endfunction + + // **************************************************************************** + // TASK: wait_for_reset + // *[Required]* Blocks until reset is released. The wait_for_reset operation is performed + // by a task in the monitor bfm. + virtual task wait_for_reset(); + monitor_bfm.wait_for_reset(); + endtask + + // **************************************************************************** + // TASK: wait_for_num_clocks + // *[Required]* Blocks until specified number of clocks have elapsed. The wait_for_num_clocks + // operation is performed by a task in the monitor bfm. + virtual task wait_for_num_clocks(int clocks); + monitor_bfm.wait_for_num_clocks(clocks); + endtask + + // **************************************************************************** + // FUNCTION : convert2string() + // This function is used to convert variables in this class into a string for log messaging. + // + virtual function string convert2string (); + // pragma uvmf custom convert2string begin + return $sformatf("inject_ecc_error:0x%x auto_clear_ecc_error_injection:0x%x ",inject_ecc_error,auto_clear_ecc_error_injection); + // pragma uvmf custom convert2string end + endfunction + + // **************************************************************************** + // FUNCTION: get_sequencer + function uvm_sequencer #(mbox_sram_transaction) get_sequencer(); + return sequencer; + endfunction + +endclass + +// pragma uvmf custom external begin +task mbox_sram_configuration::handle_reset(string kind = "HARD"); + inject_ecc_error = 0; +endtask +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver.svh new file mode 100644 index 000000000..c083be2b0 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver.svh @@ -0,0 +1,105 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class passes transactions between the sequencer +// and the BFM driver interface. It accesses the driver BFM +// through the bfm handle. This driver +// passes transactions to the driver BFM through the access +// task. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_driver extends uvmf_driver_base #( + .CONFIG_T(mbox_sram_configuration ), + .BFM_BIND_T(virtual mbox_sram_driver_bfm ), + .REQ(mbox_sram_transaction ), + .RSP(mbox_sram_transaction )); + + `uvm_component_utils( mbox_sram_driver ) +//******************************************************************* +// Macros that define structs located in mbox_sram_macros.svh +//******************************************************************* +// Initiator macro used by mbox_sram_driver and mbox_sram_driver_bfm +// to communicate initiator driven data to mbox_sram_driver_bfm. +`mbox_sram_INITIATOR_STRUCT + mbox_sram_initiator_s mbox_sram_initiator_struct; +//******************************************************************* +// Responder macro used by mbox_sram_driver and mbox_sram_driver_bfm +// to communicate Responder driven data to mbox_sram_driver_bfm. +`mbox_sram_RESPONDER_STRUCT + mbox_sram_responder_s mbox_sram_responder_struct; + +// pragma uvmf custom class_item_additional begin +// pragma uvmf custom class_item_additional end + +// **************************************************************************** +// This function is the standard SystemVerilog constructor. +// + function new( string name = "", uvm_component parent=null ); + super.new( name, parent ); + endfunction + +// **************************************************************************** +// This function sends configuration object variables to the driver BFM +// using the configuration struct. +// + virtual function void configure(input CONFIG_T cfg); + bfm.configure( cfg.to_struct() ); + endfunction + +// **************************************************************************** +// This function places a handle to this class in the proxy variable in the +// driver BFM. This allows the driver BFM to call tasks and function within this class. +// + virtual function void set_bfm_proxy_handle(); + bfm.proxy = this; endfunction + +// **************************************************************************** +// This task is called by the run_phase in uvmf_driver_base. + virtual task access( inout REQ txn ); +// pragma uvmf custom access begin + if (configuration.initiator_responder==RESPONDER) begin + // Complete current transfer and wait for next transfer + bfm.respond_and_wait_for_next_transfer( + mbox_sram_initiator_struct, + txn.to_responder_struct() + ); + // Unpack information about initiated transfer received by this responder + txn.from_initiator_struct(mbox_sram_initiator_struct); + end else begin + // Initiate a transfer and get response + bfm.initiate_and_get_response( + txn.to_initiator_struct(), + mbox_sram_responder_struct + ); + // Unpack transfer response information received by this initiator + txn.from_responder_struct(mbox_sram_responder_struct); + end +// pragma uvmf custom access end + endtask + +endclass + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver_bfm.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver_bfm.sv new file mode 100644 index 000000000..6c9359089 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_driver_bfm.sv @@ -0,0 +1,334 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +import soc_ifc_pkg::*; +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: +// This interface performs the mbox_sram signal driving. It is +// accessed by the uvm mbox_sram driver through a virtual interface +// handle in the mbox_sram configuration. It drives the singals passed +// in through the port connection named bus of type mbox_sram_if. +// +// Input signals from the mbox_sram_if are assigned to an internal input +// signal with a _i suffix. The _i signal should be used for sampling. +// +// The input signal connections are as follows: +// bus.signal -> signal_i +// +// This bfm drives signals with a _o suffix. These signals +// are driven onto signals within mbox_sram_if based on INITIATOR/RESPONDER and/or +// ARBITRATION/GRANT status. +// +// The output signal connections are as follows: +// signal_o -> bus.signal +// +// +// Interface functions and tasks used by UVM components: +// +// configure: +// This function gets configuration attributes from the +// UVM driver to set any required BFM configuration +// variables such as 'initiator_responder'. +// +// initiate_and_get_response: +// This task is used to perform signaling activity for initiating +// a protocol transfer. The task initiates the transfer, using +// input data from the initiator struct. Then the task captures +// response data, placing the data into the response struct. +// The response struct is returned to the driver class. +// +// respond_and_wait_for_next_transfer: +// This task is used to complete a current transfer as a responder +// and then wait for the initiator to start the next transfer. +// The task uses data in the responder struct to drive protocol +// signals to complete the transfer. The task then waits for +// the next transfer. Once the next transfer begins, data from +// the initiator is placed into the initiator struct and sent +// to the responder sequence for processing to determine +// what data to respond with. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +import uvmf_base_pkg_hdl::*; +import mbox_sram_pkg_hdl::*; +`include "src/mbox_sram_macros.svh" + +interface mbox_sram_driver_bfm + (mbox_sram_if bus); + // The following pragma and additional ones in-lined further below are for running this BFM on Veloce + // pragma attribute mbox_sram_driver_bfm partition_interface_xif + +`ifndef XRTL +// This code is to aid in debugging parameter mismatches between the BFM and its corresponding agent. +// Enable this debug by setting UVM_VERBOSITY to UVM_DEBUG +// Setting UVM_VERBOSITY to UVM_DEBUG causes all BFM's and all agents to display their parameter settings. +// All of the messages from this feature have a UVM messaging id value of "CFG" +// The transcript or run.log can be parsed to ensure BFM parameter settings match its corresponding agents parameter settings. +import uvm_pkg::*; +`include "uvm_macros.svh" +initial begin : bfm_vs_agent_parameter_debug + `uvm_info("CFG", + $psprintf("The BFM at '%m' has the following parameters: ", ), + UVM_DEBUG) +end +`endif + + // Config value to determine if this is an initiator or a responder + uvmf_initiator_responder_t initiator_responder; + // Custom configuration variables. + // These are set using the configure function which is called during the UVM connect_phase + bit [1:0] inject_ecc_error ; + bit auto_clear_ecc_error_injection ; + + tri clk_i; + tri dummy_i; + + // Signal list (all signals are capable of being inputs and outputs for the sake + // of supporting both INITIATOR and RESPONDER mode operation. Expectation is that + // directionality in the config file was from the point-of-view of the INITIATOR + + // INITIATOR mode input signals + tri [$bits(mbox_sram_resp_t)-1:0] mbox_sram_resp_i; +// reg [$bits(mbox_sram_resp_t)-1:0] mbox_sram_resp_o = 'bz; + mbox_sram_resp_t mbox_sram_resp_o = 'bz; + + // INITIATOR mode output signals +// tri [$bits(mbox_sram_req_t)-1:0] mbox_sram_req_i; + mbox_sram_req_t mbox_sram_req_i; + reg [$bits(mbox_sram_req_t)-1:0] mbox_sram_req_o = 'bz; + + // Bi-directional signals + + + assign clk_i = bus.clk; + assign dummy_i = bus.dummy; + + // These are signals marked as 'input' by the config file, but the signals will be + // driven by this BFM if put into RESPONDER mode (flipping all signal directions around) + assign mbox_sram_resp_i = bus.mbox_sram_resp; + assign bus.mbox_sram_resp = (initiator_responder == RESPONDER) ? mbox_sram_resp_o : 'bz; + + + // These are signals marked as 'output' by the config file, but the outputs will + // not be driven by this BFM unless placed in INITIATOR mode. + assign bus.mbox_sram_req = (initiator_responder == INITIATOR) ? mbox_sram_req_o : 'bz; + assign mbox_sram_req_i = bus.mbox_sram_req; + + // Proxy handle to UVM driver + mbox_sram_pkg::mbox_sram_driver proxy; + // pragma tbx oneway proxy.my_function_name_in_uvm_driver + + // **************************************************************************** + // **************************************************************************** + // Macros that define structs located in mbox_sram_macros.svh + // **************************************************************************** + // Struct for passing configuration data from mbox_sram_driver to this BFM + // **************************************************************************** + `mbox_sram_CONFIGURATION_STRUCT + // **************************************************************************** + // Structs for INITIATOR and RESPONDER data flow + //******************************************************************* + // Initiator macro used by mbox_sram_driver and mbox_sram_driver_bfm + // to communicate initiator driven data to mbox_sram_driver_bfm. + `mbox_sram_INITIATOR_STRUCT + mbox_sram_initiator_s initiator_struct; + // Responder macro used by mbox_sram_driver and mbox_sram_driver_bfm + // to communicate Responder driven data to mbox_sram_driver_bfm. + `mbox_sram_RESPONDER_STRUCT + mbox_sram_responder_s responder_struct; + + // **************************************************************************** +// pragma uvmf custom reset_condition_and_response begin + // Always block used to return signals to reset value upon assertion of reset + always @( negedge dummy_i ) + begin + // RESPONDER mode output signals + mbox_sram_resp_o <= 'bz; + // INITIATOR mode output signals + mbox_sram_req_o <= 'bz; + // Bi-directional signals + + end +// pragma uvmf custom reset_condition_and_response end + + // pragma uvmf custom interface_item_additional begin + // pragma uvmf custom interface_item_additional end + + //****************************************************************** + // The configure() function is used to pass agent configuration + // variables to the driver BFM. It is called by the driver within + // the agent at the beginning of the simulation. It may be called + // during the simulation if agent configuration variables are updated + // and the driver BFM needs to be aware of the new configuration + // variables. + // + + function void configure(mbox_sram_configuration_s mbox_sram_configuration_arg); // pragma tbx xtf + initiator_responder = mbox_sram_configuration_arg.initiator_responder; + inject_ecc_error = mbox_sram_configuration_arg.inject_ecc_error; + auto_clear_ecc_error_injection = mbox_sram_configuration_arg.auto_clear_ecc_error_injection; + // pragma uvmf custom configure begin + // pragma uvmf custom configure end + endfunction + +// pragma uvmf custom initiate_and_get_response begin +// **************************************************************************** +// UVMF_CHANGE_ME +// This task is used by an initator. The task first initiates a transfer then +// waits for the responder to complete the transfer. + task initiate_and_get_response( + // This argument passes transaction variables used by an initiator + // to perform the initial part of a protocol transfer. The values + // come from a sequence item created in a sequence. + input mbox_sram_initiator_s mbox_sram_initiator_struct, + // This argument is used to send data received from the responder + // back to the sequence item. The sequence item is returned to the sequence. + output mbox_sram_responder_s mbox_sram_responder_struct + );// pragma tbx xtf + // + // Members within the mbox_sram_initiator_struct: + // bit is_read ; + // bit [MBOX_ADDR_W-1:0] address ; + // bit [MBOX_DATA_W-1:0] data ; + // bit [MBOX_ECC_DATA_W-1:0] data_ecc ; + // bit ecc_single_bit_error ; + // bit ecc_double_bit_error ; + // Members within the mbox_sram_responder_struct: + // bit is_read ; + // bit [MBOX_ADDR_W-1:0] address ; + // bit [MBOX_DATA_W-1:0] data ; + // bit [MBOX_ECC_DATA_W-1:0] data_ecc ; + // bit ecc_single_bit_error ; + // bit ecc_double_bit_error ; + initiator_struct = mbox_sram_initiator_struct; + // + // Reference code; + // How to wait for signal value + // while (control_signal == 1'b1) @(posedge clk_i); + // + // How to assign a responder struct member, named xyz, from a signal. + // All available initiator input and inout signals listed. + // Initiator input signals + // mbox_sram_responder_struct.xyz = mbox_sram_resp_i; // [$bits(mbox_sram_resp_t)-1:0] + // Initiator inout signals + // How to assign a signal from an initiator struct member named xyz. + // All available initiator output and inout signals listed. + // Notice the _o. Those are storage variables that allow for procedural assignment. + // Initiator output signals + // mbox_sram_req_o <= mbox_sram_initiator_struct.xyz; // [$bits(mbox_sram_req_t)-1:0] + // Initiator inout signals + // Initiate a transfer using the data received. + @(posedge clk_i); + @(posedge clk_i); + // Wait for the responder to complete the transfer then place the responder data into + // mbox_sram_responder_struct. + @(posedge clk_i); + @(posedge clk_i); + `uvm_fatal("MBOX_SRAM_DRIVER_BFM", "Unimplemented initiate_and_get_response") + responder_struct = mbox_sram_responder_struct; + endtask +// pragma uvmf custom initiate_and_get_response end + +// pragma uvmf custom respond_and_wait_for_next_transfer begin +// **************************************************************************** +// The first_transfer variable is used to prevent completing a transfer in the +// first call to this task. For the first call to this task, there is not +// current transfer to complete. +bit first_transfer=1; + +// UVMF_CHANGE_ME +// This task is used by a responder. The task first completes the current +// transfer in progress then waits for the initiator to start the next transfer. + task respond_and_wait_for_next_transfer( + // This argument is used to send data received from the initiator + // back to the sequence item. The sequence determines how to respond. + output mbox_sram_initiator_s mbox_sram_initiator_struct, + // This argument passes transaction variables used by a responder + // to complete a protocol transfer. The values come from a sequence item. + input mbox_sram_responder_s mbox_sram_responder_struct + );// pragma tbx xtf + // Variables within the mbox_sram_initiator_struct: + // bit is_read ; + // bit [MBOX_ADDR_W-1:0] address ; + // bit [MBOX_DATA_W-1:0] data ; + // bit [MBOX_ECC_DATA_W-1:0] data_ecc ; + // bit ecc_single_bit_error ; + // bit ecc_double_bit_error ; + // Variables within the mbox_sram_responder_struct: + // bit is_read ; + // bit [MBOX_ADDR_W-1:0] address ; + // bit [MBOX_DATA_W-1:0] data ; + // bit [MBOX_ECC_DATA_W-1:0] data_ecc ; + // bit ecc_single_bit_error ; + // bit ecc_double_bit_error ; + // Reference code; + // How to wait for signal value + // while (control_signal == 1'b1) @(posedge clk_i); + // + // How to assign a responder struct member, named xyz, from a signal. + // All available responder input and inout signals listed. + // Responder input signals + // mbox_sram_responder_struct.xyz = mbox_sram_req_i; // [$bits(mbox_sram_req_t)-1:0] + // Responder inout signals + // How to assign a signal, named xyz, from an initiator struct member. + // All available responder output and inout signals listed. + // Notice the _o. Those are storage variables that allow for procedural assignment. + // Responder output signals + // mbox_sram_resp_o <= mbox_sram_initiator_struct.xyz; // [$bits(mbox_sram_resp_t)-1:0] + // Responder inout signals + + responder_struct <= mbox_sram_responder_struct; + if (!first_transfer) begin + // Perform transfer response here. + // Reply using data recieved in the mbox_sram_responder_struct. + if (mbox_sram_responder_struct.is_read) begin + mbox_sram_resp_o.rdata.data <= mbox_sram_responder_struct.data; + mbox_sram_resp_o.rdata.ecc <= mbox_sram_responder_struct.data_ecc; + end + @(posedge clk_i); + end + while (mbox_sram_req_i.cs !== 1'b1) @(posedge clk_i); + // Wait for next transfer then gather info from intiator about the transfer. + // Place the data into the mbox_sram_initiator_struct. + mbox_sram_initiator_struct.is_read = ~mbox_sram_req_i.we; + mbox_sram_initiator_struct.address = mbox_sram_req_i.addr; + mbox_sram_initiator_struct.data = mbox_sram_req_i.wdata.data; + mbox_sram_initiator_struct.data_ecc = mbox_sram_req_i.wdata.ecc; + mbox_sram_initiator_struct.ecc_single_bit_error = mbox_sram_req_i.we && proxy.configuration.inject_ecc_error[0]; + mbox_sram_initiator_struct.ecc_double_bit_error = mbox_sram_req_i.we && proxy.configuration.inject_ecc_error[1]; + if (mbox_sram_initiator_struct.ecc_single_bit_error || mbox_sram_initiator_struct.ecc_double_bit_error) `uvm_info("MBOX_SRAM_DRIVER_BFM", "Injecting ECC bit flip", UVM_DEBUG) + else if (mbox_sram_req_i.we) `uvm_info("MBOX_SRAM_DRIVER_BFM", "Receiving SRAM write without ECC bit flip", UVM_DEBUG) + if (proxy.configuration.auto_clear_ecc_error_injection && |proxy.configuration.inject_ecc_error) begin + proxy.configuration.inject_ecc_error = 2'b00; + `uvm_info("MBOX_SRAM_DRIVER_BFM", "Resetting inject_ecc_error value to 0", UVM_DEBUG) + end + first_transfer = 0; + initiator_struct = mbox_sram_initiator_struct; + endtask +// pragma uvmf custom respond_and_wait_for_next_transfer end + + +endinterface + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_if.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_if.sv new file mode 100644 index 000000000..d84655f20 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_if.sv @@ -0,0 +1,83 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This interface contains the mbox_sram interface signals. +// It is instantiated once per mbox_sram bus. Bus Functional Models, +// BFM's named mbox_sram_driver_bfm, are used to drive signals on the bus. +// BFM's named mbox_sram_monitor_bfm are used to monitor signals on the +// bus. This interface signal bundle is passed in the port list of +// the BFM in order to give the BFM access to the signals in this +// interface. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// This template can be used to connect a DUT to these signals +// +// .dut_signal_port(mbox_sram_bus.mbox_sram_req), // Agent output +// .dut_signal_port(mbox_sram_bus.mbox_sram_resp), // Agent input + +import uvmf_base_pkg_hdl::*; +import mbox_sram_pkg_hdl::*; + +interface mbox_sram_if + + ( + input tri clk, + input tri dummy, + inout tri [$bits(mbox_sram_req_t)-1:0] mbox_sram_req, + inout tri [$bits(mbox_sram_resp_t)-1:0] mbox_sram_resp + ); + +modport monitor_port + ( + input clk, + input dummy, + input mbox_sram_req, + input mbox_sram_resp + ); + +modport initiator_port + ( + input clk, + input dummy, + output mbox_sram_req, + input mbox_sram_resp + ); + +modport responder_port + ( + input clk, + input dummy, + input mbox_sram_req, + output mbox_sram_resp + ); + + +// pragma uvmf custom interface_item_additional begin +// pragma uvmf custom interface_item_additional end + +endinterface + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_infact_coverage_strategy.csv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_infact_coverage_strategy.csv new file mode 100644 index 000000000..1c218e146 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_infact_coverage_strategy.csv @@ -0,0 +1,6 @@ +Global +auto_bin_max, 64 + +Name,Type,Include +rand_fields,coverpoint,=rand *.** + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_macros.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_macros.svh new file mode 100644 index 000000000..19d629026 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_macros.svh @@ -0,0 +1,186 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This file contains macros used with the mbox_sram package. +// These macros include packed struct definitions. These structs are +// used to pass data between classes, hvl, and BFM's, hdl. Use of +// structs are more efficient and simpler to modify. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// + +// **************************************************************************** +// When changing the contents of this struct, be sure to update the to_struct +// and from_struct methods defined in the macros below that are used in +// the mbox_sram_configuration class. +// + `define mbox_sram_CONFIGURATION_STRUCT \ +typedef struct packed { \ + bit [1:0] inject_ecc_error;\ + bit auto_clear_ecc_error_injection;\ + uvmf_active_passive_t active_passive; \ + uvmf_initiator_responder_t initiator_responder; \ + } mbox_sram_configuration_s; + + `define mbox_sram_CONFIGURATION_TO_STRUCT_FUNCTION \ + virtual function mbox_sram_configuration_s to_struct();\ + mbox_sram_configuration_struct = \ + {\ + this.inject_ecc_error,\ + this.auto_clear_ecc_error_injection,\ + this.active_passive,\ + this.initiator_responder\ + };\ + return ( mbox_sram_configuration_struct );\ + endfunction + + `define mbox_sram_CONFIGURATION_FROM_STRUCT_FUNCTION \ + virtual function void from_struct(mbox_sram_configuration_s mbox_sram_configuration_struct);\ + {\ + this.inject_ecc_error,\ + this.auto_clear_ecc_error_injection,\ + this.active_passive,\ + this.initiator_responder \ + } = mbox_sram_configuration_struct;\ + endfunction + +// **************************************************************************** +// When changing the contents of this struct, be sure to update the to_monitor_struct +// and from_monitor_struct methods of the mbox_sram_transaction class. +// + `define mbox_sram_MONITOR_STRUCT typedef struct packed { \ + bit is_read ; \ + bit [MBOX_ADDR_W-1:0] address ; \ + bit [MBOX_DATA_W-1:0] data ; \ + bit [MBOX_ECC_DATA_W-1:0] data_ecc ; \ + bit ecc_single_bit_error ; \ + bit ecc_double_bit_error ; \ + } mbox_sram_monitor_s; + + `define mbox_sram_TO_MONITOR_STRUCT_FUNCTION \ + virtual function mbox_sram_monitor_s to_monitor_struct();\ + mbox_sram_monitor_struct = \ + { \ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + };\ + return ( mbox_sram_monitor_struct);\ + endfunction\ + + `define mbox_sram_FROM_MONITOR_STRUCT_FUNCTION \ + virtual function void from_monitor_struct(mbox_sram_monitor_s mbox_sram_monitor_struct);\ + {\ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + } = mbox_sram_monitor_struct;\ + endfunction + +// **************************************************************************** +// When changing the contents of this struct, be sure to update the to_initiator_struct +// and from_initiator_struct methods of the mbox_sram_transaction class. +// Also update the comments in the driver BFM. +// + `define mbox_sram_INITIATOR_STRUCT typedef struct packed { \ + bit is_read ; \ + bit [MBOX_ADDR_W-1:0] address ; \ + bit [MBOX_DATA_W-1:0] data ; \ + bit [MBOX_ECC_DATA_W-1:0] data_ecc ; \ + bit ecc_single_bit_error ; \ + bit ecc_double_bit_error ; \ + } mbox_sram_initiator_s; + + `define mbox_sram_TO_INITIATOR_STRUCT_FUNCTION \ + virtual function mbox_sram_initiator_s to_initiator_struct();\ + mbox_sram_initiator_struct = \ + {\ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + };\ + return ( mbox_sram_initiator_struct);\ + endfunction + + `define mbox_sram_FROM_INITIATOR_STRUCT_FUNCTION \ + virtual function void from_initiator_struct(mbox_sram_initiator_s mbox_sram_initiator_struct);\ + {\ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + } = mbox_sram_initiator_struct;\ + endfunction + +// **************************************************************************** +// When changing the contents of this struct, be sure to update the to_responder_struct +// and from_responder_struct methods of the mbox_sram_transaction class. +// Also update the comments in the driver BFM. +// + `define mbox_sram_RESPONDER_STRUCT typedef struct packed { \ + bit is_read ; \ + bit [MBOX_ADDR_W-1:0] address ; \ + bit [MBOX_DATA_W-1:0] data ; \ + bit [MBOX_ECC_DATA_W-1:0] data_ecc ; \ + bit ecc_single_bit_error ; \ + bit ecc_double_bit_error ; \ + } mbox_sram_responder_s; + + `define mbox_sram_TO_RESPONDER_STRUCT_FUNCTION \ + virtual function mbox_sram_responder_s to_responder_struct();\ + mbox_sram_responder_struct = \ + {\ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + };\ + return ( mbox_sram_responder_struct);\ + endfunction + + `define mbox_sram_FROM_RESPONDER_STRUCT_FUNCTION \ + virtual function void from_responder_struct(mbox_sram_responder_s mbox_sram_responder_struct);\ + {\ + this.is_read , \ + this.address , \ + this.data , \ + this.data_ecc , \ + this.ecc_single_bit_error , \ + this.ecc_double_bit_error \ + } = mbox_sram_responder_struct;\ + endfunction +// pragma uvmf custom additional begin +// pragma uvmf custom additional end diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor.svh new file mode 100644 index 000000000..701ca2ef4 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor.svh @@ -0,0 +1,101 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class receives mbox_sram transactions observed by the +// mbox_sram monitor BFM and broadcasts them through the analysis port +// on the agent. It accesses the monitor BFM through the monitor +// task. This UVM component captures transactions +// for viewing in the waveform viewer if the +// enable_transaction_viewing flag is set in the configuration. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_monitor extends uvmf_monitor_base #( + .CONFIG_T(mbox_sram_configuration ), + .BFM_BIND_T(virtual mbox_sram_monitor_bfm ), + .TRANS_T(mbox_sram_transaction )); + + `uvm_component_utils( mbox_sram_monitor ) + +// Structure used to pass data from monitor BFM to monitor class in agent. +// Use to_monitor_struct function to pack transaction variables into structure. +// Use from_monitor_struct function to unpack transaction variables from structure. +`mbox_sram_MONITOR_STRUCT + + // pragma uvmf custom class_item_additional begin + // pragma uvmf custom class_item_additional end + +// **************************************************************************** +// This function is the standard SystemVerilog constructor. +// + function new( string name = "", uvm_component parent = null ); + super.new( name, parent ); + endfunction + +// **************************************************************************** +// This function sends configuration object variables to the monitor BFM +// using the configuration struct. +// + virtual function void configure(input CONFIG_T cfg); + bfm.configure( cfg.to_struct() ); + + endfunction + +// **************************************************************************** +// This function places a handle to this class in the proxy variable in the +// monitor BFM. This allows the monitor BFM to call the notify_transaction +// function within this class. +// + virtual function void set_bfm_proxy_handle(); + bfm.proxy = this; endfunction + +// *************************************************************************** + virtual task run_phase(uvm_phase phase); + // Start monitor BFM thread and don't call super.run() in order to + // override the default monitor proxy 'pull' behavior with the more + // emulation-friendly BFM 'push' approach using the notify_transaction + // function below + bfm.start_monitoring(); + endtask + +// ************************************************************************** + +// This function is called by the monitor BFM. It receives data observed by the +// monitor BFM. Data is passed using the mbox_sram_monitor_struct. + virtual function void notify_transaction(input mbox_sram_monitor_s mbox_sram_monitor_struct); + + + trans = new("trans"); + trans.from_monitor_struct(mbox_sram_monitor_struct); + trans.start_time = time_stamp; + trans.end_time = $time; + time_stamp = trans.end_time; + + analyze(trans); + endfunction + +endclass + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor_bfm.sv b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor_bfm.sv new file mode 100644 index 000000000..3071c999d --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_monitor_bfm.sv @@ -0,0 +1,238 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +import soc_ifc_pkg::*; +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This interface performs the mbox_sram signal monitoring. +// It is accessed by the uvm mbox_sram monitor through a virtual +// interface handle in the mbox_sram configuration. It monitors the +// signals passed in through the port connection named bus of +// type mbox_sram_if. +// +// Input signals from the mbox_sram_if are assigned to an internal input +// signal with a _i suffix. The _i signal should be used for sampling. +// +// The input signal connections are as follows: +// bus.signal -> signal_i +// +// Interface functions and tasks used by UVM components: +// monitor(inout TRANS_T txn); +// This task receives the transaction, txn, from the +// UVM monitor and then populates variables in txn +// from values observed on bus activity. This task +// blocks until an operation on the mbox_sram bus is complete. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +import uvmf_base_pkg_hdl::*; +import mbox_sram_pkg_hdl::*; +`include "src/mbox_sram_macros.svh" + + +interface mbox_sram_monitor_bfm + ( mbox_sram_if bus ); + // The pragma below and additional ones in-lined further down are for running this BFM on Veloce + // pragma attribute mbox_sram_monitor_bfm partition_interface_xif + +`ifndef XRTL +// This code is to aid in debugging parameter mismatches between the BFM and its corresponding agent. +// Enable this debug by setting UVM_VERBOSITY to UVM_DEBUG +// Setting UVM_VERBOSITY to UVM_DEBUG causes all BFM's and all agents to display their parameter settings. +// All of the messages from this feature have a UVM messaging id value of "CFG" +// The transcript or run.log can be parsed to ensure BFM parameter settings match its corresponding agents parameter settings. +import uvm_pkg::*; +`include "uvm_macros.svh" +initial begin : bfm_vs_agent_parameter_debug + `uvm_info("CFG", + $psprintf("The BFM at '%m' has the following parameters: ", ), + UVM_DEBUG) +end +`endif + + + // Structure used to pass transaction data from monitor BFM to monitor class in agent. +`mbox_sram_MONITOR_STRUCT + mbox_sram_monitor_s mbox_sram_monitor_struct; + + // Structure used to pass configuration data from monitor class to monitor BFM. + `mbox_sram_CONFIGURATION_STRUCT + + + // Config value to determine if this is an initiator or a responder + uvmf_initiator_responder_t initiator_responder; + // Custom configuration variables. + // These are set using the configure function which is called during the UVM connect_phase + bit [1:0] inject_ecc_error ; + bit auto_clear_ecc_error_injection ; + + tri clk_i; + tri dummy_i; + tri mbox_sram_req_t mbox_sram_req_i; + tri mbox_sram_resp_t mbox_sram_resp_i; + assign clk_i = bus.clk; + assign dummy_i = bus.dummy; + assign mbox_sram_req_i = bus.mbox_sram_req; + assign mbox_sram_resp_i = bus.mbox_sram_resp; + + // Proxy handle to UVM monitor + mbox_sram_pkg::mbox_sram_monitor proxy; + // pragma tbx oneway proxy.notify_transaction + + // pragma uvmf custom interface_item_additional begin + function bit [1:0] rvecc_decode ( input [31:0] din, input [6:0] ecc_in); + bit [6:0] ecc_check; + + // Generate the ecc bits + ecc_check[0] = ecc_in[0]^din[0]^din[1]^din[3]^din[4]^din[6]^din[8]^din[10]^din[11]^din[13]^din[15]^din[17]^din[19]^din[21]^din[23]^din[25]^din[26]^din[28]^din[30]; + ecc_check[1] = ecc_in[1]^din[0]^din[2]^din[3]^din[5]^din[6]^din[9]^din[10]^din[12]^din[13]^din[16]^din[17]^din[20]^din[21]^din[24]^din[25]^din[27]^din[28]^din[31]; + ecc_check[2] = ecc_in[2]^din[1]^din[2]^din[3]^din[7]^din[8]^din[9]^din[10]^din[14]^din[15]^din[16]^din[17]^din[22]^din[23]^din[24]^din[25]^din[29]^din[30]^din[31]; + ecc_check[3] = ecc_in[3]^din[4]^din[5]^din[6]^din[7]^din[8]^din[9]^din[10]^din[18]^din[19]^din[20]^din[21]^din[22]^din[23]^din[24]^din[25]; + ecc_check[4] = ecc_in[4]^din[11]^din[12]^din[13]^din[14]^din[15]^din[16]^din[17]^din[18]^din[19]^din[20]^din[21]^din[22]^din[23]^din[24]^din[25]; + ecc_check[5] = ecc_in[5]^din[26]^din[27]^din[28]^din[29]^din[30]^din[31]; + + // This is the parity bit + ecc_check[6] = ((^din[31:0])^(^ecc_in[6:0])); + + rvecc_decode[0] = (ecc_check[6:0] != 0) & ecc_check[6]; // Single-bit error + rvecc_decode[1] = (ecc_check[6:0] != 0) & ~ecc_check[6]; // Double-bit error + + endfunction: rvecc_decode + // pragma uvmf custom interface_item_additional end + + //****************************************************************** + task wait_for_reset();// pragma tbx xtf +// @(posedge clk_i) ; +// do_wait_for_reset(); + endtask + + // **************************************************************************** + task do_wait_for_reset(); + // pragma uvmf custom reset_condition begin + wait ( dummy_i === 1 ) ; + @(posedge clk_i) ; + // pragma uvmf custom reset_condition end + endtask + + // pragma uvmf custom wait_for_num_clocks begin + //**************************************************************************** + // Inject pragmas's here to throw a warning on regeneration. + // Task must have automatic lifetime so that it can be concurrently invoked + // by multiple entities with a different wait value. + task automatic wait_for_num_clocks(input int unsigned count); // pragma tbx xtf + if (count == 0) `uvm_fatal("CFG", "wait_for_num_clocks called with count of 0 - this will lead to a hang"); + @(posedge clk_i); + repeat (count-1) @(posedge clk_i); + endtask + // pragma uvmf custom wait_for_num_clocks end + + //****************************************************************** + event go; + function void start_monitoring();// pragma tbx xtf + -> go; + endfunction + + // **************************************************************************** + initial begin + @go; + forever begin + @(posedge clk_i); + do_monitor( mbox_sram_monitor_struct ); + + + proxy.notify_transaction( mbox_sram_monitor_struct ); + + end + end + + //****************************************************************** + // The configure() function is used to pass agent configuration + // variables to the monitor BFM. It is called by the monitor within + // the agent at the beginning of the simulation. It may be called + // during the simulation if agent configuration variables are updated + // and the monitor BFM needs to be aware of the new configuration + // variables. + // + function void configure(mbox_sram_configuration_s mbox_sram_configuration_arg); // pragma tbx xtf + initiator_responder = mbox_sram_configuration_arg.initiator_responder; + inject_ecc_error = mbox_sram_configuration_arg.inject_ecc_error; + auto_clear_ecc_error_injection = mbox_sram_configuration_arg.auto_clear_ecc_error_injection; + // pragma uvmf custom configure begin + // pragma uvmf custom configure end + endfunction + + + // **************************************************************************** + + task do_monitor(output mbox_sram_monitor_s mbox_sram_monitor_struct); + // + // Available struct members: + // // mbox_sram_monitor_struct.is_read + // // mbox_sram_monitor_struct.address + // // mbox_sram_monitor_struct.data + // // mbox_sram_monitor_struct.data_ecc + // // mbox_sram_monitor_struct.ecc_single_bit_error + // // mbox_sram_monitor_struct.ecc_double_bit_error + // // + // Reference code; + // How to wait for signal value + // while (control_signal === 1'b1) @(posedge clk_i); + // + // How to assign a struct member, named xyz, from a signal. + // All available input signals listed. + // mbox_sram_monitor_struct.xyz = mbox_sram_req_i; // [$bits(mbox_sram_req_t)-1:0] + // mbox_sram_monitor_struct.xyz = mbox_sram_resp_i; // [$bits(mbox_sram_resp_t)-1:0] + // pragma uvmf custom do_monitor begin + // UVMF_CHANGE_ME : Implement protocol monitoring. The commented reference code + // below are examples of how to capture signal values and assign them to + // structure members. All available input signals are listed. The 'while' + // code example shows how to wait for a synchronous flow control signal. This + // task should return when a complete transfer has been observed. Once this task is + // exited with captured values, it is then called again to wait for and observe + // the next transfer. One clock cycle is consumed between calls to do_monitor. + while (mbox_sram_req_i.cs !== 1'b1) @(posedge clk_i); + mbox_sram_monitor_struct.is_read = ~mbox_sram_req_i.we; + mbox_sram_monitor_struct.address = mbox_sram_req_i.addr; + mbox_sram_monitor_struct.data = mbox_sram_req_i.wdata.data; + mbox_sram_monitor_struct.data_ecc = mbox_sram_req_i.wdata.ecc; + // For writes, the monitored transaction signals the _intent_ to inject an ECC error + // at the responder sequence + mbox_sram_monitor_struct.ecc_single_bit_error = proxy.configuration.inject_ecc_error[0]; + mbox_sram_monitor_struct.ecc_double_bit_error = proxy.configuration.inject_ecc_error[1]; + // If a write is detected, return immediately (that's the whole transaction) + if (mbox_sram_req_i.we) return; + // If a read, continue another clock cycle to capture return data + @(posedge clk_i); + mbox_sram_monitor_struct.data = mbox_sram_resp_i.rdata.data; + mbox_sram_monitor_struct.data_ecc = mbox_sram_resp_i.rdata.ecc; + // For reads, the monitored transaction signals the calculation of actual ECC errors + // observed on the data returned from the responder sequence + {mbox_sram_monitor_struct.ecc_double_bit_error, + mbox_sram_monitor_struct.ecc_single_bit_error} = rvecc_decode(mbox_sram_monitor_struct.data, mbox_sram_monitor_struct.data_ecc); + // pragma uvmf custom do_monitor end + endtask + + +endinterface + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_random_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_random_sequence.svh new file mode 100644 index 000000000..90ce2cdb4 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_random_sequence.svh @@ -0,0 +1,67 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: +// This sequences randomizes the mbox_sram transaction and sends it +// to the UVM driver. +// +// This sequence constructs and randomizes a mbox_sram_transaction. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_random_sequence + extends mbox_sram_sequence_base ; + + `uvm_object_utils( mbox_sram_random_sequence ) + + // pragma uvmf custom class_item_additional begin + // pragma uvmf custom class_item_additional end + + //***************************************************************** + function new(string name = ""); + super.new(name); + endfunction: new + + // **************************************************************************** + // TASK : body() + // This task is automatically executed when this sequence is started using the + // start(sequencerHandle) task. + // + task body(); + + // Construct the transaction + req=mbox_sram_transaction::type_id::create("req"); + start_item(req); + // Randomize the transaction + if(!req.randomize()) `uvm_fatal("SEQ", "mbox_sram_random_sequence::body()-mbox_sram_transaction randomization failed") + // Send the transaction to the mbox_sram_driver_bfm via the sequencer and mbox_sram_driver. + finish_item(req); + `uvm_info("SEQ", {"Response:",req.convert2string()},UVM_MEDIUM) + + endtask + +endclass: mbox_sram_random_sequence + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_responder_sequence.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_responder_sequence.svh new file mode 100644 index 000000000..97e8efc3c --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_responder_sequence.svh @@ -0,0 +1,122 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class can be used to provide stimulus when an interface +// has been configured to run in a responder mode. It +// will never finish by default, always going back to the driver +// and driver BFM for the next transaction with which to respond. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_responder_sequence + extends mbox_sram_sequence_base ; + + `uvm_object_utils( mbox_sram_responder_sequence ) + + // pragma uvmf custom class_item_additional begin + // Implement a model of the Mailbox SRAM + localparam NUM_BYTES = MBOX_DATA_AND_ECC_W/8 + ((MBOX_DATA_AND_ECC_W % 8) ? 1 : 0); + // TODO support initialization from mailbox.hex + logic [7:0] ram [MBOX_DEPTH][NUM_BYTES-1:0] = '{default: 8'h00}; + + function bit [1:0] rvecc_decode ( input [31:0] din, input [6:0] ecc_in); + bit [6:0] ecc_check; + + // Generate the ecc bits + ecc_check[0] = ecc_in[0]^din[0]^din[1]^din[3]^din[4]^din[6]^din[8]^din[10]^din[11]^din[13]^din[15]^din[17]^din[19]^din[21]^din[23]^din[25]^din[26]^din[28]^din[30]; + ecc_check[1] = ecc_in[1]^din[0]^din[2]^din[3]^din[5]^din[6]^din[9]^din[10]^din[12]^din[13]^din[16]^din[17]^din[20]^din[21]^din[24]^din[25]^din[27]^din[28]^din[31]; + ecc_check[2] = ecc_in[2]^din[1]^din[2]^din[3]^din[7]^din[8]^din[9]^din[10]^din[14]^din[15]^din[16]^din[17]^din[22]^din[23]^din[24]^din[25]^din[29]^din[30]^din[31]; + ecc_check[3] = ecc_in[3]^din[4]^din[5]^din[6]^din[7]^din[8]^din[9]^din[10]^din[18]^din[19]^din[20]^din[21]^din[22]^din[23]^din[24]^din[25]; + ecc_check[4] = ecc_in[4]^din[11]^din[12]^din[13]^din[14]^din[15]^din[16]^din[17]^din[18]^din[19]^din[20]^din[21]^din[22]^din[23]^din[24]^din[25]; + ecc_check[5] = ecc_in[5]^din[26]^din[27]^din[28]^din[29]^din[30]^din[31]; + + // This is the parity bit + ecc_check[6] = ((^din[31:0])^(^ecc_in[6:0])); + + rvecc_decode[0] = (ecc_check[6:0] != 0) & ecc_check[6]; // Single-bit error + rvecc_decode[1] = (ecc_check[6:0] != 0) & ~ecc_check[6]; // Double-bit error + + endfunction: rvecc_decode + // pragma uvmf custom class_item_additional end + + function new(string name = "mbox_sram_responder_sequence"); + super.new(name); + endfunction + + task body(); + req=mbox_sram_transaction::type_id::create("req"); + forever begin + start_item(req); + finish_item(req); + // pragma uvmf custom body begin + // Do something here with the resulting req item. The + // finish_item() call above will block until the req transaction is ready + // to be handled by the responder sequence. + // If this was an item that required a response, the expectation is + // that the response should be populated within this transaction now. + wait(new_rsp.triggered); + if (req.compare(rsp)) `uvm_info("MBOX_SRAM_SEQ", "req and rsp are the same after finish_item", UVM_DEBUG) + else `uvm_error("MBOX_SRAM_SEQ", $sformatf("NOTE: req and rsp are different after finish_item.\nreq: %s\nrsp: %s", req.convert2string(), rsp.convert2string())) + // The 'rsp' is actually a request from the DUT, we need to create a response + if (rsp.is_read) begin + byte unsigned ii; + for (ii=0;iinew_rsp; + // Display the received response transaction + `uvm_info("SEQ", {"New response transaction:",rsp.convert2string()}, UVM_MEDIUM) + end + join_none + endtask + + // **************************************************************************** + // TASK : pre_body() + // This task is called automatically when start is called with call_pre_post set to 1 (default). + // By calling get_responses() within pre_body() any derived sequences are automatically + // processing response transactions. Only un-comment this call to get_responses() if you + // have configured the interface driver to utilize the response transaction path by setting + // the configuration variable "return_transaction_response" to 1. Otherwise it is possible + // to impact runtime performance and memory utilization. + // + virtual task pre_body(); + // pragma uvmf custom pre_body begin + get_responses(); + // pragma uvmf custom pre_body end + endtask + + // **************************************************************************** + // TASK : body() + // This task is called automatically when start is called. This sequence sends + // a req sequence item to the sequencer identified as an argument in the call + // to start. + // + virtual task body(); + // pragma uvmf custom body begin + start_item(req); + finish_item(req); + // pragma uvmf custom body end + endtask + + // **************************************************************************** + // FUNCTION : new() + // This function is the standard SystemVerilog constructor. + // + function new( string name =""); + super.new( name ); + // pragma uvmf custom new begin + req = mbox_sram_transaction_req_t::type_id::create("req"); + rsp = mbox_sram_transaction_rsp_t::type_id::create("rsp"); + // pragma uvmf custom new end + endfunction + +endclass + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction.svh new file mode 100644 index 000000000..dd3049af0 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction.svh @@ -0,0 +1,216 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class defines the variables required for an mbox_sram +// transaction. Class variables to be displayed in waveform transaction +// viewing are added to the transaction viewing stream in the add_to_wave +// function. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +class mbox_sram_transaction extends uvmf_transaction_base; + + `uvm_object_utils( mbox_sram_transaction ) + + rand bit is_read ; + rand bit [MBOX_ADDR_W-1:0] address ; + rand bit [MBOX_DATA_W-1:0] data ; + bit [MBOX_ECC_DATA_W-1:0] data_ecc ; + rand bit ecc_single_bit_error ; + rand bit ecc_double_bit_error ; + + //Constraints for the transaction variables: + + // pragma uvmf custom class_item_additional begin + // pragma uvmf custom class_item_additional end + + //******************************************************************* + //******************************************************************* + // Macros that define structs and associated functions are + // located in mbox_sram_macros.svh + + //******************************************************************* + // Monitor macro used by mbox_sram_monitor and mbox_sram_monitor_bfm + // This struct is defined in mbox_sram_macros.svh + `mbox_sram_MONITOR_STRUCT + mbox_sram_monitor_s mbox_sram_monitor_struct; + //******************************************************************* + // FUNCTION: to_monitor_struct() + // This function packs transaction variables into a mbox_sram_monitor_s + // structure. The function returns the handle to the mbox_sram_monitor_struct. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_TO_MONITOR_STRUCT_FUNCTION + //******************************************************************* + // FUNCTION: from_monitor_struct() + // This function unpacks the struct provided as an argument into transaction + // variables of this class. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_FROM_MONITOR_STRUCT_FUNCTION + + //******************************************************************* + // Initiator macro used by mbox_sram_driver and mbox_sram_driver_bfm + // to communicate initiator driven data to mbox_sram_driver_bfm. + // This struct is defined in mbox_sram_macros.svh + `mbox_sram_INITIATOR_STRUCT + mbox_sram_initiator_s mbox_sram_initiator_struct; + //******************************************************************* + // FUNCTION: to_initiator_struct() + // This function packs transaction variables into a mbox_sram_initiator_s + // structure. The function returns the handle to the mbox_sram_initiator_struct. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_TO_INITIATOR_STRUCT_FUNCTION + //******************************************************************* + // FUNCTION: from_initiator_struct() + // This function unpacks the struct provided as an argument into transaction + // variables of this class. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_FROM_INITIATOR_STRUCT_FUNCTION + + //******************************************************************* + // Responder macro used by mbox_sram_driver and mbox_sram_driver_bfm + // to communicate Responder driven data to mbox_sram_driver_bfm. + // This struct is defined in mbox_sram_macros.svh + `mbox_sram_RESPONDER_STRUCT + mbox_sram_responder_s mbox_sram_responder_struct; + //******************************************************************* + // FUNCTION: to_responder_struct() + // This function packs transaction variables into a mbox_sram_responder_s + // structure. The function returns the handle to the mbox_sram_responder_struct. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_TO_RESPONDER_STRUCT_FUNCTION + //******************************************************************* + // FUNCTION: from_responder_struct() + // This function unpacks the struct provided as an argument into transaction + // variables of this class. + // This function is defined in mbox_sram_macros.svh + `mbox_sram_FROM_RESPONDER_STRUCT_FUNCTION + // **************************************************************************** + // FUNCTION : new() + // This function is the standard SystemVerilog constructor. + // + function new( string name = "" ); + super.new( name ); + endfunction + + // **************************************************************************** + // FUNCTION: convert2string() + // This function converts all variables in this class to a single string for + // logfile reporting. + // + virtual function string convert2string(); + // pragma uvmf custom convert2string begin + // UVMF_CHANGE_ME : Customize format if desired. + return $sformatf("is_read:0x%x address:0x%x data:0x%x data_ecc:0x%x ecc_single_bit_error:0x%x ecc_double_bit_error:0x%x ",is_read,address,data,data_ecc,ecc_single_bit_error,ecc_double_bit_error); + // pragma uvmf custom convert2string end + endfunction + + //******************************************************************* + // FUNCTION: do_print() + // This function is automatically called when the .print() function + // is called on this class. + // + virtual function void do_print(uvm_printer printer); + // pragma uvmf custom do_print begin + // UVMF_CHANGE_ME : Current contents of do_print allows for the use of UVM 1.1d, 1.2 or P1800.2. + // Update based on your own printing preference according to your preferred UVM version + $display(convert2string()); + // pragma uvmf custom do_print end + endfunction + + //******************************************************************* + // FUNCTION: do_compare() + // This function is automatically called when the .compare() function + // is called on this class. + // + virtual function bit do_compare (uvm_object rhs, uvm_comparer comparer); + mbox_sram_transaction RHS; + if (!$cast(RHS,rhs)) return 0; + // pragma uvmf custom do_compare begin + // UVMF_CHANGE_ME : Eliminate comparison of variables not to be used for compare + return (super.do_compare(rhs,comparer) + &&(this.is_read == RHS.is_read) + &&(this.address == RHS.address) + &&(this.data == RHS.data) + &&(this.data_ecc == RHS.data_ecc) + &&(this.ecc_single_bit_error == RHS.ecc_single_bit_error) + &&(this.ecc_double_bit_error == RHS.ecc_double_bit_error) + ); + // pragma uvmf custom do_compare end + endfunction + + //******************************************************************* + // FUNCTION: do_copy() + // This function is automatically called when the .copy() function + // is called on this class. + // + virtual function void do_copy (uvm_object rhs); + mbox_sram_transaction RHS; + assert($cast(RHS,rhs)); + // pragma uvmf custom do_copy begin + super.do_copy(rhs); + this.is_read = RHS.is_read; + this.address = RHS.address; + this.data = RHS.data; + this.data_ecc = RHS.data_ecc; + this.ecc_single_bit_error = RHS.ecc_single_bit_error; + this.ecc_double_bit_error = RHS.ecc_double_bit_error; + // pragma uvmf custom do_copy end + endfunction + + // **************************************************************************** + // FUNCTION: add_to_wave() + // This function is used to display variables in this class in the waveform + // viewer. The start_time and end_time variables must be set before this + // function is called. If the start_time and end_time variables are not set + // the transaction will be hidden at 0ns on the waveform display. + // + virtual function void add_to_wave(int transaction_viewing_stream_h); + `ifdef QUESTA + if (transaction_view_h == 0) begin + transaction_view_h = $begin_transaction(transaction_viewing_stream_h,"mbox_sram_transaction",start_time); + end + super.add_to_wave(transaction_view_h); + // pragma uvmf custom add_to_wave begin + // UVMF_CHANGE_ME : Color can be applied to transaction entries based on content, example below + // case() + // 1 : $add_color(transaction_view_h,"red"); + // default : $add_color(transaction_view_h,"grey"); + // endcase + // UVMF_CHANGE_ME : Eliminate transaction variables not wanted in transaction viewing in the waveform viewer + $add_attribute(transaction_view_h,is_read,"is_read"); + $add_attribute(transaction_view_h,address,"address"); + $add_attribute(transaction_view_h,data,"data"); + $add_attribute(transaction_view_h,data_ecc,"data_ecc"); + $add_attribute(transaction_view_h,ecc_single_bit_error,"ecc_single_bit_error"); + $add_attribute(transaction_view_h,ecc_double_bit_error,"ecc_double_bit_error"); + // pragma uvmf custom add_to_wave end + $end_transaction(transaction_view_h,end_time); + $free_transaction(transaction_view_h); + `endif // QUESTA + endfunction + +endclass + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction_coverage.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction_coverage.svh new file mode 100644 index 000000000..9c935c889 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_transaction_coverage.svh @@ -0,0 +1,107 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: This class records mbox_sram transaction information using +// a covergroup named mbox_sram_transaction_cg. An instance of this +// coverage component is instantiated in the uvmf_parameterized_agent +// if the has_coverage flag is set. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +covergroup mbox_sram_transaction_bit_cg with function sample(input bit val); + option.per_instance = 1; + ea_bit: coverpoint val; +endgroup + +class mbox_sram_transaction_coverage extends uvm_subscriber #(.T(mbox_sram_transaction )); + + `uvm_component_utils( mbox_sram_transaction_coverage ) + + T coverage_trans; + + // pragma uvmf custom class_item_additional begin + mbox_sram_transaction_bit_cg address_bit_cg[MBOX_ADDR_W]; + mbox_sram_transaction_bit_cg data_bit_cg[MBOX_DATA_W]; + mbox_sram_transaction_bit_cg data_ecc_bit_cg[MBOX_ECC_DATA_W]; + // pragma uvmf custom class_item_additional end + + // **************************************************************************** + covergroup mbox_sram_transaction_cg; + // pragma uvmf custom covergroup begin + // UVMF_CHANGE_ME : Add coverage bins, crosses, exclusions, etc. according to coverage needs. + option.auto_bin_max=1024; + option.per_instance=1; + is_read: coverpoint coverage_trans.is_read; + address: coverpoint coverage_trans.address; + data: coverpoint coverage_trans.data; + data_ecc: coverpoint coverage_trans.data_ecc; + ecc_single_bit_error: coverpoint coverage_trans.ecc_single_bit_error; + ecc_double_bit_error: coverpoint coverage_trans.ecc_double_bit_error; + // TODO add checks for ecc single/double errors, address='0, address='1, address alignment cases + // TODO add cross for read transaction, write transaction + // pragma uvmf custom covergroup end + endgroup + + // **************************************************************************** + // FUNCTION : new() + // This function is the standard SystemVerilog constructor. + // + function new(string name="", uvm_component parent=null); + super.new(name,parent); + mbox_sram_transaction_cg=new; + foreach (coverage_trans.address[bt]) address_bit_cg[bt] = new; + foreach (coverage_trans.data[bt]) data_bit_cg[bt] = new; + foreach (coverage_trans.data_ecc[bt]) data_ecc_bit_cg[bt] = new; + endfunction + + // **************************************************************************** + // FUNCTION : build_phase() + // This function is the standard UVM build_phase. + // + function void build_phase(uvm_phase phase); + mbox_sram_transaction_cg.set_inst_name($sformatf("mbox_sram_transaction_cg_%s",get_full_name())); + foreach (coverage_trans.address[bt]) address_bit_cg[bt].set_inst_name($sformatf("address_bit_cg_%d_%s", bt, get_full_name())); + foreach (coverage_trans.data[bt]) data_bit_cg[bt].set_inst_name($sformatf("data_bit_cg_%d_%s", bt, get_full_name())); + foreach (coverage_trans.data_ecc[bt]) data_ecc_bit_cg[bt].set_inst_name($sformatf("data_ecc_bit_cg_%d_%s", bt, get_full_name())); + endfunction + + // **************************************************************************** + // FUNCTION: write (T t) + // This function is automatically executed when a transaction arrives on the + // analysis_export. It copies values from the variables in the transaction + // to local variables used to collect functional coverage. + // + virtual function void write (T t); + `uvm_info("COV","Received transaction",UVM_HIGH); + coverage_trans = t; + mbox_sram_transaction_cg.sample(); + foreach (coverage_trans.address [bt]) address_bit_cg [bt].sample(coverage_trans.address [bt]); + foreach (coverage_trans.data [bt]) data_bit_cg [bt].sample(coverage_trans.data [bt]); + foreach (coverage_trans.data_ecc[bt]) data_ecc_bit_cg[bt].sample(coverage_trans.data_ecc[bt]); + endfunction + +endclass + +// pragma uvmf custom external begin +// pragma uvmf custom external end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs.svh new file mode 100644 index 000000000..f2a7bdb94 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs.svh @@ -0,0 +1,34 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: +// This file contains defines and typedefs to be compiled for use in +// the simulation running on the host server when using Veloce. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// + + +// pragma uvmf custom additional begin +// pragma uvmf custom additional end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs_hdl.svh b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs_hdl.svh new file mode 100644 index 000000000..0d58518e2 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/src/mbox_sram_typedefs_hdl.svh @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------- +// Created with uvmf_gen version 2022.3 +//---------------------------------------------------------------------- +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pragma uvmf custom header begin +// pragma uvmf custom header end +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// +// DESCRIPTION: +// This file contains defines and typedefs to be compiled for use in +// the simulation running on the emulator when using Veloce. +// +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +// + + + +// pragma uvmf custom additional begin +// pragma uvmf custom additional end + diff --git a/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/yaml/mbox_sram_interface.yaml b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/yaml/mbox_sram_interface.yaml new file mode 100644 index 000000000..903678275 --- /dev/null +++ b/src/soc_ifc/uvmf_soc_ifc/uvmf_template_output/verification_ip/interface_packages/mbox_sram_pkg/yaml/mbox_sram_interface.yaml @@ -0,0 +1,73 @@ +uvmf: + interfaces: + mbox_sram: + clock: clk + config_constraints: [] + config_vars: + - comment: 'Controls injection of ECC errors for write transactions. Bit[0]: Single Bit Error. Bit[1]: Double Bit Error' + isrand: 'False' + name: inject_ecc_error + type: bit [1:0] + value: 1'b0 + - comment: When set, causes the mbox_sram_responder_sequence to clear the variable 'inject_ecc_error' after a single ECC error is injected + isrand: 'False' + name: auto_clear_ecc_error_injection + type: bit + value: 1'b1 + existing_library_component: 'True' + gen_inbound_streaming_driver: 'False' + hdl_pkg_parameters: [] + hdl_typedefs: [] + hvl_pkg_parameters: [] + hvl_typedefs: [] + parameters: [] + ports: + - dir: output + name: mbox_sram_req + reset_value: '''bz' + width: $bits(mbox_sram_req_t) + - dir: input + name: mbox_sram_resp + reset_value: '''bz' + width: $bits(mbox_sram_resp_t) + reset: dummy + reset_assertion_level: 'False' + transaction_constraints: [] + transaction_vars: + - comment: '' + iscompare: 'True' + isrand: 'True' + name: is_read + type: bit + unpacked_dimension: '' + - comment: '' + iscompare: 'True' + isrand: 'True' + name: address + type: bit [MBOX_ADDR_W-1:0] + unpacked_dimension: '' + - comment: '' + iscompare: 'True' + isrand: 'True' + name: data + type: bit [MBOX_DATA_W-1:0] + unpacked_dimension: '' + - comment: '' + iscompare: 'True' + isrand: 'False' + name: data_ecc + type: bit [MBOX_ECC_DATA_W-1:0] + unpacked_dimension: '' + - comment: '' + iscompare: 'True' + isrand: 'True' + name: ecc_single_bit_error + type: bit + unpacked_dimension: '' + - comment: '' + iscompare: 'True' + isrand: 'True' + name: ecc_double_bit_error + type: bit + unpacked_dimension: '' + use_dpi_link: 'False'