Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRRTL][Ref] Determine rules about ref.send under when #3715

Closed
dtzSiFive opened this issue Aug 12, 2022 · 0 comments · Fixed by #4812
Closed

[FIRRTL][Ref] Determine rules about ref.send under when #3715

dtzSiFive opened this issue Aug 12, 2022 · 0 comments · Fixed by #4812
Assignees

Comments

@dtzSiFive
Copy link
Contributor

dtzSiFive commented Aug 12, 2022

It's strange/nonsensical for the anchor of the dataflow to be conditional (send), it should be unconditional. resolve does not have this issue.

Example:

firrtl.circuit "xmr" {
  firrtl.module private @Test(in %p: !firrtl.uint<1>, out %x: !firrtl.ref<uint<2>>) {
    firrtl.when %p {
      %zero = firrtl.constant 1 : !firrtl.uint<2>
      %w = firrtl.wire : !firrtl.uint<2>
      %1 = firrtl.ref.send %w : !firrtl.uint<2>
      firrtl.strictconnect %x, %1 : !firrtl.ref<uint<2>>
      firrtl.strictconnect %w, %zero : !firrtl.uint<2>
    }
  }
  firrtl.module @xmr(in %p: !firrtl.uint<1>) {
    %test_in, %test_x = firrtl.instance test @Test(in p: !firrtl.uint<1>, out x: !firrtl.ref<uint<2>>)
    firrtl.strictconnect %test_in, %p : !firrtl.uint<1>
    %x = firrtl.ref.resolve %test_x : !firrtl.ref<uint<2>>
  }
}

A send from within a when should work if the resolve is also in the same when block.

EDIT: previously suggested this should be illegal, I think the above example is okay, if needs some work to make that seem natural. Only one connect to the output ref port is allowed (already checked), but the above example is rejected due to not fully initializing %x.

@dtzSiFive dtzSiFive self-assigned this Mar 4, 2023
dtzSiFive added a commit that referenced this issue Mar 30, 2023
…4812)

Add "define" statement from FIRRTL 2.0, move all reference connections to use this.

Update passes accordingly.
No longer reject "define" out of a block in parser, since they're supported now.
Extend FConnectLike with static method used to query the connect behavior kind.
Used in ExpandWhen's to handle define's appropriately.

Fixes #4334 .
Fixes #3715 .
Fixes #3713 .
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 a pull request may close this issue.

1 participant