Commit Graph

6631 Commits

Author SHA1 Message Date
fzi-hielscher 911988f8e1
[Sim] Flatten format string concatenations in canonicalizer (#7316)
Provide an interface to get the flat format string for sim.fmt.concat operations and opportunistically flatten during canonicalization.
2024-07-16 22:35:33 +02:00
Bea Healy a9ac3ae4b0
[circt-bmc] Add ExternalizeRegisters Pass (#7285)
Adds a pass to externalize register states as module inputs and outputs


Co-authored-by: Martin Erhart <maerhart@outlook.com>
2024-07-16 19:34:12 +01:00
Schuyler Eldridge d940c9d674
[FIRRTL] Minor cleanup in dedup, NFC
Fix two tidy warnings inside the dedup pass.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-07-15 18:53:01 -04:00
Schuyler Eldridge a1889207b1
[FIRRTL] Report all "must dedup" errors
Change FIRRTL's deduplication pass to report all errors arising from
modules marked "must deduplicate" that do not expectedly deduplicate.
This provides a better user experience because they do not have to iterate
on long compiles only to get "one more error".

Fixes #7324.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-07-15 18:48:48 -04:00
Will Dietz 18a784a807 [FIRRTL][FIRParser][NFC] Fix warning w/o asserts, touchup. 2024-07-15 10:28:27 -05:00
Hailong Sun 4673afe1f5
[MooreToCore] Lower var, read, and assign into LLHD. (#7297) 2024-07-15 11:53:47 +08:00
Fabian Schuiki dfd4483d01
[Moore] Handle top-level typedefs by ignoring them
Typedefs are handled by Slang during type checking and don't need to be
lowered into anything in the IR. Therefore ignore top-level typedefs.
2024-07-14 11:47:03 -07:00
Amelia Dobis 2f8ba28db8
[SV] Add Intermediary Assert Op for better enable polarity flip (#7302)
This PR introduces a new assert property op to the sv dialect and uses that as an intermediary for property assertion emission. This should solve the issue of the polarity being different in SV and in verif for the enable signals ( enable in verif, disable in sv ).
2024-07-12 10:34:04 -07:00
Jack Koenig 8bc5e93cdf
Revert "[FIRRTL] Enable Wire Elimination (#7073)" (#7311)
This reverts commit f5a0969fbe.
2024-07-12 08:51:52 -07:00
John Demme 462f6b5934
[ESI] Remove last references to capnp (#7315)
The cosim document was 90% out of date. Added a note regarding
documentation status.
2024-07-12 06:36:10 -07:00
John Demme b68c01def2
[ESI][PyCDE] ChannelSignal: add `buffer` method (#7310)
Adds a channel buffer to an ESI channel. Since the channel buffer lowers
to a SystemVerilog primitive, we need to copy the ESI primitives file
into the output dir.
2024-07-12 05:07:13 -07:00
John Demme 34263bd91f
[ESI] MMIO read service implementation in PyCDE (#7306)
Implements a channel-based MMIO read service generator. Changes the offset type on the MMIO std service to `ui32` from `i32`.
2024-07-12 05:01:41 -07:00
Robert Young cdfcd96664
Allow firrtl hardware ops under sv.ifdef (#7309) 2024-07-11 20:54:25 -04:00
Bea Healy 961bad58f4
[Verif] Add `verif.bmc` operation (#7263)
Add an op to represent bounded model checking problems
2024-07-11 18:33:36 +01:00
John Demme 464f177ddc [ESI] Adjustments and fixes to cosim
Only affects Questa simulation.
- Fix the build rpath so one can run Questa on the build directory.
- Remove the CXX path as it doesn't seem to be necessary any longer.
- Switch the timescale to something more reasonable.
2024-07-11 11:29:14 +00:00
John Demme 04128c51c5 [ESI] Revert ESI manifest version to 0
Version 0 means that everything is subject to change. More appropriate
for alpha builds.
2024-07-11 09:52:33 +00:00
Will Dietz 1dfdadaf28 [HW][CAPI][NFC] Fix cast warning.
Casting from interface to operation generates these warnings,
as with other instances resolve by casting from Operation* instead.

> llvm/llvm/include/llvm/Support/Casting.h:490:69: warning: returning reference to local temporary object [-Wreturn-stack-address]
2024-07-10 15:58:03 -05:00
Robert Young 68fdd8b418
Move ResetType under the sv namespace (#7300) 2024-07-10 13:39:26 -04:00
John Demme dcc7dd8db4 [ESI runtime] Fix Python wheel build
- Older versions of Linux (like the ones we use for Python wheel builds)
need more includes.
- Install backend shared libraries
- Exclude MtiPli from repair
2024-07-10 14:58:33 +00:00
John Demme 98e8265a7c
[PyCDE][ESI] Manifest: add record about client (#7299)
Call to add a record to the manifest about a particular client. Required
plumbing through the record op to python.
2024-07-10 06:59:43 -07:00
Hideto Ueno 63ab38ca9d
[ETC] Support clocked verif ops (#7296)
This fixes a bug that clocked verif ops remain in designs.
2024-07-10 19:14:10 +09:00
Hailong Sun a75fd479c5
[ImportVerilog] Fix the segmentation fault caused by the case statement. (#7295)
Because the return of 'convertRvalueExpression()' can return '{}'. For example, when we handle the 'x'/'z' value, it will emit an error and return '{}', so we must estimate whether the return of 'convertRvalueExpression()' is '{}'. Otherwise, it will cause a segmentation fault.
2024-07-10 13:51:59 +08:00
Hailong Sun e2b4cb9c72
[ImportVerilog] Distinguish the index up or down on the range selection. (#7280) 2024-07-10 13:21:04 +08:00
Will Dietz 2671b3636b [ExportVerilog][NFC] Fix typo: up -> op. 2024-07-09 18:39:19 -05:00
elhewaty ff02e7ac1c
[ARC] Keep just one parameter if it's given multiple times (#7284) 2024-07-10 00:15:29 +03:00
fzi-hielscher 0899943a5b
[Sim] Add format string type and format specifier ops (#7208)
Adds just the operations. Appropriate lowerings are to be added in future commits.
2024-07-09 17:31:37 +02:00
Hideto Ueno 824477b416 [Seq] Revert FIFO printers change, NFC
It seems local clang-format formats slightly differently.
2024-07-09 08:26:46 -07:00
Hideto Ueno 31c37c47df [Seq] Format FIFO printers, NFC 2024-07-09 08:22:55 -07:00
Hideto Ueno 3f09e3df07
[Seq] Remove incorrect canonicalization and reject registers with presets(#7289)
This PR removes a canonicalization that incorrectly replaces self-connect registers with their non-constant reset values.
This PR also adds additional conditions for presets. We have to revisit to handle preset values. 

Fix #7266.
2024-07-09 23:46:06 +09:00
John Demme 2e17355d3e
[ESI] Add verify connections pass (#7287)
New pass to verify that channels and bundles are used the appropriate number of times. The wrap/unwrap, pack/unpack operations already have these checks, but when a channel/bundle is produced by a module (or some other op), it is not checked. A pass is the best way I could figure out how to implement the check.

Closes #7286.
2024-07-09 04:02:08 -07:00
John Demme 585dc1aecc [ESI] Manifest: move version num back, fix bug
Revert version number to 0 to indicate that the JSON schema is not
stable. Also, fix a bug in ROM creation. Bug fix will be tested in a
forthcoming PR.
2024-07-09 09:18:22 +00:00
cepheus acb558822f
[Moore] SymbolVisibility attribute support for SVModuleOp (#7278)
We can append the appropriate symbol visibility to svmoduleOp according
to the structures of instanceSymbol provided by the slang front-end. slang
provides a function to get the root of the design. Calling this method
could get all top-level instanceSymbols and help determine which ones
should be tagged. Note that the visibility attribute now used does not
contain the `nested`.
2024-07-09 12:03:18 +08:00
Hideto Ueno 917cde67bb
[FIRRTL][ModuleInliner] Add a prefix to memory instances (#7279)
This PR basically reverts 4cf7bc9a30 to add a prefix to MemOp instances. Previously we changed to remove prefix since it broke prefixes created in PrefixModules. However https://github.com/llvm/circt/pull/4952 added `prefix` attribute to MemOp so we don't need the workaround anymore. This makes output verilog a lot more LEC friendly. I checked the PR doesn't break prefixes added by PrefixModules on internal designs.
2024-07-09 07:33:35 +09:00
John Demme 292375de63 [ESI] Cleaning up some cosim Verilog
Most things don't care about format strings, but this occasionally
crashes Verilator.
2024-07-08 18:23:41 +00:00
Jiahong Bi 499d1e9fb0
[FSM]New builders for StateOp and TransitionOp. (#6991)
* [FSM]New Builders for StateOp and TransitionOp

1. Create an OutputOp inside a StateOp with the output values instead of an empty OutputOp, which needs to be erased after all.

2. Accept two functions as arguments to create the TransitionOp, which is similar to the creation of sv::IfOp. This would be helpful because one doesn't have to create the blocks and set the insertion point manually, which may cause errors sometime.
2024-07-08 09:29:16 +02:00
John Demme 792f1fe54c [ESI] Fix use-after-erase bug in connect services lowering
For some reason, this only showed up in the Windows CI.
2024-07-05 11:30:44 +00:00
Hideto Ueno 1f7fc267ce
[FIRRTL][HW] Change default implementation of CombDataFlow and add it to DPI intrinsic #7267
This PR removes default implementation of CombDataFlow which indicate an op was sequential. Also implement it for DPI intrinsic.

Close https://github.com/llvm/circt/issues/7229
2024-07-05 19:05:54 +09:00
John Demme 058654ccaf
[ESI] Make MMIO data 64-bit (#7283)
Since MMIO will be used to transmit things like pointers, we should
probably make it 64-bit data. This seemingly simple change had a bunch
of ripple effects.
2024-07-05 02:25:20 -07:00
John Demme 4a452e010c
[ESI] Add read-side MMIO back (#7282)
Use ESI channels/bundles to implement MMIO reads. Replaces the low-level
AXI interface. Keep the XRT AXI-based interface as-is for now.
2024-07-05 02:22:59 -07:00
Hailong Sun aa03227034
[Moore] Add AssignedVarOp and canonicalization for VariableOp. (#7251)
The canonicalization for VariableOp is aimed at merging the "easy use" of the variable and its value(continuous assignment) into a new op called assigned_variable. Don't handle blocking_assign and nonBlocking_assign due to the dominance.
The "easy use" is assigning a value to a variable with the whole bit-width, in other words, exclude the bits slice, concatenation operator, etc.
2024-07-04 15:38:33 +08:00
Andrew Lenharth 7490529af9
[FIRRTL] Fix use-after-free in InferReset (#7273)
As @youngar explains well, a node was being deleted when it had references.  Just route the node through the bounce wire instead of trying to replace it.

Closes #7225
2024-07-03 17:27:42 -05:00
John Demme be4484854b [PyCDE] Fixing ESI-based integration tests 2024-07-03 12:59:13 +00:00
John Demme aaaebcd46e [NFC][ESI Runtime] Eliminate `using namespace std`
Get rid of having std namespace implicitly and fix all the code relying
on it.
2024-07-03 11:48:05 +00:00
John Demme e0dbc6458f
[ESI Runtime] Load backends as plugins (#7260)
If a backend isn't found in the registry, try to load it dynamically
from some standard places. Note that if one doesn't want to keep the
plugin shared lib in one of those places, one can LD_PRELOAD it.

Linux support only. Windows to come.
2024-07-03 02:44:23 -07:00
Hideto Ueno 0bcfbdc599
[FIRRTL] Add input and output names to DPI intrinsic (#7265)
Fix https://github.com/llvm/circt/issues/7226. This adds support for specifying input and output names. This uses `;` separated string list following the same design as `guard` parameter of assert intrinsic.
2024-07-03 14:16:51 +09:00
elhewaty dbb07f3aff
[Arc] Add VectorizeOp canonicalization (#7146) 2024-07-02 16:29:04 -07:00
Mike Urbach f6ee408e22
[FIRRTL] Ensure hierpath considers owning module in LowerClasses. (#7272)
We already had logic to detect if the owning module was in the middle
of a hierarchical path, and build up the prefix just to the owning
module in this case. However, we still used the entire original
hierarchical path in the new path, which caused the prefix to the
owning module to be duplicated. This is fixed by not only setting the
moduleName to the owning module, but also trimming the prefix to the
owning module in the original path.
2024-07-02 15:40:44 -06:00
mingzheTerapines 281dc6cfa3
[MooreToCore] Fix parse error for parameter (#7253) 2024-07-02 09:23:04 +08:00
Will Dietz 461f8933f8
[FIRRTL][ResolvePaths] Fix detection of agg target if alias. (#7257) 2024-07-01 15:37:05 -05:00
Andrew Lenharth 643571890f [FIRRTL] Error when seeing inner symbols on zero-width wires and nodes in LowerToHW
Closes #5590 and #7252
2024-07-01 10:40:44 -05:00
John Demme eef4a6a2c1
[ESI Runtime] Avoid using CIRCT_* cmake variables (#7256)
Fixes #7254
2024-07-01 07:11:44 -07:00
John Demme dfeb6d7bfb
[ESI Runtime] Incorporate RPC server into ESICppRuntime (#7241)
Since the gRPC server is now going to be used in multiple places AND the RPC server now uses ports 'n' stuff from ESICppRuntime, it is appropriate to move RpcServer into ESICppRuntime proper. This also significantly simplifies the build.

No new code, just movement and CMake changes.
2024-07-01 07:01:08 -07:00
Hailong Sun d360917dae
[Moore] Add SimplifyAssigns pass to handle concat_ref. (#7216)
Co-authored-by: Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
Co-authored-by: Hideto Ueno <hideto.ueno@sifive.com>
2024-07-01 17:30:25 +08:00
Bea Healy d8b0baade5
[NFC][SV] Remove unnecessary SV dependency on Verif (#7249) 2024-06-28 14:48:44 +01:00
Bea Healy 609180aec3
Remove unnecessary Seq dependency on SV (#7247) 2024-06-28 14:47:27 +01:00
Will Dietz e5b8982065 [FIRRTL][Intrinsics][NFC] Simplify bool expr, clang-tidy. 2024-06-28 07:43:12 -05:00
Will Dietz 750543553b [FIRRTL][Intrinsics] Move default for hasNInputs to declaration.
Keep compatibility with previous signature,
and mach with hasNParam.
2024-06-28 07:42:56 -05:00
Anqi Yu ce121a0a15
[ImportVerilog] Support Generate constructs (#7243) 2024-06-28 10:10:51 +08:00
Girish Pai bf7c4e722e
Bump LLVM (#7223) 2024-06-26 13:19:37 -07:00
John Demme 20e08c092c
[ESI Runtime] Rename cmake targets, create full build one (#7238)
- Rename C++ library to ESICppRuntime.
- Create new ESIRuntime target which builds everything.
- Modify gRPC install to not include libz. (Avoids cmake warnings.)
2024-06-26 10:36:26 -07:00
Will Dietz 3f0dcf4405
[FIRRTL] Allow layers under when and match. (#7234)
Behavior is same as-if the contained operations were
not under a layer.
2024-06-26 08:35:10 -05:00
Morten Borup Petersen 03626d4a93
[ESI] Fix possible nullptr exception in RpcServer
`impl` isn't being default-initialized on the `RpcServer`, but instead constructed in `RpcServer::run`. Hence, if `RpcServer` is destructed before `run` is called, a nullptr exception may occur.
2024-06-26 14:19:26 +02:00
John Demme cc51aa5dd0 [ESI Runtime] Fix python build 2024-06-24 21:01:46 +00:00
John Demme 34c73c35c8
[ESI Runtime] Read ports now invoke callbacks (#7186)
We've switched from a polling 'pull' method to a callback-based 'push'
mechanism for read ports. Polling (via std::futures) is built on top of
the push mechanism.

The read-ordering problem has also been fixed by using std::futures
exclusively for polling schemes. They also allow for poll-wait-notify
schemes without any changes on our part.
2024-06-24 11:38:18 -07:00
John Demme 90954e2ae8 [NFC][ESI Runtime] Ridding cosim backend of std namespace
Deleted `using namespace std` and fixing the resulting errors.
2024-06-21 23:00:09 +00:00
John Demme dac5c69c25 [Python] Pybind11 version, setup.py documentation
Pybind11 2.10 has a bug related to binding enums. Somehow exposed by a
totally unrelated commit 62cb3d109e.
Upgrading past 2.10 fixed it.

Also fixing some setup.py comments.
2024-06-21 22:56:50 +00:00
John Demme 88eeb265f4
[ESI Runtime] Replace Cap'nProto with gRPC (#7217)
After spending a truly obnoxious amount of time fighting capnp and
libkj, we made the decision to switch to another RPC system. We're no
longer modeling and serializing message types in Capnp and we don't need
the performance which capnp/libkj RPC promises, so there's really no
need for the additional complexity. A slower system which is thread safe
should work fine.

This commit breaks the build in a pretty horrible way and is not
intended to be merged on its own. It simply breaks up the diff.
2024-06-21 14:22:54 -07:00
Andrew Lenharth ac858d88a1 [NFC] Double anon namespace fix 2024-06-21 13:06:53 -05:00
Will Dietz d342694c7e [FIRRTL] LowerClasses: Fix ignored LogicalResult. 2024-06-21 08:55:40 -05:00
Mike Urbach 76d376d40d [OM] Use Object Location in partially evaluated ObjectValue.
When we create partially evaluated ObjectValues, we should use the
Object's Location, rather than the location of the field being
evaluated.
2024-06-20 21:12:20 -07:00
Mike Urbach ff6ebe25cc [OM] Expose ObjectValue Location in the Python bindings.
This exposes the ObjectValue Location in the Python bindings using the
C API for MlirLocation. The Location is useful for debugging the
source that created the Object in the first place.
2024-06-20 21:12:20 -07:00
Hideto Ueno f4920aa24b
[LowerClass] Run path tracking sequentially (#7221)
This fixes a race condition was introduced by [0] for now by removing parallesim
[0] d00a1d2bdf
2024-06-21 12:49:29 +09:00
Will Dietz e89910aac8 [LTL][NFC] Remove unused static method. 2024-06-20 13:50:12 -05:00
Amelia Dobis ef30e1f20a
[FIRRTL][Verif][LTL] Replace `ltl.disable` with an enable folded into `verif.assert` (#7150)
This PR gets rid of the `ltl.disable` op and intrinsic in favor of having an enable operand on the verif assert like ops. This made it trivial to fix an incorrect when condition folding for `AssertProperty`. Most of the PR relates to fixing the chaos that was caused by removing `ltl.disable`.
2024-06-20 11:24:37 -07:00
Hideto Ueno 62cb3d109e
[HW] Clean up HWTypes (#7209)
* Port some of customAssemblyFormat to declarative assembly-format. HW uses unconventional printer so we still need to use a custom directive though. 
* Replace manual `get` declarations with TypeBuilderWithInferredContext in several places
* Make banner consistent with others
2024-06-21 02:28:16 +09:00
Andrew Young c3538f2344 [FIRRTL] SpecializeLayers: fix race condition
This pass processes all modules and layers in parallel, and since this
could result in the operation being deleted, could lead to crash when
two side-by-side ops are removed at the same time and try to modify each
other's next and previous pointers.  This changes the pass to handle the
part of the specialization which can delete the operation in serial.
2024-06-20 09:35:57 -07:00
Andrew Lenharth 2f382b2c5a
[FIRRTL] LHSType wrapper to indicate writable values. (#7117)
This is to enable a split between writable identifiers and readable identifiers.  This removed flow from the dialect eventually.
2024-06-20 10:21:00 -05:00
Hailong Sun c7f4557b4c
[Moore] Fix the stacking fault caused by cast<Variable> and remove unused headers. (#7219) 2024-06-20 15:56:11 +08:00
cepheus 560257cd4c
[Moore] Support unconnected behavior (#7202) 2024-06-20 11:12:31 +08:00
John Demme 1f6c29fb64
[ESI][PyCDE] Callback service (#7153)
Call software functions from hardware.
2024-06-18 22:14:35 -07:00
Andrew Young 0e13467021 [FIRRTL] AnnotationSet: clang-tidy clean 2024-06-18 18:39:27 -07:00
Andrew Young 961d7467e7 [FIRRTL] AnnotationSet: remove unused functionality 2024-06-18 18:39:27 -07:00
Andrew Young 76ef34a530 [FIRRTL] AnnotationSet: add static variadic hasAnnotation
This annotation helper is more convenient to use due to being variadic,
and slightly more efficient as it will not create an empty array
attribute if the target has no annotations.
2024-06-18 18:39:27 -07:00
Andrew Young e2e8e6536b [FIRRTL] AnnotationSet: array attr is never null
We have a fast path when removing annotations that checks if the
underylying array attr is null, which should be impossible.  Remove this
code path and add some asserts.
2024-06-18 18:39:27 -07:00
Will Dietz 6f2aadcb02
[FIRRTL] Fast-path removeAnnotations for operations having none. (#7203)
Common pattern of walk/visit many operations looking for annotations
and removing along the way is taking considerable amount of time
in ArrayAttr::get.  It may make sense to rework AnnotationSet to
not promise a non-null ArrayAttr but for now add a fast-path
where it matters -- in removeAnnotations(Operation *op, predicate).
2024-06-18 14:52:16 -05:00
Prithayan Barua 6cbca83fe5
[HW] Move the CombDataFlow op interface from FIRRTL to HW (#7195)
Move the `CombDataFlow` op interface from `FIRRTL` to `HW` dialect.
The op interface is better suited to reside in the `HW` dialect, along with
 other interfaces like the `HWModuleLike`.
This makes it more convenient for non-`FIRRTL` dialects to implement ops using
 this interface, without introducing a new dependence on the `FIRRTL` dialect,
 assuming  `HW` dependence already exists.
2024-06-18 10:55:05 -07:00
Andrew Young 6201aae645 [firtool] Move SpecializeLayers before LowerLayers
We can't specialize away layers after they are lowered, so this pass was
placed in the wrong spot in the pipeline. It was a last minute change to
move specialize layers after checking for combinational loops which
caused this bug, as we need to make sure that all diagnostic passes run
before we start deleting logic, otherwise we can hide errors from the
user.  This adds a few tests that layer specialization is working as
intended, and that it doesn't prevent detection of errors.
2024-06-18 08:45:22 -07:00
Andrew Young baec1a1db1
[FIRRTL][SpecializeLayers] Fix incorrect CF leading to double free (#7200)
As a part of specializing layers we have to remove any HierPathOps which
included a reference to deleted instances.  If any member of the path
array is contained in the deleted references list, we need to delete the
op.  There was incorrect use of `continue` which caused us to continue
processing the path instead of skipping to the next path operation,
which could lead to a double free when multiple instances in the path
were removed.
2024-06-18 08:42:26 -07:00
fzi-hielscher d340ca137c
[NFCI][OM][SSP][SystemC] Refactor TableGen Pass includes (#7184) 2024-06-18 14:52:24 +02:00
fzi-hielscher 15ae39ec07
[NFCI][DC][FSM][Handshake][Pipeline] Refactor TableGen Pass includes (#7181) 2024-06-18 13:26:12 +02:00
Hideto Ueno 97da411151
[ExportVerilog] Fix two state type emission of aggregate types (#7189)
This PR fixes an issue that `emitAsTwoStateType` flag was not propagated for aggregate types.

This PR also fixes a bug that ctypes (int/shortint etc) are used as an inner type of packed types (e.g. `int [2:0]` is invalid) according to SV spec 6.8.
2024-06-18 01:14:50 +09:00
Hideto Ueno d1545f4f5a [LowerDPI] Fix the incorrect input type checking
LowerDPI checks that improted DPI functions have the same function
signatures over their call sites. This fixes a bug that mistakenly
regards operand types of call op as input types. Call op has clock and
enable operands so operand types are not equal to input types of
DPI functions.
2024-06-17 08:44:51 -07:00
fzi-hielscher 9afdd4d069
[NFCI][FIRRTL] Refactor TableGen Pass includes (#7178) 2024-06-17 16:18:07 +02:00
Hideto Ueno 3e67926aa3
[SimToSV] Fix DPICall lowering to use `replaceOp` (#7192)
Previously DPICallLowering called `rewriter.replaceAllUsesWith` for individual
results but it seems that is not equivalent to `replaceOp`. 

This also adds missing dialect dependency to seq

Close #7191
2024-06-17 19:44:20 +09:00
Hideto Ueno 18d2872d70
[FIRRTL][ExpandWhens] Add StmtExprVisitor to Visitor and Support DPI intrinsic in ExpandWhens (#7177)
This adds `StmtExprVisitor` struct for visitor to handle operations with an optional result. Currently `GenericIntrinsicOp `and `DPICallIntrinsicOp` are added.

Besides that `ExpandWhens` is modified to handle DPI intrinsic.
2024-06-17 06:21:11 +09:00
fzi-hielscher 28c29619c8
[NFCI][LLHD][Moore][SV][Verif] Refactor TableGen Pass includes (#7183) 2024-06-16 18:36:00 +02:00
fzi-hielscher f5378eb8d9
[NFCI][ESI][Ibis][MSFT] Refactor TableGen Pass includes (#7179) 2024-06-16 18:33:18 +02:00
fzi-hielscher f3054773df
[NFCI][Comb][HW][Seq] Refactor TableGen Pass includes 2024-06-16 18:29:59 +02:00
Robert Young ae1b8f778e
Fix paths in tests for windows builds (#7185)
* Fix paths in tests for windows builds

* Fix patterns that check mlir: backslashes are rendered as double backslashes

* Fix fir emitter for output dirs with backslashes

* Try fixing patterns, again

* FIRLexer: parse escaped backslashes in strings

* Fix more patterns with backslashes

* This time, for an absolute path
2024-06-15 16:20:03 -04:00
Andrew Young c93ca4ecf4 [firtool] Support layer specialization 2024-06-14 15:48:53 -07:00
Andrew Young fbbf36f35a [FIRRTL] Add pass to specialize layers 2024-06-14 15:48:53 -07:00
Andrew Young 870a43ae38 [FIRRTL] InstanceChoiceOp: add method to erase ports 2024-06-14 15:48:53 -07:00
Amelia Dobis 0a81a3eb69
[Verif] Add PrepareForFormal pass (#7175)
This PR introduces a PrepareForFormal pass that tries to alleviate some of the heavy lifting being done in the btor emission. For now this only flattens wires, but in the future in will also handle formal contracts and anything else that is done to make emission for formal tools easier, which is why it's part of the verif dialect and not hw.

This is derived from #7150
2024-06-14 12:07:06 -07:00
Robert Young 41ebd04f88
[FIRRTL] Output directory control for layers and modules (#6971)
* Add getDirectoryAttr helper to HWOutputFileAttr

This helper gets the directory component of an output file name, or returns
nullptr if there is none.

* Output directory control v2

Instead of using an explicit precedence declaration anno to help guide the
assignment of floating modules to output directories, use the directory
hierarchy itself.  So if a module is used under directory A/B and A/C, it will
be placed into directory A.

* Support absolute output directories for modules

* Add comment

* Make it so output dir annos only apply to public modules

* Simplify lower layers

* Add ability to configure the output directory of assign-output-dirs

* Update tests

* Address review comments

* Clean up whitespace in test

* clang-format

* Fix up firtool integration test excercising dedup + output dirs

* Address review comments
2024-06-14 14:51:28 -04:00
fzi-hielscher 7690177154
[NFCI][Transforms] Refactor TableGen Pass includes (#7173) 2024-06-14 19:13:15 +02:00
fzi-hielscher 2554a14234
[NFCI][Calyx] Refactor TableGen Pass includes (#7182) 2024-06-14 18:55:51 +02:00
fzi-hielscher 0e22c2b27a
[NFCI][Conversion] Refactor TableGen Pass includes (#7174)
Refactor includes of TableGen passes in the "Conversion" sub-tree to the new style.
See #3962 , https://reviews.llvm.org/D143773
2024-06-14 16:37:29 +02:00
Hideto Ueno ff4c6218f3
[LowerDPI] Create a helper struct, NFC (#7176)
This is a preparation for another PR. Create `LowerDPI` struct and refactor the logic into several helper functions.
2024-06-14 23:10:08 +09:00
Hideto Ueno f32a5a196c
Bump llvm (#7167)
Bump to 00bb18a77c

* applySignatureConversion change 52050f3ff3
2024-06-14 14:38:46 +09:00
mingzheTerapines b136101756
[ImportVerilog][MooreToCore]Lower moore.namedConstant to hw.param.value (#7122)
* [mooretocore] Support namedconstant

Signed-off-by: mingzheTerapines <mingzhe.zhang@terapines.com>

* Limit type to integertype.

* add mooretocore support

* remove include

* remove verify of hwops

* remove include

* Test added.

* Add test for MooreToCore

* Support any attribute

* Modify test.

* Add symbol for wireOp

* Remove useless include

* Add more test and error cases

* slang-tidy

* some Imporvement

* Improved version

* little change

* Imporve

---------

Signed-off-by: mingzheTerapines <mingzhe.zhang@terapines.com>
2024-06-14 09:22:46 +08:00
Hailong Sun f26f534d60
[Moore] Add evenOp to handle event controls. (#7154) 2024-06-14 09:05:33 +08:00
fzi-hielscher 11fb804813
[NFC][ExportVerilog] Rename generated `options` member. (#7172)
Side-step an issue that prevents transitioning the inclusion of TableGen defined passes to the new(er) style.
2024-06-13 18:20:34 +02:00
Prithayan Barua fe133f85c9
[FIRRTL] Add a new op interface for combinational loop detection. (#7120)
Add a new CombDataflow op interface to FIRRTL.
This interface is used for specifying the combinational dataflow that exists in
 the results and operands of an operation. Any operation that doesn't implement
 this interface is assumed to have a combinational dependence from each operand
 to each result.
Currently only FIRRTL register and memory ops implement this interface, but it
 can be used in other dialects that intend to use the CheckCombCycles pass.
2024-06-13 08:54:24 -07:00
fzi-hielscher e6dec6778a
[LowerDPI] Defer deletion of call ops to prevent invalid access. (#7170) 2024-06-13 16:28:07 +02:00
Hideto Ueno 523e9b4163
[FIRTRL][ExportVerilog] Emit small integers on DPI function as two state C-compatible types (#7163)
This PR modifies ExportVerilog to emit two state types (`bit` in general) for DPI import op. Furthermore, for specific bit width (8, 16, 32 and 64) it emits C-types (byte, shortint, int and longint). 

This PR also rejects small integer types other than 8, 16, 32 and 64 bit width since  otherwise we have to use`bit` but they are passed by references in DPI. So this PR defines the ABI as "small integers are passed by values, and larger integers are passed by references.
2024-06-13 23:08:30 +09:00
Hideto Ueno 44becae000
[FIRRTL] Add DPI call intrinsic and lowering pass (#7139)
This PR adds DPICallIntrinsicOp and its lowering pass. DPICallIntrinsicOp is lowered into sim.func.dpi.call and sim.func.dpi ops. At FIRRTL level DPICallIntrinsicOp doesn't have symbols and instead LowerDPI pass accumulates call sites and creates symbols for dpi functions. LowerDPI pass directly lowers FIRRTL intrinsic into Sim dialect since FIRRTL doesn't have DPI/Function construct. LowerDPI pass could be simplified (or migrated into LowerToHW) once FIRRTL gets 1st class support for Function. Unrealized conversion cast is used to mix FIRRTL and HW type values before LowerToHW.
2024-06-13 20:54:00 +09:00
Hideto Ueno 2876be2297
[ExportVerilog] Avoid using interface pass for PrepareForEmission, NFCI (#7168)
ODS InterfacePass generates `canScheduleOn` method with a specified interface in a header file and currently we import every pass declaration through PassesDetail.h. Gcc/clang seem to compile when there is an unknown interface class but MSVC emits an error. So this PR avoids `InterfacePass` in ODS and manually implements `canScheduleOn` in PrepareForEmission.
2024-06-13 19:52:04 +09:00
Hideto Ueno ee7d59be99
[Sim] Add DPI func/call and lowering (#7042)
This PR adds DPI func/call op and SimToSV lowering. 

`sim.dpi.func` is a just bridge to `sv.func`. This op can be lowered into `func.func` in the future for Arc integration. 

`sim.func.dpi.call` represents SystemVerilog DPI function call. There are two optional operands `clock` and `enable`.

If `clock` is not provided, the callee is invoked when input values are changed. If provided, the dpi function is called at clock's posedge. The result values behave like registers and the DPI function is used as a state transfer function of them. `enable` operand is used to conditionally call the DPI since DPI call could be quite more expensive than native constructs. When `enable` is low, results of unclocked calls are undefined and in SV results they are lowered into `X`. Users are expected to gate result values by another `enable` to model a default value of results. For clocked calls, a low enable means that its register state transfer function is not called. Hence their values will not be modify in that clock.

A function that returns an explicit return is not supported yet.
2024-06-13 19:11:56 +09:00
Hailong Sun 2b16c06874
[Moore] Add the SimplifyProcedures pass. (#7161) 2024-06-13 11:05:17 +08:00
Hailong Sun 190c5f8bf7
[Moore] A new pass to delete local temporary variables. (#7082)
[Moore] Introduce Mem2Reg to elminate local variables.

Co-authored-by: Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
2024-06-13 10:25:57 +08:00
John Demme a4845f1f82 [ESI] Ripping out some dead capnp code
This code was being used to generate a C++ API, which we no longer do.
2024-06-12 23:47:53 +00:00
Amelia Dobis cef54eef1d
[firtool] Remove LTLToCore pass from verification-flavor=immediate pipeline 2024-06-11 12:04:23 -07:00
Prithayan Barua 02bec89ded
[FIRRTL][CreateSiFiveMetadata] Add the path to the DUT, in the SiFive metadata class (#7156)
This commit adds the DUT module instance path to the to the `SiFive_Metadata`
 class. This is required to generate the DUT instance path directly from the
 OMIR. This will be required to generate DUT relative hierarchy paths for
 memories in the seq_mems.json metadata, Since all paths are by default
 generated relative to the top level.
This commit creates a list of paths, to handle multiple DUTs even though the
 current designs will have a unique DUT.
2024-06-11 10:33:29 -07:00
Schuyler Eldridge d9a3a95cca
[FIRRTL] Bump minimum to 2.0.0, remove partial conect (#5075)
Bump minimum supported FIRRTL to 2.0.0.
"FIRRTL version" is now required as a result.

Remove parsing of the FIRRTL partial connect operator ("<-").  This has,
for a very long time, been almost unreachable from Chisel-emitted FIRRTL
and is now impossible to emit from Chisel.  This has also been completely
removed from the FIRRTL spec in version 2.0.0.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Co-authored-by: Will Dietz <will.dietz@sifive.com>
2024-06-11 11:07:18 -05:00
Will Dietz abf780de76
[FIRRTL][Parser] Never use forceable (#7137) 2024-06-11 08:35:36 -05:00
Will Dietz 13a22290c4
[FIRRTL] Emulate tap-as-passive for no-ref-ports option. (#7109)
Taps (using probes) support a non-passive source with a passive sink (by their nature), but the hidden option to avoid probes does not.

Detect this specifically and fix by using passive type for wiring from source.

This allows taps of non-ground (non-passive) that work with probes to also work with this option.
2024-06-11 08:34:12 -05:00
John Demme c5044b6128 [ESI runtime] Add --gui option to esi cosim runner
Will launch the GUI if supported (i.e. in Questa).
2024-06-11 03:46:49 +00:00
John Demme 965f6b0407 [Python] Add module name to backedges remaining error message 2024-06-11 03:43:25 +00:00
cepheus 54669b2b22
[MooreToCore] Add conversion support for module and instance. (#7132)
* [MooreToCore] Add conversion support for SVModuleOp and InstanceOp

* Trailing newline fix

* Add Fixme

* [MooreToCore] Add a new test case for svmoduleOp and instanceOp

This is a rather crude version without assignOp, variableOp and netOp in the examples.
2024-06-11 10:13:06 +08:00
Will Dietz bc106de42e
[Handshake] Fix canonicalizer not going through rewriter for RAUW. (#7052)
Detected by -DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON.

cc #7047.
2024-06-10 17:00:05 -05:00
Mike Urbach 72313e072e
[FIRRTL] Cast to AnyRefType for metadata output port. (#7149)
We generally type-erase objects at the boundary, to avoid needing to
declare the objects' classes as part of the interface. This adds a
cast for the metadataObj reference, so we don't have to declare its
class as part of the interface. The evaluator and any tooling built on
it already know how to "see through" this cast.
2024-06-10 14:13:38 -06:00
Will Dietz 261c246ce6
[FIRRTL] Support abstract reset in RWProbeOp (#7136) 2024-06-10 08:23:52 -05:00
Morten Borup Petersen 0bf789e607
[Ibis] Divorce symbol and actual names in class and container ops (#7123)
... while factoring out `InnerSymbol`+name logic into a new interface that is also used by Ibis port-like ops. This model could probably be factored into the `hw` dialect, seeing as we're also eventually going to divorce symbol names and actual names in `hw.module`.

Also adds de-aliasing logic to `ContainersToHW`, which is required given that `hw.module` doesn't yet split its symbol and name (#7023).
2024-06-10 10:06:16 +02:00
Hideto Ueno dc70062860
[ExportVerilog] Support sv.func.* op emission (#7015)
This PR implements ExportVerilog support of sv.func, sv.func.dpi.import, sv.func.call and sv.func.call.procedural. 

sv.func emission is similar to hw.module but one difference is a return value.  Surprisingly in SV a function name is used as a placeholder for a return value so name legalization properly sets `hw.verilogName` of a returned value to a function name. 

Result names of sv.func.call.procedural are attached to temporary registers created in PrepareForEmission. This is similar implementation approach to hw.instance.
2024-06-09 23:45:52 +09:00
Hailong Sun 69085ea0e5
[Moore] Tweak Variable and ReadLValue ops. (#7095)
[Moore] Modify the tests related to the RefType.

Add a wrapper type(moore::RefType) to work for VariableOp/NetOp, ReadOp, and AssignOpBase, and it can wrap any SystemVerilog types. We added RefType in order to introduce Mem2Reg into moore to eliminate the local temporary variables. Meanwhile, we added a new op named moore.extract_ref which is the copy of moore.extract that explicitly works on the ref type. And moore.concat_ref is the copy of moore.concat. Later, we will tweak union/struct ops like moore.struct_create in order to support the ref type.

moore.variable/moore.net will return a result with ref<T>, it's similar to memref.alloca.

Change moore::ReadLValueOp to moore::ReadOp, it's similar to memref.load. Initially, we need moore.read_lvalue only to service for assigmen operations(like +=, *=, etc). However, moore. read is not only for assignment operations but also to take a value with RefType(ref) and return the current value with the nested type(T). For example, a = b + c, moore.read will take b and c(both are ref<T>), and then return a value with the nested type(T).

We think the MooreLValueType and VariableDeclOp(52a71a6) that had been removed eventually found their proper site.

We also divide convertExpression() into convertLvalueExpression() for the LHS of assignments and convertRvalueExpression() for the RHS of assignments. The former will return a value with RefType like ref<i32>, but the latter returns a value without RefType like i32.

Co-authored-by: Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
2024-06-07 11:08:17 +08:00
Will Dietz 1ee0d3eae4
[FIRRTL][InferResets] Learn how to trace through nodes. (#7141) 2024-06-06 14:14:41 -05:00
Hideto Ueno 927a3765d4
[ExportVerilog][HW] Introduce HWEmittableModuleLike interface and use it for Prepare, NFC (#7004)
This changes pre-passes for ExportVerilog to run on HWEmittableModuleLike instead of HWModuleOp. #6977 is going to add a support for SV func op and legalization needed for SV func as well.

HWEmittableModuleLike is a new interface that inherits Emittable+HWModuleLike. I considered to use a trait but we cannot use a trait for pass scheduling so an interface is used.
2024-06-07 00:33:00 +09:00
Andrew Lenharth f5a0969fbe
[FIRRTL] Enable Wire Elimination (#7073)
Activate the wire elimination pass in the firtool pipeline.  This will likely change some names, resulting in hand-coded XMRs to be incorrect.
2024-06-05 18:20:32 -05:00
Will Dietz 6ae06b3ca3
[FIRRTL][NFC] Move IST -> FieldRef to FIRRTLUtils.h (#7135) 2024-06-05 11:29:46 -05:00
Andrew Lenharth 876be0dbff [NFC] Formatting 2024-06-05 10:35:37 -05:00
Andrew Lenharth 97d716aec4 [NFC] Fix build for OSX in ModuleSummary 2024-06-05 10:13:28 -05:00
Anqi Yu c76eb120d6
[ImportVerilog] Add conditional operator. (#6950) 2024-06-05 10:44:55 +08:00
Will Dietz 2189f25c9b
[FIRRTL][DropConst] Fix performance with many extmodule's. (#7126)
Before, DropConst on FIRRTL w/300k extmodule's took 221s.
Now it's < 1s.
2024-06-04 21:06:50 -05:00
Fabian Schuiki 4fb00f0648
[Moore] Add module and instance port support (#7112)
Add module types and support for ports to the `moore.module` and
`moore.instance` operations. Also add a `moore.output` operation as a
terminator for modules, similar to the HW dialect. Extend ImportVerilog
to generate ports.

The ports on SVModuleOp follow a similar strategy as in HWModuleOp: all
input, inout, and ref ports are passed to the module as inputs and are
carried inside the module as block arguments, while output ports are
assigned by the OutputOp terminator. The Moore dialect reuses the
`hw::ModuleType` but does not use the `inout` direction. Instead, inout
ports will be represented as inputs with a `net<T>` wrapper type, while
ref ports will be wrapped as `ref<T>`.

Instances work identically to the HW dialect: input, inout, and ref port
connections are carried as operands, while output ports are represented
as results.

This commit also adds module and instance port support to the
ImportVerilog conversion. Regular ports are mapped to corresponding
ports on the module with the appropriate direction. Multi-ports, which
are a weird quirk of SystemVerilog that allow multiple ports to be
grouped up and presented to the outside as a single named port, are
split up into individual module ports. This is necessary since this
group can contain ports of different directions.

Inside a module Slang automatically generates local net or variable
declarations for all ports. The user may specify these declarations
themselves when using non-ANSI port lists, which Slang handles properly.
ImportVerilog inserts appropriate continuous assignments to drive the
actual input port value onto the local net or variable declaration, and
to drive the local declaration's value onto the actual output port of
the module. This properly adapts from SystemVerilog's assignable and
connectable ports that feel like nets or variables, to the Moore
dialect's by-value passing of inputs and outputs.

Instances in Slang have expressions connected to their ports. Input
ports lower this expression and directly use the result as an operand.
Output ports lower this expression and drive it through a continuous
assignment inserted after the instance, with the instance's
corresponding result on the right-hand side of the assignment.

Once we have a `ref<T>` type, and later potentially also a `net<T>`
type, the port lowering shall be revisited to ensure that inout and ref
ports are mapped to net and ref types, respectively. The lowering of
expressions connected to ports requires more care to ensure that they
are appropriately lowered to lvalues or rvalues, as needed by the port
direction. A `moore.short_circuit` operation or similar would help to
connect inout ports to the local net declarations in a module, and to
capture `alias` statements.

---------

Co-authored-by: cepheus <buyun.xu@terapines.com>
Co-authored-by: Hailong Sun <hailong.sun@terapines.com>
2024-06-04 17:19:02 -07:00
Mike Urbach d00a1d2bdf
[FIRRTL] Actually copy the leading part of the path in LowerClasses. (#7130)
We stated in a comment that we copy the leading part of the
hierarchical path from the owning module to the start of the
annotation's NLA. But we never actually did that, so this adds (back)
that logic.

Fixes https://github.com/llvm/circt/issues/7125.
2024-06-04 18:00:07 -06:00
Mike Urbach 06ca84961b
[FIRRTL] Simplify path handling in ResolvePaths and LowerClasses. (#7129)
This turns the multiple-instantiation error into a warning in
ResolvePaths and LowerClasses. In real designs coming from Chisel
today, we are not yet able to enforce single instantiation. This was
never a requirement of the original way that we handled hierarchical
paths in EmitOMIR, so this removes the requirement for now. Adding it
back is tracked in https://github.com/llvm/circt/issues/7128.

With this change, the ResolvePaths logic was simplified to stop trying
to disambiguate paths in some cases, and instead allow the annotations
to simply convey the user's requested local or hierarchical path. In
LowerClasses, if there are multiple instances, this means we have
ambiguity. In practice, this logic will produce the same outputs as
EmitOMIR, once we fix https://github.com/llvm/circt/issues/7125.
2024-06-04 17:59:42 -06:00
Fabian Schuiki b39f9ecd92 [HW] Fix module signature printer crashing on absent port locations
Add a missing check for absent port location information to
`printModuleSignatureNew`. This would cause crashes if the
`--mlir-print-debuginfo` option was set during emission and there are
not port locations available. This mirrors what we already do for
port attributes.

Thanks @uenoku for pointing this out in #7112.
2024-06-04 09:49:22 -07:00
Will Dietz 1503f7d2a1 [ExportVerilog][NFC] Drop dead currentIndent var. 2024-06-04 11:37:35 -05:00
Will Dietz bc5e9f37ba [FIRRTL][NFC] Fix leftover strictconnect -> matchingconnect .
cc #7116.
2024-06-04 09:48:58 -05:00
Andrew Lenharth 7e60fb9986
[NFC, FIRRTL] Rename StrictConnect to MatchingConnect. (#7116)
This is to reserve "Strict" for LHSType connects in the future.
2024-06-04 09:19:00 -05:00
elhewaty 8e472862b1
[Arc] Add statistics to the FindInitialVectors pass (#7113) 2024-06-01 17:09:06 +02:00
Will Dietz 923305a9e1
[FIRRTL] Generate memportaccess op index as UInt. (#7108)
Create these constants as unsigned of unknown width,
instead of s64.

This way when connecting to the address, we don't emit
a connnect between s64 and something like u3
(requiring casts/trim/etc).
2024-05-31 12:35:32 -05:00
Fabian Schuiki dd68e3c6f4
[ImportVerilog] Fix expression errors not being propagated
Fix a subtle issue in ImportVerilog's statement converter, where a call
to `convertExpression` returning a null value would not properly be
mapped to a `failure()` result.

The original line was `success(<value>)`, which apparently still returns
success even with a null value. Changing this to `failure(!<value>)`
fixes the issue.

While at it, remove all error test cases that simply check for Slang
frontend errors. These things are already tested in Slang. ImportVerilog
should only test for the errors it generates itself.
2024-05-31 09:45:01 -07:00
Will Dietz e57af47765 [HGLDD] Quiet unused warnings for operator<< in release build. 2024-05-30 12:06:22 -05:00
Will Dietz 7ed4d8fdda [SMT] Fix unused variable warning in release build. 2024-05-30 12:06:21 -05:00
Will Dietz 1555e2981d [Arc] Fix unused warnings on release build. 2024-05-30 12:06:19 -05:00
Anqi Yu 76b65f8606
[ImportVerilog] Support parameter constants. (#7083) 2024-05-30 14:10:51 +08:00
Deborah Soung 21269d52a3
LLVM bump (#7103) 2024-05-29 16:22:42 -07:00
Andrew Lenharth 11fc8ab2b7 [FIRRTL] use emitConnect more places 2024-05-29 16:40:53 -05:00
Hideto Ueno ce012c04a1
[FIRRTL][LowerClass] Pre-allocate namespaces before caputring refs (#7102)
There has been a lifetime bug that caused an UAF crash. Heaps allocated by DenseMap could be invalided when DenseMap size grows.
2024-05-29 16:20:36 +09:00
mingzheTerapines 00edb48ed5
[ImportVerilog][Moore] Support union type (#7084)
* [ImportVerilog]Support union types.

* [ImportVerilog]Rename structMember with structLikeMember

* [ImportVerilog] check the type of new Expressions.

* [ImportVerilog]Add value check for new Expressions.

* clang-format modify recommand

* [importVerilog]Remove useless inlcludes

* [ImportVerilog]Add union size and domain

* [ImportVerilog]Give more specefic errors
2024-05-29 13:23:20 +08:00
elhewaty 55610921c2
[Arc] Fix crashes in FindInitialVectors Pass (#7100) 2024-05-28 22:02:51 -07:00
Amelia Dobis e71ccb85f7
[firtool] Add an option to export SV without SVA (#7081)
* added a firtool option to export sv wihtout SVA

* folded no-sva option into verification flavor

* added namespace to call
2024-05-28 15:50:54 -07:00
Martin Erhart fe5e15502e
[CombToSMT] Register dependency on func (#7098) 2024-05-28 21:46:54 +02:00
Will Dietz 0806944a52
[FIRRTL] Drop Hoistpassthroughs pass. (#7097)
This has only been used for probes, but without input probes
this is no longer useful or necessary.

The HW-signal hoisting works well (if limited) and has no
known issues[1] but has yet to be used in practice due
primarily to passthroughs being intentional occasionally
and lacking a mechanism to capture or distill this intent
properly (it must be ""optimized"" yet not).

Since this is unused, and lacking traction on the above,
remove from pipeline and delete this for now instead of
having it bitrot and be a maintenance burden while
adding/completing new features.

Lives on in version control history!

[1] FWIW, see https://github.com/llvm/circt/pull/6115 for
both small example and before/after on chipyard, as well
as testing internally back when this was introduced.
2024-05-28 13:38:51 -05:00
Luisa Cicolini fa0e61420f
[SMT] Added support for :pattern attribute (#6976) 2024-05-28 11:13:15 +02:00
elhewaty 030ad3d349
[Arc] Add pass to find seed vectors (#7061)
Add the `FindInitialVectors` pass to the Arc dialect which finds
isomorphic operations at the same topological rank and groups them into
`arc.vectorize` ops. This is going to be the starting point for later
canonicalizations and optimization steps to improve the vectors and
apply a cost model.
2024-05-27 15:10:49 -07:00
Fabian Schuiki b0dd65aeb8
[Moore] Move struct types into ODS (#7091)
Move the definitions of packed and unpacked struct types from C++ land
into `MooreTypes.td`. This removes a significant amount of complexity.

With all types moved into the TableGen file, a lot of redundant code can
finally be removed and the parsing/printing can be streamlined
significantly.

This change also drops the `StructKind` enum which was used to discern
structs, unions, and tagged unions, although the ImportVerilog
conversion never generated anything besides structs. Once we add support
for unions in the future, the intention is to define new types in ODS
for the unions and reuse the `StructMember`.
2024-05-27 09:57:48 -07:00
Fabian Schuiki 37e5ad9624
[Moore] Support stripped type parsing and printing (#7090)
Operations defined through TableGen will use a version of type parsing
and printing that strips away the dialect prefix in case this does not
lead to ambiguities. If an op specifies a type like `UnpackedType`, the
generated parser and printer will call `UnpackedType::parse` and
`UnpackedType::print` in order to parse and print that type. This method
usually prints the type without any dialect prefixes, and often also
without the type name itself (as it is obvious given the type).

Add an implementation for `parse` and `print` to `UnpackedType` which
performs this stripped printing. This makes the assembly more compact
and in-line with what MLIR would generate by default if a
TableGen-specified op would use a TableGen-specified type.

This makes the integer flavor of `IntType` look exactly like the builtin
integer type, which will facilitate a future change from Moore's integer
type to the builtin integer. Parsing is unambiguous, since the stripped
form is only used when the type is clear from the op context.
2024-05-27 09:31:39 -07:00
Fabian Schuiki a778922171
[Moore] Move array types into ODS (#7088)
Move the definitions of all array types from C++ land into
`MooreTypes.td`. This removes a significant amount of redundant code and
simplifies the dialect's type system.

Replace packed and unpacked ranges (`T [4:3]` or `T [2:4]`) with a new
type that discards the directionality and offset of the range. This
information is no longer needed at the IR level. Any meaning that the
offsets have can be encoded in the corresponding ops. Both ranges are
now represented as `array<2 x T>` and `array<3 x T>`, respectively.

Combine unpacked ranges (`T foo [6:2]`) and unpacked arrays
(`T foo [42]`) into a single `uarray<N x T>` type.
2024-05-26 09:25:55 -07:00
elhewaty 021c3c23fe
[Arc] Modify VectorizeOp to support AnyType (#7087) 2024-05-25 12:01:08 -07:00
Hideto Ueno 139c97bd90
[Seq] Fix incorrect folder (#7085)
If the register has a constant reset value, we can replace it but we cannot replace it with a non-constant reset value.
2024-05-24 18:26:16 +09:00
Amelia Dobis ba67aa42b9
[LTL] Add ops that allow for most of SVA to be modeled with LTL (#7065)
* Introduced new ltl ops

* added ops to visitor

* updated exportverilog

* added type inference for intersect

* updated tests

* added fold for trivial case

* Added FIRRTL intrinsics and test

* comments

* updated op requirements
2024-05-23 14:39:21 -07:00
Amelia Dobis efa6955a7d
[Verif] Add clocked Assert Assume Cover ops (#7022)
* added clocked assert assume cover opes

* added disable to clocked ops

* added disable to clocked ops

* updated exportVerilog to support new clocked assertlike opertaions

* added missing inlcude

* line breaks in verif.td

* added small test

* added return

* Fixed verilog export for clocked assertions

* added a verifier for the new verif ops

* added verifier tests

* updated verif ops summaries

* added deeply nested test

* Added verification pass for clocked_assert_like ops

* removed verifier and added verification pass to firtool

* removed verifier and added verification pass to firtool

* removed unnecessary dialect dependencey

* registered pass with circt-opt

* removed unnecessary imports

* clang-tidy

* clang tidy

* hoisted out the worklist from the pass

* reverted unwanted change

* Update CMakeLists.txt

* small comment changes
2024-05-23 13:14:25 -07:00
John Demme c840b39185 [esi-cosim] Fix file not found bug
Fixes issue introduced by 17449a7656
2024-05-23 19:22:42 +00:00
Prithayan Barua cdc623274f
[LowerClasses] Ensure classes are instantiated by an object. (#7072)
LowerClasses creates an object for a corresponding instance only if the
 instantiated module has property ports. But a class can be created for a
 corresponding module based on other conditions like, if the module is public,
 or instantiates other classes. This results in un-instantiated classes that
 donot correspond to the module hierarchy.
This change ensures that if a class is created for a module, the object is also
 created from the corresponding instance. Thus the module hierarchy is also
 preserved in the om IR. Downstream tools parsing the IR can assume a single
 top level class which is required for object model evaluation.
2024-05-23 09:58:21 -07:00
John Demme 17449a7656 [esi-cosim] Bunch of improvements to cosim runner
- Recursive source collection
- Run vlog on each file
- Run vlog in a Questa session to improve the speed
- Add no compile option
- Run vopt during compile so missing modules get reported
2024-05-23 09:03:47 +00:00
Anqi Yu 851a1de172
[ImportVerilog] Support set membership operator. (#7066) 2024-05-23 14:32:47 +08:00
mingzheTerapines 9006a44b07
[ImportVerilog] Support member-access expression (#7039)
* [ImportVerilog] Support member-access expression
Support member-access expression.
Add container multiSymbolValue for multi-symbols pointing one value.

Signed-off-by: mingzheTerapines <mingzhe.zhang@terapines.com>

* [ImportVerilog] Support member-access expression
Separate two containers and their annotations.

* [ImportVerilog] Support member-access expression3
use auto instead of const slang::ast::Expression *
declare concatName with expr.member.name

* [ImportVerilog] Support member-access expression4
Simplfy string allocation.

* [ImportVerilog] Support member-access expression
The signing of unpacked structures is not allowed.- IEEE Standard

* [ImportVerilog] Support member-access expression6
Add packed unsigned struct occasion for testing.

* [ImportVerilog] Support Union Type
Support Union Type
Modify uniont tyep to event type as error type example.

* [ImportVerilog]Add errors example
Add error example for unpacked union.

* [ImportVerilog] Add strucfield op
Define a struct field access op that can represent accesses into struct fields.

* [ImportVerilog] Add struct inject and extract op
Add struct inject and extract op.
Remove union support.

* [ImportVerilog] Support memberaccess

* Removed some useless include.

* fix test error

* Fix errors.sv

* remove space.

---------

Signed-off-by: mingzheTerapines <mingzhe.zhang@terapines.com>
2024-05-23 10:51:21 +08:00
Andrew Young 8a8fd29595 Replace uses of deprecated StringRef::equals with ==
StringRef::equals was was deprecated in LLVM de483ad in favor of
operator==.  This change moves away from the deprecated method.
2024-05-22 13:24:29 -07:00
Andrew Young ab2dfdaad1 Bump LLVM
TopplogicalSortUtils.h was moved from mlir/Transforms to mlir/Analysis.
2024-05-22 13:24:29 -07:00
Andrew Lenharth 946caf91a4
[FIRRTL] Limited invalid propagation. (#7074)
Now that invalid is better defined, we can start propagating it when we can preserver semantics.  This means not breaking the one-op-is-one-consistent-value (e.g. not duplicating).  The only bit mutating op which is touched by this change is not, which is a pure all-bits inversion, which should be safe (tm).
2024-05-22 11:37:10 -05:00
Hideto Ueno 9060f58dc8
[FIRRTL] Preserve all analysis if nothing happens (#7077)
LowerMatchesPass and MemOfVec should preserve analysis if nothing happens.
2024-05-23 00:30:40 +09:00
Hideto Ueno f62b8a69fe
[FIRRTL] Remove unused expensive API (#7076)
InstanceOp::getPortList is a foot-gun that walks the entire circuit. Apparently there is no user so just delete it.
2024-05-22 23:10:21 +09:00
Andrew Lenharth da2ca8cc9f
[FIRRTL] Register reset elimination based on invalid can look through nodes. (#7069)
This converts wires into nodes when there is one write to the wire and it dominates the reads.  By converting to nodes, this pass does not have to worry about symbols, references, or annotations.  Those are just copied to the node.
2024-05-21 22:57:18 -05:00
Andrew Lenharth 535f14703e [NFC] nest passes better 2024-05-21 17:18:22 -05:00
Andrew Lenharth fd491e1985
[FIRRTL] Convert Wires into Nodes (#7067)
This converts wires into nodes when there is one write to the wire and it dominates the reads.  By converting to nodes, this pass does not have to worry about symbols, references, or annotations.  Those are just copied to the node.
2024-05-21 12:26:35 -05:00
Andrew Lenharth 5077ca78c2 [NFC] Hand CSE a pointer wrapper in a performance ciritcal location 2024-05-21 09:43:56 -07:00
Hideto Ueno 2b6184d40d
[FIRRTL][LowerClasses] Improve performance, NFC (#7060)
This PR fixes a regression caused by PortAnnotation mutation. We have to batch-update the port annotations to avoid compile time regression. Several other improves are added along with the fix:

* `shouldCreateClass` is slightly expensive since it walks entire IR to check instances. `shouldCreateClass` is already lazily evaluated but however `shouldCreateClass` is immediately called for every module. So this PR changes to compute the all results parallelly beforehand instead of lazy evaluation. 
* `std::distance(a, b) == 0` is replaced with `a == b` to avoid potential iterator traversals (maybe it is optimized by clang/gcc though). 
* `processPathTrackers` is refactored into a helper struct `PathTracker` so that we can process paths/annotations parallely. We update `pathInfoTable` sequentially afterwards. 
* Several operation walks were replaced with instance graph traversal. 

It should be NFC completely. Pass should behave exactly the same way.
2024-05-21 18:08:38 +09:00
John Demme 49f663c373 [ESI][runtime] Run command in OS environment
Using the simulation environment was causing some applications to use
the shared objects distributed with the wheel. That's usually wrong
since the wheel shared objects are compiled with the "old" string C++
library for compatibility reasons. C++ applications which are compiled
against the ESI runtime don't use that.
2024-05-21 00:57:50 +00:00
John Demme 2ba19927f3
[PyCDE] Move build and publishing pipeline into repo (#7062)
Previously was built and published internally. Resolves #1509.
2024-05-20 17:37:07 -07:00
John Demme 26947339c4 Revert "[OM] Adding missing depends"
This reverts commit 5491359b38.
2024-05-20 06:34:49 +00:00
John Demme 5491359b38 [OM] Adding missing depends 2024-05-20 06:13:35 +00:00
Will Dietz 3f6b9fa00f
[FIRRTL] Reject intrinsic modules >= 4.0.0 (#7009) 2024-05-19 14:10:28 -05:00
liuyic00 d40f5283ba
[LTL] Add repeat and until operators (#6989) 2024-05-19 00:40:02 +08:00
Andrew Lenharth d8f610b857 [NFC] fix some tidy warnings in ModuleSummary.cpp 2024-05-17 14:59:37 -05:00
Will Dietz 79148d8138
[FIRRTL][Folds] Fix patterns to use rewriter for RAUW (#7049)
Fix FoldUnusedPorts to use rewriter for RAUW.
Fix FoldReadWritePorts to use rewriter for RAUW.

Detected by -DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON.

cc #7047.

Fix more RAUW's to use rewriter, inspection.
2024-05-17 14:14:06 -05:00
Andrew Lenharth a1a3b6ca78 [NFC] Convert a canonicalizer to a pattern 2024-05-17 13:34:40 -05:00
Will Dietz 5e2ad89fda
[FIRRTL][Import] Remove support for printf-encoded verif. (#7030)
Retain logic to recognize (but not parse or diagnose) printf's
of the various "flavors" previously supported so that we can reject
designs that rely on this removed support (emit error).
2024-05-17 13:21:10 -05:00
Will Dietz bd49eb7829 [NFC] Touchup 80-col violations in commments. 2024-05-17 13:15:39 -05:00