Code10: UVM Field macros int.sv - 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

209


34
 
1
//Now we'll try to understand how you add an automation method to the variables which you'll be adding in a class.
2
3
`include "uvm_macros.svh"
4
import uvm_pkg::*;
5
 
6
class obj extends uvm_object;
7
  //  `uvm_object_utils(obj) //no need this line
8
 
9
  function new(string path = "obj");
10
    super.new(path);
11
  endfunction
12
  
13
  rand bit [3:0] a;
14
  rand bit [7:0] b;
15
 
16
  `uvm_object_utils_begin(obj)
17
  `uvm_field_int(a, UVM_NOPRINT | UVM_BIN);
18
  `uvm_field_int(b, UVM_DEFAULT | UVM_DEC);
19
  `uvm_object_utils_end
20
 
21
  
22
endclass
23
 
24
module tb;
25
  obj o;
26
  
27
  initial begin
28
    o = new("obj");
29
    o.randomize();
30
    o.print(uvm_default_table_printer);
31
  end
32
  
33
endmodule
34
xxxxxxxxxx
1
 
1
// Code your design here
2
44 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0