Top Banner
[email protected] | www.verificationacademy.com UVM Basics Introducing Transactions Tom Fitzpatrick Verification Evangelist
26

Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Jul 10, 2016

Download

Documents

Basic Uvm Session5 Introducing
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

[email protected] | www.verificationacademy.com

UVM Basics Introducing Transactions

Tom Fitzpatrick

Verification Evangelist

Page 2: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT Pin wiggles

Transactions

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 3: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 4: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Transaction class my_transaction extends uvm_sequence_item;

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 5: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Transaction class my_transaction extends uvm_sequence_item; `uvm_object_utils(my_transaction)

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 6: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 7: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 8: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 9: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 10: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

uvm_sequence class my_sequence extends uvm_sequence #(my_transaction);

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 11: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 12: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 13: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 14: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

uvm_sequence

task body; forever begin end endtask: body

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 15: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 16: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 17: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Env

Sequencer and Driver

Agent

Sequencer

Driver Monitor

DUT

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 18: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Driver class my_driver extends uvm_driver #(my_transaction);

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 19: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 20: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 21: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 22: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 23: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 24: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

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.

Page 25: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

Env

Summary

Agent

Sequencer

Driver Monitor

DUT

Transactions

Pin wiggles

© 2013 Mentor Graphics Corporation, all rights reserved.

Page 26: Course Basic Uvm Session5 Introducing Transactions Tfitzpatrick

[email protected] | www.verificationacademy.com

UVM Basics Introducing Transactions

Tom Fitzpatrick

Verification Evangelist