Go to file
Fabian Schuiki a50b0bb1cc
[Debug] Add debug-only value/op analysis (#6335)
Add the `DebugAnalysis` which marks values and operations that only feed
into debug info. This will later allow ExportVerilog to skip expressions
and statements that are exclusively used by debug ops and are irrelevant
for synthesis and simulation.

The analysis is fairly straightforward at the moment. In the future, we
may want to be more clever about what we mark as debug-only. For
example, certain debug info output formats may allow us to emit entire
expressions and state machines, such that those can be stripped from the
Verilog output. In that case, we'd want to look through expressions,
wires, and registers when marking ops as debug-only. But some other
formats may only allow us to point at named signals in the Verilog, such
that any expression or register has to remain in Verilog, and possibly
be visible under a name for the debug info to make use of it.

This commit also bundles the `DebugInfo` analysis, which extracts the
source language hierarchy and variable layout from the IR, together with
this new `DebugAnalysis`, which marks ops as debug-only.
2023-10-26 13:53:49 -07:00
.github/workflows Remove old workflow (#6306) 2023-10-18 14:58:34 -07:00
.idea Fix for clion IDEA settings. (#3291) 2022-06-10 01:50:57 -04:00
.vscode Update docs to add configuration for VS code (#5845) 2023-08-17 16:44:37 +05:30
cmake/modules Disable MLIR install of CIRCT projects (#6340) 2023-10-25 10:47:39 -07:00
docs [Debug] Add debug dialect (#6308) 2023-10-20 09:51:37 -07:00
frontends [PyCDE] Support ESI bundles (#6288) 2023-10-17 13:27:12 -07:00
include [Debug] Add debug-only value/op analysis (#6335) 2023-10-26 13:53:49 -07:00
integration_test [ESI][Services] Leave breadcrumbs while connecting services (#6331) 2023-10-24 12:03:38 -07:00
lib [Debug] Add debug-only value/op analysis (#6335) 2023-10-26 13:53:49 -07:00
llvm@7ce613fc77 Bump LLVM to 7ce613fc77af092dd6e9db71ce3747b75bc5616e (#6342) 2023-10-26 13:53:12 -07:00
test [Debug] Add debug-only value/op analysis (#6335) 2023-10-26 13:53:49 -07:00
tools [firtool] Move -g option into firtool library (#6332) 2023-10-24 11:44:18 -07:00
unittests [OM] Evaluator: Support graph regions (#6249) 2023-10-06 03:24:38 +09:00
utils [cmake][CI] Use llvm_gtest target directly. (#5804) 2023-08-08 11:44:21 -05:00
.clang-format [NFC] Added newlines to the end of files 2022-03-28 18:58:23 +03:00
.clang-tidy [NFC] .clang-tidy: Disable misc-use-anonymous-namespace . (#5775) 2023-08-03 14:00:35 -05:00
.gitignore Add TAGS to gitignore (#4602) 2023-01-31 16:58:35 +09:00
.gitmodules Update LLVM (#3502) 2022-07-18 14:18:53 -05:00
.style.yapf [Python][CI] Add yapf formatting guidelines and run check in CI. 2021-04-21 15:38:02 -06:00
.yapfignore [Python][CI] Add yapf formatting guidelines and run check in CI. 2021-04-21 15:38:02 -06:00
CMakeLists.txt [ESI] Change method of packaging collateral (#6000) 2023-08-31 11:23:50 -07:00
CODEOWNERS Calyx native callout pass (#5879) 2023-08-24 09:16:54 +05:30
LICENSE [Global] Clarify license as Apache 2.0 with LLVM Exceptions (#56) 2020-07-26 11:53:57 -07:00
README.md Add workflow to track LLVM commits (#2801) 2022-03-26 11:07:22 -07:00
SECURITY.md Create SECURITY.md file 2022-10-17 11:53:37 -05:00

README.md

Nightly integration tests

Track LLVM Changes
↳ If failing, there exists an upstream LLVM commit which breaks CIRCT.

"CIRCT" / Circuit IR Compilers and Tools

"CIRCT" stands for "Circuit IR Compilers and Tools". One might also interpret it as the recursively as "CIRCT IR Compiler and Tools". The T can be selectively expanded as Tool, Translator, Team, Technology, Target, Tree, Type, ... we're ok with the ambiguity.

The CIRCT community is an open and welcoming community. If you'd like to participate, you can do so in a number of different ways:

  1. Join our Discourse Forum on the LLVM Discourse server. To get a "mailing list" like experience click the bell icon in the upper right and switch to "Watching". It is also helpful to go to your Discourse profile, then the "emails" tab, and check "Enable mailing list mode". You can also do chat with us on CIRCT channel of LLVM discord server.

  2. Join our weekly video chat. Please see the meeting notes document for more information.

  3. Contribute code. CIRCT follows all of the LLVM Policies: you can create pull requests for the CIRCT repository, and gain commit access using the standard LLVM policies.

Motivation

The EDA industry has well-known and widely used proprietary and open source tools. However, these tools are inconsistent, have usability concerns, and were not designed together into a common platform. Furthermore these tools are generally built with Verilog (also VHDL) as the IRs that they interchange. Verilog has well known design issues, and limitations, e.g. suffering from poor location tracking support.

The CIRCT project is an (experimental!) effort looking to apply MLIR and the LLVM development methodology to the domain of hardware design tools. Many of us dream of having reusable infrastructure that is modular, uses library-based design techniques, is more consistent, and builds on the best practices in compiler infrastructure and compiler design techniques.

By working together, we hope that we can build a new center of gravity to draw contributions from the small (but enthusiastic!) community of people who work on open hardware tooling. In turn we hope this will propel open tools forward, enables new higher-level abstractions for hardware design, and perhaps some pieces may even be adopted by proprietary tools in time.

For more information, please see our longer charter document.

Setting this up

These commands can be used to setup CIRCT project:

  1. Install Dependencies of LLVM/MLIR according to the instructions, including cmake and ninja.

  2. Check out LLVM and CIRCT repos. CIRCT contains LLVM as a git submodule. The LLVM repo here includes staged changes to MLIR which may be necessary to support CIRCT. It also represents the version of LLVM that has been tested. MLIR is still changing relatively rapidly, so feel free to use the current version of LLVM, but APIs may have changed.

$ git clone git@github.com:llvm/circt.git
$ cd circt
$ git submodule init
$ git submodule update

Note: The repository is set up so that git submodule update performs a shallow clone, meaning it downloads just enough of the LLVM repository to check out the currently specified commit. If you wish to work with the full history of the LLVM repository, you can manually "unshallow" the the submodule:

$ cd llvm
$ git fetch --unshallow
  1. Build and test LLVM/MLIR:
$ cd circt
$ mkdir llvm/build
$ cd llvm/build
$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir" \
    -DLLVM_TARGETS_TO_BUILD="host" \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=DEBUG \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ ninja
$ ninja check-mlir
  1. Build and test CIRCT:
$ cd circt
$ mkdir build
$ cd build
$ cmake -G Ninja .. \
    -DMLIR_DIR=$PWD/../llvm/build/lib/cmake/mlir \
    -DLLVM_DIR=$PWD/../llvm/build/lib/cmake/llvm \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=DEBUG \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ ninja
$ ninja check-circt
$ ninja check-circt-integration # Run the integration tests.

The -DCMAKE_BUILD_TYPE=DEBUG flag enables debug information, which makes the whole tree compile slower, but allows you to step through code into the LLVM and MLIR frameworks. The -DCMAKE_EXPORT_COMPILE_COMMANDS=ON flag generates a build/compile_commands.json file, which can be used by editors (or plugins) for autocomplete and/or IDE-like features.

To get something that runs fast, use -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=RelWithDebInfo if you want to go fast and optionally if you want debug info to go with it. Release mode makes a very large difference in performance.

Consult the Getting Started page for detailed information on configuring and compiling CIRCT.

Consult the Python Bindings page if you are mainly interested in using CIRCT from a Python prompt or script.