@@ -4,7 +4,6 @@ package chisel3
44
55import chisel3 .experimental .dataview .reify
66
7- import chisel3 .Data .DataExtensions
87import chisel3 .experimental .{requireIsChiselType , requireIsHardware , Analog , BaseModule }
98import chisel3 .experimental .{prefix , SourceInfo , UnlocatableSourceInfo }
109import chisel3 .experimental .dataview .{reifyIdentityView , reifySingleTarget , DataViewable }
@@ -782,12 +781,28 @@ private[chisel3] trait DataImpl extends HasId with NamedComponent { self: Data =
782781 private [chisel3] def width : Width
783782 private [chisel3] def firrtlConnect (that : Data )(implicit sourceInfo : SourceInfo ): Unit
784783
785- /** Private implementation of cloneType
784+ /** Internal API; Chisel users should look at chisel3.chiselTypeOf(...).
786785 *
787- * _cloneType must be defined for any Chisel object extending Data.
788- * It is implemented by Chisel itself or by the compiler plugin for user-defined types.
786+ * cloneType must be defined for any Chisel object extending Data.
787+ * It is responsible for constructing a basic copy of the object being cloned.
788+ *
789+ * @return a copy of the object.
790+ */
791+ def cloneType : this .type
792+
793+ /** Internal API; Chisel users should look at chisel3.chiselTypeOf(...).
794+ *
795+ * Returns a copy of this data type, with hardware bindings (if any) removed.
796+ * Directionality data and probe information is still preserved.
789797 */
790- def _cloneType : Data
798+ private [chisel3] def cloneTypeFull : this .type = {
799+ val clone = this .cloneType // get a fresh object, without bindings
800+ // Only the top-level direction needs to be fixed up, cloneType should do the rest
801+ clone.specifiedDirection = specifiedDirection
802+ probe.setProbeModifier(clone, probeInfo)
803+ clone.isConst = isConst
804+ clone
805+ }
791806
792807 /** The "strong connect" operator.
793808 *
@@ -979,7 +994,6 @@ private[chisel3] trait ObjectDataImpl {
979994 *
980995 * @param lhs The [[Data ]] hardware on the left-hand side of the equality
981996 */
982- // TODO fold this into DataExtensions
983997 implicit class DataEquality [T <: Data ](lhs : T )(implicit sourceInfo : SourceInfo ) {
984998
985999 /** Dynamic recursive equality operator for generic [[Data ]]
@@ -1058,33 +1072,6 @@ private[chisel3] trait ObjectDataImpl {
10581072 }
10591073 }
10601074 }
1061-
1062- implicit class DataExtensions [T <: Data ](self : T ) {
1063-
1064- /** Internal API; Chisel users should look at chisel3.chiselTypeOf(...).
1065- *
1066- * cloneType must be defined for any Chisel object extending Data.
1067- * It is responsible for constructing a basic copy of the object being cloned.
1068- *
1069- * @return a copy of the object.
1070- */
1071- def cloneType : T = self._cloneType.asInstanceOf [T ]
1072-
1073- /** Internal API; Chisel users should look at chisel3.chiselTypeOf(...).
1074- *
1075- * Returns a copy of this data type, with hardware bindings (if any) removed.
1076- * Directionality data and probe information is still preserved.
1077- */
1078- private [chisel3] def cloneTypeFull : T = {
1079- val clone = self.cloneType // get a fresh object, without bindings
1080- // Only the top-level direction needs to be fixed up, cloneType should do the rest
1081- clone.specifiedDirection = self.specifiedDirection
1082- // TODO do we need to exclude probe and const from cloneTypeFull on Properties?
1083- probe.setProbeModifier(clone, self.probeInfo)
1084- clone.isConst = self.isConst
1085- clone.asInstanceOf [T ]
1086- }
1087- }
10881075}
10891076
10901077trait WireFactory {
@@ -1256,8 +1243,7 @@ final case object DontCare extends Element with connectable.ConnectableDocs {
12561243 private [chisel3] override val width : Width = UnknownWidth
12571244
12581245 bind(DontCareBinding (), SpecifiedDirection .Output )
1259-
1260- override def _cloneType : Data = DontCare
1246+ override def cloneType : this .type = DontCare
12611247
12621248 override def toString : String = " DontCare()"
12631249
0 commit comments