2012-02-26 02:09:26 +01:00
|
|
|
package rocket
|
2012-02-15 22:30:22 +01:00
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import Node._
|
|
|
|
import Constants._
|
|
|
|
import Instructions._
|
|
|
|
|
|
|
|
class ioCtrlDpathVec extends Bundle
|
|
|
|
{
|
|
|
|
val valid = Bool(INPUT)
|
|
|
|
val inst = Bits(32, INPUT)
|
|
|
|
val appvl0 = Bool(INPUT)
|
|
|
|
val wen = Bool(OUTPUT)
|
|
|
|
val fn = Bits(1, OUTPUT)
|
|
|
|
val sel_vcmd = Bits(3, OUTPUT)
|
|
|
|
val sel_vimm = Bits(1, OUTPUT)
|
|
|
|
}
|
|
|
|
|
|
|
|
class ioCtrlVecInterface extends Bundle
|
|
|
|
{
|
|
|
|
val vcmdq_valid = Bool(OUTPUT)
|
|
|
|
val vcmdq_ready = Bool(INPUT)
|
|
|
|
val vximm1q_valid = Bool(OUTPUT)
|
|
|
|
val vximm1q_ready = Bool(INPUT)
|
|
|
|
val vximm2q_valid = Bool(OUTPUT)
|
|
|
|
val vximm2q_ready = Bool(INPUT)
|
2012-02-24 07:30:38 +01:00
|
|
|
|
|
|
|
val vpfcmdq_valid = Bool(OUTPUT)
|
|
|
|
val vpfcmdq_ready = Bool(INPUT)
|
|
|
|
val vpfximm1q_valid = Bool(OUTPUT)
|
|
|
|
val vpfximm1q_ready = Bool(INPUT)
|
|
|
|
val vpfximm2q_valid = Bool(OUTPUT)
|
|
|
|
val vpfximm2q_ready = Bool(INPUT)
|
|
|
|
|
2012-02-16 02:53:24 +01:00
|
|
|
val vackq_valid = Bool(INPUT)
|
|
|
|
val vackq_ready = Bool(OUTPUT)
|
2012-02-15 22:30:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class ioCtrlVec extends Bundle
|
|
|
|
{
|
|
|
|
val dpath = new ioCtrlDpathVec()
|
|
|
|
val iface = new ioCtrlVecInterface()
|
|
|
|
val sr_ev = Bool(INPUT)
|
2012-02-25 21:20:36 +01:00
|
|
|
val exception = Bool(INPUT)
|
2012-02-15 23:48:41 +01:00
|
|
|
val replay = Bool(OUTPUT)
|
2012-02-16 03:30:58 +01:00
|
|
|
val cpfence = Bool(OUTPUT)
|
2012-02-15 22:30:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class rocketCtrlVec extends Component
|
|
|
|
{
|
|
|
|
val io = new ioCtrlVec()
|
|
|
|
|
|
|
|
val veccs =
|
|
|
|
ListLookup(io.dpath.inst,
|
|
|
|
// appvlmask
|
|
|
|
// | vcmdq
|
2012-02-24 07:30:38 +01:00
|
|
|
// | | vximm1q
|
|
|
|
// | | | vximm2q
|
|
|
|
// | | | | vpfcmdq
|
|
|
|
// wen | | | | | vpximm1q
|
|
|
|
// val vcmd vimm | fn | | | | | | vpximm2q
|
|
|
|
// | | | | | | | | | | | | cpfence
|
|
|
|
// | | | | | | | | | | | | |
|
|
|
|
List(N,VCMD_X, VIMM_X, N,VEC_X ,N,N,N,N,N,N,N,N),Array(
|
2012-02-28 23:54:48 +01:00
|
|
|
VVCFGIVL-> List(Y,VCMD_I, VIMM_VLEN,Y,VEC_CFG,N,Y,Y,N,Y,Y,N,N),
|
|
|
|
VSETVL-> List(Y,VCMD_I, VIMM_VLEN,Y,VEC_VL ,N,Y,Y,N,Y,Y,N,N),
|
2012-02-24 07:30:38 +01:00
|
|
|
VF-> List(Y,VCMD_I, VIMM_ALU, N,VEC_X ,Y,Y,Y,N,N,N,N,N),
|
|
|
|
VMVV-> List(Y,VCMD_TX,VIMM_X, N,VEC_X ,Y,Y,N,N,N,N,N,N),
|
|
|
|
VMSV-> List(Y,VCMD_TX,VIMM_ALU, N,VEC_X ,Y,Y,Y,N,N,N,N,N),
|
|
|
|
VFMVV-> List(Y,VCMD_TF,VIMM_X, N,VEC_X ,Y,Y,N,N,N,N,N,N),
|
|
|
|
FENCE_L_V-> List(Y,VCMD_F, VIMM_X, N,VEC_X ,N,Y,N,N,N,N,N,N),
|
|
|
|
FENCE_G_V-> List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M_ALU, N,VEC_X ,Y,Y,Y,Y,Y,Y,Y,N),
|
|
|
|
VFSSTD-> List(Y,VCMD_MF,VIMM_ALU, N,VEC_X ,Y,Y,Y,Y,Y,Y,Y,N),
|
|
|
|
VFSSTW-> List(Y,VCMD_MF,VIMM_ALU, N,VEC_X ,Y,Y,Y,Y,Y,Y,Y,N)
|
2012-02-15 22:30:22 +01:00
|
|
|
))
|
|
|
|
|
|
|
|
val wb_vec_val :: wb_sel_vcmd :: wb_sel_vimm :: wb_vec_wen :: wb_vec_fn :: wb_vec_appvlmask :: veccs0 = veccs
|
2012-02-24 07:35:05 +01:00
|
|
|
val wb_vec_cmdq_enq :: wb_vec_ximm1q_enq :: wb_vec_ximm2q_enq :: veccs1 = veccs0
|
2012-02-24 07:30:38 +01:00
|
|
|
val wb_vec_pfcmdq_enq :: wb_vec_pfximm1q_enq :: wb_vec_pfximm2q_enq :: wb_vec_cpfence :: Nil = veccs1
|
2012-02-15 22:30:22 +01:00
|
|
|
|
|
|
|
val valid_common = io.dpath.valid && io.sr_ev && wb_vec_val.toBool && !(wb_vec_appvlmask.toBool && io.dpath.appvl0)
|
|
|
|
|
2012-02-15 23:48:41 +01:00
|
|
|
val mask_wb_vec_cmdq_ready = !wb_vec_cmdq_enq || io.iface.vcmdq_ready
|
|
|
|
val mask_wb_vec_ximm1q_ready = !wb_vec_ximm1q_enq || io.iface.vximm1q_ready
|
|
|
|
val mask_wb_vec_ximm2q_ready = !wb_vec_ximm2q_enq || io.iface.vximm2q_ready
|
2012-02-24 07:30:38 +01:00
|
|
|
val mask_wb_vec_pfcmdq_ready = !wb_vec_pfcmdq_enq || io.iface.vpfcmdq_ready
|
|
|
|
val mask_wb_vec_pfximm1q_ready = !wb_vec_pfximm1q_enq || io.iface.vpfximm1q_ready
|
|
|
|
val mask_wb_vec_pfximm2q_ready = !wb_vec_pfximm2q_enq || io.iface.vpfximm2q_ready
|
2012-02-15 22:30:22 +01:00
|
|
|
|
|
|
|
io.dpath.wen := wb_vec_wen.toBool
|
|
|
|
io.dpath.fn := wb_vec_fn
|
|
|
|
io.dpath.sel_vcmd := wb_sel_vcmd
|
|
|
|
io.dpath.sel_vimm := wb_sel_vimm
|
2012-02-15 23:48:41 +01:00
|
|
|
|
2012-02-24 07:30:38 +01:00
|
|
|
io.iface.vcmdq_valid :=
|
|
|
|
valid_common &&
|
|
|
|
wb_vec_cmdq_enq && mask_wb_vec_ximm1q_ready && mask_wb_vec_ximm2q_ready &&
|
2012-02-24 07:35:05 +01:00
|
|
|
mask_wb_vec_pfcmdq_ready && mask_wb_vec_pfximm1q_ready && mask_wb_vec_pfximm2q_ready
|
2012-02-24 07:30:38 +01:00
|
|
|
|
|
|
|
io.iface.vximm1q_valid :=
|
|
|
|
valid_common &&
|
|
|
|
mask_wb_vec_cmdq_ready && wb_vec_ximm1q_enq && mask_wb_vec_ximm2q_ready &&
|
2012-02-24 07:35:05 +01:00
|
|
|
mask_wb_vec_pfcmdq_ready && mask_wb_vec_pfximm1q_ready && mask_wb_vec_pfximm2q_ready
|
2012-02-24 07:30:38 +01:00
|
|
|
|
|
|
|
io.iface.vximm2q_valid :=
|
|
|
|
valid_common &&
|
|
|
|
mask_wb_vec_cmdq_ready && mask_wb_vec_ximm1q_ready && wb_vec_ximm2q_enq &&
|
2012-02-24 07:35:05 +01:00
|
|
|
mask_wb_vec_pfcmdq_ready && mask_wb_vec_pfximm1q_ready && mask_wb_vec_pfximm2q_ready
|
2012-02-24 07:30:38 +01:00
|
|
|
|
|
|
|
io.iface.vpfcmdq_valid :=
|
|
|
|
valid_common &&
|
|
|
|
mask_wb_vec_cmdq_ready && mask_wb_vec_ximm1q_ready && mask_wb_vec_ximm2q_ready &&
|
|
|
|
wb_vec_pfcmdq_enq && mask_wb_vec_pfximm1q_ready && mask_wb_vec_pfximm2q_ready
|
|
|
|
|
|
|
|
io.iface.vpfximm1q_valid :=
|
|
|
|
valid_common &&
|
|
|
|
mask_wb_vec_cmdq_ready && mask_wb_vec_ximm1q_ready && mask_wb_vec_ximm2q_ready &&
|
2012-02-24 07:35:05 +01:00
|
|
|
mask_wb_vec_pfcmdq_ready && wb_vec_pfximm1q_enq && mask_wb_vec_pfximm2q_ready
|
2012-02-24 07:30:38 +01:00
|
|
|
|
|
|
|
io.iface.vpfximm2q_valid :=
|
|
|
|
valid_common &&
|
|
|
|
mask_wb_vec_cmdq_ready && mask_wb_vec_ximm1q_ready && mask_wb_vec_ximm2q_ready &&
|
2012-02-24 07:35:05 +01:00
|
|
|
mask_wb_vec_pfcmdq_ready && mask_wb_vec_pfximm1q_ready && wb_vec_pfximm2q_enq
|
2012-02-15 23:48:41 +01:00
|
|
|
|
2012-02-25 21:20:36 +01:00
|
|
|
io.iface.vackq_ready := Bool(true)
|
|
|
|
|
2012-02-15 23:48:41 +01:00
|
|
|
io.replay := valid_common && (
|
|
|
|
wb_vec_cmdq_enq && !io.iface.vcmdq_ready ||
|
|
|
|
wb_vec_ximm1q_enq && !io.iface.vximm1q_ready ||
|
2012-02-24 07:30:38 +01:00
|
|
|
wb_vec_ximm2q_enq && !io.iface.vximm2q_ready ||
|
|
|
|
wb_vec_pfcmdq_enq && !io.iface.vpfcmdq_ready ||
|
|
|
|
wb_vec_pfximm1q_enq && !io.iface.vpfximm1q_ready ||
|
2012-02-24 07:35:05 +01:00
|
|
|
wb_vec_pfximm2q_enq && !io.iface.vpfximm2q_ready
|
2012-02-15 23:48:41 +01:00
|
|
|
)
|
2012-02-25 21:20:36 +01:00
|
|
|
|
|
|
|
val reg_cpfence = Reg(resetVal = Bool(false))
|
|
|
|
val do_cpfence = valid_common && wb_vec_cpfence && !io.replay
|
|
|
|
|
|
|
|
when (do_cpfence) { reg_cpfence := Bool(true) }
|
|
|
|
when (io.iface.vackq_valid || io.exception) { reg_cpfence := Bool(false) }
|
|
|
|
|
|
|
|
io.cpfence := reg_cpfence
|
2012-02-15 22:30:22 +01:00
|
|
|
}
|