Moved wire assign to interface

This commit is contained in:
Florian Zaruba 2017-04-30 23:38:57 +02:00
parent 9472444bdf
commit af46e96f5b
3 changed files with 13 additions and 3 deletions

View file

@ -25,6 +25,16 @@ interface mem_if
wire [DATA_WIDTH-1:0] data_rdata; // Read data
wire data_we; // Write enable
wire [DATA_WIDTH/8-1:0] data_be; // Byte enable
// super hack in assigning the wire a value
// we need to keep all interface signals as wire as
// the simulator does not now if this interface will be used
// as an active or passive device
// only helpful thread so far:
// https://verificationacademy.com/forums/uvm/getting-multiply-driven-warnings-vsim-passive-agent
logic data_gnt_driver = 'z;
assign data_gnt = data_gnt_driver;
// Memory interface configured as master
clocking mck @(posedge clk);
// default input #1ns output #1ns;

View file

@ -49,12 +49,12 @@ class mem_if_driver extends uvm_driver #(mem_if_seq_item);
slave_gnt: begin
forever begin
slave_data_gnt = 1'b0;
fu.data_gnt = slave_data_gnt;
fu.data_gnt_driver = slave_data_gnt;
wait (fu.data_req);
// randomize grant delay
repeat ($urandom_range(0,4)) @(fu.mck);
slave_data_gnt = 1'b1;
fu.data_gnt = slave_data_gnt;
fu.data_gnt_driver = slave_data_gnt;
wait (~fu.data_req);
end
end

View file

@ -67,7 +67,7 @@ module mem_arbiter_tb;
program testbench (mem_if master[3], mem_if slave);
initial begin
// register the ALU interface
uvm_config_db #(virtual fu_if)::set(null, "uvm_test_top", "mem_if", slave);
uvm_config_db #(virtual mem_if)::set(null, "uvm_test_top", "mem_if", slave);
// print the topology
uvm_top.enable_print_topology = 1;
// Start UVM test