Add missing cloneType methods to pin bundles
[sifive-blocks.git] / src / main / scala / devices / pwm / PWMPeriphery.scala
index 31ad5f6f3a999dc32de46efc8b6149ce4beb7429..f83cbafdfe9780ea83e865a8d94b65c4de9a8c4a 100644 (file)
@@ -18,6 +18,9 @@ class PWMPins[T <: Pin] (pingen: ()=> T, val c: PWMParams) extends Bundle {
 
   val pwm: Vec[T] = Vec(c.ncmp, pingen())
 
+  override def cloneType: this.type =
+    this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
+
   def fromPWMPort(port: PWMPortIO) {
     (pwm zip port.port)  foreach {case (pin, port) =>
       pin.outputPin(port)