Commit Graph

50 Commits

Author SHA1 Message Date
Martin Erhart 2345382e67
[LLHD] Remove llhd-sim (#7351) 2024-07-19 17:54:14 +01:00
Amelia Dobis d090c6689d
[LTL to Core] Add lowering for AssertProperty operations (#6974)
* Add lowering for AssertProperty operations

* removed nl at start of file

* sorted cmake and removed unreachable branches

* Removed useless wire in test + removed symbol from hbr compreg
2024-05-02 12:57:52 -07:00
Martin Erhart 5cf1ff57f4
[SMT] Add lowering to LLVM IR (#6902) 2024-04-20 10:11:47 +02:00
Martin Erhart 7a5635825a
[Verif] Add LEC operation (#6832) 2024-03-17 18:33:09 +01:00
Martin Erhart cfb9792f48
[SMT] Add HWToSMT and CombToSMT conversion passes (#6815) 2024-03-17 18:19:48 +01:00
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
Nandor Licker cc8fabb16d
[Sim] Initial implementation of the `sim` dialect (#6561) 2024-01-10 18:02:39 +02:00
Amelia 3707c382fb
[HW to BTOR2] btor2 conversion pass (#6378)
* Added missing tool in integration test

* Fixed formatting

* Fixed whitespace issue

* Fixed typo in VerilogGeneration.md

* Added skeleton for btor2 lowering pass

* added pattern match skeleton to lowering pass

* Added initial emission of inputs and hw::constant ops

* added constant emission

* added emission for most operations and final assertion

* Added support for muxes, assumptions and wire aliases

* Added support for inputs in btor2

* fixed bug in input generation

* added support for missing comb operations

* Changed input registration to allow for booleans

* Made input type check more robust

* WIP register state transition system generation

* Added support for registers

* refactored hardcoded string

* added names to btor2 states

* Added state initialization support

* Removed state initializer, it should be a firrtl construct and not a btor one

* Removed temporary file emission

* Added back accidentally removed btor2 string printing

* Ran clang-format

* Ran clang-format

* WIP refactored typeswitch

* refactored giant type switch

* Made all string litterals constexpr

* attempting to fix sanity check

* fixed variable name typo

* Attempting to satisfy clang-tidy

* renamed things to make clang happy

* inlined useless helper methods

* Clarified the necessity of important data structures in comments

* fixed formatting

* Changed pass into a Conversion pass

* refactored helper methods

* Checked for case where next is a port when emitted transitions

* Added newline at EOF

* Inherited visitors instead of using a big typeswitch

* Throw an error for unsupported ops and explicitly ignore the rest

* Removed unnecessary functions and refactored runOnOperation

* Fixed formatting

* Attempted to add some test

* Added in ops that weren't covered by visitors

* Added in missing declaration in header

* Included pass in CAPI CmakeLists

* Added infrastructure for btor integration tests

* Revert "Added infrastructure for btor integration tests"

This reverts commit a5ec3da4ec.

* various nitpicking comments accounted for

* used generalized ids for btor2 testcase

* fixed typo in test

* updated test and found small bug

* clang-format

* added support for arbitrary resets

* Updated test to reflect new handling of reset

* Switched to a DFS strategy for emission

* Updated test to align with preemission of register declarations

* Removed gratuitous lookups.

* inlined a bunch of string constatns

* removed certain silent fails and added out of order test
2023-12-15 20:30:07 +01:00
Morten Borup Petersen 7a3b9e478b
[Handshake] `StandardToHandshake` -> `CFToHandshake` (#5938)
... long awaited.
2023-08-25 09:24:26 +02:00
Rachit Nigam d35c2de896
Calyx native callout pass (#5879)
* start working on adding a calyx native callout pass

* missing entry in CMakeLists for circt-opt

* emit calyx in pass

* progress

* specify primitives lib

* it works!!

* fewer imports

* fix CMakeList

* cleaup and comments

* remove useless stringref

* better error message when `calyx` binary is missing

* header style

* remove primitives folder option and define pass-pipeline

* remove braces

* add native pass to calyx namespace

* remove empty namespace

* add dependency to CAPI

* clang-tidy
2023-08-24 09:16:54 +05:30
Nandor Licker 62f5672b3e
[Seq] Lower both registers and memories in the same pass (#5853)
This PR moves the conversion of FIRRTL-specific `seq` ops to their own conversion pass, `SeqToSV`.
The existing register & memory lowering passes are packaged as re-usable utilities to keep them available as individual transformations.
Both the memory and register lowering utilities are packaged into a single parallelized lowering.
2023-08-22 20:31:20 +03:00
Morten Borup Petersen 2b14a00cba
[Verif] Add `format_verilog_string, print` operations (#5616)
#5577, #5575

Re. the lowering; `verif.print` lowers directly to a `sv.fwrite` via. inspection of its source operand (which is expected to be a `verif.format_verilog_string`). The source `format_verilog_string` is `not` deleted in the process (there may be other users). However, i marked `verif.format_verilog_string` as `Pure` meaning that it'll get removed if `canonicalize` is run after `lower-verif-to-sv` and there are no more users of the result.
It's expected that `verif.print` will reside inside *something* that eventually lowers to a procedural SV region, if one is going the SV route. I'd imagine that most users will embed `verif.print` inside `hw.triggered` regions.
2023-07-20 13:12:31 +02:00
Morten Borup Petersen fac5bc8625
[HW] Add `hw.triggered` op (#5582)
Here's a stab at the `hw.triggered` operation.
I think the main issue is to decide where to place the lowering. AFAICT, the closest we have to a "hw to sv" conversion pass is `hw-legalize-modules` (which really should be named to `sv-legalize-modules` seeing as it's lowering away HW constructs in favor of SV constructs).
I chose to introduce a new pass - `lower-hw-to-sv` which could serve as a clear home for these kinds of lowerings (maybe some things in `HWLegalizeModules` could be moved to here?).

Lastly, just went with a simple assembly format. If people would like to see something more fancy, e.g. an initializer-list style format with an elided entry block:
> `hw.triggered postedge %t (%a0 : i32 = %in) { ...`
let me know.
2023-07-17 09:51:33 +02:00
Morten Borup Petersen dcf8d1b0bd
[DCToHW] Add DCToHW conversion pass (#5298)
This commit adds a lowering of DC operation to a combination of
`comb,seq` and `hw` operations. The implementations are identical to
those of the `handshake` dialect (i.e. `handshake-to-hw` sans the
arithmetic operations).

- ESI-typed I/O
- DC buffers lower to ESI buffers
  - This is just a temporary solution. I anticipate more complexity here
    in the future when we want to do more with the FIFOs that connect
    DC circuits.
- In case the IR contains DC operations that need to be clocked (fork, buffer),
  there must exist a clock and reset signal in the parent `FunctionLike`
  operation. These arguments are to be marked with a `dc.clock` and `dc.reset`
  attribute, respectively.
- Only a single integration test for now. Will add more once #5297 lands
  (allows us to do some high-level tests through handshake).
2023-06-20 15:18:53 +02:00
Morten Borup Petersen fca113cf89
[HandshakeToDC] Add conversion (#5214)
... progressive lowering of handshake!
This obviously requires a future addition of an `arith-to-comb/hw` pass to map arith stuff to comb/external hardware/pipelines, ...
2023-05-19 12:28:55 +02:00
Morten Borup Petersen 36289534c6
[HandshakeToFIRRTL] <- deprecate (#5130)
Removes the handshake to FIRRTL lowering pass.

Also:
* All handshake integration tests now run through the handshake to HW pass (thanks to 936db150)
* Some changes were required to the handshake cocotb test runner, seeing as struct are not flattened in HandshakeToHW.
2023-05-05 13:56:41 +02:00
Fabian Schuiki 700b0bd0b3 [CMake] Sort conversion subdirs alphabetically; NFC 2023-04-27 14:17:45 -07:00
Andrew Butt 80c76afb86
[LoopSchedule] Move PipelineWhile and Related Ops from Pipeline to LoopSchedule (#4947) 2023-04-18 11:56:07 -04:00
Fabian Schuiki 90832beed7
[Arc] Add basic LLVM lowering (#4685)
Add two passes to lower a design to a software model.

The `LowerClocksToFuncs` pass outlines all `arc.clock_tree` and
`arc.passthrough` operations into separate MLIR functions. This
conceptually converts clocks from being a signal in the design into a
function that can be called in order to execute the state update
triggered by that clock.

The `LowerArcToLLVM` conversion pass does exactly as it says: it sets up
a dialect conversion from Arc and the core CIRCT dialects to Func/SCF,
and from there to the LLVM dialect.

Also add an output format option to the arcilator tool that allows for
the direct emission of LLVM IR (as opposed to the MLIR's LLVM dialect).

Co-authored-by: Martin Erhart <maerhart@outlook.com>
Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
2023-03-28 14:04:49 -07:00
Fabian Schuiki ee95300b53
[Conversion] Add Comb to MLIR Arith conversion pass (#4728)
Add an experimental pass to convert operations in the Comb dialect to
their equivalent in the Arith dialect. The pass isn't used anywhere yet,
but conversion to Arith allows all canonicalizations defined on that
dialect to take effect before mapping things to LLVM to generate a
software model.

Co-authored-by: Martin Erhart <maerhart@outlook.com>
2023-03-15 21:54:35 -07:00
Fabian Schuiki 55e2230e3f
[Arc] Add arc conversion pass (#4697)
Add the `ConvertToArcs` conversion which collects the combinational
operations in a module body, divides them into distinct sets split along
registers and a few other potentially state-holding operations, and
outlines these sets into arc definitions, inserting an `arc.state` op in
place of the original combinational ops.

Note that this merely replaces logic and registers with arc invocations,
but keeps the module hierarchy intact.

Co-authored-by: Martin Erhart <maerhart@outlook.com>
Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
2023-02-23 22:27:01 -08:00
Morten Borup Petersen e7405f7be9
[Pipeline] Add `pipeline.pipeline` HW lowering (#3874)
This is a fairly straight-forward transformation since the brunt of the
work of detecting which values will be registered in a given pipeline
stage has already been performed by a prior pass.
This pass simply elaborates the `pipeline.stage.register` operations
into `seq.compreg` operations and stitches up the circuit.
2022-09-14 17:41:29 +02:00
Daniel Resnick 5f91346570
[ExportChiselInterface] Basic infrastructure for Chisel Interface file emission (#3760)
* [ExportChiselInterface] Basic infrastructure for Chisel Interface file emission

This commit adds a pass for FIRRTL that generates a Scala file with a module
class that represents the interface for the top module of the FIRRTL circuit.
This is to support the development of separable compilation of FIRRTL circuits.
The details about linking circuits together are to be determined. The generated
Scala module extends ExtModule, although a new module class may be introduced
in the future.
2022-08-25 11:56:50 -06:00
Mike Urbach b706f4d78d
[Pipeline] Remove original PipelineOp and conversion. (#3685)
This representation and conversion aren't being used, and never
connected to Verilog output. The newer PipelineWhileOp could subsume
this use-case, and further evolution is coming to this dialect, so it
seems like a good time to clean out the older parts that aren't used.
2022-08-08 11:26:20 -07:00
Martin Erhart 6e81996914
[ExportSystemC] Move pass from circt-opt to circt-translate (#3664)
Move to circt-translate because the pass does not modify the IR in any
way. Add basic code to emit each module or function to a separate file.
2022-08-05 20:28:48 +02:00
Morten Borup Petersen b3359685c7
[StaticLogic] Rename dialect to 'Pipeline' (#3648)
It is probably fair to conclude that naming this dialect `StaticLogic` has been a pain point for a while. This commit proposes a dialect renaming to `Pipeline`, for a couple of reaons:

1. So far, we've only been working with pipeline abstractions within this dialect.
2. Pipeline representations aren't necessarily statically scheduled - we plan on adding switches to select between latency sensitive and latency insensitive lowerings of pipelines.

This name change does not preclude renamings in the future if we want to fit more stuff into this dialect. Personally, i think it is prudent to maintain a dialect name which reflects what's actually being done within the dialect, as well as the (near/mid/"someone actually intends to work on this"-term) future plans for the dialect.
2022-08-04 10:58:40 +02:00
Bea Healy 2c95a38a71
[LLHDToLLVM] Refactor conversion patterns of each dialect to separate files (#3599)
Moves Comb to LLVM and HW to LLVM conversions out of the LLHDToLLVM pass and into their own dedicated lowering passes, as proposed in #3539.

The methods convertToLLVMEndianess and llvmIndexOfStructField are also encapsulated here within a HWToLLVMEndianessConverter class, in order to allow easier re-use between different passes.
2022-07-29 12:29:32 +02:00
Morten Borup Petersen 14ca56c139
[CalyxToFSM] Add CalyxToFSM conversion pass (#3213)
This commit represents a lowering pass for converting a Calyx control schedule (seq/if/while/enable) into an FSM representation. The FSM is embedded within the Calyx component, and references both the group symbols and cell SSA values.

The lowering method is a fairly straight forward conversion, which leaves plenty of canonicalization opportunities to remove redundant states in the generated FSM. However, doing it as presented in this PR lends itself to some very clean code (which I prefer, rather than prematurely optimizing during lowering) as well as meaningful naming of states (which i think is fairly important).
2022-07-21 18:54:37 +02:00
Martin Erhart 4069407da9
[SystemC] Add exporter skeleton (#3523) 2022-07-19 21:59:50 +02:00
Martin Erhart ae3d1acd19
[RFC] Add a dialect for SystemC emission (#3520) 2022-07-19 17:14:36 +02:00
7FM 655cb61abd
[HWArithToHW] Add lowering boilerplate (#3546) 2022-07-18 10:03:22 +02:00
Morten Borup Petersen 56a260a1d4
[FSMToSV] Add FSM to SV conversion pass (#3483)
This commit introduces an FSM to SV lowering pass, as well as some small modifications to the FSM dialect to facilitate the conversion. This initial version of the pass does not support transition action regions and variables.

The lowering style is fairly straight forward; two processes are emitted, one `always_ff` for state register inference, one `always_comb` for next-state calculation and output assignments.

e.g.:
```mlir
fsm.machine @top(%a0: i1, %arg1: i1) -> (i8, i8) attributes {initialState = "A", argNames = ["a0", "a1"], resNames = ["r0", "r1"]} {
  %c_42 = hw.constant 42 : i8
  fsm.state @A output  {
    %c_0 = hw.constant 0 : i8
    fsm.output %c_0, %c_42 : i8, i8
  } transitions {
    fsm.transition @B
  }

  fsm.state @B output  {
    %c_1 = hw.constant 1 : i8
    fsm.output %c_1, %c_42 : i8, i8
  } transitions {
    fsm.transition @A guard {
      %g = comb.and %a0, %arg1 : i1
      fsm.return %g
    }
  }
}
```
emits as
```sv
typedef enum {A, B} top_state_t;
module top(
  input        a0,
               a1,
               clk,
               rst,
  output [7:0] r0,
               r1);

  reg  [7:0]       output_1;
  reg  [7:0]       output_0;
      top_state_t next_state;
  wire top_state_t to_A;
  wire top_state_t to_B;
      top_state_t state_reg;

  assign to_A = A;
  assign to_B = B;
  always_ff @(posedge clk) begin
    if (rst)
      state_reg <= to_A;
    else
      state_reg <= next_state;
  end
  always_comb begin
    case (state_reg)
      A: begin
        next_state = to_B;
        output_0 = 8'h0;
        output_1 = 8'h2A;
      end
      B: begin
        next_state = a0 & a1 ? to_A : to_B;
        output_0 = 8'h1;
        output_1 = 8'h2A;
      end
    endcase
  end
  assign r0 = output_0;
  assign r1 = output_1;
endmodule
```
2022-07-16 21:57:24 +02:00
Chris Gyurgyik 6e518751cc
[SCFToCalyx] [StaticLogicToCalyx] Separate lowerings to Calyx. (#3155)
Begin transition to separating the SCF and StaticLogic conversions to Calyx.
2022-05-20 15:53:56 -07:00
Morten Borup Petersen c7c0765933
[HandshakeToHW] Initial commit for handshake-to-hw (#2680)
This initial commit handles building of the top-level hw.module when converting a handshake.func operation. All handshake modules are created as external hw modules. By doing so, follow-up commits may gradually implement each of the handshake operations using RTL dialect logic.

To transition from FIRRTL bundles with explicit ready/valid/data bundles, this commit relies on ESI channels for handshake module I/O as well as the top-level I/O.

Some changes to the flow are that:
- We're no longer inlining the handshake operations into the hw module. Instead, we maintain a value mapping from SSA values in the handshake.func to those in the hw.module, and maintain this using BackedgeBuilder operations. In general, an approach is taken of maintaining state outside the IR instead of inside the IR.

This is just the first commit in the process of transitioning away from FIRRTL for lowering Handshake operations; transitioning to be ESI based should hopefully also create a good basis for composing Handshake circuits with other parts of future HLS and CIRCT infrastructure.
2022-02-26 11:26:50 +01:00
Martin Erhart d696f344d1
Add Moore MIR dialect (#2261)
Currently, the Moore frontend-compiler parses SystemVerilog, lowers the AST to Moore MIR, and then generates HW/Comb/LLHD code which it forwards to CIRCT.

This new Moore dialect aims to move the MIR into CIRCT to benefit from the CIRCT/MLIR infrastructure. In the long-run also the parser and AST can be implemented to have a complete SystemVerilog frontend natively in CIRCT.

The purpose of Moore MIR in the lowering chain is to make all the implicit things (e.g., type casts) in SystemVerilog explicit to ease further lowering to HW/Comb/LLHD.
2021-12-01 18:56:01 +01:00
mikeurbach 72b5a9d0c2
Staticlogic conversion revert (#2169)
* Revert "Revert "[StaticLogic] Add conversion pass for Affine loop nests. (#2157)""

This reverts commit 0ce0e99b7c.

The new pass wassing missing a CMake dependency on generated files.
2021-11-12 13:00:21 -07:00
Mike Urbach 0ce0e99b7c Revert "[StaticLogic] Add conversion pass for Affine loop nests. (#2157)"
This reverts commit 0308cf325e.

It was reported that this broke the Windows build.
2021-11-12 12:30:24 -07:00
mikeurbach 0308cf325e
[StaticLogic] Add conversion pass for Affine loop nests. (#2157)
This is just the start of a pass, but this is enough to use the
scheduling tools and build a pipeline. At the moment, this doesn't
make use of the schedule, it just sets up a loop template. This is
just enough to lower a single loop and generate the appropriate
induction variable increments. Checkpointing here before moving any
further.

After this, I plan to add a helper class to this pass to answer the
questions we will need to flesh out createStaticLogicPipeline.

My goal is to take something as simple as this and start threading it
through the Calyx lowering to get a very thin path working before
adding support for more cases.

Co-authored-by: Julian Oppermann <oppermann@esa.tu-darmstadt.de>
2021-11-12 10:28:27 -07:00
Chris Lattner 0de4aac499 [ExportVerilog] Move into Conversions/ tree.
ExportVerilog was an outlier living as the only child of the Translations
tree, move it into Conversions to be more similar to other passes.
2021-10-04 16:24:12 -07:00
Morten Borup Petersen e4731d4b5b
[SCFToCalyx] Add SCFToCalyx boilerplate [1/13] (#1812)
This is the initial commit for the SCFToCalyx pass. The commit sets up the boilerplate required for adding a new conversion pass.
2021-09-20 23:56:47 +01:00
Chris Gyurgyik e1c6592852
[Calyx] Add CalyxToHW scaffolding. (#1502)
Adds scaffolding for a Calyx to HW conversion pass.
2021-08-03 18:34:11 -07:00
Fabian Schuiki a2a92d7b75
Remove FIRRTLToLLHD pass
* Remove the `FIRRTLToLLHD` pass in favor of a separate lowering from
  FIRRTL to HW, and then from HW to LLHD.

* Fixes #1175.
2021-06-09 13:59:36 +02:00
Chris Lattner 61e70086c6 [RTL->HW] Move a few more files in conversions and documentation. NFC. 2021-05-15 12:23:45 -07:00
mikeurbach 905445248b
Start of RTL to LLHD conversion pass (#343)
* [LLHD] Add start of RTL to LLHD conversion pass.

* Add basic support for converting RTL modules to LLHD entities.

* Switch implementation to use DialectConversion framework.

* Update EntityOp verification.

The verifyType method now uses the type attribute exclusively instead
of looking at the op. If the op was in fact invalid, verifyType could
crash before the verifier got a chance to catch it.

* Add a type converter and use it in RTL module conversion.

This replaces how the entity type is constructed, and is used to
re-map the RTL module's block arguments into the newly created
entity.

* Add conversion for RTL module's output terminator op.

* Clean up comments and error conditions.

* Add RTL to LLHD conversion error checks.

* Final clean ups.
2020-12-21 12:26:57 -07:00
Andrew Young 4de8ad595a
[FIRRTL] Move RTL lowering into a conversion library (#273) 2020-11-24 10:01:52 -08:00
Fabian Schuiki 87216cdf7a
[LLHD] Foundation for FIRRTL to LLHD conversion pass (#113)
* Implement a basic conversion pass for FIRRTL modules to their
  equivalent LLHD entity counterpart. Any operation in the FIRRTL module
  will cause the pass to fail. Handles only trivial ports (integers,
  possibly flipped).

* Add lowering for the `firrtl.connect` operation. Since we're currently
  lacking the `llhd.con` op, implement this as a `llhd.prb` and
  `llhd.drv`. Not *exactly* semantically equivalent, but close enough
  given that FIRRTL does not model time anyway.
2020-10-10 09:23:48 +02:00
Hanchen Ye 9ab7d667f9
[Handshake] Add StaticLogic Dialect and Pipeline Operation (#62)
* add pipeline operation

* add staticlogic dialect lib

* add standard-to-staticlogic pass

* update standard-to-staticlogic pass

* update conversion pass

* complete initial design of -create-pipeline pass

* format fixed; add testcase for -create-pipeline pass

* update references

* update pipeline operation defination; update standard-to-pipeline pass; update testcase

* add endline

* update pipeline operation and lowering pass: isolate from above, but not single-producer single-consumer; update test case.
2020-08-03 22:29:40 -07:00
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