3.5.3 · D1HDL & Digital Design Flow

Foundations — Sequential logic and always blocks

1,821 words8 min readBack to topic

This page assumes you have seen nothing. We build every word, symbol, and picture the parent Sequential logic note leans on, in an order where each idea needs only the ones before it.


0. What is a "signal" and a "bit"?

The picture to hold in your head: a wire is a horizontal line, and as time flows left→right the line sits either low or high. That squared-off up-and-down trace is called a waveform.

Figure — Sequential logic and always blocks

1. The clock and the word "edge"

The picture: on the clock waveform, an edge is the vertical line connecting a low level to a high level (or vice-versa). It has essentially zero width — it is a moment, not a duration.

Figure — Sequential logic and always blocks

2. Memory: latch vs flip-flop

The signal names that go with a flip-flop:

Figure — Sequential logic and always blocks

3. Combinational vs sequential — the two personalities

Recall The two-kids picture (from the parent)

Combinational kid shouts the answer the instant they see the question. Sequential kid only flips their whiteboard around when the teacher rings the bell (clock), holding the old answer until then.


4. The always block and its @(...) sensitivity list


5. The two assignment arrows: = and <=

These are the symbols people trip on most, so we define them on a picture, not in prose.

Figure — Sequential logic and always blocks

Why the difference matters concretely is the whole subject of Blocking vs non-blocking assignments. The short version: real flops all sample the old input at once, so <= (evaluate-old-then-update-together) is the faithful model; = (one at a time) collapses a shift register. Getting this wrong causes Synthesis vs simulation mismatch.


6. Small Verilog literals and keywords you'll meet


How these foundations feed the topic

bit and signal 0 1 X Z

waveform

clock and edge

posedge

latch vs flip-flop

D and Q signals

combinational vs sequential

always block and sensitivity list

blocking = vs non-blocking arrow

Sequential logic and always blocks

This foundation feeds forward into Finite State Machines in Verilog, Clocking and timing constraints, and the parent note itself.


Equipment checklist

Cover the right side, answer, then reveal.

A bit is
a single wire carrying a value; usually 0 (low) or 1 (high).
The four Verilog wire values are
0, 1, X (unknown) and Z (high-impedance / floating).
What does an X on Q usually mean?
an uninitialised / un-reset value the simulator cannot resolve.
A waveform shows
a signal's value (high/low) as time flows left to right.
An edge is
the instant a signal changes value; posedge = the 0→1 moment.
Why fire on an edge, not a level?
so the box updates exactly once per clock cycle, not continuously while the clock is high.
A flip-flop vs a latch
flip-flop snapshots D into Q only at the edge; a latch is transparent for a whole clock level.
D and Q are
D is the input waiting to be captured, Q is the held output value.
Combinational logic has
no memory; output depends only on present inputs.
Sequential logic has
memory; output depends on inputs plus stored past values.
An always block is
an event-driven process that runs its body once each time a sensitivity-list signal changes (not a loop).
@(posedge clk) means
fire on the rising edge of clk → sequential logic.
@(*) means
fire on any change of any signal read inside → combinational logic.
Blocking = does
immediate, in-order updates like normal software.
Non-blocking <= does
evaluate all RHS with old values, then update all LHS together — models parallel flops.
The golden pairing
sequential → <=, combinational → =.
1'b0 means
a one-bit binary value of 0.
Async vs sync reset
async reset is in the sensitivity list and acts immediately; sync reset only clears on the next clock edge.