S
Stephen Williams
Guest
Here's an interesting puzzle. The following bit of Verilog is
pretty easy to predict:
reg a = 0, b = 1;
assign (weak0, weak1) x = a;
assign y = b;
tran (x,y);
In this case, x and y are strong 1 because the strength resolution
of the tran switch blends the strong-1 driving y and weak-0 driving
x to strong-1.
But at this to the mix:
initial #1 force x = 1;
Now what? ModelSim and NC-Verilog will give x===1'b1 and y==1'bx.
VCS will give x===y===1'b1. Who's right? And why?
I've attached a slightly more complete example. The attached
program prints PASSED when run by ModelSim, something else when
run by VCS. Personally, I prefer the VCS result as it preserves
the invariant of the tran() device. Any other result seems to
just reflect quirks in the implementations of "force".
Thoughts?
(I'm trying to get Icarus Verilog to do the "Right Thing" here,
but of course that means I have to pin down exactly what that
"Right Thing" really is.)
--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
pretty easy to predict:
reg a = 0, b = 1;
assign (weak0, weak1) x = a;
assign y = b;
tran (x,y);
In this case, x and y are strong 1 because the strength resolution
of the tran switch blends the strong-1 driving y and weak-0 driving
x to strong-1.
But at this to the mix:
initial #1 force x = 1;
Now what? ModelSim and NC-Verilog will give x===1'b1 and y==1'bx.
VCS will give x===y===1'b1. Who's right? And why?
I've attached a slightly more complete example. The attached
program prints PASSED when run by ModelSim, something else when
run by VCS. Personally, I prefer the VCS result as it preserves
the invariant of the tran() device. Any other result seems to
just reflect quirks in the implementations of "force".
Thoughts?
(I'm trying to get Icarus Verilog to do the "Right Thing" here,
but of course that means I have to pin down exactly what that
"Right Thing" really is.)
--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."