Merge pull request #17 from sifive/peripheral_options
Make more peripherals "listable" to allow for 0 or more
This commit is contained in:
commit
27b00e177c
@ -10,23 +10,29 @@ import rocketchip.{
|
||||
HasTopLevelNetworksModule
|
||||
}
|
||||
import uncore.tilelink2.TLFragmenter
|
||||
import util.HeterogeneousBag
|
||||
|
||||
case object PeripheryGPIOKey extends Field[GPIOParams]
|
||||
case object PeripheryGPIOKey extends Field[Seq[GPIOParams]]
|
||||
|
||||
trait HasPeripheryGPIO extends HasTopLevelNetworks {
|
||||
val gpioParams = p(PeripheryGPIOKey)
|
||||
val gpio = LazyModule(new TLGPIO(peripheryBusBytes, gpioParams))
|
||||
gpio.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
||||
intBus.intnode := gpio.intnode
|
||||
val gpio = gpioParams map {params =>
|
||||
val gpio = LazyModule(new TLGPIO(peripheryBusBytes, params))
|
||||
gpio.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
||||
intBus.intnode := gpio.intnode
|
||||
gpio
|
||||
}
|
||||
}
|
||||
|
||||
trait HasPeripheryGPIOBundle extends HasTopLevelNetworksBundle {
|
||||
val outer: HasPeripheryGPIO
|
||||
val gpio = new GPIOPortIO(outer.gpioParams)
|
||||
val gpio = HeterogeneousBag(outer.gpioParams.map(new GPIOPortIO(_)))
|
||||
}
|
||||
|
||||
trait HasPeripheryGPIOModule extends HasTopLevelNetworksModule {
|
||||
val outer: HasPeripheryGPIO
|
||||
val io: HasPeripheryGPIOBundle
|
||||
io.gpio <> outer.gpio.module.io.port
|
||||
(io.gpio zip outer.gpio) foreach { case (io, device) =>
|
||||
io <> device.module.io.port
|
||||
}
|
||||
}
|
||||
|
@ -37,23 +37,30 @@ trait HasPeripherySPIModule extends HasTopLevelNetworksModule {
|
||||
}
|
||||
}
|
||||
|
||||
case object PeripherySPIFlashKey extends Field[SPIFlashParams]
|
||||
case object PeripherySPIFlashKey extends Field[Seq[SPIFlashParams]]
|
||||
|
||||
trait HasPeripherySPIFlash extends HasTopLevelNetworks {
|
||||
val spiFlashParams = p(PeripherySPIFlashKey)
|
||||
val qspi = LazyModule(new TLSPIFlash(peripheryBusBytes, spiFlashParams))
|
||||
qspi.rnode := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
||||
qspi.fnode := TLFragmenter(1, cacheBlockBytes)(TLWidthWidget(peripheryBusBytes)(peripheryBus.node))
|
||||
intBus.intnode := qspi.intnode
|
||||
val qspi = spiFlashParams map { params =>
|
||||
val qspi = LazyModule(new TLSPIFlash(peripheryBusBytes, params))
|
||||
qspi.rnode := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
||||
qspi.fnode := TLFragmenter(1, cacheBlockBytes)(TLWidthWidget(peripheryBusBytes)(peripheryBus.node))
|
||||
intBus.intnode := qspi.intnode
|
||||
qspi
|
||||
}
|
||||
}
|
||||
|
||||
trait HasPeripherySPIFlashBundle extends HasTopLevelNetworksBundle {
|
||||
val outer: HasPeripherySPIFlash
|
||||
val qspi = new SPIPortIO(outer.spiFlashParams)
|
||||
val qspi = HeterogeneousBag(outer.spiFlashParams.map(new SPIPortIO(_)))
|
||||
}
|
||||
|
||||
trait HasPeripherySPIFlashModule extends HasTopLevelNetworksModule {
|
||||
val outer: HasPeripherySPIFlash
|
||||
val io: HasPeripherySPIFlashBundle
|
||||
io.qspi <> outer.qspi.module.io.port
|
||||
|
||||
(io.qspi zip outer.qspi) foreach { case (io, device) =>
|
||||
io <> device.module.io.port
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user