2012-02-26 02:09:26 +01:00
|
|
|
package rocket
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-10-08 07:37:29 +02:00
|
|
|
import Chisel._
|
2012-11-18 02:24:08 +01:00
|
|
|
import Util._
|
2014-09-01 22:28:58 +02:00
|
|
|
import uncore._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2014-08-08 21:23:02 +02:00
|
|
|
case object BuildFPU extends Field[Option[() => FPU]]
|
2014-09-01 22:28:58 +02:00
|
|
|
case object XprLen extends Field[Int]
|
|
|
|
case object NMultXpr extends Field[Int]
|
|
|
|
case object RetireWidth extends Field[Int]
|
|
|
|
case object UseVM extends Field[Boolean]
|
|
|
|
case object FastLoadWord extends Field[Boolean]
|
|
|
|
case object FastLoadByte extends Field[Boolean]
|
|
|
|
case object FastMulDiv extends Field[Boolean]
|
|
|
|
case object CoreInstBits extends Field[Int]
|
|
|
|
case object CoreDataBits extends Field[Int]
|
|
|
|
case object CoreDCacheReqTagBits extends Field[Int]
|
|
|
|
|
|
|
|
abstract trait CoreParameters extends UsesParameters {
|
|
|
|
val xprLen = params(XprLen)
|
|
|
|
val coreInstBits = params(CoreInstBits)
|
|
|
|
val coreInstBytes = coreInstBits/8
|
|
|
|
val coreDataBits = xprLen
|
|
|
|
val coreDataBytes = coreDataBits/8
|
|
|
|
val coreDCacheReqTagBits = params(CoreDCacheReqTagBits)
|
|
|
|
val coreMaxAddrBits = math.max(params(PPNBits),params(VPNBits)+1) + params(PgIdxBits)
|
|
|
|
|
|
|
|
if(params(FastLoadByte)) require(params(FastLoadWord))
|
|
|
|
require(params(RetireWidth) == 1) // for now...
|
|
|
|
}
|
|
|
|
abstract class CoreBundle extends Bundle with CoreParameters
|
|
|
|
abstract class CoreModule extends Module with CoreParameters
|
2014-08-02 03:01:08 +02:00
|
|
|
|
2014-08-08 21:23:02 +02:00
|
|
|
class RocketIO extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2014-08-08 21:23:02 +02:00
|
|
|
val host = new HTIFIO
|
|
|
|
val imem = new CPUFrontendIO
|
|
|
|
val dmem = new HellaCacheIO
|
|
|
|
val ptw = new DatapathPTWIO().flip
|
2013-09-15 00:31:50 +02:00
|
|
|
val rocc = new RoCCInterface().flip
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2014-09-01 22:28:58 +02:00
|
|
|
class Core extends Module with CoreParameters
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2014-08-08 21:23:02 +02:00
|
|
|
val io = new RocketIO
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2014-08-08 21:23:02 +02:00
|
|
|
val ctrl = Module(new Control)
|
2013-08-12 19:39:11 +02:00
|
|
|
val dpath = Module(new Datapath)
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2014-09-01 22:28:58 +02:00
|
|
|
//If so specified, build an FPU module and wire it in
|
|
|
|
params(BuildFPU)
|
2014-09-08 02:54:41 +02:00
|
|
|
.map { bf => bf() }
|
2014-09-01 22:28:58 +02:00
|
|
|
.foreach { fpu =>
|
|
|
|
dpath.io.fpu <> fpu.io.dpath
|
|
|
|
ctrl.io.fpu <> fpu.io.ctrl
|
|
|
|
}
|
2013-09-15 00:31:50 +02:00
|
|
|
|
2012-11-06 17:13:44 +01:00
|
|
|
ctrl.io.dpath <> dpath.io.ctrl
|
|
|
|
dpath.io.host <> io.host
|
|
|
|
|
|
|
|
ctrl.io.imem <> io.imem
|
|
|
|
dpath.io.imem <> io.imem
|
|
|
|
|
2013-09-13 07:34:38 +02:00
|
|
|
ctrl.io.dmem <> io.dmem
|
|
|
|
dpath.io.dmem <> io.dmem
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2013-09-13 07:34:38 +02:00
|
|
|
dpath.io.ptw <> io.ptw
|
2012-11-06 17:13:44 +01:00
|
|
|
|
2013-09-15 00:31:50 +02:00
|
|
|
ctrl.io.rocc <> io.rocc
|
|
|
|
dpath.io.rocc <> io.rocc
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|