Commit Graph

8794 Commits

Author SHA1 Message Date
Martin Erhart 57b6336667
LLVM Bump (#7609) 2024-09-19 20:36:16 +01:00
Martin Erhart 71710bbb57
[CMake] Consistently declare conversion libraries and simplify circt-opt link target list (#7610) 2024-09-19 20:35:45 +01:00
Hideto Ueno d35c7c6c56
[Arc] Fully support initialization through seq.initial (#7605)
This PR implements state initialization using `seq.initial` not limited to constants
2024-09-20 02:10:29 +09:00
Schuyler Eldridge 7db6951f02
[FIRRTL] Remove unused allUnder utility
Remove an unused utility function.  This was previously used by
GrandCentral, but this is no longer load bearing.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-16 19:45:25 -04:00
Martin Erhart 5aba666e00
[HW] Add reduction patterns to trim port list of top-level module (#7587) 2024-09-16 19:47:26 +01:00
Schuyler Eldridge 478e0db04e
[FIRRTL] Fix pre-order walk in IMCP
IMCP needs to use a post-order walk as it is deleting operations (and the
operations are not skipped after erasure).  This should fix observed
failures in nightly CI [[1]].

[1]: 46014cd277 (commitcomment-146717821)

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-16 11:10:54 -04:00
Schuyler Eldridge f9ca6b0ba8
[FIRRTL] Test whitespace cleanup, NFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-13 22:49:16 -04:00
Schuyler Eldridge 3eadefcedc
[FIRRTL] Make IMCP work with Layers
Change IMCP to recurse into layers.  This has the effect of allowing IMCP
to sink constants into layers and to properly visit instances which are
instantiated under layers.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-13 16:45:33 -04:00
Schuyler Eldridge 46014cd277
[FIRRTL] Convert IMCP to walk
Change IMCP's module update to use a walk instead of only visiting
top-level ops.  This is intended to be an entirely mechanical change and
is broken out in a separate commit because of its mechanical nature.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-13 16:44:35 -04:00
Schuyler Eldridge d61cdc9a84
[FIRRTL] Fix iteration over set
Fix incorrect iteration over a set to do operation erasure.  The order of
operations is operations is important to avoid erasing an op before all
its users are erased.  Avoid this with a SetVector.

h/t @dtzSiFive for identifying the problem/fix.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-12 21:51:14 -04:00
Schuyler Eldridge d22b9cd802
[FIRRTL] Error if InferReadWrite sees WhenOps
Change the InferReadWrite pass to fail if it ever sees a WhenOp.  If this
happens, the pass can silently do the wrong thing when trying to determine
signal drivers.  This is a conservative check (with false positives), but
will have no false negatives.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-12 18:38:07 -04:00
Schuyler Eldridge 944ec93c5f
[FIRRTL] Change InferReadWrite to use a walk
Fix the InferReadWrite pass to walk into nested regions instead of only
visiting the top-level ops immediately in an FModuleOp's body.  This has
the effect of allowing it to work on memories that are declared inside
layers.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-12 18:38:03 -04:00
Martin Erhart a50540ecdb
LLVM Bump (#7595) 2024-09-12 16:16:14 +01:00
Schuyler Eldridge 9b4512df7e
[FIRRTL] Convert LowerMemory to walk
Change LowerMemory to use a walk as opposed to iteration over operations.
This is done to make this pass work with operations which have regions and
may contain memories, i.e., to make this pass work with layers and whens.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-12 10:12:30 -04:00
Hideto Ueno 008dc9da53
[python] Fix warnigns in `walk_with_filter`, NFC (#7594)
Fix naming conventions etc.
2024-09-12 15:30:10 +09:00
Schuyler Eldridge 1df22fb0af
[FIRRTL] Avoid C++20 "module" in LowerMemory, NFC
Rename to avoid using the C++20 reserved keyword "module" in the
LowerMemory pass.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-09-11 19:53:52 -04:00
Will Dietz 6176d13040
[FIRRTL][GrandCentral] Remove legacy Augmented types. (#7592)
Remove String, Boolean, Integer, Double, Literal, Deleted.

Instead of ignoring these, they will now be errors.

This reduces supported types to: Ground, Vector, Bundle.
2024-09-10 17:06:08 -05:00
Will Dietz 0a93ede626 [FIRRTL][GrandCentral] defensively check before indexing into vector.
This would ideally be a diagnostic not a fatal error, but anything is better
than a segfault.
2024-09-10 14:37:46 -05:00
Will Dietz e9ba6ca7fa [FIRRTL][GrandCentral] Check fromAttr return, fix crash.
Don't deference optional without checking.
2024-09-10 14:37:32 -05:00
Hideto Ueno c433d61523
[python] Add `walk_with_filter` to walk subset of IR (#7591)
This adds `walk_with_filter` python method to invoke callbacks
only for subset of operations. We require GIL to call python function
so this could improve performance of the tools based on Python API.

```
Starting walk_with_filter
walk_with_filter elapsed time: 0.005462 seconds cnt=1
Starting operation.walk
operation.walk elapsed time: 1.061360 seconds cnt=2
```
2024-09-10 15:13:59 +09:00
John Demme 6638aafebc [ESI][Runtime] Add MMIO service to trace backend 2024-09-07 04:20:58 +00:00
Martin Erhart cb7e9ba46d
Bump LLVM (#7572) 2024-09-06 20:53:17 +01:00
Martin Erhart 2c2ee6e0fe
Make sure type conversion materialization callbacks return values of the correct type (#7583) 2024-09-06 09:19:02 +01:00
Will Dietz 9a91f33e17
[FIRRTL][FIRParser] Check force source more. (#7574)
* Must be passive
* Explicitly diagnose if source/dest diff cannot be cast away.

Add tests.  Second crashed attempting to construct invalid RefType
before this change (non-passive base type).

While visiting, preserve layer "color" when inserting ref.cast.

Found via fuzzing.
2024-09-05 19:08:33 -05:00
Mike Urbach 804cdbe7a3
[FIRRTL] Add back unambiguous path requirement. (#7588)
This was made a warning in https://github.com/llvm/circt/pull/7129. In
reality, the flows can fail during LowerClasses if we do allow this
through, so this adds back the previous restrictions so we ensure from
the start that we have unambiguous paths as originally intended.

Closes https://github.com/llvm/circt/issues/7128.
2024-09-05 13:25:19 -06:00
Will Dietz 75a192e2bc
[FIRRTL][FIRParser] Defer inner symbols to post-processing, fix race. (#7584)
Adding inner symbols, specifically to module ports, mutates the
attribute dictionary and that races / breaks concurrent access to
properties (e.g., port names and types) commonly inspected during
parsing other module bodies (e.g., InstanceOp's).

Avoid this by instead gathering a list of operations and their
intended target as "fixups" to be processed after the original
(possibly parallel) parsing has completed and it is safe to do so.

This could be parallellized (per-module fixups)
but is not expected to have sufficient work to justify the overhead.
2024-09-04 16:07:06 -05:00
Will Dietz 9d500f52b4
[FIRRTL][Lexer] Don't crash on trailing slash in inline anno. (#7579)
Add test.

Found via fuzzing.

Co-authored-by: Andrew Young <youngar17@gmail.com>
2024-09-04 15:53:48 -05:00
Will Dietz 0f3a590235
[FIRRTL][Folds] Fix mux fold if result type doesn't match operands. (#7585)
Fixes #7562.
2024-09-04 15:52:40 -05:00
Will Dietz 169cfac28a
[HW][HWTypes] Fix use of OptionalParseResult. (#7575)
Don't return success if there's a value, that value
may be failure.  Fixes crash.

Emit diagnostic if no value found, to ensure something is produced.

Found via fuzzing.
2024-09-04 13:29:48 -05:00
Martin Erhart 17c68796da [NFC][Seq] Use pattern match for SSA value 2024-09-04 10:55:45 +01:00
Will Dietz 38f45e1be1
[HW] Fix crash when error encountered parsing hw.array. (#7578)
Fix checking of OptionalParseResult, having value does not mean
that the parsing succeeded.

Add test.

Found via fuzzing.
2024-09-04 00:29:42 -05:00
Hailong Sun f074d91fea
[ImportVerilog] Skip defparams which have been handled by slang. (#7582) 2024-09-04 13:16:12 +08:00
cepheus b441059067
[Moore][NFC] Fix warning when building Moore components (#7566)
The corresponding code snippet has a problem for checking whether the
pointer pointing to a module op is a nullptr. This commit rewrites its
code to fix the warning.
2024-09-04 11:17:15 +08:00
cepheus c0a77be1f4
[MooreToCore] Support to lower unpackedStructType (#7565)
This is a simple way to map unpackedStructType (Moore type) to structType in hw dialect directly.
2024-09-04 11:16:16 +08:00
John Demme 7c9f8fbb71 [ESI][Runtime] Fixing Windows build and logging bug
- Fixed MSVC build warning.
- Fixed MSVC build errors.
- Respect minLevel.
2024-09-03 23:24:34 +00:00
John Demme 063f7449aa
[ESI][Runtime] Logging API (#7569)
The ESI logging API is intended to be agnostic of the application's logging framework. In other words, it can be adapted to the application's logging method with ease -- users must only extend one class. It also comes with a simple text logger.

It is also designed to enable debug logging in Release builds with (very) minimal performance overhead if the user does not set the log level to debug.

This PR introduces the API, but doesn't use it much. More plumbing will be required to actually use it. In the interest of keeping this PR small, this is left for future work.
2024-09-03 13:53:10 -07:00
John Demme b76cc0e54f
[ESI] Manifest: change the schema to be more rational (#7561)
Changes falling out of an audit conducted by Morten and myself.
2024-09-03 13:35:37 -07:00
Will Dietz bdb9b0edcf
[FIRRTL][GrandCentral] Don't crash on missing keys, getAs. (#7577)
Add missing getAs return value checking, emit diagnostics.

Found via fuzzing.
2024-09-03 15:34:46 -05:00
Will Dietz 546575da37
[FIRRTL][GrandCentral] Fix crashes on error re:tryGetAs. (#7576)
Check return values of parsing functions.

Found via fuzzing.
2024-09-03 15:34:35 -05:00
Martin Erhart c102ea8832
[MooreToCore] Separate conversion pattern for moore.output (#7573)
Don't convert the output op in the module pattern because the operands will be of the wrong type since the body has not been converted yet, so it need to apply the hw output pattern afterwards anyway. Instead of relying on that pattern we should have a separate one for moore.output to hw.output that is applied once the rest of the body was converted. The HW output pattern is unnecessary because in the IR before conversion, no hw.output operation should be present (at least none that has a moore typed operand), thus its presence is only the consequence of a bad conversion process (if a target operation is inserted of which the operands are still of the source type, conversion casts should be inserted).
2024-09-03 18:12:29 +01:00
Will Dietz 7ba7fc3051
[SV] Fix regop canonicalizer crashing. (#7564) 2024-09-03 11:30:03 -05:00
Hideto Ueno ac008b1c17
[FIRRTLUtils] Fix walkDrivers subfield id calculation (#7536)
This fixes an overflow in walkDrivers when field ID is zero.

Fix https://github.com/chipsalliance/chisel/issues/4354 and https://github.com/llvm/circt/issues/7423.
2024-09-04 00:50:16 +09:00
Morten Borup Petersen 1c5dfa4a27
[ESI] Don't assume `using namespace std` in Manifest.cpp (#7571)
* [ESI] Don't assume `using namespace std` in Manifest.cpp

* format

---------

Co-authored-by: Morten Borup Petersen <mpetersen@microsoft.com>
2024-09-03 13:07:07 +02:00
John Demme ec8e3642bc [ESI][Runtime] Fix integration test
Wrong module name in test. Not caught since none of the CI gates test
the runtime. We need to fix this.
2024-09-03 04:07:25 +00:00
John Demme 1df1ef4802
[ESI][Runtime] Address MMIO regions symbolically (#7568)
Access MMIO address regions by the AppID of the requestor. Also provide
access to the MMIO space descriptors.
2024-09-02 16:40:16 -07:00
Martin Erhart d88c535754 [NFC][Seq] Fully qualify Value 2024-09-02 10:39:32 +01:00
Mike Urbach c2c047359b
Bump LLVM to 10407be542aeb2b59477b167bbba3716538dc722. (#7550)
---------

Co-authored-by: Martin Erhart <maerhart@outlook.com>
2024-09-01 09:15:42 +01:00
John Demme ce6901d54f
[ESI][Runtime] Pretty printing of service ports (#7567)
esiquery now displays the function signatures instead of the consistuent
channels. More representative of the API which is exposed.
2024-08-31 14:12:55 -07:00
Will Dietz ce8c14f9aa [Verif][VerifyClockedAssertLike] Don't crash on blockarg operand. 2024-08-31 03:17:34 -05:00
Will Dietz 929ffc4001 [FIRRTL][CreateSiFiveMetadata] Diagnostic not assertion failure. 2024-08-31 03:07:36 -05:00