10

If I write the following code:

module POLY(CLK,RESET_n,IN_VALID,IN,OUT_VALID,OUT);

input         CLK,RESET_n,IN_VALID;
input  [ 3:0] IN;
output        OUT_VALID;
output [12:0] OUT;

and then use it:

always @(*)
begin
.........
end
  1. Does it mean that the input CLK,RESET_n,IN_VALID;input [ 3:0] IN; will trigger the always block or only the input that has used in the block will trigger the always block?

  2. But it doesn't write posedge or negedge, so the two both edge will trigger the always block or not?

Jason
  • 1,573
  • 3
  • 18
  • 46

3 Answers3

27

The (*) means "build the sensitivity list for me".

For example, if you had a statement a = b + c; then you'd want a to change every time either b or c changes. In other words, a is "sensitive" to b & c. So to set this up:

always @( b or c ) begin
    a = b + c;
end

But imagine you had a large always block that was sensitive to loads of signals. Writing the sensitivity list would take ages. In fact, if you accidentally leave a signal out, the behaviour might change too! So (*) is a shorthand to solve these problems.

Marty
  • 6,494
  • 3
  • 37
  • 40
  • So in my case is it that if any one of all input changed , no matter it is used in the blocks or not. The blocks will be triggered? – Jason Mar 16 '13 at 14:21
  • Just if is is used in the block. – Marty Mar 16 '13 at 14:37
  • whats the purpose of the always(*) block then? Its behaving like a combinational circuit now, doesnt it? The output changes immediately with the input now or am I wrong? – user3019423 Jun 19 '20 at 17:41
0

It considers that all the variable will be in sensitivity list. So, you don't need to worry about adding them in the sensitivity list.

Anand Yadav
  • 45
  • 1
  • 4
-2

It will behave like combinational logic.

newbie
  • 4,639
  • 10
  • 32
  • 45
  • No, it can also be used for a latch. It is _usually_ intended for combinational logic, it is not guaranteed. – Greg Apr 25 '14 at 17:32