X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fspi%2FTLSPI.scala;h=ea28f8936be87b1d9dd9f5e169b088bdff2f78d6;hb=4fcf349adb9e66ea7d8cc5394de5d3e0a2340985;hp=b20b5246c3e5a813ee51e67f16d0712a56c6bede;hpb=64bff444622bf7a61a84ed6cdda8aa6ddd5119cf;p=sifive-blocks.git diff --git a/src/main/scala/devices/spi/TLSPI.scala b/src/main/scala/devices/spi/TLSPI.scala index b20b524..ea28f89 100644 --- a/src/main/scala/devices/spi/TLSPI.scala +++ b/src/main/scala/devices/spi/TLSPI.scala @@ -2,11 +2,11 @@ package sifive.blocks.devices.spi import Chisel._ -import config._ -import diplomacy._ -import regmapper._ -import uncore.tilelink2._ - +import freechips.rocketchip.config.Parameters +import freechips.rocketchip.diplomacy._ +import freechips.rocketchip.regmapper._ +import freechips.rocketchip.tilelink._ +import freechips.rocketchip.util.HeterogeneousBag import sifive.blocks.util.{NonBlockingEnqueue, NonBlockingDequeue} trait SPIParamsBase { @@ -47,15 +47,12 @@ case class SPIParams( require(sampleDelay >= 0) } -class SPITopBundle(val i: util.HeterogeneousBag[Vec[Bool]], val r: util.HeterogeneousBag[TLBundle]) extends Bundle - -class SPITopModule[B <: SPITopBundle](c: SPIParamsBase, bundle: => B, outer: TLSPIBase) +class SPITopModule(c: SPIParamsBase, outer: TLSPIBase) extends LazyModuleImp(outer) { - val io = new Bundle { + val io = IO(new Bundle { val port = new SPIPortIO(c) - val tl = bundle - } + }) val ctrl = Reg(init = SPIControl.init(c)) @@ -72,7 +69,8 @@ class SPITopModule[B <: SPITopBundle](c: SPIParamsBase, bundle: => B, outer: TLS val ie = Reg(init = new SPIInterrupts().fromBits(Bits(0))) val ip = fifo.io.ip - io.tl.i(0)(0) := (ip.txwm && ie.txwm) || (ip.rxwm && ie.rxwm) + val (io_int, _) = outer.intnode.out(0) + io_int(0) := (ip.txwm && ie.txwm) || (ip.rxwm && ie.rxwm) protected val regmapBase = Seq( SPICRs.sckdiv -> Seq(RegField(c.divisorBits, ctrl.sck.div)), @@ -110,12 +108,12 @@ class SPITopModule[B <: SPITopBundle](c: SPIParamsBase, bundle: => B, outer: TLS abstract class TLSPIBase(w: Int, c: SPIParamsBase)(implicit p: Parameters) extends LazyModule { require(isPow2(c.rSize)) val device = new SimpleDevice("spi", Seq("sifive,spi0")) - val rnode = TLRegisterNode(address = AddressSet(c.rAddress, c.rSize-1), device = device, beatBytes = w) + val rnode = TLRegisterNode(address = Seq(AddressSet(c.rAddress, c.rSize-1)), device = device, beatBytes = w) val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int)) } class TLSPI(w: Int, c: SPIParams)(implicit p: Parameters) extends TLSPIBase(w,c)(p) { - lazy val module = new SPITopModule(c, new SPITopBundle(intnode.bundleOut, rnode.bundleIn), this) { + lazy val module = new SPITopModule(c, this) { mac.io.link <> fifo.io.link rnode.regmap(regmapBase:_*) }