Module 5: Behavioral Verilog for Synthesis · 5.2 Sensitivity Lists and Combinational always Blocks

The Missing Signal

A missing signal in a combinational sensitivity list causes severe simulation-synthesis mismatches. The event-driven simulator models state retention, while logic synthesis tools infer combinational gates. This defect often passes functional testbenches before failing in physical silicon.

The Incomplete Sensitivity List Defect

Consider an AND gate where input b is omitted from the sensitivity list:

`timescale 1ns / 1ps
`default_nettype none

module and_gate_broken (
    input  wire a,
    input  wire b,
    output reg  y
);
    always @(a) begin      // Defect: Input b is omitted from the list
        y = a & b;
    end
endmodule

Detailed Simulation Event Trace

Time (ns) Input Stimulus Event Signal a Signal b Block Evaluates? Simulated y Hardware Truth y
0 Initial state 0 0 No x 0
10 Signal a rises 1 0 Yes 0 0
20 Signal b rises 1 1 No 0 1
30 Signal a falls 0 1 Yes 0 0
40 Signal b falls 0 0 No 0 0
50 Signal a rises 1 0 Yes 0 0

At 20 ns, input b transitions from 0 to 1 while a remains 1. Because b is absent from the sensitivity list, the simulator does not re-evaluate the block. Output y remains 0 instead of transitioning to 1.

At 30 ns, input a transitions from 1 to 0. The block re-evaluates and outputs 0, which matches the new inputs.

The simulator incorrectly models state memory. Output y retains its old value whenever b transitions alone. If a testbench transitions a after b, the block evaluates and masks the defect.

Synthesis Tool Behavior

Logic synthesis tools do not simulate events. The synthesis tool inspects the boolean expression y = a & b and infers a standard combinational AND gate (Figure 1).

Simulation against synthesis
Figure 1: Event simulator models memory while logic synthesis infers combinational gates

In physical silicon, the gate switches immediately when b transitions. Simulation waveforms and physical silicon exhibit different behaviors.

Furthermore, different simulators handle incomplete lists differently. Cycle-based simulators such as Verilator treat all level-sensitive blocks as combinational and ignore sensitivity lists completely. The design behaves correctly in Verilator but fails in event-driven simulators such as Icarus Verilog.

Detecting Sensitivity List Defects with Linters

Static linters detect missing sensitivity signals automatically. Tools like Verilator (with -Wall) and commercial EDA linters flag any variable read within an always block that is missing from its sensitivity list. Run static lint checks during continuous integration before executing functional simulations.

Testbench Demonstrating Simulation Divergence

`timescale 1ns / 1ps
`default_nettype none

module tb_and_gate_broken;

    reg  a, b;
    wire y_broken, y_correct;

    and_gate_broken  dut_broken  (.a(a), .b(b), .y(y_broken));
    and_gate_correct dut_correct (.a(a), .b(b), .y(y_correct));

    initial begin
        $dumpfile("tb_and_gate_broken.vcd");
        $dumpvars(0, tb_and_gate_broken);

        a = 1'b0; b = 1'b0;
        #10 a = 1'b1;
        #10 b = 1'b1;       // b transitions last: broken module fails to evaluate
        #10 $display("Inputs a=1, b=1: Broken Output=%b, Correct Output=%b", 
                     y_broken, y_correct);
        #10 a = 1'b0;
        #10 b = 1'b0;
        #10 $finish;
    end

endmodule

module and_gate_correct (
    input  wire a,
    input  wire b,
    output reg  y
);
    always @(*) begin
        y = a & b;
    end
endmodule

Simulation Output

Inputs a=1, b=1: Broken Output=0, Correct Output=1

The Definitive Solution

Do not maintain manual signal lists in combinational blocks. Use the wildcard sensitivity operator:

always @(*) begin
    y = a & b;
end

The wildcard construct @(*) guarantees that the sensitivity list updates automatically as expressions evolve.

The next article examines unintended transparent latch inference caused by incomplete conditional assignment branches.

← always @(*) Accidental Latches →