allow bundle content params to be specified via a def (#29)
This commit is contained in:
parent
fced2323bd
commit
015f87ec6b
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user