Go to file
Chris Lattner 7ff6ffdf2f Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
.vscode Stub out a (currently useless) verilog emitter. 2020-04-14 20:58:01 -07:00
cmake/modules Create the sketch of a FIRRTL dialect, with a single type (firrtl.uint) and a 2020-03-07 15:47:08 -08:00
include Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
lib Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
test [EmitVerilog] Implement assignment to registers correctly. 2020-04-29 11:23:13 -07:00
tools Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
.clang-format Improve the README to include some contributor notes, clang-format 2020-03-15 17:59:29 -07:00
CMakeLists.txt Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
LICENSE Initial commit 2020-03-04 20:57:43 -08:00
README.md start the rename of SPT -> CIRT, suggest by Aliaksei. This updates 2020-04-29 11:30:16 -07:00

README.md

clattner-test / CIRT / Circuit IR and Tools

This is a test repository, experimenting with an approach of building a modular set of tools for verilog and other SiFive related projects.

"CIRT" stands for "Circuit IR and Tools" or perhaps "CIRCuiT + IntermediateRepresenTation + Toolbox" (hat tip to Aliaksei Chapyzhenka). This name can still be changed if a better one is suggested. :-)

Setting this up

These are the commands Chris used to set this up on a Mac:

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

  2. Check out LLVM and CIRT repo's:

$ cd ~/Projects
$ git clone git@github.com:llvm/llvm-project.git
$ git clone git@github.com:sifive/clattner-experimental.git cirt
  1. HACK: Add symlink because I can't figure out how to get LLVM_EXTERNAL_CIRT_SOURCE_DIR to work with cmake:
$ cd ~/Projects/llvm-project
$ ln -s ../cirt cirt
  1. Configure the build to build MLIR and CIRT (MLIR is probably not necessary, but it builds reasonably fast and is good to provide a sanity check that things are working):
$ cd ~/Projects/llvm-project
$ mkdir build
$ cd build
$ cmake -G Ninja ../llvm  -DLLVM_EXTERNAL_PROJECTS="cirt" -DLLVM_EXTERNAL_CIRT_SOURCE_DIR=/Users/chrisl/Projects/cirt   -DLLVM_ENABLE_PROJECTS="mlir;cirt" -DLLVM_TARGETS_TO_BUILD="X86;RISCV"  -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=DEBUG

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.

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.

  1. Build MLIR and run MLIR tests as a smoketest:
$ ninja check-mlir
  1. Build CIRT and run CIRT tests:
$ ninja check-cirt

Submitting changes to CIRT

Talk to Chris.

Submitting changes to LLVM / MLIR

This project depends on MLIR and LLVM, and it is occasionally useful to improve them. To get set up for this:

  1. Follow the "How to Contribute" instructions, and install the right tools, e.g. 'arcanist' and clang-format.
  2. Get an LLVM Phabricator account
  3. ask for LLVM commit access.

Submitting a patch

The patch flow goes like this:

  1. Check out the LLVM mono repo (as described above).
  2. Make changes to your codebase.
  3. Stage your changes with git add.
  4. Run clang-format to tidy up the details of the patch with git clang-format origin/master
  5. Create a patch in Phabricator with arc diff.
  6. Iterate on review, changing your code and sending another patch with arc diff.

When your review converges and your patch is approved, do the following:

  1. commit your changes with git commit
  2. rebase your changes with git pull --rebase
  3. retest your patch with ninja check-mlir (or whatever other target makes sense)
  4. push your changes with git push