Jump to content
Sign in to follow this  
leo_chen

How to reuse and assign virtual interface for multi-interface environment?

Recommended Posts

Hi,

I am creating the testbench that includes 2 flash memory, so I instance 2 flash_if in top testbench, but some signals I found second instance (flash_if1) seems not assigned well.

I dump the waveform of flash_if0 and flash_if1, when receiving the flash reset command, the flash signals on both flash_if0 and flash_if1 are the same.

The reset detection mechanism in flash_bus_monitor[0] works well, but the same detection in flash_bus_monitor[1] doesn't work.:confused:

Please kindly help.

top testbench:

flash_if flash_if0 ();
flash_if flash_if1 ();

initial begin
  uvm_config_db#(virtual flash_if)::set(uvm_root::get(), "*flash_monitor[0]", "flash_if0", flash_if0);
  uvm_config_db#(virtual flash_if)::set(uvm_root::get(), "*flash_monitor[1]", "flash_if0", flash_if1); //this one looks not work
  run_test();
end

UVM environment:

flash_bus_monitor flash_monitor[2];
function void build_phase(uvm_phase phase);
  super.build_phase(phase);
  for (byte i=0; i<2; i++)
    flash_monitor[i] = flash_bus_monitor::type_id::create($sformatf("flash_monitor[%0d]",i) , this);
endfunction : build_phase

flash_bus_monitor:

virtual flash_if flash_if0;
function void build_phase(uvm_phase phase);
  if(!uvm_config_db#(virtual flash_if)::get(this, "", "flash_if0", flash_if0))
   `uvm_fatal("NOVIF",{"virtual interface must be set for: ",get_full_name(),".flash_if0"}); //neither flash_monitor[0] nor flash_monitor[1] trigger this fatal
endfunction: build_phase

Thanks in advance.

Share this post


Link to post
Share on other sites

There is a typo in top testbench. You need to change the third argument of the second uvm_config_db call to "flash_if1".

But I only instantiated only one flash_if called "flash_if0".

I thought I can assign different interfaces to the same "flash_if0" of different flash_monitor?

My intention: (not SV syntax, just concept)

flash_monitor[0].flash_if0 = top_testbench.flash_if0;
 flash_monitor[1].flash_if[COLOR="red"]0[/COLOR] = top_testbench.flash_if1;
Is this possible?

Or I need to instantiate many flash_if in flash_bus_monitor. Then :

flash_monitor[0].flash_if0 = top_testbench.flash_if0;
 flash_monitor[1].flash_if[COLOR="red"]1[/COLOR] = top_testbench.flash_if1;

Anyway, I will try it out.

Thanks, Pratta.

Share this post


Link to post
Share on other sites

I see. I didn't notice that there were two different monitor class instances. You're right that you should be able to pass the two different interface instances to the two different monitor instances.

Share this post


Link to post
Share on other sites

I see. I didn't notice that there were two different monitor class instances. You're right that you should be able to pass the two different interface instances to the two different monitor instances.

Thanks Pratta.

I have fixed this issue, that was my bad.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...