X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fgpio%2FGPIOPeriphery.scala;h=149f7074d03ed09bd9d54622c335b5fe022066f1;hb=4fcf349adb9e66ea7d8cc5394de5d3e0a2340985;hp=38fd20ad8bdd2ee6bc7781fe1b8bc5afb4470ec4;hpb=79f64de12cac914c0c195dc876f34adcaf15f7d5;p=sifive-blocks.git diff --git a/src/main/scala/devices/gpio/GPIOPeriphery.scala b/src/main/scala/devices/gpio/GPIOPeriphery.scala index 38fd20a..149f707 100644 --- a/src/main/scala/devices/gpio/GPIOPeriphery.scala +++ b/src/main/scala/devices/gpio/GPIOPeriphery.scala @@ -2,37 +2,32 @@ package sifive.blocks.devices.gpio import Chisel._ -import config.Field -import diplomacy.LazyModule -import rocketchip.{ - HasTopLevelNetworks, - HasTopLevelNetworksBundle, - HasTopLevelNetworksModule -} -import uncore.tilelink2.TLFragmenter -import util.HeterogeneousBag +import freechips.rocketchip.config.Field +import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus} +import freechips.rocketchip.diplomacy.{LazyModule,LazyModuleImp} +import freechips.rocketchip.util.HeterogeneousBag case object PeripheryGPIOKey extends Field[Seq[GPIOParams]] -trait HasPeripheryGPIO extends HasTopLevelNetworks { +trait HasPeripheryGPIO extends HasPeripheryBus with HasInterruptBus { val gpioParams = p(PeripheryGPIOKey) - val gpio = gpioParams map {params => - val gpio = LazyModule(new TLGPIO(peripheryBusBytes, params)) - gpio.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node) - intBus.intnode := gpio.intnode + val gpios = gpioParams map { params => + val gpio = LazyModule(new TLGPIO(pbus.beatBytes, params)) + gpio.node := pbus.toVariableWidthSlaves + ibus.fromSync := gpio.intnode gpio } } -trait HasPeripheryGPIOBundle extends HasTopLevelNetworksBundle { - val outer: HasPeripheryGPIO - val gpio = HeterogeneousBag(outer.gpioParams.map(new GPIOPortIO(_))) +trait HasPeripheryGPIOBundle { + val gpio: HeterogeneousBag[GPIOPortIO] } -trait HasPeripheryGPIOModule extends HasTopLevelNetworksModule { +trait HasPeripheryGPIOModuleImp extends LazyModuleImp with HasPeripheryGPIOBundle { val outer: HasPeripheryGPIO - val io: HasPeripheryGPIOBundle - (io.gpio zip outer.gpio) foreach { case (io, device) => + val gpio = IO(HeterogeneousBag(outer.gpioParams.map(new GPIOPortIO(_)))) + + (gpio zip outer.gpios) foreach { case (io, device) => io <> device.module.io.port } }