Commit Graph

16 Commits

Author SHA1 Message Date
Fabian Schuiki cacbaf7210
[reduce] Add a first proof-of-concept reducer implementation with sample FIRRTL dialect reducers (#1591)
- Update/rewrite the `circt-reduce` tool with a custom proof-of-concept
  reducer for the FIRRTL dialect. This is supposed to be a pathfinding
  exercise and just uses FIRRTL as an example. The intent is for other
  dialects to be able to produce sets of their own reducers that will
  then be combined by the tool to operate on some input IR.

  At this point, `circt-reduce` can be used to reduce FIRRTL test cases by
  converting as many `firrtl.module` ops into `firrtl.extmodule` ops as
  possible while still maintaining some interesting characteristic.

- Extend `circt-reduce` to support exploratively applying passes to the
  input in an effort to reduce its size. Also add the ability to specify
  an entire list of potential reduction strategies/patterns which are
  tried in order. This allows for reductions with big effect, like
  removing entire modules, to be tried first, before taking a closer
  look at individual instructions.

- Add reduction strategies to `circt-reduce` that try to replace the
  right hand side of FIRRTL connects with `invalidvalue`, and generally 
  try to remove operations if they have no results or no users of their 
  results.

- Add a reduction pattern to `circt-reduce` that replaces instances of
  `firrtl.extmodule` with a `firrtl.wire` for each port. This can
  significantly reduce the complexity of test cases by pruning the
  module hierarchy of unused modules.

- Move the `Reduction` class and sample implementations into a separate
  header and implementation file. These currently live in
  `tools/circt-reduce`, but should later move into a dedicated reduction
  framework, maybe in `include/circt/Reduce`, where dialects can easily
  access them and provide their own reduction implementations.
2021-08-18 17:22:43 +02:00
Andrew Young 65c72e5856
Disable llhd-sim tests when the executable is not built (#1425) 2021-07-14 18:42:45 -04:00
Mike Urbach 377c1042cf [Python][NFC] Run yapf on the entire repo.
This executes `yapf -i -r .` from the top-level directory. It is a
purely formatting change.
2021-04-21 15:38:02 -06:00
John Demme 31d19839f0
[ESI] Wrap modules exposing latency insensitive signals to expose ESI channels (#828)
Add two functions which are intended to be exposed over an API:
- A function to heuristically locate signal port triplets with ready valid on an RTL module.
- A function which takes an RTL module and a list of those port triplets and build a 'shell' around that module which 'uplifts' the port triplets to ESI channels.
Adds an 'esi-tester' binary to execute these two functions.
2021-03-27 14:06:19 -07:00
mikeurbach cce113ea55
[LLHD] Add option to specify shared libs to load in llhd-sim (#789)
This adds a -shared-libs option to llhd-sim that is analogous to the
same option for mlir-cpu-runner. If specified, those libraries are
passed to the ExecutionEngine to dynamically load and link.
2021-03-19 08:10:36 -06:00
John Demme 565bfa2b06
[ESI] Separate out the Cap'nProto code into separate library (#382)
* Scaffolding for Capnp-dependent ESI code

* Adding 'capnp' feature

* Replicated functionality

* Just missing the complex part: schema parsing

* Parse the generated schema, get the size out of that

* Documentation

* Adding NOLINT
2020-12-30 23:20:03 -08:00
George Lyon 2a9eb3506d
Create a minimal C API (#196)
* Enable cloning llvm submodule over HTTP

* Introduce C API

* Undo unrelated changes

* clang-format

* More format

* Add Header Comments

* Format

* Add basic test

* Add missing incantation

* Format

Co-authored-by: George <>
2020-11-04 11:37:51 -08:00
John Demme dc3b57de7e
Adding Verilator and a basic Verilator unit test (#179) 2020-10-30 13:12:15 -07: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
Stephen Neuendorffer 7d03c27a82 Fix CMakeFiles to include information from LLVM.
Also: fix 'check-circt' and 'install' rules.  Linkage was broken for
most of the tools.
2020-06-17 13:27:14 -07:00
Chris Lattner 3202062646 Mechanical rename of cirt -> circt. 2020-06-17 10:19:08 -07:00
Chris Lattner c216617817 Move the remaining references of SPT to CIRT. NFC. 2020-04-29 11:57:17 -07:00
Chris Lattner 66e9c9ca25 rename spt-opt and spt-translate to cirt-* 2020-04-29 11:45:54 -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