Skip to content

Library structure

Matthew Amy edited this page Oct 30, 2019 · 16 revisions

This page provides an overview of the synthewareQ library and the overall directory structure.

Repository

Directory Description
include The main source code directory
libs External header libraries
qasm Example openQASM source files
synthewareQ The main synthewareQ compiler
tools Holds the synthewareQ tool suite
unit_tests Unit tests for the synthewareQ library

Source

Directory Description
include/ast Holds the class hierarchy for representing QASM syntax trees (ASTs). Doubles as the library IR
    .../semantic.hpp Holds semantic analysis & type checking routines
    .../visitor.hpp Defines a visitor interface for ASTs
    .../replacer.hpp Concrete visitors for performing node insertion, deletion and replacement
    .../traversal.hpp Concrete visitor for performing post-order traversal of ASTs
include/gates Holds representations & tools for working with particular gate sets
    .../channel.hpp Tools for working with Clifford gates in the channel representation -- that is, Clifford gates represented as permutations of the Pauli group and arbitrary Pauli-axis rotations as sums of Paulis
include/mapping Classes & algorithms for mapping to physical/constrained hardware
include/optimization Optimizations on QASM ASTs
    .../rotation_folding.hpp An optimization to merge or cancel non-Clifford rotation gates (e.g. t, tdg, rx, ...) when possible
    .../simplify.hpp A basic adjacent gate cancellation optimization
include/output Transpilers from QASM into other languages
include/parser Holds the openQASM parser
include/synthesis Algorithms for synthesizing various types of circuits
    .../linear_reversible.hpp Contains algorithms for synthesizing CX circuits from permutation matrices, either unconstrained (Gaussian elimination) and constrained by physical architectures (Steiner tree based)
    .../cnot_dihedral.hpp Contains algorithms for synthesizing CX+rz circuits from their Fourier expansions. Implements both unconstrained and topologically constrained versions
    .../logic_synthesis.hpp Implements synthesis of quantum circuits from classical Verilog files. Uses the EPFL tools & implementation of LUT-based Hierarchical Reversible Logic Synthesis
include/tools Contains miscellaneous tools for working with QASM ASTs
    .../ast_printer.hpp Prints the raw AST, as an alternative to the source code printer (<< overload)
    .../resource_estimator.hpp Computes the gate/depth/qubit counts of a circuit
include/transformations Utility AST transformations
    .../desugar.hpp Transformation to expand all gates applied to registers
    .../inline.hpp Configurable AST inliner. Can be used to inline only certain gates
    .../oracle_synthesizer.hpp Replaces oracle declarations with synthesized circuits
    .../substitution.hpp Generic substitution routines. Includes simple variable substitution, as well as a powerful register substitution framework
include/utils Miscellaneous utilities

Mapping

Directory Description
include/mapping/device.hpp Defines the physical device class, as well as some example devices
include/mapping/layout Algorithms and tools for generating an initial layout of a circuit onto a device
    .../basic.hpp Assigns physical qubits in order to logical qubits
    .../bestfit.hpp Assigns physical qubits so that the highest fidelity couplings are mapped to the logical qubits with the most CX gates
    .../eager.hpp Assigns physical qubits on a 'by-need' basis -- that is, assigns a valid physically coupled pair of qubits whenever an unmapped CX gate is found
include/mapping/mapping Algorithms and tools for mapping CX between uncoupled qubits
    .../swap.hpp Swaps qubits along a shortest path from the CX control to target
    .../steiner.hpp Re-synthesizes the circuit using a physically constrained version of Gray-synth

Included libs

Directory Description
CLI Parsing command line options. EPFL dependency
caterpillar EPFL library for quantum circuit synthesis
easy EPFL library for ESOP manipulation
ez EPFL dependency
fmt Output formatting. EPFL dependency
glucose SAT solver. EPFL dependency
googletest GTest unit testing library
kitty EPFL truth table library
lorina EPFL library for parsing of classical logic formats
mockturtle EPFL library for logic network representation
pthreadwin32 Windows pthread compatibility. Glucose dependency.
rang Terminal colours. EPFL dependency
sparsepp Hash map library. EPFL dependency
tweedledum EPFL library for general purpose quantum compilation
zlib Windows zlib compatibility. Glucose dependency.

QASM

Clone this wiki locally