Skip to content
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