1
0
Fork 0

allow bundle content params to be specified via a def (#29)

This commit is contained in:
Henry Cook 2017-08-02 11:46:27 -07:00 committed by GitHub
parent fced2323bd
commit 015f87ec6b
3 changed files with 5 additions and 5 deletions

View File

@ -82,7 +82,7 @@ class GPIOPortIO(c: GPIOParams) extends GenericParameterizedBundle(c) {
// It would be better if the IOF were here and
// we could do the pinmux inside.
trait HasGPIOBundleContents extends Bundle {
val params: GPIOParams
def params: GPIOParams
val port = new GPIOPortIO(params)
}

View File

@ -44,7 +44,7 @@ case class PWMParams(
cmpWidth: Int = 16)
trait HasPWMBundleContents extends Bundle {
val params: PWMParams
def params: PWMParams
val gpio = Vec(params.ncmp, Bool()).asOutput
}

View File

@ -12,10 +12,10 @@ import sifive.blocks.util.ShiftRegisterInit
case object PeripheryUARTKey extends Field[Seq[UARTParams]]
trait HasPeripheryUART extends HasPeripheryBus with HasInterruptBus {
val uartParams = p(PeripheryUARTKey)
val divinit = (p(PeripheryBusParams).frequency / 115200).toInt
private val divinit = (p(PeripheryBusParams).frequency / 115200).toInt
val uartParams = p(PeripheryUARTKey).map(_.copy(divisorInit = divinit))
val uarts = uartParams map { params =>
val uart = LazyModule(new TLUART(pbus.beatBytes, params.copy(divisorInit = divinit)))
val uart = LazyModule(new TLUART(pbus.beatBytes, params))
uart.node := pbus.toVariableWidthSlaves
ibus.fromSync := uart.intnode
uart