You are on page 1of 12

UVM Basics

Connecting Env to DUT

Tom Fitzpatrick
Verification Evangelist

info@verificationacademy.com | www.verificationacademy.com
Connecting Env to DUT

module
Top-level
uvm_test Variable part
uvm_env
Class-based
uvm_agent classes Fixed part

dut_if
Structural interface

DUT
module
Interface
interface dut_if();

logic clock, reset;


logic data;

endinterface: dut_if

Top-level
uvm_test
uvm_env
uvm_agent

dut_if

DUT
DUT
module dut(dut_if _if);

always @(posedge _if.clock)


begin
...
end

endmodule: dut Top-level


uvm_test
uvm_env
uvm_agent

dut_if

DUT
Configuration Database

Top-level Config Database


uvm_test name = value
name = value
uvm_env name = value
name = .

uvm_agent Virtual interface

Virtual interface
dut_if
Interface

DUT
uvm_config_db ... set
module top;
...
dut_if dut_if1 ();

initial
begin: blk Type of value Prefix Path
uvm_config_db #(virtual dut_if)::set(null, “uvm_test_top”,
"dut_vi", dut_if1);
Field name Value
run_test("my_test");
end

endmodule: top
Test Passes Virtual Interface Down
class my_test extends uvm_test;
...
my_dut_config dut_config_0;
...

function void build_phase(uvm_phase phase);


dut_config_0 = new();
Type of value Prefix Path
if(!uvm_config_db #(dut_if)::get( this, “”,
“dut_vi”, dut_config_0.dut_vi))
Field name Value
`uvm_fatal(“MY_TEST”, “No DUT_IF”);
// other DUT configuration settings
uvm_config_db#(my_dut_config)::set(this, “*”, “dut_config”,
dut_config_0);
endfunction
Accessing Pins through Virtual Interface
class my_driver extends uvm_driver;
`uvm_component_utils(my_driver)

virtual dut_if dut_vi; _vi = virtual interface

function new(string name, uvm_component parent);


...
function void build_phase(uvm_phase phase);
... Top-level

task run_phase(uvm_phase phase); uvm_test

phase.raise_objection(this); uvm_env
uvm_agent
#10 dut_vi.data = 0;
#10 dut_vi.data = 1;
#10 phase.drop_objection(this); dut_if

endtask: run_phase DUT


...
Setting and Getting Configuration Values

uvm_config_db #(T)::set(this, "path", "name", value);


Config database
name = value
name = value Scope
name = value

name = value
name = value
name = value

uvm_config_db #(T)::get(this, "", "name", value);

Scope
Path and field names can contain wildcards (glob pattern matching)
uvm_config_db: Hierarchical Configuration

Config information flows top-down, higher levels overriding lower levels

uvm_test
set(this, "*", "data", a);

uvm_env
get(this, "", "opt", b);
set(this, "*", "data", b);

uvm_component

get(this, "", "data", obj); // obj = a


Summary

Top-level Config Database


uvm_test name = value
name = value
name = value
uvm_env name = .

uvm_agentVirtual interface

dut_if
Interface

DUT
UVM Basics
Connecting Env to DUT

Tom Fitzpatrick
Verification Evangelist

info@verificationacademy.com | www.verificationacademy.com

You might also like