Hello,
We need to test our chip with different flash models, which are coded in verilog.
At the moment the test bench is in verilog and the script is used to select the flash model and put it to a wrapper.
The test bench connects the wrapper to the DUT. We need to recompile everything if the flash model is changed.
We would like to use uvm so that we do not need to recompile if we use different flash models.
Since I am a beginner to uvm, I started with a small uvm test bench with the DUT and 2 flash models.
Our idea is to put the 3 virtual interfaces (dut_flash_vif, flash1_vif, flash2_vif) in the agent. In the connect phase of the agent,
dut_flash_vif, flash1_vif, flash2_vif are connected to the flash interfaces of the DUT, flash1, flash2 verilog modules.
Furthermore, we want to connect dut_flash_vif to flash1_vif or flash2_vif based upon the flash model which is selected in the uvm test case.
In the following code we connect dut_flash_vif to flash1_vif by assigning the dut virtual interface pointer to the flash1 virtual interface pointer
(this.flash1_vif = this.dut_flash_vif). Unfortunately the connection from dut_flash_vif to flash1_vif is not working. Flash1 interface does not receive the signal toggling at the DUT flash inetrface.
Why does flash1_vif not get the signal changing from dut_flash_vif? How do we connect dut_flash_vif to flash1_vif?
Does someone have a better idea to select the flash verilog models in the uvm testbench?
Thanks.
Christine
The followings are some extraction from the codes.
module top
……….
flash_if flash1_if();
flash_if flash2_if();
flash_if dut_flash_if();
………..
initial
begin
uvm_config_db#(virtual flash_if)::set(null, "*", "dut_flash_vif", dut_flash_if);
uvm_config_db#(virtual flash_if)::set(null, "*", "flash1_vif", flash1_if);
uvm_config_db#(virtual flash_if)::set(null, "*", "flash2_vif", flash2_if);
run_test();
end
endmodel
-----------------------------------------------------------------------
package flash_pkg;
……………
typedef enum {FALSH1, FLASH2} flash_t;
…………
endpackage: flash_pkg
------------------------------------------
class test_sel_flash extends uvm_test;
……..
flash_t flash_cfg;
………
function void build_phase(uvm_phase phase);
flash_cfg = FLASH1;
uvm_config_db #(flash_t)::set(this, "m_env.m_flash_agent", "flash_cfg", flash_cfg);
endfunction : build_phase
………..
endclass: test_sel_flash
-----------------------------------------------------
class flash_agent extends uvm_agent;
……….
virtual flash_if dut_flash_vif;
virtual flash_if flash1_vif;
virtual flash_if flash2_vif;
flash_t flash_cfg;
…….
function void connect_phase(uvm_phase phase);
// Get the interfaces from the configuration database,
if ( !uvm_config_db#(virtual flash_if)::get(this, "", "dut_flash_vif", dut_flash_vif))
`uvm_fatal(get_type_name(), "flash_agent's DUT Flash virtual interface not configured")
if ( !uvm_config_db#(virtual flash_if)::get(this, "", "flash1_vif", flash1_vif))
`uvm_fatal(get_type_name(), "flash_agent's Flash 1 virtual interface not configured")
if ( !uvm_config_db#(virtual flash_if)::get(this, "", "flash2_vif", flash2_vif))
`uvm_fatal(get_type_name(), "flash_agent's Flash2 virtual interface not configured")
// connect dut_falsh_vif to the selected flash vif
if ( uvm_config_db#(flash_t)::get(this, "", "flash_cfg", flash_cfg)) begin
case (flash_cfg)
**FLASH1 : this.flash1_vif = this.dut_flash_vif;
FLASH2 : this.flash2_vif = this.dut_flash_vif;
** endcase
end
else
`uvm_fatal(get_type_name(), "flash type (flash_cfg) not configured")
……….
endfunction : connect_phase