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

[WIP] Add tests for https://github.com/chipsalliance/chisel/issues/4388 #4389

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/test/scala/chiselTests/ProbeSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,43 @@ class ProbeSpec extends ChiselFlatSpec with MatchesAndOmits with Utils {
}
ChiselStage.emitCHIRRTL(new TestMod)
}

"Probes of Bool()" should "fail to be driven with 0.U.asTypeOf(...)" in {
class TestMod extends RawModule {
val a = IO(Output(Probe(Bool())))
a :#= 0.U.asTypeOf(a)
}
val exc = intercept[chisel3.ChiselException] {
ChiselStage.emitCHIRRTL(new TestMod, Array("--throw-on-first-error"))
}
exc.getMessage should include(
"Cannot create Const of a Probe."
) // current message is: mismatched probe/non-probe types in TestMod.a")
}
"Probes of Aggregates" should "fail to be driven with 0.U.asTypeOf(...)" in {
class BundleWithABool extends Bundle {
val foo = Bool()
}
class TestMod extends RawModule {
val a = IO(Output(Probe(new BundleWithABool())))
a :#= 0.U.asTypeOf(a)
}
val exc = intercept[chisel3.ChiselException] {
ChiselStage.emitCHIRRTL(new TestMod, Array("--throw-on-first-error"))
}
exc.getMessage should include("Cannot create Const of a Probe.")
}
"Bundles of Probes" should "fail to be driven with 0.U.asTypeOf(...)" in {
class BundleWithAProbe extends Bundle {
val tap = Probe(Bool())
}
class TestMod extends RawModule {
val a = IO(Output(new BundleWithAProbe()))
a :#= 0.U.asTypeOf(a)
}
val exc = intercept[chisel3.ChiselException] {
ChiselStage.emitCHIRRTL(new TestMod, Array("--throw-on-first-error"))
}
exc.getMessage should include("Cannot create Const of a Probe.") // currently just succeeds!
}
}
Loading