1
0

GPIO Pins needs clone type.

This commit is contained in:
Megan Wachs 2017-09-22 16:38:37 -07:00
parent 5d1e9b793a
commit 77df75f4ed

View File

@ -11,9 +11,15 @@ import sifive.blocks.devices.pinctrl.{Pin}
// type of pad this connects to. // type of pad this connects to.
class GPIOSignals[T <: Data] (pingen: ()=> T, c: GPIOParams) extends Bundle { class GPIOSignals[T <: Data] (pingen: ()=> T, c: GPIOParams) extends Bundle {
val pins = Vec(c.width, pingen()) 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 { object GPIOPinsFromPort {