what "always @(*)" mean?

Guest
Hello,
what is the "always @(*)" expression means in the following code?

always @(*)
begin
if (something_happened) begin
do_something
end
end


Regards,
J
 
On Wed, 25 Jun 2008 05:46:03 -0700 (PDT), japonetz@gmail.com wrote:

Hello,
what is the "always @(*)" expression means in the following code?

always @(*)
begin
if (something_happened) begin
do_something
end
end
It's an automatically-generated sensitivity list.

There are some wrinkles and weird details, but for
all practical purposes it looks at the body of its
always block, and builds a sensitivity list from
all variables and nets that the code reads. This
is usually what you want for a synthesisable
combinational block.

By the way, it's preferable to use the form without
parentheses:

always @* begin
...
end

to avoid any possibility of confusion with Verilog
attribute syntax.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
Hello Jonathan,
Thank you very much.
Great help, as usual.

Regards,
J

On 25 יוני, 17:42, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
On Wed, 25 Jun 2008 05:46:03 -0700 (PDT), japon...@gmail.com wrote:
Hello,
what is the "always @(*)" expression means in the following code?

always @(*)
begin
    if (something_happened) begin
   do_something
    end
end

It's an automatically-generated sensitivity list.

There are some wrinkles and weird details, but for
all practical purposes it looks at the body of its
always block, and builds a sensitivity list from
all variables and nets that the code reads.  This
is usually what you want for a synthesisable
combinational block.

By the way, it's preferable to use the form without
parentheses:

  always @* begin
    ...
  end

to avoid any possibility of confusion with Verilog
attribute syntax.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
On Fri, 27 Jun 2008 00:54:58 -0700 (PDT), Michael wrote:

always @(*)
begin
if (something_happened) begin
do_something
end
end

You should aware of the tasks and functions used in such "always". If
your task/function uses a signal not defined as an input of the task
and no other construction of the "always" uses it either, the
simulation result will be wrong.
Yes, that's probably the most important of the "wrinkles"
I mentioned; thanks for emphasising it.

This is one of the reasons why SystemVerilog's "always_comb"
is such a big improvement over "always @*" for design.
Many tools now support always_comb, and you should use it
if you can.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
On Jun 26, 12:42 am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
On Wed, 25 Jun 2008 05:46:03 -0700 (PDT), japon...@gmail.com wrote:
Hello,
what is the "always @(*)" expression means in the following code?

always @(*)
begin
if (something_happened) begin
do_something
end
end

It's an automatically-generated sensitivity list.

There are some wrinkles and weird details, but for
all practical purposes it looks at the body of its
always block, and builds a sensitivity list from
all variables and nets that the code reads. This
is usually what you want for a synthesisable
combinational block.

By the way, it's preferable to use the form without
parentheses:

always @* begin
...
end

to avoid any possibility of confusion with Verilog
attribute syntax.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
You should aware of the tasks and functions used in such "always". If
your task/function uses a signal not defined as an input of the task
and no other construction of the "always" uses it either, the
simulation result will be wrong.
 
On Tue, 1 Jul 2008 04:44:37 +0000 (UTC), Joseph H Allen wrote:

Another problem with always @*: shared loop induction variables:

Basically each always @* block needs to have its own induction variables.
Do not share them.
Yes. But it's pretty daft to share any such temporary
variables across always blocks anyhow. They're local,
and should be declared locally.

always_comb begin: iterated_logic
integer i;
for (i=0; i<N; i=i+1) A <= B[N-(i+1)];
end

Declaring "i" at the module level is inexcusable.

Incidentally, that's another nice benefit of SystemVerilog
always_comb: it would have detected the multiple always_comb
blocks writing to your induction variable, which is illegal.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top