Sidsh

driver.sv

Oct 29th, 2022 (edited)
1,517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class our_driver extends uvm_driver #(our_packet)       //Parameterized the driver class
  2.     `uvm_component_utils(our_driver)
  3.  
  4.     our_interface intf;     //instantiating our interface
  5.     our_packet pkt;         //instantiating our packet class   
  6.    
  7.     //build phase
  8.     //build other components
  9.         uvm_config_db #(virtual our_interface) :: get (null, " * ", "intf", intf);      //The GET method
  10.  
  11.         pkt = our_packet :: type_id :: create ("Our Packet")        //created an object Our Packet
  12.  
  13.     //run phase
  14.     task run_phase (uvm_pahse phase);
  15.  
  16.         forever begin      
  17.             @(posedge intf.clk)         //very similar to always block, intf.clk because we are using interface clock(external)
  18.            
  19.                 seq_item_port.get_next_item(pkt);   //means 'from sequence item port get next item(packet pkt)'
  20.                 intf.input_1 <= pkt.input_1;        //means get input_1 from packet, and assign to the interfaces input_1
  21.                 seq_item_port.item_done();          //this tells that driver has given one packet and it is ready to accept next packet
  22. end
  23. endtask
  24.  
Advertisement
Add Comment
Please, Sign In to add comment