This commit fixes the crash of disallowLocalVars mode for the IR with
array_index_inout/struct_field_inout and sv.read_inout.
Currently `hoistNonSideEffectExpr` doesn't hoist array_index_inout
and struct_field_inout because they are considered to be lvalues.
This is true only if they are not read. They might become rvalues
afterwards so we have to hoist them as well as read_inout op.
Add handling of Chisel's "forceName" API during FIRRTL Dialect to HW
Dialect conversion. This can be used to guarantee that an instance has
a specific name. The full Chisel API can be used to also force the
names of signals, but this is not supported.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
After merging the implicit CSE for subfield operations, the output of
this test case broke. The easiest way to fix this was to stop using a
bundle, which was not important for the test.
This adds an implicit CSE for subindexes and
subaccess to the FIRRTL parser. Due to the nature of the FIRRTL textual
format, we create an incredible number of these things which slows down
the initial IR generation. On my laptop this sped up a test case from
13-15 second to 8-9 seconds.
Add HW Dialect's ParamDeclAttr to the FIRRTL Dialect. This commit only
adds this attribute, but does not use it. This commit is part of a
series of commits that migrate FIRRTL external modules to use HW-like
parameters.
Change FIRRTL's ExtModule to use ParamDeclAttr for parameter storage as
opposed to using a dictionary. Modify parsing/printing to put
parameters in a carat-delimited area before ports (just like how HW
Dialect does this).
This makes NO modifications to the way ExtModule is represented.
Parameter values are still stored on the ExtModule and not on the
instantiation. This will be changed in a later commit.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
In trying to get function pipelining to work, it finally seems like we've found the issue for why this hasn't been working. If we keep simple merges, and then add buffers to their outputs, function pipelining looks to be working.
This commit allows simple merges in canonical handshake IR, but keeps the option of removing them through a separate pass. After buffer insertion, the merges will be redundant, but we must keep them (at least for now) to guide buffer insertion.
This change removes the usage of DontTouch annotation from FIRRTL dialect,
and replaces it with `inner_sym`.
Currently, symbols and the annotation, both block any canonicalization/constant
propagation through them. Replacing the check for DontTouch annotation with
the `inner_sym` will simplify the implementation.
Changes in this PR:
1. Remove the `DontTouch` annotation while parsing and instead add a symbol
to the op.
2. The DontTouch annotation can remain after parsing if it only applies
to a subfield.
3. Add `inner_sym` to `CHIRRTL::SeqMemOp` and `CHIRRTL::CombMemOp`, and
propagate the symbol to `FIRRTL::MemOp`
4. During `LowerTypes`, add the appropriate symbols if `DontTouch`
subfield-annotation present.
5. Remove the check for `DontTouch` annotation from `Annotations` and
canonicalization. Instead only check for symbols.
6. `LowerTypes` will silently drop symbols on aggregate types while lowering.
Remove the errors.
Followup cleanup work pending after this commit:
1. All clients for `inner_sym` must verify the appropriate symbol exists.
2. Remove usage of `DontTouch` annotation, that is no longer required.
We were fixing up the function type, but neglected to fix the `argNames`
and `resultNames` attributes. This did not affect functional
correctness, "just" the port names.
The select operation will select between two inputs based on an input conditional. The select operation differs from a mux in that:
1. both operands must be valid before the operation can transact
2. both operands will be transacted once one of them is selected
We previously lowered select operations directly to mux'es, however, this is incorrect. Since a mux will only transact the selected input, the other input (and the entire upstream path that generates the input) will be left stuck, waiting for the mux to transact.
A minimal semantics value probe operation which allows extracting values out of a module without needing to route each through a symboled entity which restricts transformation.
This will be used for binds and GrandCentral views.
Control-network connected constants may help debugability, but may result in slightly larger circuits. This commit provides an option to connect constants to Source ops instead.
Previously, a sub-path could be specified by encoding it in the name
of the attribute using a certain scheme. This is brittle and
non-standard. To make this more natural and robust, the sub-path is
added as a field of the attribute definition as a StringRef. It is not
required, in which case an empty StringRef can be used. The attribute
name for placement attributes is no longer used in any logic.
Due to the previous implementation of this function being based on a graph traversal which stopped at buffer ops, running bufferAllStrategy did not actually "buffer all" unbuffered channels, if some buffers already existed.
This commit simplifies bufferAllStrategy to do what is promised.
Another step towards #2365. This pass 'bubbles up' wires which are merely pass throughs in a given module. It then 'sinks down' wires which are looped back in the instantiation. Together with the entity movement piece, this effectively moves the wires as well. Does not handle wire manipulation operations, which also need to be moved/copied.
The design partitioning pass used to build HWModuleOps. The new wire
cleanup passes, however, will be operating on the design partitions so
the modifying extensions will come in handy.
In aggregate preservation mode, GrandCentral may create VerbatimExpr ops
with aggregate types. This commit allows verbatim to have non-integer types
such as a struct type or array type.
Change Namespace.h to use a single, unified StringMap instead of a
StringSet and a StringMap. This removes storage of duplicate keys in
two equivalent datstructures.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
This commit allows us to annotate AugmentedGroundTypeAttr to non-ground
types. First, I changed the element type of leafMap to be FieldRef
so that we can annotate to subelements. And `computeField` and
`traverseField` are modified to traverse the path represented by `fieldID`.
This commit changes the visiting order of simplifications to handle
nested regions properly. Currently `runOnGraphRegion` executes the
following procedure:
```
for op in body:
recurseToSubegions(op)
mergeIfPossible(op)
```
This commit modifies the procedure like this:
```
for op in body:
mergeIfPossible(op)
for op in body:
recurseToSubregions(op)
```
This effectively handles nested regions. Interestingly, this also
makes `opsToRevisitRegionsIn` unnecessary because we merge
the outer level first.
This commit adds new operation `multibit_mux` to make
subaccess lowering more efficient. Subaccess ops are
currently lowered into mux chains but in HW/Comb dialect
they are pulled back to `array_create` + `array_get`.
`multibit_mux` will be directly lowered into `array_create`
+ `array_get` at LowerToHW.
This commit containts parser/printer, folder, LowerTypes
and LowerToHW change. `multibit_mux` operations are
created only at subaccess lowering in LowerTypes.
This speeds up entire process after LowerTypes 5%~10%
for large circuits.
This commit makes aggregate preservation more conservative.
There are basically two changes: Previously bitcast was
fine to preserve aggregates but it breaks the compile if
`repl-seq-meme` is enabled. This issue is yet to be reduced but it
should not break the compile so I would like to make conservative
here. Another thing is the preservation of aggregate types with
zero-bit width(zero-bit integer or empty vector/bundle).
This is causing tedious downstream issues about zero-width struct
emissions in ExportVerilog so I would like to change not to emit
these things at all.
Some canonicalizers create new sv.if ops. As a result,
we get redundant if statement in output verilog.
This commit fixes the issue by moving HWCleanup to the later.
This refactors ExportQuartusTcl to use the hw::GlobalRefs and arrays
of hw::InnerRefAttrs directly. This greatly simplifies the
implementation, and removes the need for SwitchInstanceAttr. That
attribute will be fully removed in a follow up.
This replaces the use of msft::SwitchInstanceAttr on leaf entities
with a hw::GlobalRefOp. The global ref specifies the same path, using
an array of hw::InnerRefAttrs. It also has an attribute containing the
same placement information as the msft::SwitchInstanceAttr had.
This will simplify ExportQuartusTcl by letting it simply generate Tcl
referring to the hw::GlobalRefs. It will also make the placements
robust to changes in the instance hierarchy via the guarantees
provided by hw::GlobalRef's verifier and utilities for rebuilding
hw::GlobalRefs.
This adds the necessary support for PipelineWhileOp in the
WhileOpInterface. It also adds basic support for lowering the
PipelineTerminatorOp and PipelineStageOp. Together, this enables the
PipelineWhileOp condition, iter args, and results to be converted.
Building pipeline registers and scheduling groups to pass values
between pipeline stages will be added as follow up work.
Add a new operation `GlobalRef` to `HW` dialect, that will eventually replace
`FIRRTL::NonLocalAnchor`.
`GlobalRef` can be used to identify a unique instance path of an operation globally.
This is part of the plan to move the `firrtl.nla` to `HW` dialect.
SFC regards printf operations whose messages have specific prefixs
like "assert:", "assume:" or "cover". Most of them are converted into
builtin assert/assume/cover by FIRPaserAsserts but if the format is
"ifElseFatal", assertions are lowered into sv.error + sv.fatal. We have to
parse the error message again to regard such sv.error ops as assertions.