Commit Graph

2504 Commits

Author SHA1 Message Date
Andrew Young f57dfdc357
[ESI] Use new ParameterAttr for module parameters (#1817)
This fixes a compilation error in the integration test where ESI was not
switched to use a new dedicated ParameterAttr introduced in 471e60ce.
2021-09-20 13:25:56 -07:00
Morten Borup Petersen f353f91267 [Handshake][NFC] Iterate using getOps() where applicable 2021-09-20 09:50:07 +01:00
Morten Borup Petersen c30bb840ce [Handshake][NFC] Remove excess whitespace 2021-09-20 09:46:24 +01:00
Morten Borup Petersen 13eab41880 [Handshake][NFC] Simplify removeAllocOps 2021-09-20 09:43:24 +01:00
Morten Borup Petersen 29d84f0a58 [Handshake][NFC] Pass vectors by ArrayRef instead of by-value std::vector 2021-09-20 09:38:06 +01:00
Morten Borup Petersen ebaf6a7544 [Handshake][NFC] Address various static analysis warnings 2021-09-20 09:33:02 +01:00
Morten Borup Petersen 4c0cd77956 [Handshake][NFC] Use TypeSwitch in replaceMemOps 2021-09-20 09:27:02 +01:00
Morten Borup Petersen 98c7636031 [Handshake][NFC] Reduce use of large nested control statements 2021-09-20 09:20:42 +01:00
Morten Borup Petersen e1d50dcfa7 [Handshake][NFC] Simplify getControlMerge/getStartOp 2021-09-20 09:01:30 +01:00
Morten Borup Petersen 3053fcbbe3 [Handshake] Pass MergeLikeOpInterface directly to checkMergePredecessors 2021-09-20 08:52:37 +01:00
Morten Borup Petersen fdf0964182
[Handshake] Postpone adding ctrl arg to handshake::FuncOp until end of conversion (#1807)
No functional change, but a major step in the debug-ability of the pass. Previously, there was a discrepancy between the # of args of the Handshake FuncOp and the inlined body of the source FuncOp. This meant that any attempt at dump'ing the IR during conversion would crash, due a mismatch between the type signature of the handshake funcop and its entry block arguments.

This commit postpones adding the control argument to (and modifying the type signature of) the handshake funcOp until end of conversion.
2021-09-20 08:43:02 +01:00
Chris Lattner c0de60c9bb [HW] Add a ParameterAttr::getWithName member to consolidate helpers. 2021-09-19 21:36:26 -07:00
Chris Lattner ddb16da7a1 [HW] Replace getParameterNoValue with ParameterAttr::get members, NFC. 2021-09-19 21:33:26 -07:00
Chris Lattner 9d1a362dfd [HW] Move ParameterAttr from StructAttr to AttrDef
This makes it more efficient by storing it as a first-class attribute,
rather than as an interpreted dictionary.  This exposes a bunch of
ways in which StructAttr is unnecessarily different than AttrDef,
which is filed as LLVM PR 51909
2021-09-19 21:17:55 -07:00
Chris Lattner 7d0a5a1d87 [FIRRTL] Use some default fields of AttrDef instead of specifying them, NFC. 2021-09-19 21:17:30 -07:00
Chris Lattner d5c1010efb [HWLegalizeNames] Handle renamed ParameterRefAttr's. 2021-09-19 17:47:05 -07:00
Chris Lattner c8d11ec6e4 [HW] Verify parameter values for modules and localparam. 2021-09-19 17:04:29 -07:00
Chris Lattner 08e46ac976 [HW] Verify that instance parameters are structurally correct. 2021-09-19 15:58:39 -07:00
Chris Lattner cb1d8bf727 [HW] Inline a function into its only caller to simplify code, NFC. 2021-09-19 15:31:21 -07:00
Chris Lattner d22f1dc019 Move sv.verbatim.parameter up to the HW dialect.
This also renames it to hw.verbatim.parameter.value, and gives it a
proper type.  This makes it possible to do attribute checking without
the overhead of introducing an attribute interface.
2021-09-19 15:28:50 -07:00
Chris Lattner 3390221cdd Two files that were supposed to go with the previous patch. 🤦 2021-09-19 13:58:00 -07:00
Chris Lattner 12ab97af33 [HW] Introduce ParameterRefAttr, allowing use of parameter values in a module body.
This is still missing validation of the attributes, but does include
ExportVerilog support.
2021-09-19 13:55:28 -07:00
Chris Lattner e1e7e0feaf [SV] Switch LocalParamOp to take an attribute instead of SSA value.
This keeps params and attributes in different domains.  This will
allow better enforcement of valid parameter values in the verifier.
2021-09-19 12:33:01 -07:00
John Demme 0f7bb1b2ce [ESI] Fixing Capnp code to use new parameters model 2021-09-18 18:44:52 -07:00
Chris Lattner 6e21c285bd [HW] Remove support for old-style parameters entirely.
This completes Issue #1489.
2021-09-18 17:49:31 -07:00
Chris Lattner b2d60da553 [ESI] Switch to the new parameter model. 2021-09-18 17:48:42 -07:00
Chris Lattner 49f55d2a6a [test] Rename a test to align with the pass it is testing. 2021-09-18 17:46:32 -07:00
Chris Lattner cdfe44bc23 [HWStubExternalModules] Correctly handle parameters now that we can represent them. 2021-09-18 17:45:48 -07:00
Chris Lattner 74eda94c4f [LowerToHW] Switch to the new HW parameter module.
This also switches the module build() methods to take an ArrayAttr for
parameters instead of an ArrayRef<ParameterAttr>.  This is more consistent
with instances and is easier to work with.
2021-09-18 17:12:22 -07:00
Chris Lattner 4a48372658 [ExportVerilog] Add support for instance parameters. 2021-09-18 16:43:40 -07:00
Chris Lattner 2ac8f90d84 [HWLegalizeNames] Propagate renamed parameters to instances correctly. 2021-09-18 16:25:58 -07:00
Chris Lattner 18746a3b4f [HW] Add IR parser/printer/verifier support for new-style instance parameters. 2021-09-18 15:57:47 -07:00
Chris Lattner 985a547ffc [test] convert a few more parameters -> oldParameters. 2021-09-18 15:38:19 -07:00
Chris Lattner 47a6ddbe59 [HW] rename "defaultValue" to just "value" in ParameterAttr. NFC. 2021-09-18 15:20:49 -07:00
Chris Lattner 1bb45c820b [HW] One more change for hw.instance parameters -> oldParameters. 2021-09-18 15:00:06 -07:00
Chris Lattner a1e08007f0 [HW] Rename the 'parameters' member of hw.instance to 'oldParameters'.
We're going to get a new model for parameters here and I want to make
room for it.  Both models will have to co-exist for a while.
2021-09-18 14:57:42 -07:00
Richard Xia e97cff3fd5
[SV][LowerToHW] Add ExportModuleHierarchy pass. (#1792)
* [LowerToHW] Lower mainModule and DesignUnderTest attributes into moduleHierarchyFile attribute.

Since these are currently only used for the export module hierarchy
pass, these have been replaced with a more generic attribute marking
which modules should have their hierarchies exported to output files.

* [SV] Add ExportModuleHierarchy pass.

This adds a pass that collects the full module hierarchy into a JSON
string, which is then exported as part of an sv.verbatim op. The pass
collects a hierarchy for each module with the firrtl.moduleHierarchyFile
attribute.

The pass can be enabled in firtool by providing the
--export-module-hierarchy option.
2021-09-18 12:14:58 -07:00
Chris Lattner e0cd23fe85 [HWLegalizeNames] Legalize parameter names that conflict with ports/keywords. 2021-09-17 23:17:23 -07:00
Chris Lattner 01647926c4 [ExportVerilog] Add support for module parameters. 2021-09-17 22:57:13 -07:00
Chris Lattner bb9781ce49 [ExportVerilog] Remove #ifdef'd out code I inadvertantly committed, NFC. 2021-09-17 18:24:10 -07:00
Chris Lattner 3cbdf1f139 [HW] Split inline lambdas out to named lambdas, NFC.
This makes the code easier to read, and will hopefully fix a
clang-format grumpiness on a builder.
2021-09-17 18:22:36 -07:00
Chris Lattner 8b866609f7 [tests] remove the top level MLIR module from this test, NFC.
It is just indenting things for no reason.
2021-09-17 17:49:27 -07:00
Chris Lattner 471e60ceaf [HW] Add support for parameter decls to the hw.module* operations.
This adds IR support to parse and print them, but there is no export
verilog support yet.
2021-09-17 17:48:38 -07:00
Chris Lattner 97f3149214 [HW] Split custom attributes out to their own .td file. NFC. 2021-09-17 14:46:58 -07:00
Morten Borup Petersen eff81822c1
[Handshake] Fix lowering of std.CallOp to handshake.InstanceOp (#1538)
The PR adds a wrapRewriter which wraps the partial lowering functions already in place (such as replaceCallOps, addForkOps...). This rewriter composes a bit of supporting code (lowerToHandshake, PartialLowerFuncOp) that creates an instance of a ConversionTarget as well as an application of applyPartialConversion. The end result is that any rewriting and their side effects (most importantly modifications to referencing SSA values) made within each of the partial lowering functions are fully "comitted" after a partial lowering function returns. While being a bit hacky, I suspect that this structure might be generally useful for conversion passes which is heavily dependent on some sequence of transformations being applied in a specific order, where the author does not want to write distinct transformation passes for each of these steps.
2021-09-17 18:04:17 +01:00
John Demme 67fd0f8e6d [MSFT] Python bindings for ops and changes to make them work
- Adds python bindings for MSFTModuleOp and InstanceOp.
- Re-use as much as possible from `circt.hw._hw_ops_ext`. Required changes to
  ODS definitions.
- Found and fixed some bugs.
2021-09-17 00:16:49 -07:00
cgyurgyik 853c97d073 [Calyx] [obvious] Use a boolean to determine whether ElseRegion exists.
Also pass in the Operation's body instead of using a Region index. This
seems slightly easier to read and also templating is no longer a
necessity.
2021-09-16 22:51:58 -07:00
Chris Gyurgyik b9e0dbc603
[Calyx] [NFC] Emitter now emits `ElseRegion`. (#1804)
Fixes the emitter so that an `ElseRegion` for the `IfOp` is emitted, if it exists. This required 
adding a regionIndex variable to determine whether the current region should be the ThenRegion 
or ElseRegion of an IfOp.
2021-09-16 22:41:04 -07:00
John Demme 88abe4dbb3
[MSFT] Lower `MSFTModuleOp`s to `HWModuleOp`s (#1803) 2021-09-16 20:35:01 -07:00
Schuyler Eldridge 82c2945eaa
[FIRRTL] GCT Views: SV keyword Failing Test, NFC
Add a test that shows a failure where HWLegalizeNames will rename
signals and invalidate a Grand Central-generated XMR.  This test is
marked as expectedly failing.  This is being tracked in #1799.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2021-09-16 18:13:52 -04:00