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._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-10-16 01:29:49 +02:00
|
|
|
class ioRocket(implicit conf: RocketConfiguration) extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2012-10-19 02:26:03 +02:00
|
|
|
val host = new ioHTIF(conf.ntiles)
|
2012-11-06 08:52:32 +01:00
|
|
|
val imem = new IOCPUFrontend()(conf.icache)
|
|
|
|
val vimem = new IOCPUFrontend()(conf.icache)
|
|
|
|
val dmem = new ioHellaCache()(conf.dcache)
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-10-16 01:29:49 +02:00
|
|
|
class rocketProc(implicit conf: RocketConfiguration) extends Component
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2012-05-02 03:23:04 +02:00
|
|
|
val io = new ioRocket
|
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 11:55:45 +01:00
|
|
|
val ptw = Vec(0) { new IOTLBPTW }
|
|
|
|
val arb = new HellaCacheArbiter(DCACHE_PORTS)
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2012-02-26 07:05:30 +01:00
|
|
|
var vu: vu = null
|
|
|
|
if (HAVE_VEC)
|
|
|
|
{
|
|
|
|
vu = new vu()
|
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
val vdtlb = new rocketTLB(8)
|
|
|
|
vdtlb.io.invalidate := dpath.io.ptbr_wen
|
|
|
|
vdtlb.io.status := dpath.io.ctrl.status
|
|
|
|
ptw += vdtlb.io.ptw
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
vdtlb.io.cpu_req <> vu.io.vec_tlb_req
|
|
|
|
vu.io.vec_tlb_resp := vdtlb.io.cpu_resp
|
2012-03-18 23:06:39 +01:00
|
|
|
vu.io.vec_tlb_resp.xcpt_pf := Bool(false)
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
val pftlb = new rocketTLB(2)
|
|
|
|
pftlb.io.invalidate := dpath.io.ptbr_wen
|
|
|
|
pftlb.io.status := dpath.io.ctrl.status
|
|
|
|
pftlb.io.cpu_req <> vu.io.vec_pftlb_req
|
|
|
|
ptw += pftlb.io.ptw
|
2012-02-27 01:19:50 +01:00
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
vu.io.vec_pftlb_resp := pftlb.io.cpu_resp
|
2012-02-26 07:05:30 +01:00
|
|
|
vu.io.vec_pftlb_resp.xcpt_ld := Bool(false)
|
|
|
|
vu.io.vec_pftlb_resp.xcpt_st := Bool(false)
|
|
|
|
}
|
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
// connect DTLB to ctrl+dpath
|
|
|
|
val dtlb = new rocketTLB(DTLB_ENTRIES)
|
2012-02-26 07:05:30 +01:00
|
|
|
dtlb.io.invalidate := dpath.io.ptbr_wen
|
|
|
|
dtlb.io.status := dpath.io.ctrl.status
|
2012-11-06 11:55:45 +01:00
|
|
|
ptw += dtlb.io.ptw
|
|
|
|
|
|
|
|
dtlb.io.cpu_req.valid := ctrl.io.dtlb_val
|
|
|
|
dtlb.io.cpu_req.bits.kill := ctrl.io.dtlb_kill
|
|
|
|
dtlb.io.cpu_req.bits.cmd := ctrl.io.dmem.req.bits.cmd
|
|
|
|
dtlb.io.cpu_req.bits.asid := UFix(0)
|
|
|
|
dtlb.io.cpu_req.bits.vpn := dpath.io.dtlb.vpn
|
|
|
|
ctrl.io.xcpt_dtlb_ld := dtlb.io.cpu_resp.xcpt_ld
|
|
|
|
ctrl.io.xcpt_dtlb_st := dtlb.io.cpu_resp.xcpt_st
|
|
|
|
ctrl.io.dtlb_rdy := dtlb.io.cpu_req.ready
|
|
|
|
ctrl.io.dtlb_miss := dtlb.io.cpu_resp.miss
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2012-10-08 22:06:45 +02:00
|
|
|
arb.io.requestor(DCACHE_CPU).req.bits.ppn := dtlb.io.cpu_resp.ppn
|
2012-11-06 11:55:45 +01:00
|
|
|
|
|
|
|
ctrl.io.dpath <> dpath.io.ctrl
|
|
|
|
dpath.io.host <> io.host
|
|
|
|
|
2012-10-10 06:35:03 +02:00
|
|
|
ctrl.io.imem <> io.imem
|
|
|
|
dpath.io.imem <> io.imem
|
2011-11-12 03:48:34 +01:00
|
|
|
|
2012-11-06 11:55:45 +01:00
|
|
|
ctrl.io.dmem <> arb.io.requestor(DCACHE_CPU)
|
|
|
|
dpath.io.dmem <> arb.io.requestor(DCACHE_CPU)
|
2011-11-10 09:23:29 +01:00
|
|
|
|
2012-02-24 02:39:34 +01:00
|
|
|
var fpu: rocketFPU = null
|
2012-02-08 08:54:25 +01:00
|
|
|
if (HAVE_FPU)
|
|
|
|
{
|
2012-02-24 02:39:34 +01:00
|
|
|
fpu = new rocketFPU(4,6)
|
2012-02-08 08:54:25 +01:00
|
|
|
dpath.io.fpu <> fpu.io.dpath
|
2012-02-12 13:36:01 +01:00
|
|
|
ctrl.io.fpu <> fpu.io.ctrl
|
2012-02-08 08:54:25 +01:00
|
|
|
}
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-02-09 06:43:45 +01:00
|
|
|
if (HAVE_VEC)
|
|
|
|
{
|
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-10-10 06:35:03 +02:00
|
|
|
io.vimem.req.bits.status := dpath.io.ctrl.status
|
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
|
|
|
|
io.vimem.req.bits.invalidate := ctrl.io.dpath.flush_inst
|
|
|
|
io.vimem.req.bits.invalidateTLB := dpath.io.ptbr_wen
|
|
|
|
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-02-15 22:30:22 +01:00
|
|
|
// hooking up vector command queues
|
|
|
|
vu.io.vec_cmdq.valid := ctrl.io.vec_iface.vcmdq_valid
|
|
|
|
vu.io.vec_cmdq.bits := dpath.io.vec_iface.vcmdq_bits
|
|
|
|
vu.io.vec_ximm1q.valid := ctrl.io.vec_iface.vximm1q_valid
|
|
|
|
vu.io.vec_ximm1q.bits := dpath.io.vec_iface.vximm1q_bits
|
|
|
|
vu.io.vec_ximm2q.valid := ctrl.io.vec_iface.vximm2q_valid
|
|
|
|
vu.io.vec_ximm2q.bits := dpath.io.vec_iface.vximm2q_bits
|
2012-03-04 00:09:42 +01:00
|
|
|
vu.io.vec_cntq.valid := ctrl.io.vec_iface.vcntq_valid
|
2012-03-18 01:50:37 +01:00
|
|
|
vu.io.vec_cntq.bits := Cat(dpath.io.vec_iface.vcntq_last, dpath.io.vec_iface.vcntq_bits)
|
2012-02-15 22:30:22 +01:00
|
|
|
|
2012-02-24 09:44:13 +01:00
|
|
|
// prefetch queues
|
|
|
|
vu.io.vec_pfcmdq.valid := ctrl.io.vec_iface.vpfcmdq_valid
|
|
|
|
vu.io.vec_pfcmdq.bits := dpath.io.vec_iface.vcmdq_bits
|
|
|
|
vu.io.vec_pfximm1q.valid := ctrl.io.vec_iface.vpfximm1q_valid
|
|
|
|
vu.io.vec_pfximm1q.bits := dpath.io.vec_iface.vximm1q_bits
|
|
|
|
vu.io.vec_pfximm2q.valid := ctrl.io.vec_iface.vpfximm2q_valid
|
|
|
|
vu.io.vec_pfximm2q.bits := dpath.io.vec_iface.vximm2q_bits
|
2012-03-05 21:09:41 +01:00
|
|
|
vu.io.vec_pfcntq.valid := ctrl.io.vec_iface.vpfcntq_valid
|
|
|
|
vu.io.vec_pfcntq.bits := dpath.io.vec_iface.vcntq_bits
|
2012-02-24 09:44:13 +01:00
|
|
|
|
|
|
|
// don't have to use pf ready signals
|
|
|
|
// if cmdq is not a load or store
|
2012-02-15 22:30:22 +01:00
|
|
|
ctrl.io.vec_iface.vcmdq_ready := vu.io.vec_cmdq.ready
|
|
|
|
ctrl.io.vec_iface.vximm1q_ready := vu.io.vec_ximm1q.ready
|
|
|
|
ctrl.io.vec_iface.vximm2q_ready := vu.io.vec_ximm2q.ready
|
2012-03-04 00:09:42 +01:00
|
|
|
ctrl.io.vec_iface.vcntq_ready := vu.io.vec_cntq.ready
|
2012-02-24 09:44:13 +01:00
|
|
|
ctrl.io.vec_iface.vpfcmdq_ready := vu.io.vec_pfcmdq.ready
|
|
|
|
ctrl.io.vec_iface.vpfximm1q_ready := vu.io.vec_pfximm1q.ready
|
|
|
|
ctrl.io.vec_iface.vpfximm2q_ready := vu.io.vec_pfximm2q.ready
|
2012-03-05 21:09:41 +01:00
|
|
|
ctrl.io.vec_iface.vpfcntq_ready := vu.io.vec_pfcntq.ready
|
2012-03-04 00:09:42 +01:00
|
|
|
|
2012-03-12 05:38:47 +01:00
|
|
|
// user level vector command queue ready signals
|
|
|
|
ctrl.io.vec_iface.vcmdq_user_ready := vu.io.vec_cmdq_user_ready
|
|
|
|
ctrl.io.vec_iface.vximm1q_user_ready := vu.io.vec_ximm1q_user_ready
|
|
|
|
ctrl.io.vec_iface.vximm2q_user_ready := vu.io.vec_ximm2q_user_ready
|
|
|
|
|
2012-03-09 08:31:57 +01:00
|
|
|
// fences
|
|
|
|
ctrl.io.vec_iface.vfence_ready := vu.io.vec_fence_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-10-08 22:06:45 +02:00
|
|
|
arb.io.requestor(DCACHE_VU).req.valid := vu.io.dmem_req.valid
|
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.kill := vu.io.dmem_req.bits.kill
|
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.cmd := vu.io.dmem_req.bits.cmd
|
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.typ := vu.io.dmem_req.bits.typ
|
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.idx := vu.io.dmem_req.bits.idx
|
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.ppn := Reg(vu.io.dmem_req.bits.ppn)
|
2012-11-06 08:52:32 +01:00
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.data := Reg(StoreGen(vu.io.dmem_req.bits.typ, Bits(0), vu.io.dmem_req.bits.data).data)
|
2012-10-08 22:06:45 +02:00
|
|
|
arb.io.requestor(DCACHE_VU).req.bits.tag := vu.io.dmem_req.bits.tag
|
|
|
|
|
|
|
|
vu.io.dmem_req.ready := arb.io.requestor(DCACHE_VU).req.ready
|
|
|
|
vu.io.dmem_resp.valid := Reg(arb.io.requestor(DCACHE_VU).resp.valid)
|
|
|
|
vu.io.dmem_resp.bits.nack := arb.io.requestor(DCACHE_VU).resp.bits.nack
|
|
|
|
vu.io.dmem_resp.bits.data := arb.io.requestor(DCACHE_VU).resp.bits.data_subword
|
|
|
|
vu.io.dmem_resp.bits.tag := Reg(arb.io.requestor(DCACHE_VU).resp.bits.tag)
|
|
|
|
vu.io.dmem_resp.bits.typ := Reg(arb.io.requestor(DCACHE_VU).resp.bits.typ)
|
2012-02-24 02:39:34 +01:00
|
|
|
|
2012-02-25 04:22:35 +01:00
|
|
|
// share vector integer multiplier with rocket
|
|
|
|
dpath.io.vec_imul_req <> vu.io.cp_imul_req
|
|
|
|
dpath.io.vec_imul_resp <> vu.io.cp_imul_resp
|
|
|
|
|
2012-02-27 08:46:51 +01:00
|
|
|
// share sfma and dfma pipelines with rocket
|
2012-02-26 10:54:42 +01:00
|
|
|
fpu.io.sfma <> vu.io.cp_sfma
|
|
|
|
fpu.io.dfma <> vu.io.cp_dfma
|
2012-02-24 02:39:34 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-08 22:06:45 +02:00
|
|
|
arb.io.requestor(DCACHE_VU).req.valid := Bool(false)
|
2012-02-24 02:39:34 +01:00
|
|
|
if (HAVE_FPU)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
ptw += io.imem.ptw
|
|
|
|
val thePTW = new PTW(ptw.length)
|
|
|
|
thePTW.io.requestor <> ptw
|
|
|
|
thePTW.io.ptbr := dpath.io.ptbr;
|
|
|
|
arb.io.requestor(DCACHE_PTW) <> thePTW.io.mem
|
|
|
|
|
|
|
|
arb.io.mem <> io.dmem
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|