In reply to Christine Lin:
Hi Christine,
no problem. I try to explain some more details.
I understood you have 2 different configurations for your DUT and UVM environment, flash1 and flash2.
But each configuration needs only 1 virtual interface, but they are different for each configuration. With macros you can control this situation. FLASH1 and FLASH2 are macros.
In the toplevel module you can do the following:
module top
……….
flash_if flash1_if();
flash_if flash2_if();
`ifdef FLASH1
flash_design DUT(flash1);
`endif
`ifdef FLASH2
flash_design DUT(flash2);
`endif
………..
initial
begin
`ifdef FLASH1
uvm_config_db#(virtual flash_if)::set(null, "*", "flash_vif", flash1_if);
`endif
`ifdef FLASH2
uvm_config_db#(virtual flash_if)::set(null, "*", "flash_vif", flash2_if);
`endif
run_test();
end
endmodule
In the agent you’ll retrieve the interface passed to the config_db. The correct interface was put to the config_db from the toplevel module. We do not have to differentiate.
class flash_agent extends uvm_agent;
……….
virtual flash_if 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, "", "flash_vif", vif))
`uvm_error(get_type_name(), "flash_agent's DUT Flash virtual interface not configured")
From the command line of your simulator you can define which macro has to set. I’m not so familiar with VCS, but there should be a switch to set the specific macro you need. It should look like this
+define+FLASH1
for setting the macro FLASH1
Then the simulator executes your code specified inside ifdef FLASH1 - endif
Hope this makes it now clear to you.
If you have more questions please let me know.
You can also use my email christoph@christoph-suehnel.de
Christoph