System verilog testbench

how a generator and driver connected in system verilog. and how do they communicate to each other.As in UVM we have tlm ports but can anybody describe about how a stimulus is sent to driver??how r they connected and communicate?

Hi Divya,

In System Verilog, generator and driver are connected with the help of system verilog mailbox. For mailbox you can refer, Section 15.4 Mailboxes of IEEE Std 1800-2012 IEEE STANDARD FOR SYSTEMVERILOG—UNIFIED HARDWARE DESIGN, SPECIFICATION, AND VERIFICATION LANGUAGE.

You right that in UVM, TLM port is used to communication between driver and sequencer. To understand the flow, you need to refer section 5.9.2.1 Getting Started with Sequences of UVM 1.0 EA User’s Guide which is freely downloadable UVM User Guide.

Let me know in case of any concern.
Best Regards,
Chetan Shah
Sr. ASIC Verification Engineer

Product Engineering Services
Software | Embedded | Semiconductor
www.einfochips.com
Frost & Sullivan Company of the Year 2013-14

Hi Divya,

In SV Communication is done through Mailboxes.

In below code you can see generator class and driver class communicates through mailbox i.e
gen2dvr.put(pkt) puts a randomized transaction and gen2dvr.get(pktd) driver gets that packet and process accordingly.

Thanks,
Vikas Billa



//Generator Class
class generator;
 packet pkt;
 mailbox gen2dvr;

 function void start (mailbox gen2dvr);
   this.gen2dvr = gen2dvr;
   pkt =new();
 endfunction

 task run;
   //Randomizing the packet 
   //Returns "1" if successfully Randomized else "0"
   if(pkt.randomize())             
     $display("Randomization Completed Successfully");
    else
       $display("Randomization Failed");
   //putting it in to generator to driver mailbox
   gen2dvr.put(pkt);
 endtask

 endclass : generator


//Driver Class

class driver;
  packet pktd;
  mailbox gen2dvr,dvr2scb,dvr2cov;

  virtual fifo_if vif;

 function void start(mailbox gen2dvr,dvr2scb,dvr2cov, virtual fifo_if vif)
   this.gen2dvr = gen2dvr;
   this.dvr2scb = dvr2scb;
   this.dvr2cov = dvr2cov;
   this.vif     = vif;
 endfunction

 task run;
   $display("***********In Driver Class start**********");
   repeat(10) 
    begin
     gen2dvr.get(pktd);
       @(posedge vif.clk)
        if(pktd.rst == 1'b1)
         begin
          vif.cb_dut.data_in <=15'b00000000000000;
         end
          else
            vif.cb_dut.data_in<= pktd.data_in;
     end
    $display("***********In Driver Class end**********");

    gen2dvr.get(pktd);
    gen2cov.put(pktd);
    gen2scb.put(pktd);
 endtask 

 endclass : driver