Commit Graph

8551 Commits

Author SHA1 Message Date
Fabian Schuiki 5f9ef3c4fd
[Moore] Simplify dialect tests 2024-06-07 09:46:20 -07: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 53abd04cac [CI][NFC] Remove duplicate LLVM_PARALLEL_LINK_JOBS 2024-06-06 14:30:52 -05:00
Will Dietz a7bd8da352 Remove LLVM_ENABLE_TERMINFO from cmake invocations.
Harmless to specify but no longer needed as the option has been removed.

852aaf5407
2024-06-06 14:30:40 -05: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 bf2487161f
Capitalize Mode in github workflow. (#7140)
* Capitalize Mode in github workflow.  This might fix a new breakage on the gcc build complaining about DCMAKE_BUILD_TYPE

* audited for more instances
2024-06-06 08:59:20 -05: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
Andrew Lenharth 5d9cc388ff [NFC] LLVM bump 2024-06-05 15:05:26 -05:00
Amelia Dobis 6e17eb004b
[Docs][LTL] Add SVA Encodings to LTL rationale (#7131)
* added sva.assertproperty ops

* added rationale for non-consecutive repetitions

* Added SVA encodings to LTL rationale

* undid stray changes

* removed comment about supporting function via frontend

* fixed typos

* Update LTL.md
2024-06-05 12:15:20 -07: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 0b5c8f5c35 [FIRRTL] Update wildly out-of-date rational doc 2024-06-05 10:21:34 -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 e2e7da6ef4 [FIRRTL][NFC] Touchup test comment. 2024-06-04 10:03:34 -05:00
Will Dietz 6fb5ef593e [FIRRTL][NFC] Update tests for more strict -> matching. 2024-06-04 10:01:11 -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
Andrew Lenharth e75c17f395 [NFC, FIRRTL] Elide duplicate types in connect printing and parsing. 2024-06-03 14:10:05 -05:00
elhewaty 8e472862b1
[Arc] Add statistics to the FindInitialVectors pass (#7113) 2024-06-01 17:09:06 +02:00
Will Dietz 5e95aa09e8
CMake: Fix CIRCT_ENABLE_FRONTENDS to be string not bool. (#7110) 2024-05-31 13:27:57 -05: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 6509577803
[FIRRTL] Visitor: Add missing ops, fix GenericIntrinsicOp visit. (#7107) 2024-05-30 19:21:31 -05: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
John Demme aaca8bad71 [pycde] Fix race condition in test
Memory write may not be complete before the read happens.
2024-05-28 18:17:12 +00:00
John Demme ff89611259 [Verif] Removing unnecessary include
Was generating missing header includes. Turns out to be not needed.
2024-05-28 17:58:54 +00:00
Luisa Cicolini fa0e61420f
[SMT] Added support for :pattern attribute (#6976) 2024-05-28 11:13:15 +02:00
Fabian Schuiki 695e36e5d4
[Arc] Add prefix to FindInitialVectors pass option
Add an `arc-` prefix to FindInitialVectors's command line name.
2024-05-27 15:40:27 -07: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