GPIO Pins needs clone type. signal_bundles
authorMegan Wachs <megan@sifive.com>
Fri, 22 Sep 2017 23:38:37 +0000 (16:38 -0700)
committerMegan Wachs <megan@sifive.com>
Fri, 22 Sep 2017 23:38:37 +0000 (16:38 -0700)
src/main/scala/devices/gpio/GPIOPins.scala

index e2f279eeacc6da9892fe81a99f6dbcd154b8c76a..85729237f6e9eac42a10190addfd19b481d52045 100644 (file)
@@ -11,9 +11,15 @@ import sifive.blocks.devices.pinctrl.{Pin}
 // type of pad this connects to.
 class GPIOSignals[T <: Data] (pingen: ()=> T,  c: GPIOParams) extends Bundle {
   val pins = Vec(c.width, pingen())
+
+  override def cloneType: this.type =
+    this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
 }
 
-class GPIOPins[T <: Pin] (pingen: ()=> T,  c: GPIOParams) extends GPIOSignals[T](pingen, c)
+class GPIOPins[T <: Pin] (pingen: ()=> T,  c: GPIOParams) extends GPIOSignals[T](pingen, c) {
+  override def cloneType: this.type =
+    this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
+}
 
 object GPIOPinsFromPort {