So now I’m having an error saying that “port connections to inout ports must be nets”.
So I changed the data type of sent_line in the interface from logic to “wire logic” but the new error says that my driver is illegally driving the sent_line.
Dave, Can i assign a value to a net(which is inside) from a class based testbench?
interface a2b;
wire w1; // w1 is a bi-directional signal
endinterface
class a2b_dr;
virtual a2b inf;
....
task dr;
inf.w1 <= 1'b1;
endtask
endclass
Currently this is allowed in vcs. I would like to understand the reason for not using this kind of code? (When class is not driving the signal the default value of net is “z”. and from the class we can drive “z” on this w1 signal)
Every time there is a change on one of the drivers, the function is called to produce a resolved value. The function is created at elaboration (before simulation starts) and is based on the kind of net type, wand, wor, tri1, etc.
The above statement means that tool will not be able to consider the dynamic assignment(which is created during simulation) for value resolution?
is a non-blocking procedural assignment to a wire, it is not a continuous driver to the wire. A procedural assignment has no duration to it; you are depositing the value of the expression on the RHS of the ‘<=’ to the variable on the LHS. The variable stores the value until there is another procedural assignment that replaces the old value with a new one. The execution of the procedural assignment is part of a sequential thread of procedural statements that usually starts with an initial or always block construct.
A continuous assignment
assign w1 = w2;
is structural, not procedural. You are driving the value of the expression on the RHS to the net on the LHS, for all time. A change at anytime on the RHS expression cause a new value to be driven on the LHS.
It seems that VCS allows procedural assignments to wires, and that seems to work as long as there are no other continuous assignments to the wire. In that case, you treat the wire the same as you would a variable. The problem comes in when you try to mix the two kinds of assignments. Let’s say the DUT is continuously driving a 1’b1, and the testbench makes a procedural assignment to 1’b0. Does the procedural assignment replace the value being driven with 1’b0, like any other procedural assignment. Or does it try to do wire resolution and make the wire go to 1’bx. I suppose the LRM could define an answer for this, but Verilog was designed as a description language to show more intent. As an analogy, you could define an array with fixed size 10 elements and allow the 11th element to be assigned by growing the array by one element when that happens, but then what was the point of declaring a 10 element array in the first place?
I read your paper but I haven’t found much usefull in my situation. I think it is due to the fact I am trying to simulate Xilinx’ IOB, so that means I don’t have the I/O/T signals, I therefore only have the inout port from the IOB… so as far as I know I can’t do anything like:
Connecting up a SystemVerilog interface to bidi signals is a bit tricky. But in fact there’s a way to accomplish it that works in both simulation and synthesis (it works under Xilinx for Vivado at least). It requires a few extra steps but works reliably.
As the instance name implies, what we’re looking for here is a (non-existing SystemVerilog feature) of a “net alias” that works with interface members. This trick fills the language hole with a few extra steps.
The above will connect up your bidi signals to the interface - and it works both in simulation and synthesis (at least for Vivado)