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
      • Constant Propagation
      • Redundancy Removal
      • Factoring, Collapsing and Sharing
      • AIGs, Depth and Area
      • Don't-Cares
    • Technology Mapping
    • Cell Libraries and Liberty
    • 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

‹Boolean Optimisation
  1. Topics
  2. Logic Synthesis
  3. Logic Optimisation and Mapping
  4. Boolean Optimisation
  5. Redundancy Removal

Part 2 · Logic Optimisation and Mapping · Intermediate

Redundancy Removal

Duplicate and dead logic removed, proved with a runnable Yosys script.

On this page

    Redundant logic

    Redundant logic computes something already known or something nobody reads. Duplicate gates, self-cancelling terms and undriven or unused nets all qualify.

    Removal is safe because the visible function never changes. The tool still proves that with an assertion in the script below.

    Pattern

    Rewrite

    x | x, x & x

    x

    x | ~x, x & ~x

    1, 0

    Two gates with identical inputs

    One gate driving both loads

    Undriven net, unused gate output

    Delete the net and the gate

    What the passes do

    Yosys splits the work across small passes that run in sequence. Each pass handles one shape of redundancy.

    Pass

    Job

    opt_expr

    Simplifies expressions: constant folding and identical-input reduction.

    opt_merge

    Merges functionally identical cells into one.

    opt_clean

    Deletes unused cells and wires.

    opt

    General clean-up pass over the network.

    Proof in Yosys

    The script below builds two identical AND gates feeding one OR. After the passes one coarse $and cell remains and no $or cell, which the two assertions pin.

    yosys
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    read_verilog <<EOV
    module top(input a, b, output y);
      wire t1 = a & b;
      wire t2 = a & b;
      assign y = t1 | t2;
    endmodule
    EOV
    hierarchy -check -top top
    proc
    opt_merge
    opt_expr
    opt
    opt_clean
    check
    select -assert-count 1 t:$and
    select -assert-none t:$or
    stat
    log PASS: duplicate AND merged and redundant OR gone

    Common mistakes

    Redundancy at RTL is not always redundancy at the gate level. Shared sub-expressions written twice in RTL merge only if every input matches exactly.

    Common pitfall

    Deleting logic by hand to help the tool usually backfires. Hand edits hide the structure that later passes, especially mapping, would have used.

    Interview

    Likely probes: which pass does what, and what the assertions mean.

    • opt_expr simplifies, opt_merge merges duplicates, opt_clean deletes the unused.

    • The count assertion pins exactly one coarse $and cell after optimisation.

    • The none assertion pins zero coarse $or cells: x | x folded to x.

    Check yourself Two identical AND gates feed one OR. What survives optimisation, and why?

    One AND gate. The duplicates merge and the OR of a signal with itself folds away.

    Check yourself The OR fed two different AND gates instead. Would the OR survive?

    It can. Different inputs mean no identical-input folding applies, so the OR keeps its function.

    Related topics

    • Previous: Constant propagation

    • Next: Factoring, collapsing and sharing

    Previous

    18 / 139

    Next: Factoring, Collapsing and Sharing

    Up next

    Up nextFactoring, Collapsing and Sharing

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • AIGs, Depth and Area
    • Don't-Cares