circt
circt copied to clipboard
[FIRRTL] Add the FIRRTL RefType Ops
This PR introduces two operations to handle RefType
.
The RefType
can be used to represent dataflow across modules and only module/instance ports can declare values of RefType
.
The following operations are added to FIRRTL
to express the dataflow across modules.
- RefSendOp
- Send a read-only handle of a local value to a reference port.
- Has connect-like semantics, but can only connect a
BaseType
value to aRefType
port. - Expresses the source of a dataflow by getting it's reference.
- RefResolveOp
- Reads the
BaseType
value from a reference port - Represents the sink of a dataflow from the reference ports
- The
RefType
is constrained to express a "single source to one-or-more sink" dataflow - Hence, multiple
RefResolveOp
s can be remotely connected to a singleRefSendOp
. - If the Reference ops are lowered to cross-module-reference, then it represents the location of the XMR.
- Reads the
Added few lit tests to verify proper errors for the constraints on the Reference ops and added the xmr.mlir
to demonstrate the usage of Reference ops, it does not check for any output, just that there are no errors. xmr.mlir
can possibly be removed later when other passes handling the Reference ops are introduced.
Co-authored-by: Will Dietz [email protected]