This is the first PR in a longer chain that adds basic SV support to
CIRCT.
Add the Slang Verilog frontend as a CIRCT dependency. This will be the
foundation for CIRCT's Verilog parsing, elaboration, type checking, and
lowering to the core dialects. By default, Slang is built as a static
library from scratch, which is then linked into the new `ImportVerilog`
conversion. Alternatively, CIRCT can also be linked against a local
Slang installation provided by the system.
Add the `ImportVerilog` conversion library. This library statically
links in the Slang dependency and wraps it in an exception-safe,
LLVM-style API. Currently this only consists of the `getSlangVersion`
function and the necessary linking flags to get it to link statically
against Slang.
Add the `circt-verilog` tool, which will provide a fully-flegded
interface to the new `ImportVerilog` library. Later on we'll also add an
MLIR translation library for single-file SV import. But in general, SV
builds take a lot of command line options (macros, search paths, etc.)
and multiple input files, which is why we have a dedicated tool. All the
tool does at the moment is print the linked Slang version. More to come.
Note that this intentionally links against **version 3** of Slang. Newer
versions are available -- 4 and 5 as of this commit -- but they rely on
fairly new C++ compiler features that didn't work out of the box in our
CI images. We'll eventually want to upgrade, but for now Slang 3 is
sufficient to get the ball rolling.
See https://github.com/MikePopoloski/slang for details on Slang.
Co-authored-by: ShiZuoye <albertethon@163.com>
Co-authored-by: hunterzju <hunter_ht@zju.edu.cn>
Co-authored-by: 孙海龙 <hailong.sun@terapines.com>
Adds `ibistool` - a tool for driving Ibis lowerings. The tool has two
modes - low-level and high-level Ibis lowering.
Alongside this, introduce a set of Ibis pass pipelines which other users
may load to ensure that they're lowering ibis constructs in the
standard order.
This commit is based on firld work by Will. This commit adds a boilerplate and
minimal implementation for `om-linker` which aims to link separated objectmodel
IRs into a single IR.
With this PR `om-linker` is able to read input MLIR files, and concat into
a single MLIR file without flattening ModuleOp. Currently it doesn't perform
any symbol resolution. For instance, we link following IR
```a.mlir
om.class @A(%arg: i1) {}
```
```b.mlir
om.class.extern @A(%arg: i1) {}
om.class @b(%arg: i2) {}
```
`$ om-linker a.mlir b.mlir`
```mlir
module {
module {
om.class @A(%arg: i1) {}
}
module {
om.class.extern @A(%arg: i1) {}
om.class @b(%arg: i2) {}
}
}
```
The actual linking pass will be added in a follow-up PR.
Co-authored-by: Will Dietz <will.dietz@sifive.com>
Turns out the cocotb driver is useful for things other than handshake... moves the cocotb driver to a separate tool folder, and modifies handshake tests accordingly.
A logical equivalence checking tool for CIRCT. As of now it covers some
basic `hw` operations and the whole `comb` dialect. Z3 acts as the
logical backend and has been introduced as a build dependency for the
tool. Furthermore, regression tests for part of the implemented
operations and features have been written.
Co-authored-by: Hideto Ueno <uenoku.tokotoko@gmail.com>
Add the `arcilator` convenience tool to make experimenting with the
dialect easier. The intended pass sequence performs the full conversion
from a circuit cut along port boundaries (through modules) to a circuit
cut along the state elements (through arcs). The tool simply executes
this pass pipeline.
Co-authored-by: Martin Erhart <maerhart@outlook.com>
Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
... the long awaited.
This intends to be a mostly boilerplate-y commit for introducing an `hlstool` to circt. The goal is fairly clear - provide a tool which composes the various passes and abstractions in CIRCT which care about high-level design/synthesis.
By doing so, the tool intends to take out the guesswork in terms of how these abstractions are to be composed, as well as when and where to run a pass.
Benefits should be fairly immediate - both in terms of reducing the verbosity of integration tests (many of which currently have to manually describe a fairly long pass pipeline) as well as for newcomers to CIRCT, which can be pointed to a tool/pass pipeline that shows a verified phase ordering of lowering/transformation passes.
As for tests, this commit includes modifications to most of the Handshake integration tests using the 'all' driver.
To replace all tests, a follow-up commit should define how to handle flow-specific arguments to `hlstool`.
Writing failing tests for PyCDE code gets cumbersome, quickly, without --split-input-file behaviour like we're used to in opt tools.
This commit adds a small python script which splits an input file based on a split token (# -----) and executes each split separately, catching any exceptions which might be thrown.
Add a `circt-reduce` utility, which basically follows the "build a
custom mlir-reduce" steps described in the MLIR documentation. The
intent here is to have a first step towards a CIRCT-specific reduction
utility. At a later stage, we may want to start populating the reducer
framework with reduction patterns specific to CIRCT (like fan-in/-out
cone isolation, port removal, etc).
* [ESI] Convert cosim integration test to tool
* Point to the lib when launching cosim
* Fix copy-paste error
* Switch to using new DPI capability of circt-rtl-sim
* [Tests] [Questa] If found, provide feature and path
* Abstraction script and moving existing test
* Default sim
* Passing default simulator through env var
* Adding default driver.sv
* Various bug fixes
* Argparse wasn't working properly
* Don't touch files in test/
* Creating a default for commercial simulation
* Making circt-rtl-sim a tool not a util script
* Removing old comment
* Adding 'rtl-sim' feature and renaming 'comsim' to 'ieee-sim'
* Merge LLHD project into CIRCT
* Split LLHDOps.td into multiple smaller files
* move LLHDToLLVM init definition and prune includes
* Format tablegen files with 2 space indent, 80 col width; move out trait helper function
* Move implementation logic from LLHDOps.h to cpp file
* Empty lines for breathing space; nicer operation separators
* Move simulator to Dialect/LLHD/Simulator
* move `State.h` and `signal-runtime-wrappers.h` to lib directory
* pass ModuleOp by value
* make getters const, return ModuleOp by value
* Use isa, cast, dyn_cast appropriately
* wrap struct in anon namespace; make helpers static
* [cmake] Fold into LINK_LIBS
* fix for loops
* replace floating point with `divideCeil`
* prune redundant includes
* make llhd-sim helpers static
* remove StandardToLLVM pass registration
* move verilog printer to cpp file, add global function as public API
* Move transformation pass base classes and registration to lib, add file header boilerplate
* Few improvements
* Return diagnostics directly
* isa instead of kindof
* Improve walks
* etc.
* add 'using namespace llvm;' again
* Always pass a location when creating new ops
* Improve cmake files
* remove unnecessary `LLVMSupport` links.
* add `PUBLIC` where missing.
* move LLVMCore under `LINK_COMPONENTS`.
* Add file headers and improve simulator comments
* Some LLHDToLLVM improvements
* Fix walks.
* Use `std::array` instead of `SmallVector` when resize is not needed.
* Fix a potential sefgault by passing an ArrayRef with no data owner.
* Remove some unnecessary steps.
* Remove some unnecessary const strings.
* Add new LowerToLLVMOptions argument
The new argument was added in 10643c9ad85bf072816bd271239281ec50a52e31.
* Add missing file header boilerplate and newline
* Improve for-loop
* use static instead of anonymous namespace for functions
* fit to 80 columns, cast instead of dyn_cast
* Changes for LLVM update
* use llvm format instead of std::stringstream and iomanip
Co-authored-by: rodonisi <simon@rodoni.ch>
This also updates the README to include some building information.
Lots of caveats:
- This is all experimental
- The actual tool isn't interesting yet.
- The naming is arbitrary and will likely change.
- Much of the cmake files were cargo culted from other places
because I don't know what I'm doing.