0% found this document useful (0 votes)
43 views

Course Basic Uvm Session2 Uvm Hello World Tfitzpatrick

Uploaded by

thrumalesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Course Basic Uvm Session2 Uvm Hello World Tfitzpatrick

Uploaded by

thrumalesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

UVM Basics

UVM "Hello World"

Tom Fitzpatrick
Verification Evangelist

[email protected] | www.verificationacademy.com
DUT and Verification Environment

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

dut_if
Structural interface

DUT
module

© 2013 Mentor Graphics Corporation, all rights reserved.


Interface
interface dut_if();

...

endinterface: dut_if

Top-level
uvm_test
uvm_env

dut_if

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.


DUT
module dut(dut_if _if);

...

endmodule: dut

Top-level
uvm_test
uvm_env

dut_if

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.


DUT Instantiation
module top;
...

dut_if dut_if1 ();

dut dut1 ( ._if(dut_if1) );

... Top-level
uvm_test
endmodule: top uvm_env

dut_if

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.


Env
class my_env extends uvm_env;

Top-level
uvm_test
uvm_env

dut_if

DUT

endclass: my_env
© 2013 Mentor Graphics Corporation, all rights reserved.
Env
class my_env extends uvm_env;
`uvm_component_utils(my_env)

Top-level
uvm_test
uvm_env

dut_if

DUT

endclass: my_env
© 2013 Mentor Graphics Corporation, all rights reserved.
Env
class my_env extends uvm_env;
`uvm_component_utils(my_env)

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new

Top-level
uvm_test
uvm_env

dut_if

DUT

endclass: my_env
© 2013 Mentor Graphics Corporation, all rights reserved.
Env
class my_env extends uvm_env;
`uvm_component_utils(my_env)

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new

function void build_phase(uvm_phase phase);


...//instantiate components
Top-level
uvm_test
endfunction: build_phase uvm_env

dut_if

DUT

endclass: my_env
© 2013 Mentor Graphics Corporation, all rights reserved.
Env
class my_env extends uvm_env;
`uvm_component_utils(my_env)

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new

function void build_phase(uvm_phase phase);


Top-level
super.build_phase(phase); uvm_test
endfunction: build_phase uvm_env

task run_phase(uvm_phase phase);


dut_if

DUT
endtask: run_phase
endclass: my_env
© 2013 Mentor Graphics Corporation, all rights reserved.
End-of-Test Mechanism

task run_phase(uvm_phase phase);


1st objection raised when time = 0
phase.raise_objection(this);

#10; Test ends when all objections


dropped
phase.drop_objection(this);

endtask: run_phase

© 2013 Mentor Graphics Corporation, all rights reserved.


Test
class my_test extends uvm_test;
`uvm_component_utils(my_test)

Top-level
uvm_test
uvm_env

dut_if

DUT

endclass: my_test
© 2013 Mentor Graphics Corporation, all rights reserved.
Test
class my_test extends uvm_test;
`uvm_component_utils(my_test)

my_env my_env_h; _h = handle

Top-level
uvm_test
uvm_env

dut_if

DUT

endclass: my_test
© 2013 Mentor Graphics Corporation, all rights reserved.
Test
class my_test extends uvm_test;
`uvm_component_utils(my_test)

my_env my_env_h;

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new
Top-level
uvm_test
function void build_phase(uvm_phase phase); uvm_env

endfunction: build_phase
dut_if

DUT
endclass: my_test

© 2013 Mentor Graphics Corporation, all rights reserved.


Test
class my_test extends uvm_test;
`uvm_component_utils(my_test)

my_env my_env_h;

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new
Top-level
uvm_test
function void build_phase(uvm_phase phase); uvm_env
my_env_h = my_env::type_id::create(...
endfunction: build_phase
dut_if

DUT
endclass: my_test

© 2013 Mentor Graphics Corporation, all rights reserved.


Test
class my_test extends uvm_test;
`uvm_component_utils(my_test)

my_env my_env_h;

function new(string name, uvm_component parent);


super.new(name, parent);
endfunction: new
Top-level
uvm_test
function void build_phase(uvm_phase phase); uvm_env
my_env_h = my_env::type_id::create("my_env_h", this);
endfunction: build_phase
name parent
dut_if

DUT
endclass: my_test

© 2013 Mentor Graphics Corporation, all rights reserved.


Package
package my_pkg;
`include "uvm_macros.svh"
import uvm_pkg::*;
`include “my_env.svh”
`include “my_test.svh”
endpackage: my_pkg
my_env.svh:
class my_env extends uvm_env; Top-level

... uvm_test
uvm_env
endclass: my_env
my_test.svh: dut_if
class my_test extends uvm_test;
DUT
...
endclass: my_test
© 2013 Mentor Graphics Corporation, all rights reserved.
Test Instantiation
module top;

import uvm_pkg::*;
import my_pkg::*;

dut_if dut_if1 ();

dut dut1 ( ._if(dut_if1) );


Top-level
uvm_test
uvm_env

dut_if

DUT

endmodule: top
© 2013 Mentor Graphics Corporation, all rights reserved.
Test Instantiation
module top;

import uvm_pkg::*;
import my_pkg::*;

dut_if dut_if1 ();

dut dut1 ( ._if(dut_if1) );


Top-level
uvm_test
initial uvm_env
begin
run_test("my_test");
dut_if
end
DUT

endmodule: top
© 2013 Mentor Graphics Corporation, all rights reserved.
Running the Simulation
> vlog file.sv
> vsim top
# Loading sv_std.std
# Loading work.uvm_pkg
# Loading work.my_pkg
# Loading work.top
# Loading work.dut_if
# Loading work.dut
# Loading ./work/_dpi/qv_dpi.so
# run -all
# ----------------------------------------------------------------
# UVM-1.1d
# (C) 2007-2013 Mentor Graphics Corporation
# (C) 2007-2013 Cadence Design Systems, Inc.
# (C) 2006-2013 Synopsys, Inc.
# (C) 2001-2013 Cypress Semiconductor Corp.
# ----------------------------------------------------------------
© 2013 Mentor Graphics Corporation, all rights reserved.
Running the Simulation

# UVM_INFO @ 0: reporter [RNTST] Running test my_test...


# UVM_INFO /home/UVM/uvm-1.1d/src/base/uvm_objection.svh(1116) @ 10:
reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
#

© 2013 Mentor Graphics Corporation, all rights reserved.


Running the Simulation

# --- UVM Report Summary ---


#
# ** Report counts by severity
# UVM_INFO : 2
# UVM_WARNING : 0
# UVM_ERROR : 0
# UVM_FATAL : 0
# ** Report counts by id
# [RNTST] 1
# [TEST_DONE] 1
# ** Note: $finish : /home/UVM/uvm-1.1d/src/base/uvm_root.svh(430)
# Time: 10 ns Iteration: 55 Instance: /top

© 2013 Mentor Graphics Corporation, all rights reserved.


Summary

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

dut_if
Structural interface

DUT
module

© 2013 Mentor Graphics Corporation, all rights reserved.


UVM Basics
UVM "Hello World"

Tom Fitzpatrick
Verification Evangelist

[email protected] | www.verificationacademy.com

You might also like