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._
|
|
|
|
import Node._
|
|
|
|
import Constants._
|
2012-02-09 06:43:45 +01:00
|
|
|
import hwacha._
|
2012-11-18 02:24:08 +01:00
|
|
|
import Util._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-01-07 22:38:59 +01:00
|
|
|
class RocketIO(implicit conf: RocketConfiguration) extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2013-03-01 06:03:37 +01:00
|
|
|
val host = new HTIFIO(conf.lnConf.nClients)
|
2013-01-07 22:38:59 +01:00
|
|
|
val imem = new CPUFrontendIO()(conf.icache)
|
|
|
|
val vimem = new CPUFrontendIO()(conf.icache)
|
|
|
|
val dmem = new HellaCacheIO()(conf.dcache)
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 17:13:44 +01:00
|
|
|
class Core(implicit conf: RocketConfiguration) extends Component
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2013-01-07 22:38:59 +01:00
|
|
|
val io = new RocketIO
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2012-11-06 08:52:32 +01:00
|
|
|
val ctrl = new Control
|
|
|
|
val dpath = new Datapath
|
2011-10-26 08:02:47 +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
|
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
val dmemArb = new HellaCacheArbiter(2 + conf.vec)
|
2012-11-06 17:13:44 +01:00
|
|
|
dmemArb.io.mem <> io.dmem
|
|
|
|
val dmem = dmemArb.io.requestor
|
|
|
|
dmem(1) <> ctrl.io.dmem
|
|
|
|
dmem(1) <> dpath.io.dmem
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2012-11-06 17:13:44 +01:00
|
|
|
val ptw = collection.mutable.ArrayBuffer(io.imem.ptw, io.dmem.ptw)
|
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
val fpu: FPU = if (conf.fpu) {
|
2012-11-06 17:13:44 +01:00
|
|
|
val fpu = new FPU(4,6)
|
|
|
|
dpath.io.fpu <> fpu.io.dpath
|
|
|
|
ctrl.io.fpu <> fpu.io.ctrl
|
|
|
|
fpu
|
|
|
|
} else null
|
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
if (conf.vec) {
|
2013-01-29 02:56:32 +01:00
|
|
|
val vu = new vu(Reg(reset))
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-11-07 08:53:52 +01:00
|
|
|
val vdtlb = new TLB(8)
|
2012-11-06 11:55:45 +01:00
|
|
|
ptw += vdtlb.io.ptw
|
2012-11-07 10:15:33 +01:00
|
|
|
vdtlb.io <> vu.io.vtlb
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-11-07 08:53:52 +01:00
|
|
|
val pftlb = new TLB(2)
|
2012-11-07 10:15:33 +01:00
|
|
|
pftlb.io <> vu.io.vpftlb
|
2012-11-06 11:55:45 +01:00
|
|
|
ptw += pftlb.io.ptw
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-02-15 22:30:22 +01:00
|
|
|
dpath.io.vec_ctrl <> ctrl.io.vec_dpath
|
|
|
|
|
|
|
|
// hooking up vector I$
|
2012-11-06 11:55:45 +01:00
|
|
|
ptw += io.vimem.ptw
|
2012-11-04 05:51:46 +01:00
|
|
|
io.vimem.req.bits.pc := vu.io.imem_req.bits
|
2012-10-10 06:35:03 +02:00
|
|
|
io.vimem.req.valid := vu.io.imem_req.valid
|
2012-11-16 10:55:45 +01:00
|
|
|
io.vimem.invalidate := ctrl.io.imem.invalidate
|
2012-10-10 06:35:03 +02:00
|
|
|
vu.io.imem_resp.valid := io.vimem.resp.valid
|
2012-11-04 05:51:46 +01:00
|
|
|
vu.io.imem_resp.bits.pc := io.vimem.resp.bits.pc
|
|
|
|
vu.io.imem_resp.bits.data := io.vimem.resp.bits.data
|
|
|
|
vu.io.imem_resp.bits.xcpt_ma := io.vimem.resp.bits.xcpt_ma
|
|
|
|
vu.io.imem_resp.bits.xcpt_if := io.vimem.resp.bits.xcpt_if
|
|
|
|
io.vimem.resp.ready := vu.io.imem_resp.ready
|
2012-10-10 06:35:03 +02:00
|
|
|
io.vimem.req.bits.mispredict := Bool(false)
|
|
|
|
io.vimem.req.bits.taken := Bool(false)
|
2012-02-15 08:34:57 +01:00
|
|
|
|
2012-11-07 10:15:33 +01:00
|
|
|
ctrl.io.vec_iface.vcmdq <> vu.io.vcmdq
|
|
|
|
ctrl.io.vec_iface.vximm1q <> vu.io.vximm1q
|
|
|
|
ctrl.io.vec_iface.vximm2q <> vu.io.vximm2q
|
|
|
|
ctrl.io.vec_iface.vcntq <> vu.io.vcntq
|
|
|
|
|
|
|
|
dpath.io.vec_iface.vcmdq <> vu.io.vcmdq
|
|
|
|
dpath.io.vec_iface.vximm1q <> vu.io.vximm1q
|
|
|
|
dpath.io.vec_iface.vximm2q <> vu.io.vximm2q
|
|
|
|
dpath.io.vec_iface.vcntq <> vu.io.vcntq
|
|
|
|
|
|
|
|
ctrl.io.vec_iface.vpfcmdq <> vu.io.vpfcmdq
|
|
|
|
ctrl.io.vec_iface.vpfximm1q <> vu.io.vpfximm1q
|
|
|
|
ctrl.io.vec_iface.vpfximm2q <> vu.io.vpfximm2q
|
|
|
|
ctrl.io.vec_iface.vpfcntq <> vu.io.vpfcntq
|
|
|
|
|
|
|
|
dpath.io.vec_iface.vpfcmdq <> vu.io.vpfcmdq
|
|
|
|
dpath.io.vec_iface.vpfximm1q <> vu.io.vpfximm1q
|
|
|
|
dpath.io.vec_iface.vpfximm2q <> vu.io.vpfximm2q
|
|
|
|
dpath.io.vec_iface.vpfcntq <> vu.io.vpfcntq
|
2012-03-04 00:09:42 +01:00
|
|
|
|
2012-03-12 05:38:47 +01:00
|
|
|
// user level vector command queue ready signals
|
2012-11-07 10:15:33 +01:00
|
|
|
ctrl.io.vec_iface.vcmdq_user_ready := vu.io.vcmdq_user_ready
|
|
|
|
ctrl.io.vec_iface.vximm1q_user_ready := vu.io.vximm1q_user_ready
|
|
|
|
ctrl.io.vec_iface.vximm2q_user_ready := vu.io.vximm2q_user_ready
|
2012-03-12 05:38:47 +01:00
|
|
|
|
2012-03-09 08:31:57 +01:00
|
|
|
// fences
|
2012-11-07 10:15:33 +01:00
|
|
|
ctrl.io.vec_iface.vfence_ready := vu.io.vfence_ready
|
2012-02-15 08:34:57 +01:00
|
|
|
|
2012-03-14 22:15:28 +01:00
|
|
|
// irqs
|
|
|
|
ctrl.io.vec_iface.irq := vu.io.irq
|
|
|
|
ctrl.io.vec_iface.irq_cause := vu.io.irq_cause
|
|
|
|
dpath.io.vec_iface.irq_aux := vu.io.irq_aux
|
|
|
|
|
2012-02-26 01:37:56 +01:00
|
|
|
// exceptions
|
2012-03-09 10:09:22 +01:00
|
|
|
vu.io.xcpt.exception := ctrl.io.vec_iface.exception
|
2012-03-14 07:45:10 +01:00
|
|
|
vu.io.xcpt.evac := ctrl.io.vec_iface.evac
|
|
|
|
vu.io.xcpt.evac_addr := dpath.io.vec_iface.evac_addr.toUFix
|
|
|
|
vu.io.xcpt.kill := ctrl.io.vec_iface.kill
|
|
|
|
vu.io.xcpt.hold := ctrl.io.vec_iface.hold
|
2012-02-26 01:37:56 +01:00
|
|
|
|
2012-02-15 22:30:22 +01:00
|
|
|
// hooking up vector memory interface
|
2012-11-20 10:32:33 +01:00
|
|
|
dmem(2).req.bits.data := RegEn(StoreGen(vu.io.dmem_req.bits).data, vu.io.dmem_req.valid && isWrite(vu.io.dmem_req.bits.cmd))
|
2012-11-17 19:52:10 +01:00
|
|
|
dmem(2).req <> vu.io.dmem_req
|
|
|
|
dmem(2).resp <> vu.io.dmem_resp
|
2012-02-24 02:39:34 +01:00
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
// DON'T share vector integer multiplier with rocket
|
|
|
|
vu.io.cp_imul_req.valid := Bool(false)
|
2012-02-25 04:22:35 +01:00
|
|
|
|
2012-02-27 08:46:51 +01:00
|
|
|
// share sfma and dfma pipelines with rocket
|
2012-11-18 02:24:08 +01:00
|
|
|
require(conf.fpu)
|
2012-02-26 10:54:42 +01:00
|
|
|
fpu.io.sfma <> vu.io.cp_sfma
|
|
|
|
fpu.io.dfma <> vu.io.cp_dfma
|
2012-11-18 02:24:08 +01:00
|
|
|
} else if (conf.fpu) {
|
2012-11-06 17:13:44 +01:00
|
|
|
fpu.io.sfma.valid := Bool(false)
|
|
|
|
fpu.io.dfma.valid := Bool(false)
|
2012-02-09 06:43:45 +01:00
|
|
|
}
|
2012-11-06 11:55:45 +01:00
|
|
|
|
|
|
|
val thePTW = new PTW(ptw.length)
|
2012-11-06 17:13:44 +01:00
|
|
|
ptw zip thePTW.io.requestor map { case (a, b) => a <> b }
|
|
|
|
thePTW.io.dpath <> dpath.io.ptw
|
|
|
|
dmem(0) <> thePTW.io.mem
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|