Commit Graph

8980 Commits

Author SHA1 Message Date
Schuyler Eldridge 8a12831dcd
[FIRRTL] Avoid "is invalid" in tests, NFC
Convert tests to use "invalidate" and not "is invalid".  The latter is
supposed to be illegal in FIRRTL >=3.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-25 16:15:30 -04:00
Schuyler Eldridge 67fda5937f
[FIRRTL] Update integration tests for FIRRTL 4
Remove FIRRTL 3 features from an integration test.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-25 15:32:14 -04:00
Schuyler Eldridge 97effa7357
[FIRRTL] Reject "reg with" if >=3.0.0
Reject parsing registers that use the "reg with" syntax if the FIRRTL
version is 3 or higher.

Towards #7731.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-25 14:29:49 -04:00
Schuyler Eldridge 8783db87e5
[FIRRTL] Remove "reg with" usage in tests, NFC
FIRRTL spec 3.0.0 dropped support for the "reg with" syntax for specifying
a register with a reset in favor of the simpler "regreset" syntax.  Update
all tests to use this new syntax.

This is preparing to start rejecting this syntax if the reported FIRRTL
version is 3.0.0+.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-25 14:17:18 -04:00
Schuyler Eldridge 38502160a3
[FIRRTL] Migrate tests to connect, invalidate, NFC
Migrate all FIRRTL tests to FIRRTL spec version 3.0+.  Many tests were
still using "a <= b" and "c is invalid" syntax which was deprecated in
FIRRTL 3.0.  This was _not_ deprecated in CIRCT's FIRRTL parser, though.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-25 01:03:45 -04:00
Schuyler Eldridge ad28fd2291
[FIRRTL] Add "effective" design to Instance Info
Expand the API of the InstanceInfo analysis to include queries for if
something is in the "effective" design.  This is equivalent to querying if
something is not under a layer.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-24 18:43:42 -04:00
Bea Healy b173a2745b
[circt-bmc] Add simple initial value support to ExternalizeRegisters (#7728) 2024-10-24 21:13:25 +01:00
Martin Erhart 56f5254e50
[HWToSMT] Proper error message for 0-bit constants (#7727) 2024-10-24 17:37:03 +01:00
Schuyler Eldridge d1250de93c
clang-format, NFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-24 00:26:35 -04:00
Schuyler Eldridge 4d03e88ab6
[FIRRTL] Add "inDesign" to InstanceInfo Analysis
Extend the existing InstanceInfo analysis to track information about if a
module is in the "design".  The design is defined is everything that is or
is under the design-under-test, but is not in a layer.  I.e., this
excludes things that are in layers.

This is added because it is not possible to compute this using the
existing information about something being under the DUT or under a layer.
A module could have mixed instantiation under the DUT and mixed
instantiation under a layer, yet not be in the design.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-24 00:17:07 -04:00
Schuyler Eldridge eff08d48ab
[FIRRTL] Cleanup emit-metadata.mlir test, NFC
Manually format the MLIR in the emit-metadata.mlir test as the current
state is difficult for me to read.  This doesn't cleanup the FileCheck
lines.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-23 15:46:23 -04:00
Robert Young 7998f449b1
[FIRRTL][LayerSink] Fix: initialize an unitialized bool member (#7724) 2024-10-23 15:21:18 -04:00
Schuyler Eldridge b60df2062b
[FIRRTL] Use InstanceInfo in CreateSiFiveMetadata (#7720)
Update the CreateSiFiveMetadata pass to use the InstanceInfo analysis to
check if modules/memories are instantiated under the effective DUT as
opposed to using custom logic to check this.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-23 10:51:11 -04:00
Will Dietz efca772639 [FIRRTL][PrefixModules][NFC] Use else-if in dyn_cast chain.
Co-authored-by: Andrew Young <youngar17@gmail.com>
2024-10-22 11:34:13 -05:00
Will Dietz c6ece8d70a [FIRRTL][AdvLayerSink][NFC] Rename 'module' for C++20. 2024-10-22 11:30:46 -05:00
Robert Young ec8ffaf4fe
Advanced LayerSink (#7548) 2024-10-22 10:18:07 -04:00
Hideto Ueno c0e31955ce
[HW][Seq] Allow typed attr to be an element of aggregate_constant and make seq.const_clock typed attr (#7718)
This fixes https://github.com/llvm/circt/issues/7716. Aggregate constant verifier rejects unknown attributes hence hw.aggregate_constant cannot be used for attributes defined by other dialects (in this case seq.const_clock) was rejected even when hw.aggregate_create allows users to create clock type arrays. This PR loosen the restriction by allowing TypedAttribute. 

This commits also adds TypedAttrInterface to seq.const_clock and support its lowering.
2024-10-22 15:53:10 +09:00
Schuyler Eldridge bcee76272e
[FIRRTL] Fix InstanceInfo top-is-DUT bug
Fix a bug where the internal `underDut` member was not correctly asserted
if the top module is the DUT.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-21 18:35:42 -04:00
Schuyler Eldridge 63a1ba17d8
[FIRRTL] Inline annotations for test, NFC
Move annotations used only for a lit test into the test as inline
annotations.  This annotaiton file is only used for that test and is never
optionally included, e.g., there are multiple RUN lines and only some of
them use the annotation file.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-21 18:35:42 -04:00
Lenny Truong 3a9ccf9583
[OM] Rework ClassOp to use return style for class fields (#7537)
This changes the OM dialect Class/ExternClass to use a return style
field name/type specifier syntax and, for non-extern class, a terminator
op in the style of hw.output.
2024-10-21 17:15:36 -04:00
Schuyler Eldridge f85865eea9
[FIRRTL] Convert CheckLayers to use InstanceInfo (#7635)
Change the `CheckLayers` pass to use the `InstanceInfo` analysis.  This
new analysis makes the error checking trivial.  However, the error
reporting is still somewhat tedious.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-10-21 12:47:10 -04:00
John Demme bc2951d75b [ESI][Runtime] Install Logging.h
Wasn't part of the Python package.
2024-10-18 19:28:05 -07:00
Ivecia 0ae52c1ddc
[docs] Fix broken image links in docs (#7710) 2024-10-18 13:29:59 -06:00
John Demme 313ac7a40e
[ESI] Promote and generalize 'channel assignments' (#7715)
Previously, cosim store its ESI channel to cosim channel name in the
`implDetails`. DMA engines to make channel communication work in real
hardware need this information as well.
2024-10-18 02:18:14 -07:00
John Demme ffc954a7f3 [ESI][Runtime] Parse AppIDs into std::any
In "free form" sections, parse out anything that looks like an AppID
into an AppID. Not used (yet) in CIRCT, but an internal DMA engine does
use it.
2024-10-18 08:31:28 +00:00
John Demme d6b191a830 [ESI][Runtime] Add service context to bundle requests
Pass the current services table when requesting bundle ports. Not (yet)
used in CIRCT but is required for an internal DMA engine. Useful for any
DMA engine but we haven't open sourced any.
2024-10-18 03:00:45 +00:00
Mike Urbach 555de19161
Bump LLVM to 92663defb1c27d809f644752d65d8ccff93a7054. (#7714) 2024-10-17 20:30:50 -06:00
John Demme 9fecf63ae7 [ESI] Support service generators producing service requests
The service request wiring code now picks up connection requests issued
by service generators previously run. This allows hierarchical services.

Too difficult to test with CIRCT tests. Will be tested in the PyCDE
tests in a subsequent PR.
2024-10-18 02:13:14 +00:00
John Demme 625299def8 [ESI][Runtime] Add `disconnect` port call to Python 2024-10-18 00:38:15 +00:00
John Demme a7963d246a [PyCDE] Add an ESI ChannelService convenience service decl
Useful for cases where one actually wants an unnamed channel.
2024-10-18 00:38:15 +00:00
John Demme ab79e91dd6 [PyCDE] Better AppID strings and dictattr conversion 2024-10-18 00:38:15 +00:00
fzi-hielscher 759b2b09dd
[CombFolds] Preserve two-state attribute in `narrowOperationWidth` (#7712)
We're already doing a best-effort preservation of discardable attributes through `narrowOperationWidth`. I cannot think of a reason why the inherent two-state attribute should not be carried over.
2024-10-17 21:54:45 +02:00
Bea Healy 117b5ecaa4
[NFC] Fix typo in Arc PrintCostModel summary 2024-10-17 14:57:04 +01:00
Lenny Truong ea952baa3e
[Verif] Add LowerFormalToHW pass (#7707)
* Rewrites `verif.formal` to `hw.module`
* Lifts `verif.symbolic_value` to be an input to the module
2024-10-15 17:04:44 -07:00
Fabian Schuiki 2085d0d91e
[Arc] Add dominance-aware pass to sink ops and merge scf.if ops (#7702)
Add the `MergeIfs` pass to the Arc dialect. This pass covers a handful
of control flow optimizations that are valuable to pick up after
`hw.module`s have been linearized and lowered into `arc.model` ops:

- It moves operations closer to their earliest user, if possible sinking
  them into blocks if all uses are nested in the same block.
- It merges adjacent `scf.if` operations with the same condition.
- It moves operations in between two `scf.if` operations ahead of the
  first if op to allow them to be merged.

The `MergeIfs` pass can operate on SSACFG regions. It assigns an integer
order to each operation and considers that order to determine up to
which point operations can be moved without moving beyond their first
use and without crossing interfering side-effecting ops. The pass is
aware of side-effects, and in particular uses the non-aliasing between
`arc.state` and `arc.memory` to track read/write side-effects at a
per-state level, which allows for fairly aggressive optimization. Other
side-effecting ops act as a hard barrier and will not be moved or moved
over.

This pass supersedes the very effective `GroupResetsAndEnables` pass
we have been using until now. The latter relies on the
`LegalizeStateUpdate` pass to run at a later point however, which will
be removed in a future PR, thus making this new pass necessary.

This is a preparatory step for a later PR that overhauls the LowerState
pass. That rewrite will make the `arc.clock_tree` and `arc.passthrough`
ops obsolete, which is why they are not present in the tests.
2024-10-15 11:38:29 -07:00
Will Dietz 5a6a5619b2
[FIRRTL][ProbesToSignals] RWProbe support (#7706)
* Define type conversion mapping rwprobe<T> -> passive(T)
* Forceable support (passive read of data result)
* RWProbeOp support (materialize target, to passive)
* Reject {force,release}{,_initial}

Add some basic tests.
2024-10-15 09:40:36 -05:00
Lenny Truong dce37cc067
Remove redundant CMakeLists.txt entry (#7696) 2024-10-14 12:33:32 -07:00
Fabian Schuiki 629abefea2
[Arc] Make arc.model have an SSACFG region (#7701)
Remove the `RegionKindInterface` from `arc.model` such that its body
region becomes an SSACFG region. The current implementation of the
LowerState pass already creates models which honor SSA dominance, and
future improvements to the Arc dialect will benefit from models
enforcing dominance.
2024-10-14 09:57:07 -07:00
Fabian Schuiki 24522338f2
[Arc] Add arc.final op (#7700)
Add the `arc.final` op to complement the existing `arc.initial`. The
body of `arc.final` is executed after the last time step, when the
simulation is shut down. This corresponds to SystemVerilog's `final`
procedure, and can also be used to report statistics about which `cover`
statements were hit, or to check if an `eventually` property has been
satisfied.

The `arc.final` op is extracted into a `*_final` function. The contract
with the user is that the `*_final` function must be called exactly once
after the last call to `*_eval`. The simulation lifetime now looks like
this:

```
design_initial()
design_eval()
design_eval()
design_eval()
...
design_eval()
design_final()
```

The `arc.sim.instantiate` op inserts a corresponding call to `*_final`
when lowering to LLVM.
2024-10-14 09:49:24 -07:00
Fabian Schuiki 947a635bda
[ArcToLLVM] Add support for index dialect (#7699)
Support the index dialect when lowering from Arc to LLVM. Also fix a
minor issue in the lowering `SimGetPortOp`.
2024-10-14 09:06:59 -07:00
Fabian Schuiki 822ac6bba4
[Arc][NFC] Tweak arc op docs and add missing test
Slightly tweak the summary and description fields of a few Arc ops and
add missing tests for `arc.state_write` and `arc.state_read` to the
basic Arc dialect test.
2024-10-13 18:24:37 -07:00
Andrew Young 3e3345ebea [FIRRTL] InferWidths: fix invalid frame reference
The frame.indent reference can be invalidated when we push to the
worklist. This change caches the indentation level locally to fix the
issue.
2024-10-13 02:37:13 -04:00
Andrew Young 9dea002d5c [FIRRTL] InferWidths: remove unused function argument 2024-10-11 20:01:51 -04:00
Andrew Young 786c5c06e1 [FIRRTL] InferWidths: Don't need to duplicate InvalidValues
We used to duplicate InvalidValues to their uses, so that each use could
be inferred separately.  This was because InvalidValues were considered
constants, and things like CSE might combine many unknown-width invalid
values, and we wanted to counteract this affect.  InvalidValues are no
longer pure, and so will not be CSE'd away this way anymore, making this
code no longer needed.
2024-10-11 20:01:51 -04:00
Andrew Young 2258a6e433 [FIRRTL] InferWidths: Don't need vars to unify types
UnifyTypes works by setting the LHS's expression to point at the RHS's.
Running declareVars on the LHS before unifying the expressions is
pointless, as these VarExprs will just end up dangling. This change
stops creating the useless VarExprs.
2024-10-11 20:01:51 -04:00
Andrew Young e90e309232 [FIRRTL] InferWidths: stop double checking for uninferred widths
The width is just checked to be uninferred, so there is no point in
checking again.
2024-10-11 20:01:51 -04:00
Andrew Young 6aebe7a5b2 [FIRRTL] InferWidths: lazily create KnownExprs
This changes InferWidths to stop eagerly creating KnownExprs for every
operation with a known width result, and instead creates them when
needed for an actual expression.
2024-10-11 20:01:51 -04:00
Andrew Young 7b75ae8bf5 [FIRRTL] InferWidths: don't store all exprs in a vector
We are currently storing all allocated expressions in a single giant
vector, which we later use to find VarExprs and DerivedExprs.  This
changes it to keep two separate dedicated vectors which only store the
type of exprs we are interested in. It would be nice if we could iterate
over all objects in a SpecificBumpPtrAllocator, but they don't expose
such an API.
2024-10-11 20:01:51 -04:00
Andrew Young 490c78a055 [FIRRTL] InferWidths: add value accessor for KnownExpr
The KnownExpr always has a known width, but it stores this width using
the Expr base class' memoized solution field.  To make things a bit
clearer, add an accessor for this value that doesn't return an
optional width.
2024-10-11 20:01:51 -04:00
Andrew Young ed2430de9b [FIRRTL] InferWidths: pack base Expr struct fields
This shrinks the size of the base Expr from 12 bytes to 8 bytes.
2024-10-11 20:01:51 -04:00