Add missing cloneType methods to pin bundles
[sifive-blocks.git] / src / main / scala / devices / i2c / I2CPins.scala
index df6dd6f3bd13d33da2e4025e5135f39008f0d877..8e17765b908a48511db73f27acd0b1d953b5dbad 100644 (file)
@@ -12,6 +12,9 @@ class I2CPins[T <: Pin](pingen: () => T) extends Bundle {
   val scl: T = pingen()
   val sda: T = pingen()
 
+  override def cloneType: this.type =
+    this.getClass.getConstructors.head.newInstance(pingen).asInstanceOf[this.type]
+
   def fromI2CPort(i2c: I2CPort, clock: Clock, reset: Bool, syncStages: Int = 0) = {
     withClockAndReset(clock, reset) {
       scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B)