Module 2: Logic Synthesis · 2.1 From RTL to Gates

Technology Mapping

Module 1 executed logic synthesis inside the automated flow. This module investigates the internal operations of synthesis tools.

When Yosys processes Verilog RTL, it generates instances of standard cells such as sky130_fd_sc_hd__nand2_1 and sky130_fd_sc_hd__mux2_1. The synthesis tool does not process concrete gates initially. It optimizes technology-independent Boolean expressions. The tool converts these expressions to standard cells during the final phase: technology mapping.

Two Primary Synthesis Stages

Logic synthesis combines two distinct stages:

  1. Logic Optimization: The tool parses the RTL description and simplifies Boolean logic. It removes redundant gates, factors common algebraic terms, and minimizes logic depth. Yosys performs these optimizations on a generic graph of primitive logic operations (AND, OR, XOR, NOT, MUX). This representation does not include physical parameters such as cell area or drive strength.
  2. Technology Mapping: The tool matches subgraphs of the generic logic network against standard cells from the target library. It selects cell combinations that satisfy area and timing constraints.

In OpenLane, Yosys executes logic optimization passes. Yosys then invokes ABC, an open-source synthesis and mapping engine developed at UC Berkeley. ABC reads standard cell timing and area data from the Liberty (.lib) file.

RTL to generic Boolean network to ABC mapping to a netlist of real cells
Figure 1: Optimise on a generic network, then map onto real cells

This two-stage division simplifies optimization. The logic optimizer refines Boolean equations without evaluating hundreds of cell variants and drive strengths. The tool determines circuit structure first and assigns physical library cells second.

Technology Mapping as a Graph Covering Problem

Technology mapping solves a graph covering problem. ABC decomposes the Boolean network into subject graphs. It searches the standard cell library for matching cell patterns that cover those subgraphs. ABC selects the covering that minimizes cost, measured by area, delay, or a combined metric.

Multiple valid coverings exist for any Boolean equation. Different synthesis strategies produce distinct gate topologies for identical RTL source code. A mapped netlist is one valid physical implementation among many equivalent solutions.

Manual Mapping Example

Consider a simplified standard cell library containing four basic gates:

Cell Boolean Function Relative Area (Units)
INV Y = NOT A 1.0
AND2 Y = A AND B 2.0
OR2 Y = A OR B 2.0
NAND2 Y = NOT (A AND B) 1.5

Map the following logic function:

$$ F = (A \cdot B) + \overline{C} $$

This expression computes F = (A AND B) OR (NOT C). Figure 2 presents two distinct physical coverings:

Two mappings of the same function: AND2, INV and OR2 versus two NAND2 gates
Figure 2: Two coverings of F = AB + C', with different area

  • Covering 1 (Direct Structural Match): Uses one AND2 gate for (A AND B), one INV gate for NOT C, and one OR2 gate for the sum. Total area equals $2.0 + 1.0 + 2.0 = 5.0$ units. The path has two logic levels.
  • Covering 2 (NAND2 Restructuring): Applying De Morgan’s theorem transforms the equation: (A AND B) OR (NOT C) equals NOT(NOT(A AND B) AND C). This structure maps directly to two NAND2 gates. Total area equals $1.5 + 1.5 = 3.0$ units. The path maintains two logic levels.

Covering 2 reduces circuit area by 40 percent without increasing path delay. ABC evaluates similar structural transformations across libraries containing hundreds of complex logic gates.

Practice Exercise

Using the four-cell library above, map F = NOT(A OR B) using two different cell configurations. Determine which configuration achieves smaller area.

Solution

Configuration 1 (Direct): Use one OR2 gate followed by one INV gate. Total area equals $2.0 + 1.0 = 3.0$ units.

Configuration 2 (De Morgan transformation): Transform NOT(A OR B) into (NOT A) AND (NOT B). Using two inverters and one NAND2 gate with an output inverter requires three inverters and one NAND2 gate. Total area equals $(3 \times 1.0) + 1.5 = 4.5$ units.

Configuration 1 achieves smaller area (3.0 units versus 4.5 units). The toy library does not contain a dedicated NOR2 gate. In a full standard cell library, a single NOR2 gate would provide the optimal implementation.

The next article examines how RTL coding style influences synthesis results and physical layout quality.

RTL Style and Its Physical Consequences →