UVM callback - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

204


21
 
1
class driver extends uvm_component;
2
  `uvm_component_utils(driver)
3
  `uvm_register_cb(driver,driver_cb) // callback registration
4
  
5
  function new(string name = "driver", uvm_component parent = null);
6
    super.new(name,parent);
7
  endfunction
8
  
9
  task run_phase(uvm_phase phase); 
10
    super.run_phase(phase);
11
    drive();
12
    `uvm_do_callbacks(driver,driver_cb,modify_pkt()); // callback hook
13
    `uvm_info(get_full_name(),$sformatf("Driven pkt is %s", pkt.name()),UVM_LOW);
14
  endtask
15
  
16
  task drive();
17
    `uvm_info(get_full_name(),"Inside drive method",UVM_LOW);
18
    std::randomize(pkt) with {pkt == GOOD;};
19
  endtask
20
endclass
21
xxxxxxxxxx
1
 
1
1994 views and 2 likes     
 
Example for UVM callback

Example for UVM callback

140:0