circt icon indicating copy to clipboard operation
circt copied to clipboard

[FIRRTL] Add the FIRRTL RefType Ops

Open prithayan opened this issue 2 years ago • 0 comments

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 a RefType 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 RefResolveOps can be remotely connected to a single RefSendOp.
    • If the Reference ops are lowered to cross-module-reference, then it represents the location of the XMR.

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]

prithayan avatar Aug 10 '22 20:08 prithayan