GPIO: Make GPIO peripheral another listable one
This commit is contained in:
parent
0ca609d324
commit
c89f163c0d
@ -11,22 +11,27 @@ import rocketchip.{
|
|||||||
}
|
}
|
||||||
import uncore.tilelink2.TLFragmenter
|
import uncore.tilelink2.TLFragmenter
|
||||||
|
|
||||||
case object PeripheryGPIOKey extends Field[GPIOParams]
|
case object PeripheryGPIOKey extends Field[Seq[GPIOParams]]
|
||||||
|
|
||||||
trait HasPeripheryGPIO extends HasTopLevelNetworks {
|
trait HasPeripheryGPIO extends HasTopLevelNetworks {
|
||||||
val gpioParams = p(PeripheryGPIOKey)
|
val gpioParams = p(PeripheryGPIOKey)
|
||||||
val gpio = LazyModule(new TLGPIO(peripheryBusBytes, gpioParams))
|
val gpio = gpioParams map {params =>
|
||||||
|
val gpio = LazyModule(new TLGPIO(peripheryBusBytes, params))
|
||||||
gpio.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
gpio.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)
|
||||||
intBus.intnode := gpio.intnode
|
intBus.intnode := gpio.intnode
|
||||||
|
gpio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait HasPeripheryGPIOBundle extends HasTopLevelNetworksBundle {
|
trait HasPeripheryGPIOBundle extends HasTopLevelNetworksBundle {
|
||||||
val outer: HasPeripheryGPIO
|
val outer: HasPeripheryGPIO
|
||||||
val gpio = new GPIOPortIO(outer.gpioParams)
|
val gpio = HeterogeneousBag(outer.gpioParams(map(new GPIOPortIO(_))))
|
||||||
}
|
}
|
||||||
|
|
||||||
trait HasPeripheryGPIOModule extends HasTopLevelNetworksModule {
|
trait HasPeripheryGPIOModule extends HasTopLevelNetworksModule {
|
||||||
val outer: HasPeripheryGPIO
|
val outer: HasPeripheryGPIO
|
||||||
val io: HasPeripheryGPIOBundle
|
val io: HasPeripheryGPIOBundle
|
||||||
io.gpio <> outer.gpio.module.io.port
|
(io.gpio zip outer.gpio) foreach { case (io, device) =>
|
||||||
|
io.gpio <> device.module.io.port
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user