2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
2016-09-08 11:08:57 +02:00
|
|
|
|
|
|
|
package rocketchip
|
|
|
|
|
|
|
|
import Chisel._
|
2016-11-18 23:05:14 +01:00
|
|
|
import config._
|
2016-09-08 11:08:57 +02:00
|
|
|
import junctions._
|
2016-10-04 00:17:36 +02:00
|
|
|
import diplomacy._
|
2016-09-08 11:08:57 +02:00
|
|
|
import uncore.tilelink._
|
2016-09-15 03:09:27 +02:00
|
|
|
import uncore.tilelink2._
|
2016-09-11 08:39:29 +02:00
|
|
|
import uncore.devices._
|
2016-09-28 06:27:07 +02:00
|
|
|
import util._
|
2016-09-11 08:39:29 +02:00
|
|
|
import rocket._
|
2016-09-08 11:08:57 +02:00
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
/** BareTop is the root class for creating a top-level RTL module */
|
2016-12-02 02:46:52 +01:00
|
|
|
abstract class BareTop(implicit p: Parameters) extends LazyModule {
|
2017-02-03 04:24:55 +01:00
|
|
|
ElaborationArtefacts.add("graphml", graphML)
|
2016-10-29 06:56:11 +02:00
|
|
|
}
|
2016-09-15 09:38:46 +02:00
|
|
|
|
2016-12-02 02:46:52 +01:00
|
|
|
abstract class BareTopBundle[+L <: BareTop](_outer: L) extends GenericParameterizedBundle(_outer) {
|
2016-10-29 12:30:49 +02:00
|
|
|
val outer = _outer
|
2016-12-02 02:46:52 +01:00
|
|
|
implicit val p = outer.p
|
2016-10-29 12:30:49 +02:00
|
|
|
}
|
|
|
|
|
2016-11-23 00:01:45 +01:00
|
|
|
abstract class BareTopModule[+L <: BareTop, +B <: BareTopBundle[L]](_outer: L, _io: () => B) extends LazyModuleImp(_outer) {
|
2016-10-29 12:30:49 +02:00
|
|
|
val outer = _outer
|
|
|
|
val io = _io ()
|
2016-10-29 06:56:11 +02:00
|
|
|
}
|
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
/** HasTopLevelNetworks provides buses that will serve as attachment points,
|
|
|
|
* for use in sub-traits that connect individual agents or external ports.
|
|
|
|
*/
|
|
|
|
trait HasTopLevelNetworks extends HasPeripheryParameters {
|
|
|
|
val module: HasTopLevelNetworksModule
|
2016-11-16 03:27:52 +01:00
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
val socBus = LazyModule(new TLXbar) // Wide or unordered-access slave devices (TL-UH)
|
|
|
|
val peripheryBus = LazyModule(new TLXbar) // Narrow and ordered-access slave devices (TL-UL)
|
|
|
|
val intBus = LazyModule(new IntXbar) // Interrupts
|
2017-03-25 05:37:47 +01:00
|
|
|
val fsb = LazyModule(new TLBuffer) // Master devices talking to the frontside of the L2
|
|
|
|
val bsb = LazyModule(new TLBuffer) // Slave devices talking to the backside of the L2
|
2017-02-23 23:25:17 +01:00
|
|
|
val mem = Seq.fill(nMemoryChannels) { LazyModule(new TLXbar) } // Ports out to DRAM
|
2016-09-17 02:27:49 +02:00
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
// The peripheryBus hangs off of socBus;
|
|
|
|
// here we convert TL-UH -> TL-UL
|
2016-09-24 00:25:58 +02:00
|
|
|
peripheryBus.node :=
|
2017-01-17 20:57:23 +01:00
|
|
|
TLBuffer()(
|
2016-11-17 23:07:53 +01:00
|
|
|
TLWidthWidget(socBusConfig.beatBytes)(
|
|
|
|
TLAtomicAutomata(arithmetic = peripheryBusArithmetic)(
|
2017-01-17 20:57:23 +01:00
|
|
|
socBus.node)))
|
2016-09-11 08:39:29 +02:00
|
|
|
}
|
2016-09-08 11:08:57 +02:00
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
trait HasTopLevelNetworksBundle extends HasPeripheryParameters {
|
|
|
|
val outer: HasTopLevelNetworks
|
2016-09-08 11:08:57 +02:00
|
|
|
}
|
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
trait HasTopLevelNetworksModule extends HasPeripheryParameters {
|
|
|
|
val outer: HasTopLevelNetworks
|
|
|
|
val io: HasTopLevelNetworksBundle
|
2016-09-08 11:08:57 +02:00
|
|
|
}
|
2016-09-27 20:55:32 +02:00
|
|
|
|
2017-02-23 23:25:17 +01:00
|
|
|
/** Base Top class with no peripheral devices or ports added */
|
2016-11-23 00:01:45 +01:00
|
|
|
class BaseTop(implicit p: Parameters) extends BareTop
|
2017-02-23 23:25:17 +01:00
|
|
|
with HasTopLevelNetworks {
|
2016-10-29 12:30:49 +02:00
|
|
|
override lazy val module = new BaseTopModule(this, () => new BaseTopBundle(this))
|
2016-10-29 06:56:11 +02:00
|
|
|
}
|
|
|
|
|
2016-11-23 00:01:45 +01:00
|
|
|
class BaseTopBundle[+L <: BaseTop](_outer: L) extends BareTopBundle(_outer)
|
2017-02-23 23:25:17 +01:00
|
|
|
with HasTopLevelNetworksBundle
|
2016-10-29 06:56:11 +02:00
|
|
|
|
2016-11-23 00:01:45 +01:00
|
|
|
class BaseTopModule[+L <: BaseTop, +B <: BaseTopBundle[L]](_outer: L, _io: () => B) extends BareTopModule(_outer, _io)
|
2017-02-23 23:25:17 +01:00
|
|
|
with HasTopLevelNetworksModule
|