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

@ -2,12 +2,8 @@
package sifive.blocks.devices.spi
import Chisel._
import freechips.rocketchip.util.GenericParameterizedBundle
abstract class SPIBundle(val c: SPIParamsBase) extends GenericParameterizedBundle(c) {
override def cloneType: SPIBundle.this.type =
this.getClass.getConstructors.head.newInstance(c).asInstanceOf[this.type]
}
abstract class SPIBundle(private val c: SPIParamsBase) extends Bundle
class SPIDataIO extends Bundle {
val i = Bool(INPUT)

View File

@ -5,15 +5,11 @@ import Chisel._
import chisel3.experimental.{withClockAndReset}
import sifive.blocks.devices.pinctrl.{PinCtrl, Pin}
class SPISignals[T <: Data] (pingen: ()=> T, c: SPIParamsBase) extends SPIBundle(c) {
class SPISignals[T <: Data](private val pingen: () => T, c: SPIParamsBase) extends SPIBundle(c) {
val sck = pingen()
val dq = Vec(4, pingen())
val cs = Vec(c.csWidth, pingen())
override def cloneType: this.type =
this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
}
class SPIPins[T <: Pin] (pingen: ()=> T, c: SPIParamsBase) extends SPISignals(pingen, c)