Skip to content

[FIRRTL][LowerLayers] Add probe type support#10223

Open
prithayan wants to merge 2 commits intomainfrom
dev/pbarua/lowerLayers-probes
Open

[FIRRTL][LowerLayers] Add probe type support#10223
prithayan wants to merge 2 commits intomainfrom
dev/pbarua/lowerLayers-probes

Conversation

@prithayan
Copy link
Copy Markdown
Contributor

This PR adds the support for LowerLayers to handle probe ops, without depending on LowerXMR.
This reverts the commit that adds the LowerXMR dependency on LowerLayers.

Layers can now capture and use probe references across layer boundaries, in addition to domain types.

Following examples demonstrate the two major use cases.

  1. Handle probe input captures, by adding input ports driven by a ref.resolve in the parent and recreate the probe by a ref.send of the input argument.
    For example,
// Before: 
    %w = firrtl.wire : !firrtl.uint<1>
    %r = firrtl.ref.send %w : !firrtl.uint<1>
    firrtl.layerblock @A {
      firrtl.ref.resolve %r : !firrtl.probe<uint<1>>
    }
  
// After:
  firrtl.module private @ProbeCapture_A(in %_0: !firrtl.uint<1>) {
      %0 = firrtl.ref.send %_0 : !firrtl.uint<1>
      %1 = firrtl.ref.resolve %0 : !firrtl.probe<uint<1>>
    }
    firrtl.module @ProbeCapture() {
      %w = firrtl.wire : !firrtl.uint<1>
      %0 = firrtl.ref.send %w : !firrtl.uint<1>
      %1 = firrtl.ref.resolve %0 : !firrtl.probe<uint<1>>
      firrtl.instance @ProbeCapture_A(in %1: !firrtl.uint<1>)
    }
  1. Handle probe output escape by adding probe type output ports.
 // Before:
%dest_ref = firrtl.wire : !firrtl.probe<uint<1>, @A>
firrtl.layerblock @A {
  %src_ref = firrtl.wire : !firrtl.probe<uint<1>, @A>
  firrtl.ref.define %dest_ref, %src_ref : !firrtl.probe<uint<1>, @A>
}

// After:
firrtl.module private @Layer_A(out %p: !firrtl.probe<uint<1>>) {  
  %src_ref = firrtl.wire : !firrtl.probe<uint<1>>
  firrtl.ref.define %p, %src_ref : !firrtl.probe<uint<1>>
}
firrtl.module @Parent() {
  %dest_ref = firrtl.wire : !firrtl.probe<uint<1>>
  %p = firrtl.instance @Layer_A(out %p: !firrtl.probe<uint<1>>)
  firrtl.ref.define %dest_ref, %p : !firrtl.probe<uint<1>>
}

AI-assisted-by: Claude Sonnet 4.5

Enable layer blocks to capture probe references across boundaries.
Input ports use base types + ref.send; output ports use RefType + ref.define.
XMR refs are cloned to preserve rwprobe types. Unified domain/probe handling
in FConnectLike. Includes 12 comprehensive test cases with 100% pass rate.
@fabianschuiki
Copy link
Copy Markdown
Contributor

Results of circt-tests run for 895f895 compared to results for 7763950: no change to test results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants