|
From: Martin W. <ic...@ma...> - 2018-03-31 19:34:16
|
I think the problem is that you are writing to b0 both inside and outside the always_comb statement. Icarus's sensitivity calculation only operates at the word level, not the bit level, so it doesn't detect that you are writing to different bits inside and outside. It just sees you are writing to b0, so removes it from the sensitivity list. It should then have issued an error message, but I think that's one of the things Cary said he hadn't implemented yet. This is of course a bug, but it's not going to be an easy fix. This is why I never tackled implementing always_comb. Niels Möller wrote: > Hi, > > I've tried to use always_comb and always_ff consistently in my code, in > the hope that it would detect some bugs in my code. > > However, I've found one unexpected change in behavior when replacing an > "always @(*)" by "always_comb". Consider below program popc-bug.vl > (population count of a 64-bit value), and note the `ifdef ALWAYS_COMB. > > I compile and run it as follows: > > $ iverilog -g2005-sv -Wall popc-bug.vl && ./a.out > $ iverilog -g2005-sv -Wall -DALWAYS_COMB popc-bug.vl && ./a.out > popc fail: in: 0000000000000001, out: 0000000, ref: 0000001 > $ > > So when always_comb is used in the last process (the others don't > matter, it seems), popc(1) produces 0, not 1 like it should. As usual, > it could well be my code which is incorrect, but as you see, I got no > warnings or errors from the iverilog compiler. > > Regards, > /Niels |