Jump to content
ljepson74

named event to trigger between class and module

Recommended Posts

We (as an industry) normally use virtual interfaces to communicate between the module 'world' and the class 'world' of SystemVerilog.  Right?**

 

Can anyone comment on the use of events (named events) for class<-->module communication?  Good?  Bad?  Gothchas?

 

Scenario: A test wants to send a signal (trigger) to the top (where the DUT is instantiated).

Creating a 1b interface to transmit this trigger seems like overkill, but that is what I did.  I had some trouble triggering on an event between module and class. Hierarchy problems.  I did not try passing the event thru the config_db - if that even makes sense (is possible).

 

**Correct me if I'm wrong, but that's the way I see it.  I'm sure the UVM base class has a sea of code that I don't understand.

 

Share this post


Link to post
Share on other sites

We hacked around with this tonight @ http://www.meetup.com/SystemVerilog-Social-Club-Silicon-Valley

 

Here is the code.   I think the uvm added to some confusion for me.   Maybe tomorrow I'll replace the interface I used.

// From SVSC meetup, 2015 July 20
// Some code we hacked around with.
// Trying to get event to trigger between module and class.
// Play: 
//   Swap A1 and A2. 
//   Switch the locations of the initial blocks, so order compiler
//    encounters them differs.
//   Comment out/in B1, to adjust the triggering of the event

class event_holder;
   event class_e;

   function new();
      $display(" pre trigger.");      
      ->$root.top.top_e;    //or even just ->top.top_e;
      $display(" post trigger.");      
   endfunction
endclass : event_holder


module top;
   event top_e;

   initial begin
      event_holder m_event_holder;
      $display(" Start ** ** **.");
      #1;  //B1
      m_event_holder=new();      
      #55;
      //->top_e;
   end

   initial begin
      $display(" pre event.");
      @top_e;                   //A1
      //wait(top_e.triggered);  //A2
      $display(" post event.");
   end
endmodule

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.


×
×
  • Create New...