• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. run_phase doesn't update SV interface signals

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 65
  • Views 2741
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

run_phase doesn't update SV interface signals

Sporadic Crash
Sporadic Crash over 7 years ago

Hi,

I am trying to set up a minimal UVM env to learn this methodology.

My problem is that UVM driver doesn't seem to update the interface signals connected to DUT. Testbench can update it (clock and reset are driven). Counter runs because clock and reset could be applied.However the driver does not seem to work, even the $display in run_phase is not called. I have doubt that driver is setup properly. I have neither compilation nor elab errors. 

Can anybody point me where my error is?

The example below is a derivative of the UVM example in Youtube film First Steps with UVM Part 2 by Doulos.

Shall I use modports in the interface?

Interface:

interface dut_if;
logic i_clk;
logic i_rst;
logic i_load_en;
logic [7:0] i_load_val;
logic [7:0] o_counter;
endinterface

DUT:

module my_counter (dut_if dif);

always_ff @(posedge dif.i_clk) begin
if (dif.i_rst)
dif.o_counter <= '0;
else if (dif.i_load_en)
dif.o_counter <= dif.i_load_val;
else
dif.o_counter <= dif.o_counter + 1;
end

endmodule

Testbench:

module tb ();

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

dut_if dif();

initial
begin
dif.i_clk = '0;
forever #10 dif.i_clk = ~dif.i_clk;
end

initial
begin
dit.i_rst = '1;
#15 dif.i_rst = '0;
end

my_counter dut (.dif (dif));

initial begin
`uvm_info ("SIM START", "Simulation has started!!", UVM_MEDIUM);
uvm_config_db #(virtual dut_if)::set(null, "*", "dut_if", dif);
uvm_top.finish_on_completion = 1;
run_test("my_test");
end

always @(posedge dif.i_clk)
begin
`uvm_info ("", $sformatf("DUT received %b", dif.o_counter), UVM_MEDIUM);
end

endmodule

UVM package:

package my_pkg;

import uvm_pkg::*;

class my_env extends uvm_env;
`uvm_component_utils (my_env)

function new (string name, uvm_component parent);
super.new(name, parent);
endfunction

endclass

class my_test extends uvm_test;

`uvm_component_utils (my_test)

my_env m_env;

function new (string name, uvm_component parent);
super.new (name, parent);
endfunction

function void build_phase(uvm_phase phase);
m_env = my_env::type_id::create("m_env", this);
endfunction

task run_phase(uvm_phase phase);
phase.raise_objection(this);
#200;
`uvm_info("", "Hello world", UVM_MEDIUM);
phase.drop_objection(this);
endtask

endclass: my_test

class my_driver extends uvm_driver;
`uvm_component_utils (my_driver)

virtual dut_if dut_vi;

function new(string name, uvm_component parent);
super.new(name, parent);
endfunction

function void build_phase(uvm_phase phase);
if (! uvm_config_db #(virtual dut_if)::get(this, "", "dut_if", dut_vi))
`uvm_error ("", "uvm_config_db::get failed");
endfunction

task run_phase(uvm_phase phase);
forever
begin
@(posedge dut_vi.i_clk);
$display ("run_phase!!");
dut_vi.i_load_en <= '0;
dut_vi.i_load_val <= $urandom;
end
endtask

endclass: my_driver
endpackage

Cadence version is 15.22.

  • Cancel
  • TAM1
    TAM1 over 7 years ago

    The problem is that you have defined the driver class, but you haven't instantiated it inside of anything. I suspect you'll want to instantiate it inside your env class. Here is some code from a small testcase:

    class uvc_agent extends uvm_agent;
        uvc_driver driver;
        `uvm_component_utils_begin(uvc_agent)
             `uvm_field_object(driver,UVM_DEFAULT)
        `uvm_component_utils_end

        function new(string name = "uvc_agent", uvm_component parent = null);
           super.new(name, parent);
         endfunction : new

         virtual function void build_phase(uvm_phase phase);
           super.build_phase(phase);
           driver = uvc_driver::type_id::create("driver", this);
        end
        endfunction : build_phase

    There is a lot more to do to build a real UVC. You may want to invest in a book like "A Practical Guide to Adopting the Universal Verification Methodology", a book which I reference often.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Sporadic Crash
    Sporadic Crash over 7 years ago in reply to TAM1

    Thanks to point this out. It was in the examples of Doulos not very clear.

    The driver works when instantiated in env or test class. I know this is the not the best. 

    I will take a look at UVC agents from now on.for better and proper UVM test structure.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information