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.
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
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.
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.
* [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.
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.
- 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.
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.
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>