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
    • Boolean Optimisation
    • Technology Mapping
    • Cell Libraries and Liberty
      • What a Library Contains
      • Reading the Teaching Library
      • Delay Tables and Interpolation
      • Flops, Power, and Variants
      • Mapping Against the Library
    • Structuring and Buffering
  • 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

‹Cell Libraries and Liberty
  1. Topics
  2. Logic Synthesis
  3. Logic Optimisation and Mapping
  4. Cell Libraries and Liberty
  5. Mapping Against the Library

Part 2 · Logic Optimisation and Mapping · Intermediate

Mapping Against the Library

A Yosys run that maps two gates to library cells with asserted counts.

On this page

    From RTL to cells

    The design below holds one inverter and one two-input NAND. Mapping must cover both from the course library.

    The script reads the library, runs generic optimisation, maps with ABC, then asserts the result. Each assertion pins a claim the lesson makes.

    yosys
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    read_liberty -lib course.lib
    read_verilog <<EOV
    module top(input wire a, input wire b, input wire c, output wire y1, output wire y2);
    assign y1 = ~a;
    assign y2 = ~(b & c);
    endmodule
    EOV
    hierarchy -check -top top
    proc
    opt
    techmap
    abc -liberty course.lib
    stat -liberty course.lib
    select -assert-count 1 t:INV
    select -assert-min 1 t:NAND2
    log PASS: inverter maps to INV and NAND maps to NAND2 from course.lib

    Reading the result

    The first assertion pins exactly one INV cell. The second pins at least one NAND2 cell, a bound that holds even if the mapper adds buffering.

    The stat line reports area from the same library areas. No report text is quoted here, so every number below comes from asserted counts times table areas.

    Diagram
    course.lib EXAMPLE areas (library units): INV = 1, NAND2 = 2
    example covering: 1 INV cell and 1 NAND2 cell
    area = 1 x 1 + 1 x 2 = 1 + 2 = 3 library units

    What the library decides

    The same RTL mapped against nand_only.lib can only use INV, BUF, and NAND2. A wider library offers cheaper coverings, such as AOI21 for and-or-invert cones.

    Every mapping claim names its library. Cell counts and areas from one library never transfer to another.

    Common pitfall

    Exact ABC cell counts vary between builds, so only robust properties are asserted here. A lesson that quotes an exact mapped area must say it holds for one exact build and library.

    Interview

    Likely probes: reading a mapped result against its library.

    • Name the library before the counts: one INV and one NAND2 here come from course.lib.

    • Area follows from counts times table areas: 1 + 2 = 3 units.

    • A smaller library forces costlier coverings for the same RTL.

    Check yourself The run asserts one INV and at least one NAND2. What area does exactly one of each give?

    Three library units: 1 x 1 + 1 x 2 = 3.

    Check yourself Why does the lesson assert at least one NAND2 instead of exactly one?

    Exact ABC counts can vary between builds. The lower bound stays true even if the mapper adds buffering.

    Related topics

    • Delay tables and interpolation

    • Structuring and Buffering

    Previous

    31 / 139

    Next: Structuring and Buffering

    Up next

    Up nextStructuring and Buffering

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • What a Library Contains
    • Reading the Teaching Library
    • Delay Tables and Interpolation