import freechips.rocketchip.util.SynchronizerShiftReg
import freechips.rocketchip.regmapper._
import freechips.rocketchip.tilelink._
-import freechips.rocketchip.util.{AsyncResetRegVec, GenericParameterizedBundle}
+import freechips.rocketchip.util.AsyncResetRegVec
case class GPIOParams(address: BigInt, width: Int, includeIOF: Boolean = false)
// level, and we have to do the pinmux
// outside of RocketChipTop.
-class GPIOPortIO(c: GPIOParams) extends GenericParameterizedBundle(c) {
+class GPIOPortIO(val c: GPIOParams) extends Bundle {
val pins = Vec(c.width, new EnhancedPin())
val iof_0 = if (c.includeIOF) Some(Vec(c.width, new IOFPin).flip) else None
val iof_1 = if (c.includeIOF) Some(Vec(c.width, new IOFPin).flip) else None
// 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, 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 {
import freechips.rocketchip.util.SyncResetSynchronizerShiftReg
import sifive.blocks.devices.pinctrl.{Pin, PinCtrl}
-class I2CSignals[T <: Data](pingen: () => T) extends Bundle {
-
+class I2CSignals[T <: Data](private val 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]
}
class I2CPins[T <: Pin](pingen: () => T) extends I2CSignals[T](pingen)
class PWMPortIO(val c: PWMParams) extends Bundle {
val port = Vec(c.ncmp, Bool()).asOutput
- override def cloneType: this.type = new PWMPortIO(c).asInstanceOf[this.type]
}
import Chisel._
import sifive.blocks.devices.pinctrl.{Pin}
-class PWMSignals[T <: Data] (pingen: ()=> T, val c: PWMParams) extends Bundle {
-
+class PWMSignals[T <: Data](private val 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]
}
-class PWMPins[T <: Pin] (pingen: ()=> T, c: PWMParams) extends PWMSignals[T](pingen, c)
+class PWMPins[T <: Pin](pingen: () => T, c: PWMParams) extends PWMSignals[T](pingen, c)
object PWMPinsFromPort {
def apply[T <: Pin] (pins: PWMSignals[T], port: PWMPortIO): Unit = {
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(val c: SPIParamsBase) extends Bundle
class SPIDataIO extends Bundle {
val i = Bool(INPUT)
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](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)
import freechips.rocketchip.util.SyncResetSynchronizerShiftReg
import sifive.blocks.devices.pinctrl.{Pin}
-class UARTSignals[T <: Data] (pingen: () => T) extends Bundle {
+class UARTSignals[T <: Data](private val pingen: () => T) extends Bundle {
val rxd = pingen()
val txd = pingen()
-
- override def cloneType: this.type =
- this.getClass.getConstructors.head.newInstance(pingen).asInstanceOf[this.type]
}
-class UARTPins[T <: Pin] (pingen: () => T) extends UARTSignals[T](pingen)
+class UARTPins[T <: Pin](pingen: () => T) extends UARTSignals[T](pingen)
object UARTPinsFromPort {
def apply[T <: Pin](pins: UARTSignals[T], uart: UARTPortIO, clock: Clock, reset: Bool, syncStages: Int = 0) {
import freechips.rocketchip.regmapper._
import freechips.rocketchip.util.WideCounter
-class SlaveRegIF(w: Int) extends Bundle {
+class SlaveRegIF(val w: Int) extends Bundle {
val write = Valid(UInt(width = w)).flip
val read = UInt(OUTPUT, w)
- override def cloneType: this.type = new SlaveRegIF(w).asInstanceOf[this.type]
-
def toRegField(dummy: Int = 0): RegField = {
def writeFn(valid: Bool, data: UInt): Bool = {
write.valid := valid