← ProblemsVerilog Language / Procedures
Always blocks (clocked)
64%proceduresflip-flopsA clocked always block — always @(posedge clk) — infers flip-flops: its outputs only update at the rising clock edge.
Build an XOR gate three ways:
out_assign: with anassignstatementout_always_comb: inside a combinationalalways @(*)blockout_always_ff: inside a clockedalways @(posedge clk)block — this output is the XOR delayed by one clock edge, because it passes through a flip-flop
In the clocked block use a non-blocking assignment (<=); in the combinational block use a blocking assignment (=). Mixing them up causes subtle simulation bugs in larger designs.