>Anyone with a Modelsim install wants to see what it does?
"ModelSim SE PLUS 6.5, 2009.01" also goes into a loop:

# bar=x
# bar=1
# bar=1
# bar=1

and eventually ends with:
# ** Error: (vsim-3601) Iteration limit reached at time 0 ns.


If "$display("bar=%d", bar);" is removed, ModelSim does not enter a loop
and simply displays:
# End of simulation - bar=1

as expected.  I would say this is a bug in both ModelSim and Icarus, unless
reading a signal is meant to affect simulation behavior.

~William


On Mon, Nov 26, 2012 at 7:06 AM, Sebastien Bourdeauducq <
[email protected]> wrote:

> Hi,
>
> Consider the following Verilog source:
>
> ============
> module event_test();
>
> reg foo, bar;
>
> always @(*) begin
>         $display("bar=%d", bar);
>         bar <= 1'b0;
>         if(foo)
>                 bar <= 1'b1;
> end
>
> initial begin
>         foo <= 1'd1;
>         #1 $display("End of simulation - bar=%d", bar);
> end
>
> endmodule
> ============
>
> The intended functionality of the always block is pretty clear: it should
> be a
> pass-through from "foo" to "bar" that displays the value of "bar" just
> before
> it changes. This corresponds to the behaviour observed when simulating with
> GPL Cver and Xilinx ISim:
> bar=x
> End of simulation - bar=1
>
> But Icarus Verilog seems to take the event-driven model of Verilog a bit
> too
> strictly and goes into an infinite loop:
> bar=x
> bar=1
> bar=1
> bar=1
> ...
>
> I'm pretty sure this is an Icarus Verilog bug, especially since rewriting
> the
> always block in this way fixes the problem:
> ============
> always @(*) begin
>         $display("bar=%d", bar);
>         if(foo)
>                 bar <= 1'b1;
>         else
>                 bar <= 1'b0;
> end
> ============
>
> Anyone with a Modelsim install wants to see what it does?
>
> I'm posting it here since this sort of issue tends to pop up when
> simulating
> Migen-built Verilog, as Migen is quite zealous when initializing signals in
> combinatorial always blocks.
>
> Sebastien
> _______________________________________________
> http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
> IRC: #milkymist@Freenode
>
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to