On Friday, January 13, 2012 4:35:57 AM UTC-8, glen herrmannsfeldt wrote:
> Daku <
daku...@gmail.com> wrote:
> > Maybe this is a very stupid question, as my Verilog is slightly rusty.
> > What does "aways @*" mean, does it mean that the 'always' block should
> > respond to any change in any input ?
Yes. It was added so people wouldn't forget a signal in the sensitivity list and end up with a latch instead of combinatorial logic.
>
> Personally, I usually use continuous assignment (the assign statement)
> much of the time, but yes ,as well as I understand it, the
> always @* means to evaluate the block when any signal used as
> an input within the block changes.
For simple stuff, yes, an assignment is easier, although you can into the nasty inertial vs transport delay behavior of Verilog in some cases.
For big blocks, like the combinatorial part of a state machine with lots in inputs and outputs, you'll want the always block.
In System Verilog, the always @* is now replaced with always_comb (and always_ff for block that infer registers). This has a couple of advantages. First, it tell the simulator and synthesis tools that you really don't want latches or flip-flops. This lets the tool analyze your code and warn you if you put in something that doesn't match this behavior. A lot of the System Verilog keywords are like this in telling the tools what you were trying to do instead of relying on certain templates or pragmas in comments to help the tools.
The other thing, if I remember correctly, is that @* doesn't (or does?) trigger at time zero. Whatever it does is wrong and fixed in always_comb. For most code it doesn't make a difference, but can bite you in certain cases.
David