Skip to content

About

Custom synthesis backend w/ LUT tech mapping

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation


Project Specification: Custom C++ FPGA Logic Synthesis Engine

1. Executive Summary & Project Intent

The primary objective of this project is to design and implement a custom logic synthesis, optimization, and technology mapping engine in C++. The tool takes intermediate representations generated by Yosys (such as Yosys JSON or bit-blasted AIGER netlists) for complex SystemVerilog Out-of-Order (OoO) RISC-V processor modules—such as the Reorder Buffer (ROB), Reservation Station (RS), or Register Alias Table (RAT)—and transforms them into structural Verilog netlists targeting FPGA architectures.

This project explicitly excludes front-end HDL parsing and parameter elaboration, leveraging Yosys as a front-end parser to emit intermediate netlist representations. The engine focuses exclusively on graph data structures, Boolean logic optimization passes, cut-based technology mapping, and backend verification.


2. System Architecture & Flow

+-----------------------------------------------------------------------------------+
|               SystemVerilog RTL (e.g., ROB / RS / RAT Modules)                    |
+-----------------------------------------------------------------------------------+
                                         |
                                         |  Yosys Parsing & Elaboration
                                         v
+-----------------------------------------------------------------------------------+
|               Intermediate Netlist Representation (Yosys JSON / AIGER)            |
+-----------------------------------------------------------------------------------+
                                         |
                                         |  CUSTOM C++ SYNTHESIS ENGINE
                                         v
+-----------------------------------------------------------------------------------+
|  1. IR Ingestion & Core Graph Manager (AIG / Strashing)                           |
|  2. Pre-Mapping Optimizations (Constant Folding, DCE, Resubstitution)             |
|  3. K-Feasible Cut Enumeration & Technology Mapping (K=6)                         |
|  4. Sub-Graph Truth Table Computation & Netlist Emission                          |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
|              Target Netlist: Structural Verilog (`LUT6` + `FDRE` Primitives)     |
+-----------------------------------------------------------------------------------+
                 /                                                   \
                v                                                     v
+-----------------------------------+               +-----------------------------------+
|   Yosys SAT Equivalence Proof     |               |   Vivado / Quartus Physical Flow  |
|   (`equiv_make` -> `sat` miter)   |               |   Place & Route (P&R), Slack & Fmax   |
+-----------------------------------+               +-----------------------------------+


3. Technical Requirements & Functional Specifications

3.1. Front-End Ingestion Interface

  • Netlist Ingestion: Ingest intermediate representations emitted by Yosys (e.g., Yosys JSON or AIGER) representing combinational logic cones and sequential flip-flops.
  • Scope Boundary: Focus purely on netlist graph ingestion; no custom SystemVerilog parsing or elaboration.

3.2. Core Logic Graph Manager

  • Graph Representation: Implement an internal Directed Acyclic Graph (DAG) / And-Inverter Graph (AIG) manager to represent logic network topology and complemented edges.
  • Constant Handling: Support constant node representation and propagation across the logic graph.
  • Structural Hashing (Strashing): Implement structural hashing to automatically deduplicate redundant logic gates during graph construction.

3.3. Pre-Mapping Logic Optimizations

Perform graph cleaning and logic minimization passes prior to technology mapping:

  • Constant Folding: Propagate known constant values through logic cones.
  • Dead Code Elimination (DCE): Purge unreferenced nodes that do not drive primary outputs or sequential registers.
  • Node Merging & Rewriting: Collapse redundant sub-graphs to minimize total graph node count.

3.4. Technology Mapping ($K$-Feasible Cut Engine)

  • Target Primitives: $K$-input Look-Up Tables ($K$-LUTs, targeting $K=6$) for modern FPGA architectures.
  • Cut Enumeration: Enumerate $K$-feasible cuts across graph nodes using dynamic programming techniques.
  • Cover Selection: Traverse the cut graph to select a global LUT cover optimizing for depth (delay) and area (LUT count).

3.5. Netlist Emission

  • Truth Table Evaluation: Compute Boolean truth tables (INIT masks) for each mapped LUT cut.
  • Structural Output: Emit structural Verilog composed of target FPGA primitives (LUT6 and flip-flop instantiations) ready for downstream verification and vendor Place & Route.

4. Verification & Validation Metrics

4.1. Formal Combinational Equivalence Checking (CEC)

Every synthesized netlist must pass automated formal verification to guarantee mathematical correctness against the original RTL:

  • Verification Driver: Yosys script utilizing equiv_make to construct a miter circuit between the original SystemVerilog module and the engine's output structural Verilog netlist.
  • Proof Engine: Run sat -prove-defined inside Yosys. A run is marked successful only if the solver returns an explicit UNSAT (proving zero equivalence-violating input patterns exist).

4.2. Physical FPGA Downstream Benchmark

  • Target Toolchains: Xilinx Vivado or Intel Quartus.
  • Flow: Ingest the generated structural Verilog directly into the vendor tool, bypass vendor logic synthesis (synth_design), and run implementation (opt_design, place_design, route_design).
  • Metrics: Collect physical Quality-of-Results (QoR) metrics:
  • Area: Total physical LUT count.
  • Timing: Maximum Operating Frequency ($F_{max}$) and Worst Negative Slack (WNS).

5. Scope & Reach Goals

Primary Deliverable Scope

  1. Synthesize at least one complex module (e.g., ROB, RS, or RAT) from the custom Out-of-Order processor into a verified LUT netlist.
  2. Complete full end-to-end verification via Yosys SAT equivalence checking.
  3. Successfully run physical Place & Route on an FPGA target.

Project Reach Goals

  1. Extend technology mapping to target standard cell Liberty (.lib) libraries instead of FPGA LUTs.
  2. Expand synthesis scale to process the entire Out-of-Order processor core end-to-end.
  3. Eliminate the Yosys front-end dependency by writing an isolated bit-blasting IR parser directly.

6. Core Learning Takeaways & Research Questions

This project is explicitly designed to explore critical questions in electronic design automation and system architecture:

  1. Understanding Synthesis Tradeoffs: Quantify the exact area/delay trade-offs introduced by custom $K$-cut mapping heuristics versus commercial baseline synthesizers.
  2. Synthesis Runtime Bottlenecks: Evaluate whether logic synthesis optimization runtime is a primary constraint in current semiconductor workflows, analyzing its impact from a software programmer's perspective.
  3. Workload-Specific Optimization: Explore how custom logic transformations can be specialized for specific microarchitectural structures, such as priority encoders inside Reservation Stations or content-addressable memory inside the ROB.

About

Custom synthesis backend w/ LUT tech mapping

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages