Commit Graph

686 Commits

Author SHA1 Message Date
Hanchen Ye 5c8c1dcff9
Lower Handshake to FIRRTL (#27)
* update some git and vscode config files

* add HandshakeToFIRRTL files

* Add normal to bundle type conversion

* add handshake to firrtl signature conversion

* add convertMerge and convertReturn function

* update convertmerge code

* add mergeToEntryBlock() function

* remove signature conversion, successfully transform foo.mlir

* foo.mlir support lit test

* add test_inst.mlir testcase

* add module generation for binary ops

* add createBinaryOpModule function

* correctly create new FModule for standard binary operation

* correctly create new FModule for standard binary operation

* correctly connect instance with other operations

* correctly transform test_inst.mlir (binary operation => instance)

* add TODO for 06/29 morning

* support lit test for test_inst.mlir

* support arbitrary binary and unary operations

* add function for checking duplicated FModules

* add remove block structure pass for handshake dialect

* update the combinational logic for binary operation

* update getBundleType function

* clean the existing code

* reorganize code sturcture

* add buildBinaryOp function

* update extractSubfields function

* update buildBinaryOp function

* update getBundleType function

* update createInstOp function

* update code structure, TODO: write buildMergeOp

* update code structure

* update code structure

* support single input merge with instance op; update createInstOp function

* align to upstream repo

* untrack .vscode files

* align with upstream

* align .vscode dir

* align .vscode dir

* Now buildMergeLogic support any number of inputs

* Add buildControlMergeLogic function

* add buildBranchLogic function

* add buildConditionalBranchLogi function

* add buildForkLogic and buildLazyForkLogic function

* add sink, constant operations

* update pass rewrite function, support all (except memory related) elastic component and all binary expressions

* update submodule naming strategy

* update -remove-block-structure pass; -lower-handshake-to-firrtl bugs fix

* add buildJoinLogic function

* bug fixed: instance output connection

* follow clang format

* code cleanup and update testcases

* update testcases

* small bug fixed

* fix CMakeLists for HandshakeToFIRRTL

* update .gitignore

* delete .vscode dir

* fix merge operation logic

* add elastic component test cases

* add elastic component test cases

* add some references

* fix clang formant

* fix some small writing issues

* update test cases

* some small updates

* fix most issues

* emit errors rather than assert
2020-07-10 21:20:48 -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 8420dce471 Implement a stubbed out "-lower-firrt-to-rtl" pass that just lowers constants for now. 2020-05-30 16:16:30 -07:00
Chris Lattner 45fc170ab1 [RTL] Implement some new combinatorial ops, implement VerilogEmitter
support for them, implement a new rtl::CombinatorialVistor class.
2020-05-16 23:19:59 -07:00
Chris Lattner a9e4310c12 [RTL] Sketch out an rtl.constant operation, and the infra to support
operations in general.
2020-05-08 16:00:58 -07:00
Chris Lattner c109c655d6 Introduce a framework for a new RTL dialect. NFC. 2020-05-07 13:50:01 -07:00
Chris Lattner 7a80afaad6 Disable MLIR multithreading while parsing input, this speeds up the
parser (which doesn't a lot of IR generation) by about 18%!
2020-05-02 17:13:55 -07:00
Chris Lattner 90daf8bbcf [MLIR Update] Fixes to build against ToT MLIR 2020-05-02 09:40:09 -07:00
Chris Lattner 109bb2499c [EmitVerilg] Emit locator comments. 2020-04-30 12:05:57 -07:00
Chris Lattner c216617817 Move the remaining references of SPT to CIRT. NFC. 2020-04-29 11:57:17 -07:00
Chris Lattner b50c43470b remove some files that got moved. 2020-04-29 11:47:18 -07:00
Chris Lattner 66e9c9ca25 rename spt-opt and spt-translate to cirt-* 2020-04-29 11:45:54 -07:00
Chris Lattner 7ff6ffdf2f Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
Chris Lattner 9d11c786d4 start the rename of SPT -> CIRT, suggest by Aliaksei. This updates
the readme and namespace.  NFC.
2020-04-29 11:30:16 -07:00
Chris Lattner 3a0aac339b [firtool] Wire a couple optimizations (cse and canonicalize for now) into
firtool by default to clean up the IR.
2020-04-24 10:51:56 -07:00
Chris Lattner 126b62a5cc Give the FIR parser an options struct to configure it. Change firtool
to default to ignoring @info locations for now.  I don't need firtool to
report errors pointing at Scala files right now, I need it pointing to
the .fir files.  The default can be switched back as things mature.
2020-04-22 09:44:36 -07:00
Chris Lattner 56bd282978 [EmitVerilog] emit wire declarations for intermediate values
used by expressions and node declarations.  Also add a newline
between ports and wire decls and the body for clarity.
2020-04-21 22:55:25 -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 b179ab36e0 Eliminate the IR subdirectory of include/spt/Dialect/FIRRTL, flattening its
contents into the parent directory.  NFC.
2020-04-17 09:53:48 -07:00
Chris Lattner d65f385d06 Link the CSE pass into spt-opt, it deletes one half of the lines in the "low"
output I'm looking at, going from 1.2M lines of IR to 630K, largely by
eliminating duplicate constants.
2020-04-15 11:38:40 -07:00
Chris Lattner 0d441cee3f Stub out circuit/module walking and some other boring infra. 2020-04-14 21:27:20 -07:00
Chris Lattner 628be893e0 Rename FIRToMLIR.h -> FIRParser.h, remove some dead state from FIRParser.cpp, NFC. 2020-04-14 21:01:42 -07:00
Chris Lattner aa1deb3371 Stub out a (currently useless) verilog emitter. 2020-04-14 20:58:01 -07:00
Chris Lattner cfba8c2d08 fix a .mlir parser ambiguity with firrtl.printf, enable the
canonicalization pass in spt-opt.

Right now it seems to be doing trivial dead code elimination of
unused primitive and node operations.
2020-04-13 16:48:20 -07:00
Chris Lattner 66d332fe35 Move the FIRParser out of the FIRRTL dialect directory, NFC. 2020-04-13 09:57:28 -07:00
Chris Lattner 4864e0ec74 Update to latest MLIR. 2020-04-12 10:58:47 -07:00
Chris Lattner 92e910b574 update for mainline MLIR changes. 2020-04-06 13:49:50 -07:00
Chris Lattner 08372cba3e Update to ToT MLIR. 2020-04-01 11:50:06 -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 233e04e710 Improve the README to include some contributor notes, clang-format
the codebase.
2020-03-15 17:59:29 -07:00
Chris Lattner 24c3b33447 Create the sketch of a FIRRTL dialect, with a single type (firrtl.uint) and a
single registered operations (firrtl.add).  Add a testcase showing that these
are now being properly checked.
2020-03-07 15:47:08 -08:00
Chris Lattner 7783a53c8e Push the cmake files far enough along to make spt-opt be able to link in
MLIR libraries, parsing and printing the output, running passes, etc.
2020-03-06 16:42:00 -08: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