1
0

Remove cloneTypes in favor of autoclonetype (#51)

* Remove cloneTypes in favor of autoclonetype

* Consistently use private val for autoclonetype
This commit is contained in:
Jack Koenig
2018-03-04 10:29:51 -08:00
committed by Henry Cook
parent 00fbfb6dd8
commit 39287b9215
9 changed files with 12 additions and 40 deletions

View File

@ -9,17 +9,11 @@ import sifive.blocks.devices.pinctrl.{Pin}
// even though it looks like something that more directly talks to
// a pin. It also makes it possible to change the exact
// type of pad this connects to.
class GPIOSignals[T <: Data] (pingen: ()=> T, c: GPIOParams) extends Bundle {
class GPIOSignals[T <: Data](private val pingen: () => T, private val 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) {
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)
object GPIOPinsFromPort {