Open Lesmiscore opened 3 years ago
I will need to do some testing because there is some subtlety in this. Also the standard reference you pasted does not address this holding the value.
It looks like Icarus is working as expected. I think your misunderstanding is that there is a single function call that somehow is remembering the value between calls and that is not the case. The function is called whenever din or sel change. The implicit function variable defaults to x and since it is never assigned a value for the x/z sel cases that is what gets assigned to dout.
I tested a simplified version of this on a commercial simulator and it gave the same result as Icarus.
Unless you can provide a reference to why this should work differently I will close this as an invalid report in a few days to give you some time to reply while it is still open.
With the same code above on Cver and ModelSim Quartus II (w/o simplification), they give me different result than Icarus Verilog.
I'm sorry if I'm confusing you, this issue is about return value of func
function, so it's not about multiplexer
module itself.
@caryr, no, in a non-automatic function, all function variables, including the implicit one, are static and shared by all activations of that function within a module.
I wrote this to Steve back in 2016:
Whilst adding support for assignment operators on real values, I noticed you've recently changed the vvp code generator to keep function return values on the stack rather than in a local variable. Whilst this is no doubt good for performance, it does break some aspects of behaviour, namely that the implicit variable that holds the function return variable is static and is visible from outside the function. The attached (admittedly contrived) example demonstrates this. v10 gives the expected behaviour, devel fails.
I think you could safely apply the optimisation to automatic functions.
P.S. Before you ask, yes, other (big-name) simulators give the expected result.
Okay, that makes sense. VCS gives the same behavior as Icarus and I checked with xprop turned off. In general I trust incisive and VCS more than the others, but it seems like this is a VCS bug also.
any progress on this?
Hi,
Given following code:
and command line:
When
multiplexer
got value onsel
that fails allif
s (e.g.2'bxx
), the returned value is not same as previous one.As IEEE1364: 2001 states,
the function should hold the last value at
begin
of function on-g2001
flag.Thanks.