always @(*)
A combinational always block must include every signal it reads within its sensitivity list. For complex decoders with dozens of inputs, manual sensitivity lists become difficult to maintain. IEEE 1364-2001 introduced the wildcard sensitivity list @(*) to eliminate manual list maintenance.
The Problem with Manual Sensitivity Lists
Consider a 4-to-1 multiplexer with a manual sensitivity list:
`timescale 1ns / 1ps
`default_nettype none
module mux4 (
input wire [1:0] sel,
input wire a, b, c, d,
output reg y
);
always @(sel or a or b or c or d) begin
case (sel)
2'b00: y = a;
2'b01: y = b;
2'b10: y = c;
2'b11: y = d;
endcase
end
endmodule
If an engineer adds input e to the case statement but omits e from the sensitivity list, the simulation behaves incorrectly. Transitions on e will not trigger block re-evaluation. The source code compiles, but simulation results diverge from physical hardware.
The Automatic Sensitivity List
The wildcard syntax @(*) instructs the compiler to generate a complete sensitivity list automatically:
`timescale 1ns / 1ps
`default_nettype none
module mux4_star (
input wire [1:0] sel,
input wire a, b, c, d,
output reg y
);
always @(*) begin
case (sel)
2'b00: y = a;
2'b01: y = b;
2'b10: y = c;
2'b11: y = d;
endcase
end
endmodule
The syntax @(*) and @* are equivalent. Both describe a block sensitive to all read signals. The automatic list cannot become stale during design refactoring. Always use @(*) for combinational procedural blocks.
Signals Included and Excluded by @(*)
The @(*) construct automatically tracks every signal read inside the block:
- Signals on the right-hand side of assignments (
y = a & b). - Signals tested in condition statements (
if,case,?:). - Dynamic bit-select indices and array address words.
- Signals read inside user-defined functions called by the block.
Signals in inactive branches are also tracked. If input a changes while mode is 0 in the following block, the simulator re-evaluates the block harmlessly:
always @(*) begin
y = 1'b0;
if (mode)
y = a & b;
else
y = c | d;
end
The wildcard construct excludes:
- Signals that are only written within the block.
- Clock edge transitions (
posedge,negedge). Sequential flip-flops require explicit edge triggers.
Hardware Equivalence
A manual sensitivity list and an automatic @(*) list synthesize into identical gate netlists:
// Manual list
always @(en or req) begin
valid = 1'b0;
grant = 2'b00;
if (en) begin
if (req[3]) begin grant = 2'b11; valid = 1'b1; end
else if (req[2]) begin grant = 2'b10; valid = 1'b1; end
else if (req[1]) begin grant = 2'b01; valid = 1'b1; end
else if (req[0]) begin grant = 2'b00; valid = 1'b1; end
end
end
// Automatic wildcard list: generates identical hardware
always @(*) begin
valid = 1'b0;
grant = 2'b00;
if (en) begin
if (req[3]) begin grant = 2'b11; valid = 1'b1; end
else if (req[2]) begin grant = 2'b10; valid = 1'b1; end
else if (req[1]) begin grant = 2'b01; valid = 1'b1; end
else if (req[0]) begin grant = 2'b00; valid = 1'b1; end
end
end
Legacy Code Conversion
To update legacy Verilog-1995 code, replace the manual signal list with *:
always @(a or b or sel) begin --> always @(*) begin
y = sel ? a : b; y = sel ? a : b;
end end
Using @(*) prevents human error while preserving functional intent.
SystemVerilog always_comb Construct
SystemVerilog (IEEE 1800) introduces the dedicated always_comb block:
always_comb begin
y = a & b & c;
end
The always_comb block improves upon @(*) in two ways:
- It executes automatically at simulation time zero, guaranteeing valid initial states before the first clock edge.
- Synthesis tools enforce strict combinational rules, generating compile errors if an assignment path infers a transparent latch.
Module 9 covers SystemVerilog constructs in detail. In standard Verilog-2001, use always @(*).
Practice Exercise
Convert each manual block to @(*) and list the automatically inferred sensitivity signals:
// Block 1
always @(x or y or z) begin
out = (x & y) | (~x & z);
end
// Block 2
always @(addr or wen or wdata or mem_out) begin
rdata = wen ? wdata : mem_out;
ack = (addr < 8'hFF);
end
// Block 3
always @(state or req or ack or timeout) begin
case (state)
2'b00: next_state = req ? 2'b01 : 2'b00;
2'b01: next_state = ack ? 2'b10 : 2'b01;
2'b10: next_state = timeout ? 2'b00 : 2'b10;
default: next_state = 2'b00;
endcase
end
Solution
Replace each header with always @(*). The automatically inferred sensitivity signals are:
- Block 1:
x,y,z(outputoutis excluded). - Block 2:
addr,wen,wdata,mem_out(outputsrdataandackare excluded). - Block 3:
state,req,ack,timeout(outputnext_stateis excluded).
The next article examines the simulation-synthesis mismatch caused by incomplete sensitivity lists and explains why synthesis tools ignore missing sensitivity signals.