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
    • Synthesis Flow Overview
      • What Synthesis Does
      • The Five Flow Stages
      • Why Constraints Change the Netlist
      • A Small Design Through Yosys
      • Concepts, Not Commands
    • Synthesizable RTL and Inference
    • Reading Netlists and Reports
  • Logic Optimisation and Mapping20
  • Constraints and Timing15
  • Sequential, FSM and Memory19
  • Datapath Synthesis14
  • Area, Power and Test14
  • Verification, ECO and Handoff15
  • Flows and Debugging15
  • Interview and Judgment11
Loading lesson

‹Synthesis Flow Overview
  1. Topics
  2. Logic Synthesis
  3. Synthesis Foundations
  4. Synthesis Flow Overview
  5. A Small Design Through Yosys

Part 1 · Synthesis Foundations · Intermediate

A Small Design Through Yosys

A real Yosys flow on a small design, asserting only robust mapped facts.

On this page

    The example design

    The design computes y from (a and b) or (c and d): an AND-OR structure over four inputs. The assertions below pin only robust facts about the mapped result.

    The full Verilog sits inside the runnable block, with one design only. It finishes in a fraction of a second.

    Stage by stage

    Command

    Stage

    What it does here

    read_verilog

    Read in

    Loads the inline design through a here-document.

    hierarchy

    Elaboration

    Checks the design and sets the top module.

    proc, flatten

    Elaboration

    Resolves processes and flattens hierarchy.

    opt

    Generic optimisation

    Cleans up the generic graph before mapping.

    techmap

    Mapping

    Lowers generic cells toward mappable gates.

    abc -liberty

    Mapping

    Maps the logic to cells of course.lib.

    stat -liberty

    Reporting

    Prints counts and area in library units.

    The runnable flow

    The script below runs the whole flow and asserts only robust facts: no generic gates remain and mapped cells are present. A wrong claim fails the run instead of printing PASS.

    yosys
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    read_verilog <<EOV
    module and_or(
      input wire a,
      input wire b,
      input wire c,
      input wire d,
      output wire y
    );
      assign y = (a & b) | (c & d);
    endmodule
    EOV
    hierarchy -check -top and_or
    proc
    flatten
    opt
    techmap
    abc -liberty course.lib
    stat -liberty course.lib
    select -assert-none t:$_AND_ t:$_OR_ %u
    select -assert-min 1 t:NAND2
    log PASS: and_or mapped to library cells with no generic gates left

    The PASS line proves the mapped design uses library cells, with at least one NAND2 present. Exact mapped counts depend on the tool build, so the lesson never quotes them.

    Common mistakes

    Common pitfall

    Quoting the mapped cell mix as a fixed fact misleads. Mapping choices vary by tool build, so this lesson pins only the absence of generics plus a mapped-cell minimum.

    Interview

    Likely probes: reading this flow and its assertions.

    • Elaboration builds an AND-OR structure; mapping covers it with library cells.

    • The absence of generic gates after abc shows mapping completed.

    • Exact mapped counts depend on the tool build and are never pinned.

    Check yourself What does the script assert about the mapped design?

    That no generic AND or OR remains and at least one mapped NAND2 is present. Exact mapped counts depend on the tool build, so the script never pins them.

    Check yourself Why does the script assert nothing about generic gates before techmap?

    Before techmap the design still uses coarse cells, so a generic-gate assertion there fails. The script pins only post-mapping facts.

    Related topics

    • Concepts, not commands

    • Equivalence Checking

    • Scripted Flows and Regression

    Previous

    6 / 139

    Next: Concepts, Not Commands

    Up next

    Up nextConcepts, Not Commands

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • What Synthesis Does
    • The Five Flow Stages