Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Logic Synthesis Glossary
  • Logic Synthesis Cheatsheet
  • Synthesis Foundations14
  • Logic Optimisation and Mapping20
  • Constraints and Timing15
  • Sequential, FSM and Memory19
    • Flops, Resets and Enables
      • D Flop Inference
      • Enables: Mux or Clock Enable
      • Synchronous and Asynchronous Reset
      • Reset-less Flops and Initial Values
      • Mapping Flops to Library Cells
    • FSM Synthesis
    • Memory and Macro Inference
    • Retiming and Pipelining
  • Datapath Synthesis14
  • Area, Power and Test14
  • Verification, ECO and Handoff15
  • Flows and Debugging15
  • Interview and Judgment11
Loading lesson

‹Flops, Resets and Enables
  1. Topics
  2. Logic Synthesis
  3. Sequential, FSM and Memory
  4. Flops, Resets and Enables
  5. D Flop Inference

Part 4 · Sequential, FSM and Memory · Intermediate

D Flop Inference

How a plain clocked block becomes one $dff cell.

On this page

    The plain D flop idiom

    A block clocked on one edge with nonblocking assignments infers D flops. One such block maps each bit to storage.

    An if without an else still infers a flop here. Holding the old value is what a flop does, unlike combinational logic where it would infer a latch.

    What Yosys builds

    The script below infers a 4-bit plain register and pins its family. It asserts one $dff cell and no enabled or reset variants.

    yosys
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    read_verilog <<EOV
    module top(input clk, input [3:0] d, output reg [3:0] q);
    always @(posedge clk) q <= d;
    endmodule
    EOV
    hierarchy -check -top top
    proc
    select -assert-count 1 t:$dff
    select -assert-none t:$dffe
    select -assert-none t:$adff
    select -assert-none t:$sdff
    log PASS: plain 4-bit register infers one $dff cell

    Width and area

    Yosys keeps the 4-bit vector in one $dff cell carrying four bits. Mapping later expands it to one library flop per bit.

    Diagram
    course.lib EXAMPLE areas: DFF = 8 units per bit
    32-bit plain register: 32 x 8 = 256 units
    32-bit sync-reset register: 32 x 10 = 320 units
    reset overhead = 320 - 256 = 64 units = 64 / 256 = 25% over plain

    Common mistakes

    Blocking assignments in clocked blocks simulate differently from the flop hardware. Keep nonblocking assignments for sequential loads.

    Common pitfall

    Reading the flop output in the same block that loads it (for example q <= q + 1) is fine, but mixing blocking and nonblocking assignments to q in one block misleads simulation. Use one nonblocking style for every sequential assignment.

    Interview

    Likely probes: what $dff means, and why the count is cells not bits.

    • A plain clocked block with no enable or reset infers $dff.

    • A vector is one $dff cell pre-mapping and one library flop per bit after.

    • The assertion pins the family, so a wrong idiom fails the run.

    Check yourself The script asserts one $dff for a 4-bit register. Why one cell and not four?

    Pre-mapping vectors stay together in one cell with a width parameter. The four library flops appear only after mapping.

    Check yourself An if (en) is added around the load with no other change. Which assertion in the script now fails?

    The select -assert-none t:$dffe line. The block now infers an enabled flop instead of a plain one.

    Related topics

    • Enables: Mux or Clock Enable

    • Synthesizable RTL and Inference

    • RTL: Flip-Flops and Registers

    Previous

    52 / 139

    Next: Enables: Mux or Clock Enable

    Up next

    Up nextEnables: Mux or Clock Enable

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Synchronous and Asynchronous Reset
    • Reset-less Flops and Initial Values
    • Mapping Flops to Library Cells