X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fgpio%2FGPIOPeriphery.scala;fp=src%2Fmain%2Fscala%2Fdevices%2Fgpio%2FGPIOPeriphery.scala;h=b7a479cddbbfd23377090aae52b7a17c788c2c57;hb=dacca7e7b127f5578373c8aa28195ae189d81e51;hp=38fd20ad8bdd2ee6bc7781fe1b8bc5afb4470ec4;hpb=27b00e177c2b4cd29234e556b3b6a0260d151431;p=sifive-blocks.git diff --git a/src/main/scala/devices/gpio/GPIOPeriphery.scala b/src/main/scala/devices/gpio/GPIOPeriphery.scala index 38fd20a..b7a479c 100644 --- a/src/main/scala/devices/gpio/GPIOPeriphery.scala +++ b/src/main/scala/devices/gpio/GPIOPeriphery.scala @@ -3,18 +3,14 @@ package sifive.blocks.devices.gpio import Chisel._ import config.Field -import diplomacy.LazyModule -import rocketchip.{ - HasTopLevelNetworks, - HasTopLevelNetworksBundle, - HasTopLevelNetworksModule -} +import diplomacy.{LazyModule,LazyMultiIOModuleImp} +import rocketchip.HasSystemNetworks import uncore.tilelink2.TLFragmenter import util.HeterogeneousBag case object PeripheryGPIOKey extends Field[Seq[GPIOParams]] -trait HasPeripheryGPIO extends HasTopLevelNetworks { +trait HasPeripheryGPIO extends HasSystemNetworks { val gpioParams = p(PeripheryGPIOKey) val gpio = gpioParams map {params => val gpio = LazyModule(new TLGPIO(peripheryBusBytes, params)) @@ -24,15 +20,15 @@ trait HasPeripheryGPIO extends HasTopLevelNetworks { } } -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 LazyMultiIOModuleImp 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.gpio) foreach { case (io, device) => io <> device.module.io.port } }