From d70a6e05beb90291cf935b0611c674d6440d104b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksandar=20Kondi=C4=87?= Date: Mon, 21 Aug 2023 17:50:05 +0200 Subject: [PATCH] Specify type parameter when calling chiselTypeClone --- src/main/scala/diplomacy/BundleBridge.scala | 10 +++++----- src/main/scala/util/BundleMap.scala | 2 +- src/main/scala/util/HeterogeneousBag.scala | 2 +- src/main/scala/util/RecordMap.scala | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/scala/diplomacy/BundleBridge.scala b/src/main/scala/diplomacy/BundleBridge.scala index e02d6f4f966..9b9919c11c9 100644 --- a/src/main/scala/diplomacy/BundleBridge.scala +++ b/src/main/scala/diplomacy/BundleBridge.scala @@ -25,12 +25,12 @@ class BundleBridgeImp[T <: Data]() extends SimpleNodeImp[BundleBridgeParams[T], (sourceOpt, sinkOpt) match { case (None, None) => throw new Exception("BundleBridge needs source or sink to provide bundle generator function") - case (Some(a), None) => chiselTypeClone(a) - case (None, Some(b)) => chiselTypeClone(b) + case (Some(a), None) => chiselTypeClone[T](a) + case (None, Some(b)) => chiselTypeClone[T](b) case (Some(a), Some(b)) => { require(DataMirror.checkTypeEquivalence(a, b), s"BundleBridge requires doubly-specified source and sink generators to have equivalent Chisel Data types, but got \n$a\n vs\n$b") - chiselTypeClone(a) + chiselTypeClone[T](a) } } } @@ -48,7 +48,7 @@ case class BundleBridgeSink[T <: Data](genOpt: Option[() => T] = None) } def makeIO()(implicit valName: ValName): T = { - val io: T = IO(if (inferOutput) Output(chiselTypeOf(bundle)) else chiselTypeClone(bundle)) + val io: T = IO(if (inferOutput) Output(chiselTypeOf(bundle)) else chiselTypeClone[T](bundle)) io.suggestName(valName.name) io <> bundle io @@ -71,7 +71,7 @@ case class BundleBridgeSource[T <: Data](genOpt: Option[() => T] = None)(implici } def makeIO()(implicit valName: ValName): T = { - val io: T = IO(if (inferInput) Input(chiselTypeOf(bundle)) else Flipped(chiselTypeClone(bundle))) + val io: T = IO(if (inferInput) Input(chiselTypeOf(bundle)) else Flipped(chiselTypeClone[T](bundle))) io.suggestName(valName.name) bundle <> io io diff --git a/src/main/scala/util/BundleMap.scala b/src/main/scala/util/BundleMap.scala index 57dd5153043..1af90ef611d 100644 --- a/src/main/scala/util/BundleMap.scala +++ b/src/main/scala/util/BundleMap.scala @@ -98,7 +98,7 @@ class BundleMap(val fields: Seq[BundleFieldBase]) extends Record { // All fields must have distinct key.names require(fields.map(_.key.name).distinct.size == fields.size) - val elements: SeqMap[String, Data] = SeqMap(fields.map { bf => bf.key.name -> chisel3.reflect.DataMirror.internal.chiselTypeClone(bf.data) } :_*) + val elements: SeqMap[String, Data] = SeqMap(fields.map { bf => bf.key.name -> chisel3.reflect.DataMirror.internal.chiselTypeClone[Data](bf.data) } :_*) // A BundleMap is best viewed as a map from BundleKey to Data def keydata: Seq[(BundleKeyBase, Data)] = (fields zip elements) map { case (field, (_, data)) => (field.key, data) } diff --git a/src/main/scala/util/HeterogeneousBag.scala b/src/main/scala/util/HeterogeneousBag.scala index f9a591b4b42..0bf29c720b1 100644 --- a/src/main/scala/util/HeterogeneousBag.scala +++ b/src/main/scala/util/HeterogeneousBag.scala @@ -12,7 +12,7 @@ final case class HeterogeneousBag[T <: Data](elts: Seq[T]) extends Record with c def length = elts.length override def className: String = super.className - val elements = ListMap(elts.zipWithIndex.map { case (n,i) => (i.toString, chiselTypeClone(n)) }:_*) + val elements = ListMap(elts.zipWithIndex.map { case (n,i) => (i.toString, chiselTypeClone[T](n)) }:_*) // IndexedSeq has its own hashCode/equals that we must not use override def hashCode: Int = super[Record].hashCode override def equals(that: Any): Boolean = super[Record].equals(that) diff --git a/src/main/scala/util/RecordMap.scala b/src/main/scala/util/RecordMap.scala index 4dd6bc11ae9..cd47938521b 100644 --- a/src/main/scala/util/RecordMap.scala +++ b/src/main/scala/util/RecordMap.scala @@ -13,7 +13,7 @@ final class RecordMap[T <: Data] (eltMap: ListMap[String, T]) eltMap.foreach { case (name, elt) => requireIsChiselType(elt, name) } // This is needed for Record - val elements = ListMap[String, T]() ++ eltMap.mapValues(chiselTypeClone(_).asInstanceOf[T]) // mapValues return value is lazy + val elements = ListMap[String, T]() ++ eltMap.mapValues(chiselTypeClone[T](_)) // mapValues return value is lazy def apply(x: Int) = elements.values.toSeq(x) def apply(x: String) = elements.get(x)