UVM command line options - 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


50
 
1
import uvm_pkg::*;
2
3
// This class contains a property that can be set
4
// from the command line.
5
class my_agent extends uvm_agent;
6
7
  // This property can be set from the command line like:
8
  // +uvm_set_config_int=*,mode,5
9
  int mode;
10
  `uvm_component_utils_begin(my_agent)
11
    `uvm_field_int(mode, UVM_ALL_ON)
12
  `uvm_component_utils_end
13
14
  function new(string name = "my_agent", uvm_component parent = null);
15
    super.new(name, parent);
16
  endfunction
17
18
endclass
19
20
// The UVM test
21
class my_test extends uvm_test;
22
23
  `uvm_component_utils(my_test)
24
  
25
  my_agent agent;
26
  
27
  function new(string name = "my_test", uvm_component parent = null);
28
    super.new(name, parent);
29
    uvm_component::print_config_matches = 1;
30
  endfunction
31
  
32
  function void build_phase(uvm_phase phase);
33
    agent = my_agent::type_id::create("my_agent", this);
34
  endfunction: build_phase
35
  
36
  task run_phase(uvm_phase phase);
37
    `uvm_info("my_test",
38
      $sformatf("Running test with mode %0d", agent.mode),
39
      UVM_LOW)
40
  endtask: run_phase
41
42
endclass
43
44
module top_tb;
45
  // Start UVM
46
  initial begin
47
    run_test("my_test");
48
  end
49
endmodule
50
xxxxxxxxxx
1
 
1
232 views and 0 likes     
 
Can UVM flag an error for bad command line options?

Can UVM flag an error for bad command line options?

1100:0