Update the `cmake/modules/CMakeLists.txt` file and friends such that the
config file also includes the `CIRCT_TOOLS_BINARY_DIR` variable, and the
generation of that file resembles that in MLIR more closely. This should
make it easier in the future to use some of LLVM's cmake utilities.
Update the `install` commands concerned with the CIRCT header files to
match the MLIR style: one for `circt` and `circt-c` in the source tree,
and one for `circt` and `circt-c` in the build tree.
This only affects out-of-tree users of CIRCT and in the worst case
provide additional header files than what they have seen so far.
This reverts commit 8e44671.
The problem which I thought this commit (partially) solved is actually solved by #2444. In light of that, this commit is technically a regression and should be reverted.
The default git describe command will simply return the most recent
tag. We want the most recent tag prefixed with "pycde", otherwise we
might try to parse the version from the wrong tag.
Add the `CIRCTConfig.cmake` and `AddCIRCT.cmake` files to the list of
installed files. This mimics the behaviour implemented in MLIR, and
allows for CIRCT to be used out of tree (e.g. as part of the Moore
compiler, among other things).
Use a reference to the namespace instead of invoking the copy constructor.
The entire module body is under a single namespace,
so it makes sense to maintain a single copy of the namespace
and pass reference to it, instead of invoking the copy constructor
for every statement block.
Fixes the performance regression in FirParser.
Fixes#2440
The `getModulePortInfo` was dropping the symbols, when constructing the
`PortInfo`.
Parse the `hw.exportPort` to get the symbols on ports.
There is no client for this change right now.
This provides a way to refer to values without pre-binding a name. Thus the implementation of the device holding a value is unspecified, simply constrained such that at emission time, a namable entity will exist with the value in it. This will be used for bind and XMRs and in verbatim name-substitutions.
This change will update the `FIRRTL::NonLocalAnchor` to use an array of
`InnerRefAttr` instead of separate arrays of modules and local names.
The leaf element can either be a `FlatSymbolRefAttr` when the nla is
applied to a module, or `InnerRefAttr` when its on an operation.
Changes in this commit:
1. Update `FIRRTL::NonLocalAnchor` op to contain a `hw::NameRefArrayAttr`.
2. FIRRTL passes need to load the `HWDialect`.
3. Update all users of the nla op to get the `InnerRefAttr` for the instance
path, and a final `InnerRefAttr` or a `FlatSymbolRefAttr`.
4. The nla op will add an `inner_sym` symbol to each of the instance ops in
the instance path.
5. Adding the symbols on each op containing a reference to the nla, will
have DontTouch implications. So, its important to ensure no spurious
symbols are added.
7. Inter-procedural constant propagation needs to handle symbols on
`InstanceOps` as a special case. It should not block constant
propagation across instance op ports.
8. During parsing, whenever the nla is constructed, it assumes a symbol name
for the operation, which is the operation name.
A dontTouch is added to the ops containing a reference to the nla.
This dontTouch will be replaced with an `inner_sym` after annotation parsing
is done.
(Verified that the verilog output on some internal test cases like e21,p550 is
exactly the same, with and without this change)
This commit adds support for buffer initialization. A list of integer values may be provided to sequential buffers, which will be made the reset values of the buffer registers when lowering to hardware.
This has been a long-standing to-do for me; the intention of this commit is to start removing lowering state from within the IR itself, and make it explicitly managed. In the long term, this intends to remove all of the "helper values" and assumptions on temporary values being placed at fixed indexes for certain operations - something which i don't see as maintainable nor extensible.
One of the first issues that is tackled through this is the managing of the "block entry control value". Previously, this was assumed to be any `control_merge` operation that existed within a basic block (an assumption which is no longer valid in some stuff i'm working on locally).
This ensures paths get spliced together as entities bubble up, and get
split as entities are pushed down into the partition. This also
ensures the design partition instance includes ref attributes. These
changes allow global refs to be maintained through the partitioning
pass, and Tcl export to work.
This commit adds `FieldNameResolver` class to legalize field names in
struct types. Field names may contain verilog reserved keywrods so it's
necessary to rename them before the emission.
With this commit, field names are renamed while their name being printed.
We rename field names in the module scope, not in global scope.
Therefore, it might be possible to emit different field names for the
same type if they are in different modules.
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.