Commit Graph

21 Commits

Author SHA1 Message Date
Fabian Schuiki 3d8b7d08d9
[ImportVerilog] Add Slang frontend dependency (#6620)
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>
2024-01-30 13:22:00 -08:00
Morten Borup Petersen 6b73873825
[Ibis] Add ibistool (#6206)
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.
2023-09-28 10:14:20 +02:00
Hideto Ueno 2fa8a4989c
[om-linker] Set up boilerplate; parse and concat modules (#5693)
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>
2023-07-27 17:06:27 +09:00
Morten Borup Petersen 9df2cf4e3c
Move cocotb driver to separate tool (#5279)
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.
2023-05-30 09:48:47 +02:00
frog-in-the-well 5e5f3a3f79
[circt-lec] Introduce the `circt-lec` tool (#3991)
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>
2023-05-01 09:02:20 -07:00
Fabian Schuiki c37e320a60
[Arc] Add arcilator convenience tool (#4700)
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>
2023-03-12 16:39:31 -07:00
Fabian Schuiki 8e911fa3c6
[NFC] Whitespace fix 2023-02-19 17:18:39 -08:00
Will Dietz fba580565b
circt-{as,dis}: init basic MLIR <--> MLIRBC utilities. (#3941) 2022-09-22 10:43:31 -05:00
Morten Borup Petersen a249757c1f
[hlstool] Add hlstool for composing high-level abstractions and passes (#3866)
... 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`.
2022-09-12 19:30:35 +02:00
Morten Borup Petersen b7f6d475fd
Add py-split-input-file for better python test support (#3356)
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.
2022-06-15 19:56:13 +02:00
George Lyon 7c006d9fb0
Add `circt-lsp-server` tool which can be used with the MLIR VSCode extension (#2199) 2021-11-17 12:16:30 -08:00
Fabian Schuiki bff6411032 Add circt-reduce
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).
2021-08-04 13:19:48 +02:00
John Demme 34b497f9b2
[ESI] Convert cosim integration test "lit format" to tool (#445)
* [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
2021-01-13 15:00:27 -08:00
John Demme c9ccc4de01
[lit] RTL simulation script with Verilator and Questa support (#334)
* [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'
2020-12-22 14:30:25 -08:00
maerhart 8a82a81806
Merge LLHD project into CIRCT (#14)
* 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>
2020-07-02 11:04:33 -07:00
Stephen Neuendorffer 0c00022c74 Import handshake dialect 2020-06-17 14:14:42 -07:00
Chris Lattner 3202062646 Mechanical rename of cirt -> circt. 2020-06-17 10:19:08 -07:00
Chris Lattner 66e9c9ca25 rename spt-opt and spt-translate to cirt-* 2020-04-29 11:45:54 -07:00
Chris Lattner 0f98ce99de Introduce a new 'firtool' command with a simplified user interface. 2020-04-21 14:38:09 -07:00
Chris Lattner 2fe028d811 Implement the build and integeration outline of an spt-translate tool,
and stub out a .fir parser (which doesn't do anything yet) that is driven
from it.
2020-03-16 15:14:56 -07:00
Chris Lattner 64cec97240 Introduce a CMakefile scaffolding to build and test an executable.
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.
2020-03-05 15:16:55 -08:00