Commit Graph

8359 Commits

Author SHA1 Message Date
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 42e1adfe72 CODEOWNERS: Remove RamirezLucas, user does not exist. 2024-06-10 13:09:51 -05: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
Lenny Truong e0f884a450
[Docs] Update Python bindings pip instructions (#7147)
Fixes https://github.com/llvm/circt/issues/7115
This option no longer exists
2024-06-09 10:29:28 -06: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
Mike Urbach 2c1aac86da [OM] Register Verif dialect in om-linker.
The om-linker is expected to be able to link MLIR that has Verif
dialect operations in it, rather than failing to read the MLIR.
2024-06-07 11:10:58 -07:00
Mike Urbach 1891582fc9 [OM] Register LTL dialect in om-linker.
The om-linker is expected to be able to link MLIR that has LTL dialect
operations in it, rather than failing to read the MLIR.
2024-06-07 10:58:00 -07:00
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