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

bundleWithABoolProbe := 0.U.asTypeOf(bundleWithABoolProbe) results in illegal firrtl #4388

Open
mwachs5 opened this issue Sep 10, 2024 · 0 comments
Labels

Comments

@mwachs5
Copy link
Contributor

mwachs5 commented Sep 10, 2024

Type of issue: Bug Report

Please provide the steps to reproduce the problem:

What is the current behavior?

Consider the following:

    class BundleWithAProbe extends Bundle {
      val tap = Probe(Bool())
    }
    class TestMod extends RawModule{
      val a = IO(Output(new BundleWithAProbe()))
      a :#= 0.U.asTypeOf(a)
    }
    ChiselStage.emitCHIRRTL(new TestMod)

This successfully emits illegal firrtl:

circuit TestMod :
  ...
  public module TestMod : @[src/test/scala/chiselTests/ProbeSpec.scala 751:11]
    output a : { tap : Probe<UInt<1>>}

    define a.tap = UInt<1>(0h0)

What is the expected behavior?

Not sure. This should at minimum not emit illegal firrtl.
If you do this without a Bundle, you get an error like:

mismatched probe/non-probe types in TestMod.a: IO[Bool] and Bool(false).
[error]       a :#= 0.U.asTypeOf(a)

And if you do it for a Probe of a Bundle you get an even better error before you even try to do the connect, which is:

"Cannot create Const of a Probe."

It should probably throw an error, making it the user's responsibility to somehow drive the probe fields to probes-of-Wires that are initialized to 0, but that could be quite annoying and a helper API to do that might also be useful.

Please tell us about your environment:

commit: cf42ac7
Date: Mon Sep 9 12:57:04 2024 -0700

Other Information

What is the use case for changing the behavior?

Chisel should generally not emit invalid firrtl

@mwachs5 mwachs5 added the bug label Sep 10, 2024
mwachs5 added a commit that referenced this issue Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant