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

208


49
 
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
  endfunction
30
  
31
  function void build_phase(uvm_phase phase);
32
    agent = my_agent::type_id::create("my_agent", this);
33
  endfunction: build_phase
34
  
35
  task run_phase(uvm_phase phase);
36
    `uvm_info("my_test",
37
      $sformatf("Running test with mode %0d", agent.mode),
38
      UVM_LOW)
39
  endtask: run_phase
40
41
endclass
42
43
module top_tb;
44
  // Start UVM
45
  initial begin
46
    run_test("my_test");
47
  end
48
endmodule
49
xxxxxxxxxx
1
 
1
1084 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