2017-07-23 17:31:04 +02:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
package freechips.rocketchip.coreplex
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import freechips.rocketchip.config.{Field, Parameters}
|
|
|
|
import freechips.rocketchip.diplomacy._
|
|
|
|
import freechips.rocketchip.tilelink._
|
|
|
|
|
2017-07-25 09:55:55 +02:00
|
|
|
import freechips.rocketchip.config.Field
|
|
|
|
|
2017-07-23 17:31:04 +02:00
|
|
|
case class PeripheryBusParams(
|
|
|
|
beatBytes: Int,
|
|
|
|
blockBytes: Int,
|
|
|
|
masterBuffering: BufferParams = BufferParams.default,
|
|
|
|
slaveBuffering: BufferParams = BufferParams.none,
|
2017-07-25 09:55:55 +02:00
|
|
|
arithmetic: Boolean = true,
|
|
|
|
frequency: BigInt = BigInt(100000000) // 100 MHz as default bus frequency
|
2017-07-23 17:31:04 +02:00
|
|
|
) extends TLBusParams {
|
|
|
|
}
|
|
|
|
|
|
|
|
case object PeripheryBusParams extends Field[PeripheryBusParams]
|
|
|
|
|
2017-08-31 01:21:08 +02:00
|
|
|
class PeripheryBus(params: PeripheryBusParams)(implicit p: Parameters) extends TLBusWrapper(params, "PeripheryBus") {
|
2017-08-08 02:30:24 +02:00
|
|
|
|
2017-07-23 17:31:04 +02:00
|
|
|
def toFixedWidthSingleBeatSlave(widthBytes: Int) = {
|
|
|
|
TLFragmenter(widthBytes, params.blockBytes)(outwardWWNode)
|
|
|
|
}
|
|
|
|
|
|
|
|
def toLargeBurstSlave(maxXferBytes: Int) = {
|
|
|
|
TLFragmenter(params.beatBytes, maxXferBytes)(outwardBufNode)
|
|
|
|
}
|
|
|
|
|
|
|
|
val fromSystemBus: TLInwardNode = {
|
|
|
|
val atomics = LazyModule(new TLAtomicAutomata(arithmetic = params.arithmetic))
|
|
|
|
inwardBufNode := atomics.node
|
|
|
|
atomics.node
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Provides buses that serve as attachment points,
|
|
|
|
* for use in traits that connect individual devices or external ports.
|
|
|
|
*/
|
|
|
|
trait HasPeripheryBus extends HasSystemBus {
|
|
|
|
private val pbusParams = p(PeripheryBusParams)
|
|
|
|
val pbusBeatBytes = pbusParams.beatBytes
|
|
|
|
|
|
|
|
val pbus = new PeripheryBus(pbusParams)
|
|
|
|
|
|
|
|
// The peripheryBus hangs off of systemBus; here we convert TL-UH -> TL-UL
|
|
|
|
pbus.fromSystemBus := sbus.toPeripheryBus
|
|
|
|
}
|