I have defined an interface for my DUT as such:
interface video_input_interface(clk, rst);
input logic clk;
input logic rst;
logic[1:0] x_lsb;
logic[1:0] x_msb;
logic[3:0] x;
assign x = {x_msb, x_lsb};
endinterface
The reason I did this is because my DUT has separate ports for x_msb and x_lsb and I want to explicitly show which bits of signal x
I am connecting to these ports. For example, when instantiating the DUT:
interface video_input_interface vif;
dut udut(
.msb(vif.x_msb),
.lsb(vif.x_lsb),
.............
);
Now the issue is I have 2 drivers in my agent:
Driver A: When driving the interface from Driver A, I would like to drive signal x and not x_lsb, x_msb.
Driver B: When driving the interface from Driver B, I would like to drive signal x_lsb and x_msb individually.
I would think that my solution would split up signal x in my interface into x_lsb and x_msb. In DriverA, I can just drive this signal x
. Also, for driver B the interface would be ok with me accessing the bits individually and everything would work just fine... not!
The assign causes signal x to be "X - unknown value". I have to drive x_msb and x_lsb individually for DriverA. Or other option is to
assign x_lsb = x[1:0]
assign x_msb = x[3:2]
This means DriverA would work, but would run into same problem from DriverB (when trying to drive x_lsb and x_msb).
Is there a solution to this? Thanks