Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Post on 10-Jul-2016

221 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

DESCRIPTION

Basic Uvm Session5 Introducing

Transcript

info@verificationacademy.com | www.verificationacademy.com

UVM Basics Introducing Transactions

Tom Fitzpatrick

Verification Evangelist

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT Pin wiggles

Transactions

© 2013 Mentor Graphics Corporation, all rights reserved.

UVM Class Hierarchy

uvm_env uvm_agent uvm_driver uvm_monitor

uvm_scoreboard uvm_test uvm_sequencer

Structure uvm_component

uvm_sequence_item

uvm_sequence

Data

uvm_transaction

uvm_object

uvm_report_object

© 2013 Mentor Graphics Corporation, all rights reserved.

Transaction class my_transaction extends uvm_sequence_item;

© 2013 Mentor Graphics Corporation, all rights reserved.

Transaction class my_transaction extends uvm_sequence_item; `uvm_object_utils(my_transaction)

© 2013 Mentor Graphics Corporation, all rights reserved.

Transaction class my_transaction extends uvm_sequence_item; `uvm_object_utils(my_transaction) rand bit cmd; rand int addr; rand int data; constraint c_addr { addr >= 0; addr < 256; } constraint c_data { data >= 0; data < 256; }

© 2013 Mentor Graphics Corporation, all rights reserved.

Transaction class my_transaction extends uvm_sequence_item; `uvm_object_utils(my_transaction) rand bit cmd; rand int addr; rand int data; constraint c_addr { addr >= 0; addr < 256; } constraint c_data { data >= 0; data < 256; } function new (string name = ""); super.new(name); endfunction: new endclass: my_transaction

© 2013 Mentor Graphics Corporation, all rights reserved.

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.

Vanilla Sequencer – use typedef typedef uvm_sequencer #(my_transaction) my_sequencer; /* class my_sequencer extends uvm_sequencer #(my_transaction); `uvm_component_utils(my_sequencer) function new(string name, uvm_component parent); super.new(name, parent); endfunction: new endclass: my_sequencer */

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence class my_sequence extends uvm_sequence #(my_transaction);

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence class my_sequence extends uvm_sequence #(my_transaction); `uvm_object_utils(my_sequence)

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence class my_sequence extends uvm_sequence #(my_transaction); `uvm_object_utils(my_sequence) function new (string name = ""); super.new(name); endfunction: new

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence class my_sequence extends uvm_sequence #(my_transaction); `uvm_object_utils(my_sequence) function new (string name = ""); super.new(name); endfunction: new task body; ... The behavior of the sequence

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence

task body; forever begin end endtask: body

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence

task body; forever begin my_transaction tx; tx = my_transaction::type_id::create("tx"); end endtask: body

"Factory method" can be overridden in tests

© 2013 Mentor Graphics Corporation, all rights reserved.

uvm_sequence

task body; forever begin my_transaction tx; tx = my_transaction::type_id::create("tx"); start_item(tx); assert( tx.randomize() ); finish_item(tx); end endtask: body

© 2013 Mentor Graphics Corporation, all rights reserved.

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver class my_driver extends uvm_driver #(my_transaction);

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver class my_driver extends uvm_driver #(my_transaction); `uvm_component_utils(my_driver) virtual dut_if dut_vi; function new(string name, uvm_component parent); super.new(name, parent); endfunction: new function void build_phase(uvm_phase phase); ... task run_phase(uvm_phase phase); ...

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver task run_phase(uvm_phase phase); forever begin my_transaction tx; @(posedge dut_vi.clock); end endtask: run_phase

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver task run_phase(uvm_phase phase); forever begin my_transaction tx; @(posedge dut_vi.clock); seq_item_port.get_next_item(tx); end endtask: run_phase

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver task run_phase(uvm_phase phase); forever begin my_transaction tx; @(posedge dut_vi.clock); seq_item_port.get_next_item(tx); dut_vi.cmd = tx.cmd; dut_vi.addr = tx.addr; dut_vi.data = tx.data; end endtask: run_phase

Pin wiggles

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver task run_phase(uvm_phase phase); forever begin my_transaction tx; @(posedge dut_vi.clock); seq_item_port.get_next_item(tx); dut_vi.cmd = tx.cmd; dut_vi.addr = tx.addr; dut_vi.data = tx.data; @(posedge dut_vi.clock) seq_item_port.item_done(); end endtask: run_phase

Transaction complete

© 2013 Mentor Graphics Corporation, all rights reserved.

Driver task run_phase(uvm_phase phase); forever begin my_transaction tx; @(posedge dut_vi.clock); seq_item_port.get_next_item(tx); dut_vi.cmd = tx.cmd; dut_vi.addr = tx.addr; dut_vi.data = tx.data; @(posedge dut_vi.clock) seq_item_port.item_done(); end endtask: run_phase

© 2013 Mentor Graphics Corporation, all rights reserved.

Env

Summary

Agent

Sequencer

Driver Monitor

DUT

Transactions

Pin wiggles

© 2013 Mentor Graphics Corporation, all rights reserved.

info@verificationacademy.com | www.verificationacademy.com

UVM Basics Introducing Transactions

Tom Fitzpatrick

Verification Evangelist

top related