Skip to content
โณ Continuous vs Procedural Assignment

โณ Continuous vs Procedural Assignment

Understanding the difference between continuous and procedural assignment is essential for designing reliable, audit-ready hardware systems. This note breaks down both styles with annotated clarity.


๐Ÿ”Œ Continuous Assignment

Definition: A declarative connection between a wire and a logic expression that is always active.

wire y;
assign y = a & b;

Syntax

  • wire refers to literal wiring
  • Paired with assign which is only used for continuous assignment

โœ… Characteristics

  • Always active: updates instantly when inputs change.
  • Stateless: does not store values.
  • Used for: simple combinational logic, wiring, gates.

๐Ÿ“Œ Notes

  • Only works with wire types.
  • Cannot include if, case, or multi-step logic.
  • Ideal for clean, declarative connections.

๐Ÿ” Procedural Assignment

Definition: Imperative logic inside an always block that executes when triggered by a sensitivity list.

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

Syntax

  • reg stands for register which points to storing values

โœ… Characteristics

  • Triggered: runs when inputs in sensitivity list change.
  • Can store state: especially in clocked blocks.
  • Used for: FSMs, conditional logic, multi-step computation.

๐Ÿ“Œ Notes

  • Requires reg type for assigned variables
  • Can include if, case, loops, and intermediate variables.
  • Enables modeling of both combinational and sequential logic.

๐Ÿงช Comparison Table

FeatureContinuous (assign)Procedural (always)
Syntaxassign y = ...always @(*) y = ...
Target typewirereg
TimingAlways activeEvent-driven
State retentionโŒ Noโœ… Yes (if clocked)
Control flowโŒ Limitedโœ… Full (if, case)
Use caseSimple logicFSMs, counters, branching

๐Ÿงญ When to Use Each

Use assign when:

  • Logic is simple and stateless.
  • You want direct wiring between signals.

Use always when:

  • Logic involves conditions, branching, or multi-step computation.
  • You need to store state or react to clock edges.

๐Ÿงฐ Vault Notes

Rule of Thumb If you’re modeling wires, use assign.
If you’re modeling behavior, use always.

โ„น๏ธ

FSM State Update

reg [1:0] state;
always @(posedge clk) begin
    if (rst)
        state <= IDLE;
    else
        state <= next_state;
end
โš ๏ธ
Common Mistake Donโ€™t use assign to drive a reg, and donโ€™t assign to a wire inside an always block.
Last updated on