Commit Graph

3379 Commits

Author SHA1 Message Date
Fabian Schuiki 416560123e [CMake] Align CIRCTConfig.cmake more closely with MLIR
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.
2022-01-13 11:19:03 +01:00
Fabian Schuiki 209c85d305 [CMake] Update header install commands to match MLIRs
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.
2022-01-13 11:19:03 +01:00
Morten Borup Petersen 6515ddcb70
Revert "[Handshake] Allow simple merges in canonical form (#2430)" (#2455)
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.
2022-01-13 11:16:53 +01:00
Luís Marques db68c0fbea
[NFC] Fix typo in Charter.md 2022-01-13 10:15:00 +00:00
Mike Urbach ef3d36261e [PyCDE] Update "pycde" tag prefix for setuptools_scm.
The quotes around the match pattern are not needed in the TOML file.
2022-01-12 16:50:02 -07:00
Mike Urbach 2a989e89dd [PyCDE] Search for "pycde" tag prefix with setuptools_scm.
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.
2022-01-12 16:09:06 -07:00
Prithayan Barua bcd07843df
[FIRRTL] Add utilities for updating NLA. NFC. (#2447)
Add helper utilities for updating the `FIRRTL::NonLocalAnchor` op.
2022-01-12 11:23:11 -08:00
Fabian Schuiki 486ec2223d
[CMake] Install CIRCTConfig and AddCIRCT cmake files
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).
2022-01-12 19:02:19 +01:00
Prithayan Barua 3e8f636605
[FIRRTL] Use reference to namepsace, instead of copying it in Parser (#2446)
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
2022-01-12 08:04:40 -08:00
Prithayan Barua 564fdd2296
[HW] Fix PortInfo construction to get the symbols. NFC (#2399)
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.
2022-01-12 07:46:58 -08:00
Andrew Lenharth 67a8d24ce8
hw.probe for late binding to nameless values (#2443)
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.
2022-01-12 08:46:27 -06:00
John Demme 8cc1a1a514 [MSFT] Add input, output verification to instance op
Design partitioning pass was making unverified assumptions about
instances matching their modules. Adds a function to check.
2022-01-12 05:03:36 +00:00
Prithayan Barua 0b6b9f3afd
[FIRRTL] Update NonLocalAnchor to use InnerRef (#2317)
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)
2022-01-11 19:58:19 -08:00
Morten Borup Petersen 185b9c6d85
[Handshake] Support buffer initialization (#2436)
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.
2022-01-11 19:58:41 +01:00
Andrew Lenharth 06aff6997f [NFC] firrtl.probe asm format change 2022-01-11 11:03:02 -06:00
Morten Borup Petersen 55a4b30bae [StandardToHandshake] Refactor partial lowering driving from FOL 2022-01-11 10:52:15 +01:00
Morten Borup Petersen 38cab756ab [StandardToHandshake] Initial commit for stateful std-to-hs lowering
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).
2022-01-11 10:52:15 +01:00
Hideto Ueno f40cf9418a [LowerTypes][firtool] NFC: Remove word 'experimental' for aggregate preservation mode 2022-01-11 17:44:24 +09:00
John Demme 59f00457e4 [PyCDE] Fixing tests broken by wirecleanup pass 2022-01-11 03:02:14 +00:00
John Demme 24429a512e [MSFT] [Partitioning] Small fixes / cleanups 2022-01-11 02:51:45 +00:00
mikeurbach bd229f8dec
[MSFT] Legalize global refs during partition pass. (#2429)
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.
2022-01-10 19:33:16 -07:00
John Demme 111e0662a3
[MSFT] [Design Partitioning] Bubble up wire manipulation ops also (#2426)
Towards #2365: Automatically tag "wire manipulation" ops for movement into the design partition.
2022-01-10 13:27:00 -08:00
Hideto Ueno 5426bf1556
[ExportVerilog] Legalize field names of struct types (#2359)
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.
2022-01-10 20:53:30 +09:00
Hideto Ueno 6be754b850
[ExportVerilog] Make `hoistNonSideEffectExpr` hoist inout chains (#2405)
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.
2022-01-10 06:50:54 +09:00
Morten Borup Petersen 31d5b4864b [HandshakeToFIRRTL] Support none-typed muxes 2022-01-08 18:48:25 +01:00
John Demme 1c13db6c9c [MSFT] Cleanup partitioning pass code
- More names for better debug.
- Clean some code.
2022-01-08 03:28:08 +00:00
Andrew Young 319535af03
[Reducer][FIRRTL] Fix memory stubber for memories with bundles (#2383)
This adds some additional casting and proper connections to the memory
puts in the face of bundle types.
2022-01-07 19:30:24 -05:00
Schuyler Eldridge bbc9cbebc1
[LowerToHW] Support ForceNameAnnotation instances (#2432)
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>
2022-01-07 19:27:49 -05:00
Andrew Young 27066d7e9c
[FIRRTL] Clean up and fix assertion parser test case
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.
2022-01-07 14:40:43 -05:00
Andrew Young 5723b66622
[FIRRTL] Add a subaccess cache to the fir parser (#2364)
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.
2022-01-07 14:08:36 -05:00
Schuyler Eldridge 5096dc6d10
[FIRRTL] Add ParamDeclAttr, use for FExtModule (#2411)
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>
2022-01-07 13:30:38 -05:00
Morten Borup Petersen 8e4467132c
[Handshake] Allow simple merges in canonical form (#2430)
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.
2022-01-07 18:59:22 +01:00
Morten Borup Petersen 7406aadb1b
[Handshake] Canonicalize away sunk buffers (#2431) 2022-01-07 17:14:06 +01:00
Prithayan Barua cab3bf93c0
[FIRRTL] Replace DontTouch annotation with symbols (#2407)
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.
2022-01-07 07:53:03 -08:00
John Demme 1594727822
[MSFT] Fix naming issue in `MSFTModuleOp::removePorts` (#2427)
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.
2022-01-06 15:52:00 -08:00
Morten Borup Petersen 5d1a33ef81
[Handshake] Add new `select` operation (#2423)
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.
2022-01-06 18:27:23 +01:00
Andrew Lenharth c190f6f94d
[FIRRTL] Value probe operation (#2425)
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.
2022-01-06 10:17:14 -06:00
Morten Borup Petersen 898118be38
[StandardToHandshake] Optionally connect constants to Source ops (#2422)
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.
2022-01-06 17:00:29 +01:00
mikeurbach c9c50d2889
[MSFT] Add optional sub-path to PhysLocationAttr. (#2421)
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.
2022-01-05 18:39:54 -07:00
Morten Borup Petersen 811fa5fd28
[Handshake] Always add buffers to unbuffered channels in bufferAllStrategy (#2418)
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.
2022-01-05 13:46:28 +01:00
Morten Borup Petersen dfbafcb6ba [Handshake][NFC] Rename HandshakeDataflow to StandardToHandshake 2022-01-05 09:03:56 +01:00
Morten Borup Petersen 01469f03f6 [Handshake][NFC] Rename HandshakeDataflow to StandardToHandshake 2022-01-05 09:02:01 +01:00
Morten Borup Petersen 3044c4efdd
[HandshakeToFIRRTL] Check single-use precondition before lowering (#2417)
Partially reverts 1d55044, and now only checks the precondition instead of running the fork/sink materialization pass.
2022-01-05 08:18:36 +01:00
John Demme 91e7297d5e [FIRRTL] Fix Questa lint integration test 2022-01-04 17:38:40 -08:00
John Demme bd3a6499f7
[MSFT] Wire cleanup pass (#2410)
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.
2022-01-04 15:12:43 -08:00
Morten Borup Petersen 4fc4a870fd [Handshake] Fix roundtripping of source op 2022-01-04 11:31:50 +01:00
John Demme 922282ca83
[MSFT] [NFC] Refactor design partition pass to share code (#2416)
Enable code sharing with the future wire cleanup pass. Move utility methods into new super class. Create a "framework" method for updating instances.
2022-01-03 16:18:40 -08:00
John Demme 117262aa68
[MSFT] Use MSFTModuleOp for design partitions (#2415)
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.
2022-01-03 16:14:30 -08:00
Morten Borup Petersen 675b7da6f6
[HandshakeToFIRRTL] Ensure materialized IR before conversion (#2412) 2022-01-02 18:42:12 +01:00
Hideto Ueno d80618a17e
[SV] Allow verbatim to have non-integer type (#2408)
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.
2022-01-02 12:40:16 +09:00