diff --git a/core/src/main/scala/chisel3/Data.scala b/core/src/main/scala/chisel3/Data.scala index 00cd4f78f11..979b561b1b2 100644 --- a/core/src/main/scala/chisel3/Data.scala +++ b/core/src/main/scala/chisel3/Data.scala @@ -65,7 +65,7 @@ object SpecifiedDirection { val prevId = Builder.idGen.value val data = source // evaluate source once (passed by name) requireIsChiselType(data) - val out = if (!data.mustClone(prevId)) data else data.cloneType.asInstanceOf[T] + val out = if (!data.mustClone(prevId)) data else data.cloneTypeFull.asInstanceOf[T] out.specifiedDirection = dir(data) // Must use original data, specified direction of clone is cleared out } diff --git a/src/test/scala/chiselTests/Direction.scala b/src/test/scala/chiselTests/Direction.scala index bb3598020c9..8cc78f325d0 100644 --- a/src/test/scala/chiselTests/Direction.scala +++ b/src/test/scala/chiselTests/Direction.scala @@ -550,4 +550,13 @@ class DirectionSpec extends ChiselPropSpec with Matchers with Utils { ) ) } + + property("Probe and const are preserved by Output()") { + class MyModule extends RawModule { + val tpe = probe.Probe(Const(Bool())) + val test = IO(Output(tpe)) + } + val emitted: String = ChiselStage.emitCHIRRTL(new MyModule) + assert(emitted.contains("Probe>")) + } }