2012-02-26 02:09:26 +01:00
|
|
|
package rocket
|
2011-10-26 08:02:47 +02:00
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import Node._;
|
|
|
|
|
|
|
|
import Constants._
|
|
|
|
import Instructions._
|
2012-02-09 06:43:45 +01:00
|
|
|
import hwacha._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
class ioCtrlDpath extends Bundle()
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2011-11-02 01:59:27 +01:00
|
|
|
// outputs to datapath
|
2012-02-08 15:47:26 +01:00
|
|
|
val sel_pc = UFix(3, OUTPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val wen_btb = Bool(OUTPUT);
|
|
|
|
val clr_btb = Bool(OUTPUT);
|
|
|
|
val stallf = Bool(OUTPUT);
|
|
|
|
val stalld = Bool(OUTPUT);
|
|
|
|
val killf = Bool(OUTPUT);
|
|
|
|
val killd = Bool(OUTPUT);
|
|
|
|
val killx = Bool(OUTPUT);
|
|
|
|
val killm = Bool(OUTPUT);
|
|
|
|
val ren2 = Bool(OUTPUT);
|
|
|
|
val ren1 = Bool(OUTPUT);
|
2012-02-08 15:47:26 +01:00
|
|
|
val sel_alu2 = UFix(3, OUTPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val fn_dw = Bool(OUTPUT);
|
|
|
|
val fn_alu = UFix(4, OUTPUT);
|
|
|
|
val mul_val = Bool(OUTPUT);
|
|
|
|
val mul_fn = UFix(2, OUTPUT);
|
|
|
|
val div_val = Bool(OUTPUT);
|
|
|
|
val div_fn = UFix(2, OUTPUT);
|
|
|
|
val sel_wa = Bool(OUTPUT);
|
|
|
|
val sel_wb = UFix(3, OUTPUT);
|
2012-03-24 21:03:31 +01:00
|
|
|
val pcr = UFix(3, OUTPUT)
|
2012-01-18 19:28:48 +01:00
|
|
|
val id_eret = Bool(OUTPUT);
|
|
|
|
val wb_eret = Bool(OUTPUT);
|
|
|
|
val mem_load = Bool(OUTPUT);
|
2012-02-08 08:54:25 +01:00
|
|
|
val ex_fp_val= Bool(OUTPUT);
|
2012-02-12 13:36:01 +01:00
|
|
|
val mem_fp_val= Bool(OUTPUT);
|
2012-02-08 08:54:25 +01:00
|
|
|
val ex_wen = Bool(OUTPUT);
|
|
|
|
val mem_wen = Bool(OUTPUT);
|
|
|
|
val wb_wen = Bool(OUTPUT);
|
2012-02-23 23:43:49 +01:00
|
|
|
val wb_valid = Bool(OUTPUT)
|
2012-02-09 10:32:52 +01:00
|
|
|
val flush_inst = Bool(OUTPUT);
|
2012-02-12 10:35:55 +01:00
|
|
|
val ex_mem_type = UFix(3,OUTPUT)
|
2011-11-10 11:46:09 +01:00
|
|
|
// exception handling
|
2012-01-18 19:28:48 +01:00
|
|
|
val exception = Bool(OUTPUT);
|
2012-03-24 21:03:31 +01:00
|
|
|
val cause = UFix(6,OUTPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val badvaddr_wen = Bool(OUTPUT); // high for a load/store access fault
|
2012-03-14 22:15:28 +01:00
|
|
|
val vec_irq_aux_wen = Bool(OUTPUT)
|
2011-11-02 01:59:27 +01:00
|
|
|
// inputs from datapath
|
2012-01-18 19:28:48 +01:00
|
|
|
val xcpt_ma_inst = Bool(INPUT); // high on a misaligned/illegal virtual PC
|
|
|
|
val btb_hit = Bool(INPUT);
|
|
|
|
val inst = Bits(32, INPUT);
|
|
|
|
val br_eq = Bool(INPUT);
|
|
|
|
val br_lt = Bool(INPUT);
|
|
|
|
val br_ltu = Bool(INPUT);
|
|
|
|
val div_rdy = Bool(INPUT);
|
|
|
|
val div_result_val = Bool(INPUT);
|
|
|
|
val mul_rdy = Bool(INPUT);
|
|
|
|
val mul_result_val = Bool(INPUT);
|
2012-02-08 08:54:25 +01:00
|
|
|
val mem_wb = Bool(INPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val ex_waddr = UFix(5,INPUT); // write addr from execute stage
|
|
|
|
val mem_waddr = UFix(5,INPUT); // write addr from memory stage
|
|
|
|
val wb_waddr = UFix(5,INPUT); // write addr from writeback stage
|
2012-03-24 21:03:31 +01:00
|
|
|
val status = Bits(32, INPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val sboard_clr = Bool(INPUT);
|
|
|
|
val sboard_clra = UFix(5, INPUT);
|
2012-02-08 08:54:25 +01:00
|
|
|
val fp_sboard_clr = Bool(INPUT);
|
|
|
|
val fp_sboard_clra = UFix(5, INPUT);
|
2012-04-01 07:23:51 +02:00
|
|
|
val fp_sboard_wb_waddr = UFix(5, INPUT);
|
2012-01-18 19:28:48 +01:00
|
|
|
val irq_timer = Bool(INPUT);
|
|
|
|
val irq_ipi = Bool(INPUT);
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class ioCtrlAll extends Bundle()
|
|
|
|
{
|
|
|
|
val dpath = new ioCtrlDpath();
|
2012-03-02 05:48:46 +01:00
|
|
|
val imem = new ioImem(List("req_val", "resp_val")).flip
|
2012-05-02 03:23:04 +02:00
|
|
|
val dmem = new ioHellaCache
|
2012-01-18 19:28:48 +01:00
|
|
|
val dtlb_val = Bool(OUTPUT);
|
|
|
|
val dtlb_kill = Bool(OUTPUT);
|
|
|
|
val dtlb_rdy = Bool(INPUT);
|
|
|
|
val dtlb_miss = Bool(INPUT);
|
|
|
|
val xcpt_dtlb_ld = Bool(INPUT);
|
|
|
|
val xcpt_dtlb_st = Bool(INPUT);
|
|
|
|
val xcpt_itlb = Bool(INPUT);
|
2012-02-12 13:36:01 +01:00
|
|
|
val fpu = new ioCtrlFPU();
|
2012-02-15 22:30:22 +01:00
|
|
|
val vec_dpath = new ioCtrlDpathVec()
|
|
|
|
val vec_iface = new ioCtrlVecInterface()
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-03-09 08:31:57 +01:00
|
|
|
object rocketCtrlDecode
|
|
|
|
{
|
|
|
|
val xpr64 = Y;
|
|
|
|
|
|
|
|
val decode_default =
|
2012-05-02 05:16:36 +02:00
|
|
|
// eret
|
|
|
|
// fp_val renx2 | syscall
|
|
|
|
// | vec_val | renx1 mem_val mul_val div_val wen pcr | | privileged
|
|
|
|
// val | | brtype | | s_alu2 dw alu | mem_cmd mem_type| mul_fn | div_fn | s_wa s_wb | sync | | | replay_next
|
|
|
|
// | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
|
|
List(N, X,X,BR_X, X,X,A2_X, DW_X, FN_X, N,M_X, MT_X, X,MUL_X, X,DIV_X, X,WA_X, WB_X, PCR_X,SYNC_X,X,X,X,X)
|
2012-03-09 08:31:57 +01:00
|
|
|
|
|
|
|
val xdecode = Array(
|
2012-05-02 05:16:36 +02:00
|
|
|
// eret
|
|
|
|
// fp_val renx2 | syscall
|
|
|
|
// | vec_val | renx1 mem_val mul_val div_val wen pcr | | privileged
|
|
|
|
// val | | brtype | | s_alu2 dw alu | mem_cmd mem_type| mul_fn | div_fn | s_wa s_wb | sync | | | replay_next
|
|
|
|
// | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
|
|
BNE-> List(Y, N,N,BR_NE, Y,Y,A2_BTYPE,DW_X, FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
BEQ-> List(Y, N,N,BR_EQ, Y,Y,A2_BTYPE,DW_X, FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
BLT-> List(Y, N,N,BR_LT, Y,Y,A2_BTYPE,DW_X, FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
BLTU-> List(Y, N,N,BR_LTU,Y,Y,A2_BTYPE,DW_X, FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
BGE-> List(Y, N,N,BR_GE, Y,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
|
|
REMW-> List(xpr64,N,N,BR_N, Y,Y,A2_X, DW_32, FN_X, N,M_X, MT_X, N,MUL_X, Y,DIV_R, Y,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
REMUW-> List(xpr64,N,N,BR_N, Y,Y,A2_X, DW_32, FN_X, N,M_X, MT_X, N,MUL_X, Y,DIV_RU,Y,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
|
|
|
|
SYSCALL-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,Y,N,N),
|
|
|
|
SETPCR-> List(Y, N,N,BR_N, N,N,A2_ITYPE,DW_XPR,FN_OP2, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_ALU,PCR_S,SYNC_N,N,N,Y,Y),
|
|
|
|
CLEARPCR-> List(Y, N,N,BR_N, N,N,A2_ITYPE,DW_XPR,FN_OP2, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_ALU,PCR_C,SYNC_N,N,N,Y,Y),
|
|
|
|
ERET-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,Y,N,Y,N),
|
|
|
|
FENCE-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, Y,M_FENCE, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_D,N,N,N,N),
|
|
|
|
FENCE_I-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, Y,M_FLA, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_I,N,N,N,Y),
|
|
|
|
CFLUSH-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, Y,M_FLA, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,Y,Y),
|
|
|
|
MFPCR-> List(Y, N,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_X, PCR_F,SYNC_N,N,N,Y,Y),
|
|
|
|
MTPCR-> List(Y, N,N,BR_N, Y,N,A2_RTYPE,DW_XPR,FN_OP2, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_ALU,PCR_T,SYNC_N,N,N,Y,Y),
|
|
|
|
RDTIME-> List(Y, N,N,BR_N, N,N,A2_X, DW_XPR,FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_TSC,PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
RDCYCLE-> List(Y, N,N,BR_N, N,N,A2_X, DW_XPR,FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_TSC,PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
RDINSTRET-> List(Y, N,N,BR_N, N,N,A2_X, DW_XPR,FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_IRT,PCR_N,SYNC_N,N,N,N,N))
|
2012-03-09 08:31:57 +01:00
|
|
|
|
|
|
|
val fdecode = Array(
|
2012-05-02 05:16:36 +02:00
|
|
|
// eret
|
|
|
|
// fp_val renx2 | syscall
|
|
|
|
// | vec_val | renx1 mem_val mul_val div_val wen pcr | | privileged
|
|
|
|
// val | | brtype | | s_alu2 dw alu | mem_cmd mem_type| mul_fn | div_fn | s_wa s_wb | sync | | | replay_next
|
|
|
|
// | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
|
|
FCVT_S_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FCVT_D_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, M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,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMAX_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FADD_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FADD_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FSUB_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FSUB_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMUL_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMUL_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMADD_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMADD_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMSUB_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FMSUB_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FNMADD_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FNMADD_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FNMSUB_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FNMSUB_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
MFTX_S-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
MFTX_D-> List(FPU_Y,Y,N,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_X, PCR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X, PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FLW-> List(FPU_Y,Y,N,BR_N, N,Y,A2_ITYPE,DW_XPR,FN_ADD, Y,M_XRD, MT_W, N,MUL_X, N,DIV_X, N,WA_RD,WB_ALU,PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FLD-> List(FPU_Y,Y,N,BR_N, N,Y,A2_ITYPE,DW_XPR,FN_ADD, Y,M_XRD, MT_D, N,MUL_X, N,DIV_X, N,WA_RD,WB_ALU,PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FSW-> List(FPU_Y,Y,N,BR_N, N,Y,A2_BTYPE,DW_XPR,FN_ADD, Y,M_XWR, MT_W, N,MUL_X, N,DIV_X, N,WA_X, WB_ALU,PCR_N,SYNC_N,N,N,N,N),
|
|
|
|
FSD-> List(FPU_Y,Y,N,BR_N, N,Y,A2_BTYPE,DW_XPR,FN_ADD, Y,M_XWR, MT_D, N,MUL_X, N,DIV_X, N,WA_X, WB_ALU,PCR_N,SYNC_N,N,N,N,N))
|
2012-03-09 08:31:57 +01:00
|
|
|
|
|
|
|
val vdecode = Array(
|
2012-05-02 05:16:36 +02:00
|
|
|
// eret
|
|
|
|
// fp_val renx2 | syscall
|
|
|
|
// | vec_val | renx1 mem_val mul_val div_val wen pcr | | privileged
|
|
|
|
// val | | brtype | | s_alu2 dw alu | mem_cmd mem_type| mul_fn | div_fn | s_wa s_wb | sync | | | replay_next
|
|
|
|
// | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
|
|
VVCFGIVL-> List(VEC_Y,N,Y,BR_N, N,Y,A2_ZERO, DW_XPR,FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, Y,WA_RD,WB_ALU,PCR_N,SYNC_N,N,N,N,Y),
|
|
|
|
VVCFG-> List(VEC_Y,N,Y,BR_N, Y,Y,A2_ZERO, DW_XPR,FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_ALU,PCR_N,SYNC_N,N,N,N,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XCPTEVAC-> List(VEC_Y,N,Y,BR_N, N,Y,A2_ZERO, DW_XPR,FN_ADD, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_RD,WB_ALU,PCR_N,SYNC_N,N,N,Y,N),
|
|
|
|
VXCPTKILL-> List(VEC_Y,N,Y,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,Y,N),
|
|
|
|
VXCPTHOLD-> List(VEC_Y,N,Y,BR_N, N,N,A2_X, DW_X, FN_X, N,M_X, MT_X, N,MUL_X, N,DIV_X, N,WA_X, WB_X, PCR_N,SYNC_N,N,N,Y,N))
|
2012-03-09 08:31:57 +01:00
|
|
|
}
|
|
|
|
|
2011-10-26 08:02:47 +02:00
|
|
|
class rocketCtrl extends Component
|
|
|
|
{
|
|
|
|
val io = new ioCtrlAll();
|
2012-02-08 08:54:25 +01:00
|
|
|
|
2012-03-09 08:31:57 +01:00
|
|
|
var decode_table = rocketCtrlDecode.xdecode
|
|
|
|
if (HAVE_FPU) decode_table ++= rocketCtrlDecode.fdecode
|
|
|
|
if (HAVE_VEC) decode_table ++= rocketCtrlDecode.vdecode
|
|
|
|
|
2012-05-02 05:16:36 +02:00
|
|
|
val cs = DecodeLogic(io.dpath.inst, rocketCtrlDecode.decode_default, decode_table)
|
2012-02-09 06:43:45 +01:00
|
|
|
|
2012-05-02 05:16:36 +02:00
|
|
|
val id_int_val :: id_fp_val :: id_vec_val :: id_br_type :: id_renx2 :: id_renx1 :: id_sel_alu2 :: id_fn_dw :: id_fn_alu :: cs0 = cs
|
2012-02-09 06:43:45 +01:00
|
|
|
val id_mem_val :: id_mem_cmd :: id_mem_type :: id_mul_val :: id_mul_fn :: id_div_val :: id_div_fn :: id_wen :: id_sel_wa :: id_sel_wb :: cs1 = cs0
|
2012-03-27 23:48:30 +02:00
|
|
|
val id_pcr :: id_sync :: id_eret :: id_syscall :: id_privileged :: id_replay_next :: Nil = cs1
|
2012-02-09 06:43:45 +01:00
|
|
|
|
|
|
|
val if_reg_xcpt_ma_inst = Reg(io.dpath.xcpt_ma_inst, resetVal = Bool(false));
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-02-08 08:54:25 +01:00
|
|
|
val id_raddr3 = io.dpath.inst(16,12);
|
2011-10-26 08:02:47 +02:00
|
|
|
val id_raddr2 = io.dpath.inst(21,17);
|
|
|
|
val id_raddr1 = io.dpath.inst(26,22);
|
2012-01-02 09:25:11 +01:00
|
|
|
val id_waddr = Mux(id_sel_wa === WA_RA, RA, io.dpath.inst(31,27));
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2011-12-10 09:42:09 +01:00
|
|
|
val wb_reg_div_mul_val = Reg(resetVal = Bool(false))
|
2012-05-02 03:23:04 +02:00
|
|
|
val wb_reg_dcache_miss = Reg(io.dmem.resp.bits.miss || io.dmem.resp.bits.nack, resetVal = Bool(false));
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-02-23 23:43:49 +01:00
|
|
|
val id_reg_valid = Reg(resetVal = Bool(false));
|
2011-11-10 12:38:59 +01:00
|
|
|
val id_reg_btb_hit = Reg(resetVal = Bool(false));
|
|
|
|
val id_reg_xcpt_itlb = Reg(resetVal = Bool(false));
|
|
|
|
val id_reg_xcpt_ma_inst = Reg(resetVal = Bool(false));
|
2012-01-12 04:20:20 +01:00
|
|
|
val id_reg_icmiss = Reg(resetVal = Bool(false));
|
2012-01-18 06:12:31 +01:00
|
|
|
val id_reg_replay = Reg(resetVal = Bool(false));
|
2012-02-07 02:26:45 +01:00
|
|
|
val id_load_use = Wire(){Bool()};
|
2011-11-10 09:50:09 +01:00
|
|
|
|
2012-05-02 05:16:36 +02:00
|
|
|
val ex_reg_br_type = Reg(){Bits()}
|
2011-11-02 07:14:34 +01:00
|
|
|
val ex_reg_btb_hit = Reg(){Bool()};
|
2012-01-31 06:14:28 +01:00
|
|
|
val ex_reg_div_val = Reg(){Bool()};
|
|
|
|
val ex_reg_mul_val = Reg(){Bool()};
|
2011-11-02 07:14:34 +01:00
|
|
|
val ex_reg_mem_val = Reg(){Bool()};
|
2012-05-02 05:16:36 +02:00
|
|
|
val ex_reg_mem_cmd = Reg(){Bits()};
|
2011-11-02 07:14:34 +01:00
|
|
|
val ex_reg_mem_type = Reg(){UFix(width = 3)};
|
2012-02-23 23:43:49 +01:00
|
|
|
val ex_reg_valid = Reg(resetVal = Bool(false));
|
2012-03-24 21:03:31 +01:00
|
|
|
val ex_reg_pcr = Reg(resetVal = PCR_N);
|
2012-02-08 08:54:25 +01:00
|
|
|
val ex_reg_wen = Reg(resetVal = Bool(false));
|
|
|
|
val ex_reg_fp_wen = Reg(resetVal = Bool(false));
|
2011-11-02 07:14:34 +01:00
|
|
|
val ex_reg_eret = Reg(resetVal = Bool(false));
|
2011-11-14 13:13:13 +01:00
|
|
|
val ex_reg_flush_inst = Reg(resetVal = Bool(false));
|
2012-03-19 09:02:06 +01:00
|
|
|
val ex_reg_xcpt_interrupt = Reg(resetVal = Bool(false));
|
|
|
|
val ex_reg_cause = Reg(){UFix()}
|
2011-11-10 12:38:59 +01:00
|
|
|
val ex_reg_xcpt_ma_inst = Reg(resetVal = Bool(false));
|
2011-11-10 09:50:09 +01:00
|
|
|
val ex_reg_xcpt_itlb = Reg(resetVal = Bool(false));
|
|
|
|
val ex_reg_xcpt_illegal = Reg(resetVal = Bool(false));
|
|
|
|
val ex_reg_xcpt_privileged = Reg(resetVal = Bool(false));
|
|
|
|
val ex_reg_xcpt_syscall = Reg(resetVal = Bool(false));
|
2012-02-08 08:54:25 +01:00
|
|
|
val ex_reg_fp_val = Reg(resetVal = Bool(false));
|
2012-02-14 09:32:25 +01:00
|
|
|
val ex_reg_fp_sboard_set = Reg(resetVal = Bool(false));
|
2012-02-09 10:28:16 +01:00
|
|
|
val ex_reg_vec_val = Reg(resetVal = Bool(false));
|
2012-01-18 06:12:31 +01:00
|
|
|
val ex_reg_replay = Reg(resetVal = Bool(false));
|
2012-02-09 07:30:45 +01:00
|
|
|
val ex_reg_load_use = Reg(resetVal = Bool(false));
|
2011-11-10 12:38:59 +01:00
|
|
|
|
2012-02-23 23:43:49 +01:00
|
|
|
val mem_reg_valid = Reg(resetVal = Bool(false));
|
2012-03-24 21:03:31 +01:00
|
|
|
val mem_reg_pcr = Reg(resetVal = PCR_N);
|
2012-02-08 08:54:25 +01:00
|
|
|
val mem_reg_wen = Reg(resetVal = Bool(false));
|
|
|
|
val mem_reg_fp_wen = Reg(resetVal = Bool(false));
|
2011-11-14 13:13:13 +01:00
|
|
|
val mem_reg_flush_inst = Reg(resetVal = Bool(false));
|
2012-03-19 09:02:06 +01:00
|
|
|
val mem_reg_xcpt_interrupt = Reg(resetVal = Bool(false));
|
|
|
|
val mem_reg_cause = Reg(){UFix()}
|
2011-11-10 12:38:59 +01:00
|
|
|
val mem_reg_xcpt_ma_inst = Reg(resetVal = Bool(false));
|
2011-11-10 09:50:09 +01:00
|
|
|
val mem_reg_xcpt_itlb = Reg(resetVal = Bool(false));
|
|
|
|
val mem_reg_xcpt_illegal = Reg(resetVal = Bool(false));
|
|
|
|
val mem_reg_xcpt_privileged = Reg(resetVal = Bool(false));
|
2011-11-14 08:32:18 +01:00
|
|
|
val mem_reg_xcpt_fpu = Reg(resetVal = Bool(false));
|
2012-02-09 10:28:16 +01:00
|
|
|
val mem_reg_xcpt_vec = Reg(resetVal = Bool(false));
|
2011-11-10 09:50:09 +01:00
|
|
|
val mem_reg_xcpt_syscall = Reg(resetVal = Bool(false));
|
2012-02-12 13:36:01 +01:00
|
|
|
val mem_reg_fp_val = Reg(resetVal = Bool(false));
|
2011-12-10 04:42:58 +01:00
|
|
|
val mem_reg_replay = Reg(resetVal = Bool(false));
|
2012-01-12 23:19:18 +01:00
|
|
|
val mem_reg_kill = Reg(resetVal = Bool(false));
|
2012-02-14 09:32:25 +01:00
|
|
|
val mem_reg_fp_sboard_set = Reg(resetVal = Bool(false));
|
2011-11-14 13:13:13 +01:00
|
|
|
|
2012-02-23 23:43:49 +01:00
|
|
|
val wb_reg_valid = Reg(resetVal = Bool(false));
|
2012-03-24 21:03:31 +01:00
|
|
|
val wb_reg_pcr = Reg(resetVal = PCR_N);
|
2012-02-08 08:54:25 +01:00
|
|
|
val wb_reg_wen = Reg(resetVal = Bool(false));
|
|
|
|
val wb_reg_fp_wen = Reg(resetVal = Bool(false));
|
2012-01-27 05:36:31 +01:00
|
|
|
val wb_reg_flush_inst = Reg(resetVal = Bool(false));
|
2012-01-03 00:42:39 +01:00
|
|
|
val wb_reg_eret = Reg(resetVal = Bool(false));
|
|
|
|
val wb_reg_exception = Reg(resetVal = Bool(false));
|
2012-01-18 06:12:31 +01:00
|
|
|
val wb_reg_replay = Reg(resetVal = Bool(false));
|
2012-01-03 00:42:39 +01:00
|
|
|
val wb_reg_cause = Reg(){UFix()};
|
2012-02-13 05:12:53 +01:00
|
|
|
val wb_reg_fp_val = Reg(resetVal = Bool(false));
|
2012-02-14 09:32:25 +01:00
|
|
|
val wb_reg_fp_sboard_set = Reg(resetVal = Bool(false));
|
2012-01-03 00:42:39 +01:00
|
|
|
|
2012-03-19 09:02:06 +01:00
|
|
|
val take_pc = Wire(){Bool()}
|
|
|
|
val take_pc_wb = Wire(){Bool()}
|
2012-01-12 04:20:20 +01:00
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
when (!io.dpath.stalld) {
|
|
|
|
when (io.dpath.killf) {
|
2012-02-23 23:43:49 +01:00
|
|
|
id_reg_valid := Bool(false)
|
2012-02-12 02:20:33 +01:00
|
|
|
id_reg_btb_hit := Bool(false);
|
|
|
|
id_reg_xcpt_ma_inst := Bool(false);
|
|
|
|
id_reg_xcpt_itlb := Bool(false);
|
2012-02-24 01:49:46 +01:00
|
|
|
id_reg_replay := !take_pc; // replay on I$ miss
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
.otherwise{
|
2012-02-23 23:43:49 +01:00
|
|
|
id_reg_valid := Bool(true)
|
2012-02-12 02:20:33 +01:00
|
|
|
id_reg_btb_hit := io.dpath.btb_hit;
|
|
|
|
id_reg_xcpt_ma_inst := if_reg_xcpt_ma_inst;
|
|
|
|
id_reg_xcpt_itlb := io.xcpt_itlb;
|
2012-02-24 01:49:46 +01:00
|
|
|
id_reg_replay := id_replay_next
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
id_reg_icmiss := !io.imem.resp_val;
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2012-03-19 09:02:06 +01:00
|
|
|
|
|
|
|
var vec_replay = Bool(false)
|
|
|
|
var vec_stalld = Bool(false)
|
|
|
|
var vec_irq = Bool(false)
|
2012-03-24 21:03:31 +01:00
|
|
|
var vec_irq_cause = UFix(CAUSE_INTERRUPT+IRQ_IPI) // don't care
|
2012-03-19 09:02:06 +01:00
|
|
|
if (HAVE_VEC)
|
|
|
|
{
|
|
|
|
// vector control
|
|
|
|
val vec = new rocketCtrlVec()
|
|
|
|
|
|
|
|
io.vec_dpath <> vec.io.dpath
|
|
|
|
io.vec_iface <> vec.io.iface
|
|
|
|
|
2012-03-21 01:09:54 +01:00
|
|
|
vec.io.valid := wb_reg_valid
|
2012-03-19 09:02:06 +01:00
|
|
|
vec.io.s := io.dpath.status(SR_S)
|
|
|
|
vec.io.sr_ev := io.dpath.status(SR_EV)
|
|
|
|
vec.io.exception := wb_reg_exception
|
|
|
|
vec.io.eret := wb_reg_eret
|
|
|
|
|
2012-03-21 23:08:48 +01:00
|
|
|
val vec_dec = new rocketCtrlVecDecoder()
|
|
|
|
vec_dec.io.inst := io.dpath.inst
|
|
|
|
|
|
|
|
val s = io.dpath.status(SR_S)
|
|
|
|
val mask_cmdq_ready = !vec_dec.io.sigs.enq_cmdq || s && io.vec_iface.vcmdq_ready || !s && io.vec_iface.vcmdq_user_ready
|
|
|
|
val mask_ximm1q_ready = !vec_dec.io.sigs.enq_ximm1q || s && io.vec_iface.vximm1q_ready || !s && io.vec_iface.vximm1q_user_ready
|
|
|
|
val mask_ximm2q_ready = !vec_dec.io.sigs.enq_ximm2q || s && io.vec_iface.vximm2q_ready || !s && io.vec_iface.vximm2q_user_ready
|
|
|
|
val mask_cntq_ready = !vec_dec.io.sigs.enq_cntq || io.vec_iface.vcntq_ready
|
|
|
|
val mask_pfcmdq_ready = !vec_dec.io.sigs.enq_pfcmdq || io.vec_iface.vpfcmdq_ready
|
|
|
|
val mask_pfximm1q_ready = !vec_dec.io.sigs.enq_pfximm1q || io.vec_iface.vpfximm1q_ready
|
|
|
|
val mask_pfximm2q_ready = !vec_dec.io.sigs.enq_pfximm2q || io.vec_iface.vpfximm2q_ready
|
|
|
|
val mask_pfcntq_ready = !vec_dec.io.sigs.enq_pfcntq || io.vec_iface.vpfcntq_ready
|
|
|
|
|
|
|
|
vec_stalld =
|
2012-05-02 05:16:36 +02:00
|
|
|
id_vec_val && (
|
2012-03-21 23:08:48 +01:00
|
|
|
!mask_cmdq_ready || !mask_ximm1q_ready || !mask_ximm2q_ready || !mask_cntq_ready ||
|
2012-05-02 05:16:36 +02:00
|
|
|
!mask_pfcmdq_ready || !mask_pfximm1q_ready || !mask_pfximm2q_ready || !mask_pfcntq_ready ||
|
|
|
|
vec_dec.io.sigs.vfence && !vec.io.vfence_ready)
|
2012-03-21 23:08:48 +01:00
|
|
|
|
2012-03-19 09:02:06 +01:00
|
|
|
vec_replay = vec.io.replay
|
|
|
|
vec_irq = vec.io.irq
|
|
|
|
vec_irq_cause = vec.io.irq_cause
|
|
|
|
}
|
2011-11-02 01:59:27 +01:00
|
|
|
|
2012-05-02 05:16:36 +02:00
|
|
|
// executing ERET when traps are enabled causes an illegal instruction exception
|
|
|
|
val illegal_inst = !id_int_val.toBool || (id_eret.toBool && io.dpath.status(SR_ET))
|
2012-03-19 09:02:06 +01:00
|
|
|
|
2012-03-24 21:03:31 +01:00
|
|
|
val p_irq_timer = (io.dpath.status(SR_IM+IRQ_TIMER).toBool && io.dpath.irq_timer);
|
|
|
|
val p_irq_ipi = (io.dpath.status(SR_IM+IRQ_IPI).toBool && io.dpath.irq_ipi);
|
2012-03-19 09:02:06 +01:00
|
|
|
val id_interrupt =
|
2012-03-19 23:13:57 +01:00
|
|
|
io.dpath.status(SR_ET).toBool &&
|
2012-03-24 21:03:31 +01:00
|
|
|
((io.dpath.status(SR_IM+IRQ_TIMER).toBool && io.dpath.irq_timer) ||
|
|
|
|
(io.dpath.status(SR_IM+IRQ_IPI).toBool && io.dpath.irq_ipi) ||
|
2012-03-19 09:02:06 +01:00
|
|
|
vec_irq);
|
|
|
|
val id_cause =
|
2012-03-24 21:03:31 +01:00
|
|
|
Mux(p_irq_ipi, UFix(CAUSE_INTERRUPT+IRQ_IPI,6),
|
2012-05-15 07:25:12 +02:00
|
|
|
Mux(p_irq_timer, UFix(CAUSE_INTERRUPT+IRQ_TIMER,6),
|
2012-03-19 09:02:06 +01:00
|
|
|
vec_irq_cause))
|
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
when (reset.toBool || io.dpath.killd) {
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_br_type := BR_N;
|
|
|
|
ex_reg_btb_hit := Bool(false);
|
|
|
|
ex_reg_div_val := Bool(false);
|
|
|
|
ex_reg_mul_val := Bool(false);
|
|
|
|
ex_reg_mem_val := Bool(false);
|
2012-02-23 23:43:49 +01:00
|
|
|
ex_reg_valid := Bool(false);
|
2012-03-24 21:03:31 +01:00
|
|
|
ex_reg_pcr := PCR_N
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_wen := Bool(false);
|
|
|
|
ex_reg_fp_wen := Bool(false);
|
|
|
|
ex_reg_eret := Bool(false);
|
|
|
|
ex_reg_flush_inst := Bool(false);
|
|
|
|
ex_reg_xcpt_ma_inst := Bool(false);
|
|
|
|
ex_reg_xcpt_itlb := Bool(false);
|
|
|
|
ex_reg_xcpt_illegal := Bool(false);
|
|
|
|
ex_reg_xcpt_privileged := Bool(false);
|
|
|
|
ex_reg_xcpt_syscall := Bool(false);
|
|
|
|
ex_reg_fp_val := Bool(false);
|
2012-02-14 09:32:25 +01:00
|
|
|
ex_reg_fp_sboard_set := Bool(false);
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_vec_val := Bool(false);
|
|
|
|
ex_reg_replay := Bool(false);
|
|
|
|
ex_reg_load_use := Bool(false);
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
.otherwise {
|
|
|
|
ex_reg_br_type := id_br_type;
|
|
|
|
ex_reg_btb_hit := id_reg_btb_hit;
|
|
|
|
ex_reg_div_val := id_div_val.toBool && id_waddr != UFix(0);
|
|
|
|
ex_reg_mul_val := id_mul_val.toBool && id_waddr != UFix(0);
|
|
|
|
ex_reg_mem_val := id_mem_val.toBool;
|
2012-02-23 23:43:49 +01:00
|
|
|
ex_reg_valid := id_reg_valid
|
2012-03-24 21:03:31 +01:00
|
|
|
ex_reg_pcr := id_pcr
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_wen := id_wen.toBool && id_waddr != UFix(0);
|
2012-05-02 05:16:36 +02:00
|
|
|
ex_reg_fp_wen := id_fp_val && io.fpu.dec.wen
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_eret := id_eret.toBool;
|
|
|
|
ex_reg_flush_inst := (id_sync === SYNC_I);
|
|
|
|
ex_reg_xcpt_ma_inst := id_reg_xcpt_ma_inst;
|
|
|
|
ex_reg_xcpt_itlb := id_reg_xcpt_itlb;
|
|
|
|
ex_reg_xcpt_illegal := illegal_inst;
|
|
|
|
ex_reg_xcpt_privileged := (id_privileged & ~io.dpath.status(SR_S)).toBool;
|
|
|
|
ex_reg_xcpt_syscall := id_syscall.toBool;
|
2012-05-02 05:16:36 +02:00
|
|
|
ex_reg_fp_val := id_fp_val
|
2012-02-14 09:32:25 +01:00
|
|
|
ex_reg_fp_sboard_set := io.fpu.dec.sboard
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_vec_val := id_vec_val.toBool
|
2012-02-24 01:49:46 +01:00
|
|
|
ex_reg_replay := id_reg_replay
|
2012-02-12 02:20:33 +01:00
|
|
|
ex_reg_load_use := id_load_use;
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2012-02-27 03:53:39 +01:00
|
|
|
ex_reg_mem_cmd := id_mem_cmd
|
|
|
|
ex_reg_mem_type := id_mem_type.toUFix
|
2012-03-19 09:02:06 +01:00
|
|
|
ex_reg_xcpt_interrupt := id_reg_valid && id_interrupt && !take_pc
|
|
|
|
ex_reg_cause := id_cause
|
2012-02-24 10:42:33 +01:00
|
|
|
|
2011-10-26 08:02:47 +02:00
|
|
|
val beq = io.dpath.br_eq;
|
|
|
|
val bne = ~io.dpath.br_eq;
|
|
|
|
val blt = io.dpath.br_lt;
|
|
|
|
val bltu = io.dpath.br_ltu;
|
|
|
|
val bge = ~io.dpath.br_lt;
|
|
|
|
val bgeu = ~io.dpath.br_ltu;
|
|
|
|
|
2012-03-19 11:08:53 +01:00
|
|
|
val br_taken = !(wb_reg_dcache_miss && ex_reg_load_use) &&
|
|
|
|
((ex_reg_br_type === BR_EQ) && beq ||
|
|
|
|
(ex_reg_br_type === BR_NE) && bne ||
|
|
|
|
(ex_reg_br_type === BR_LT) && blt ||
|
|
|
|
(ex_reg_br_type === BR_LTU) && bltu ||
|
|
|
|
(ex_reg_br_type === BR_GE) && bge ||
|
|
|
|
(ex_reg_br_type === BR_GEU) && bgeu ||
|
|
|
|
(ex_reg_br_type === BR_J)) // treat J/JAL like taken branches
|
|
|
|
val jr_taken = !(wb_reg_dcache_miss && ex_reg_load_use) && ex_reg_br_type === BR_JR
|
2011-11-02 07:14:34 +01:00
|
|
|
|
|
|
|
val mem_reg_div_mul_val = Reg(){Bool()};
|
2011-11-02 21:32:32 +01:00
|
|
|
val mem_reg_eret = Reg(){Bool()};
|
2011-11-02 07:14:34 +01:00
|
|
|
val mem_reg_mem_val = Reg(){Bool()};
|
2012-05-02 05:16:36 +02:00
|
|
|
val mem_reg_mem_cmd = Reg(){Bits()}
|
|
|
|
val mem_reg_mem_type = Reg(){Bits()}
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
when (reset.toBool || io.dpath.killx) {
|
2012-02-23 23:43:49 +01:00
|
|
|
mem_reg_valid := Bool(false);
|
2012-03-24 21:03:31 +01:00
|
|
|
mem_reg_pcr := PCR_N
|
2012-02-12 02:20:33 +01:00
|
|
|
mem_reg_div_mul_val := Bool(false);
|
|
|
|
mem_reg_wen := Bool(false);
|
|
|
|
mem_reg_fp_wen := Bool(false);
|
|
|
|
mem_reg_eret := Bool(false);
|
|
|
|
mem_reg_mem_val := Bool(false);
|
|
|
|
mem_reg_flush_inst := Bool(false);
|
|
|
|
mem_reg_xcpt_ma_inst := Bool(false);
|
|
|
|
mem_reg_xcpt_itlb := Bool(false);
|
|
|
|
mem_reg_xcpt_illegal := Bool(false);
|
|
|
|
mem_reg_xcpt_privileged := Bool(false);
|
|
|
|
mem_reg_xcpt_fpu := Bool(false);
|
|
|
|
mem_reg_xcpt_vec := Bool(false);
|
|
|
|
mem_reg_xcpt_syscall := Bool(false);
|
2012-02-12 13:36:01 +01:00
|
|
|
mem_reg_fp_val := Bool(false);
|
2012-02-14 09:32:25 +01:00
|
|
|
mem_reg_fp_sboard_set := Bool(false)
|
2011-11-02 01:59:27 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
.otherwise {
|
2012-02-23 23:43:49 +01:00
|
|
|
mem_reg_valid := ex_reg_valid
|
2012-03-24 21:03:31 +01:00
|
|
|
mem_reg_pcr := ex_reg_pcr
|
2012-02-12 02:20:33 +01:00
|
|
|
mem_reg_div_mul_val := ex_reg_div_val || ex_reg_mul_val;
|
|
|
|
mem_reg_wen := ex_reg_wen;
|
|
|
|
mem_reg_fp_wen := ex_reg_fp_wen;
|
|
|
|
mem_reg_eret := ex_reg_eret;
|
|
|
|
mem_reg_mem_val := ex_reg_mem_val;
|
|
|
|
mem_reg_flush_inst := ex_reg_flush_inst;
|
|
|
|
mem_reg_xcpt_ma_inst := ex_reg_xcpt_ma_inst;
|
|
|
|
mem_reg_xcpt_itlb := ex_reg_xcpt_itlb;
|
2012-02-13 10:30:01 +01:00
|
|
|
mem_reg_xcpt_illegal := ex_reg_xcpt_illegal || ex_reg_fp_val && io.fpu.illegal_rm;
|
2012-02-12 02:20:33 +01:00
|
|
|
mem_reg_xcpt_privileged := ex_reg_xcpt_privileged;
|
|
|
|
mem_reg_xcpt_fpu := ex_reg_fp_val && !io.dpath.status(SR_EF).toBool;
|
|
|
|
mem_reg_xcpt_vec := ex_reg_vec_val && !io.dpath.status(SR_EV).toBool;
|
|
|
|
mem_reg_xcpt_syscall := ex_reg_xcpt_syscall;
|
2012-02-12 13:36:01 +01:00
|
|
|
mem_reg_fp_val := ex_reg_fp_val
|
2012-02-14 09:32:25 +01:00
|
|
|
mem_reg_fp_sboard_set := ex_reg_fp_sboard_set
|
2011-11-02 01:59:27 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
mem_reg_mem_cmd := ex_reg_mem_cmd;
|
|
|
|
mem_reg_mem_type := ex_reg_mem_type;
|
2012-03-19 09:02:06 +01:00
|
|
|
mem_reg_xcpt_interrupt := ex_reg_xcpt_interrupt && !take_pc_wb
|
|
|
|
mem_reg_cause := ex_reg_cause
|
2012-01-03 00:42:39 +01:00
|
|
|
|
|
|
|
when (io.dpath.killm) {
|
2012-02-23 23:43:49 +01:00
|
|
|
wb_reg_valid := Bool(false)
|
2012-03-24 21:03:31 +01:00
|
|
|
wb_reg_pcr := PCR_N
|
2012-02-12 02:20:33 +01:00
|
|
|
wb_reg_wen := Bool(false);
|
|
|
|
wb_reg_fp_wen := Bool(false);
|
|
|
|
wb_reg_eret := Bool(false);
|
|
|
|
wb_reg_flush_inst := Bool(false);
|
|
|
|
wb_reg_div_mul_val := Bool(false);
|
2012-02-13 05:12:53 +01:00
|
|
|
wb_reg_fp_val := Bool(false)
|
2012-02-14 09:32:25 +01:00
|
|
|
wb_reg_fp_sboard_set := Bool(false)
|
2012-01-03 00:42:39 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
.otherwise {
|
2012-02-23 23:43:49 +01:00
|
|
|
wb_reg_valid := mem_reg_valid
|
2012-03-24 21:03:31 +01:00
|
|
|
wb_reg_pcr := mem_reg_pcr
|
2012-02-12 02:20:33 +01:00
|
|
|
wb_reg_wen := mem_reg_wen;
|
|
|
|
wb_reg_fp_wen := mem_reg_fp_wen;
|
|
|
|
wb_reg_eret := mem_reg_eret;
|
|
|
|
wb_reg_flush_inst := mem_reg_flush_inst;
|
|
|
|
wb_reg_div_mul_val := mem_reg_div_mul_val;
|
2012-02-13 05:12:53 +01:00
|
|
|
wb_reg_fp_val := mem_reg_fp_val
|
2012-02-14 09:32:25 +01:00
|
|
|
wb_reg_fp_sboard_set := mem_reg_fp_sboard_set
|
2012-01-03 00:42:39 +01:00
|
|
|
}
|
2011-11-02 07:14:34 +01:00
|
|
|
|
2012-02-14 03:12:23 +01:00
|
|
|
val sboard = new rocketCtrlSboard(32, 3, 2);
|
|
|
|
sboard.io.r(0).addr := id_raddr2.toUFix;
|
|
|
|
sboard.io.r(1).addr := id_raddr1.toUFix;
|
|
|
|
sboard.io.r(2).addr := id_waddr.toUFix;
|
2012-02-08 08:54:25 +01:00
|
|
|
|
|
|
|
// scoreboard set (for D$ misses, div, mul)
|
2012-02-14 03:12:23 +01:00
|
|
|
sboard.io.w(0).en := wb_reg_div_mul_val || wb_reg_dcache_miss && wb_reg_wen
|
|
|
|
sboard.io.w(0).data := Bool(true)
|
|
|
|
sboard.io.w(0).addr := io.dpath.wb_waddr
|
2012-02-08 08:54:25 +01:00
|
|
|
|
2012-02-14 03:12:23 +01:00
|
|
|
sboard.io.w(1).en := io.dpath.sboard_clr
|
|
|
|
sboard.io.w(1).data := Bool(false)
|
|
|
|
sboard.io.w(1).addr := io.dpath.sboard_clra
|
2012-02-08 08:54:25 +01:00
|
|
|
|
2012-02-14 03:12:23 +01:00
|
|
|
val id_stall_raddr2 = id_renx2.toBool && sboard.io.r(0).data
|
|
|
|
val id_stall_raddr1 = id_renx1.toBool && sboard.io.r(1).data
|
|
|
|
val id_stall_waddr = id_wen.toBool && sboard.io.r(2).data
|
2012-02-08 08:54:25 +01:00
|
|
|
|
|
|
|
var id_stall_fpu = Bool(false)
|
|
|
|
if (HAVE_FPU) {
|
2012-02-15 04:11:57 +01:00
|
|
|
val fp_sboard = new rocketCtrlSboard(32, 4, 3);
|
2012-02-14 03:12:23 +01:00
|
|
|
fp_sboard.io.r(0).addr := id_raddr1.toUFix
|
|
|
|
fp_sboard.io.r(1).addr := id_raddr2.toUFix
|
|
|
|
fp_sboard.io.r(2).addr := id_raddr3.toUFix
|
|
|
|
fp_sboard.io.r(3).addr := id_waddr.toUFix
|
|
|
|
|
2012-02-14 09:32:25 +01:00
|
|
|
fp_sboard.io.w(0).en := wb_reg_dcache_miss && wb_reg_fp_wen || wb_reg_fp_sboard_set
|
2012-02-14 03:12:23 +01:00
|
|
|
fp_sboard.io.w(0).data := Bool(true)
|
2012-04-01 07:23:51 +02:00
|
|
|
fp_sboard.io.w(0).addr := io.dpath.fp_sboard_wb_waddr
|
2012-02-14 03:12:23 +01:00
|
|
|
|
|
|
|
fp_sboard.io.w(1).en := io.dpath.fp_sboard_clr
|
|
|
|
fp_sboard.io.w(1).data := Bool(false)
|
|
|
|
fp_sboard.io.w(1).addr := io.dpath.fp_sboard_clra
|
|
|
|
|
2012-02-15 04:11:57 +01:00
|
|
|
fp_sboard.io.w(2).en := io.fpu.sboard_clr
|
|
|
|
fp_sboard.io.w(2).data := Bool(false)
|
|
|
|
fp_sboard.io.w(2).addr := io.fpu.sboard_clra
|
|
|
|
|
2012-02-14 03:12:23 +01:00
|
|
|
id_stall_fpu = io.fpu.dec.ren1 && fp_sboard.io.r(0).data ||
|
|
|
|
io.fpu.dec.ren2 && fp_sboard.io.r(1).data ||
|
|
|
|
io.fpu.dec.ren3 && fp_sboard.io.r(2).data ||
|
|
|
|
io.fpu.dec.wen && fp_sboard.io.r(3).data
|
2012-02-08 08:54:25 +01:00
|
|
|
}
|
|
|
|
|
2011-11-10 09:50:09 +01:00
|
|
|
// exception handling
|
2012-05-02 03:23:04 +02:00
|
|
|
val mem_xcpt_ma_ld = io.dmem.xcpt.ma.ld && !mem_reg_kill
|
|
|
|
val mem_xcpt_ma_st = io.dmem.xcpt.ma.st && !mem_reg_kill
|
2012-01-12 23:19:18 +01:00
|
|
|
val mem_xcpt_dtlb_ld = io.xcpt_dtlb_ld && !mem_reg_kill
|
|
|
|
val mem_xcpt_dtlb_st = io.xcpt_dtlb_st && !mem_reg_kill
|
2011-11-13 09:27:57 +01:00
|
|
|
|
2012-03-19 09:02:06 +01:00
|
|
|
val mem_exception =
|
|
|
|
mem_reg_xcpt_interrupt ||
|
|
|
|
mem_xcpt_ma_ld ||
|
|
|
|
mem_xcpt_ma_st ||
|
|
|
|
mem_xcpt_dtlb_ld ||
|
|
|
|
mem_xcpt_dtlb_st ||
|
|
|
|
mem_reg_xcpt_illegal ||
|
|
|
|
mem_reg_xcpt_privileged ||
|
|
|
|
mem_reg_xcpt_fpu ||
|
|
|
|
mem_reg_xcpt_vec ||
|
|
|
|
mem_reg_xcpt_syscall ||
|
|
|
|
mem_reg_xcpt_itlb ||
|
|
|
|
mem_reg_xcpt_ma_inst;
|
|
|
|
|
|
|
|
val mem_cause =
|
|
|
|
Mux(mem_reg_xcpt_interrupt, mem_reg_cause, // asynchronous interrupt
|
|
|
|
Mux(mem_reg_xcpt_itlb, UFix(1,5), // instruction access fault
|
|
|
|
Mux(mem_reg_xcpt_illegal, UFix(2,5), // illegal instruction
|
|
|
|
Mux(mem_reg_xcpt_privileged, UFix(3,5), // privileged instruction
|
|
|
|
Mux(mem_reg_xcpt_fpu, UFix(4,5), // FPU disabled
|
|
|
|
Mux(mem_reg_xcpt_syscall, UFix(6,5), // system call
|
|
|
|
// breakpoint
|
|
|
|
Mux(mem_xcpt_ma_ld, UFix(8,5), // misaligned load
|
|
|
|
Mux(mem_xcpt_ma_st, UFix(9,5), // misaligned store
|
|
|
|
Mux(mem_xcpt_dtlb_ld, UFix(10,5), // load fault
|
|
|
|
Mux(mem_xcpt_dtlb_st, UFix(11,5), // store fault
|
|
|
|
Mux(mem_reg_xcpt_vec, UFix(12,5), // vector disabled
|
|
|
|
UFix(0,5)))))))))))); // instruction address misaligned
|
2011-11-10 12:38:59 +01:00
|
|
|
|
2011-12-10 04:42:58 +01:00
|
|
|
// control transfer from ex/mem
|
2012-02-09 10:32:52 +01:00
|
|
|
val take_pc_ex = ex_reg_btb_hit != br_taken || jr_taken
|
2012-03-19 09:02:06 +01:00
|
|
|
take_pc_wb := wb_reg_replay || vec_replay || wb_reg_exception || wb_reg_eret
|
2012-02-09 07:30:45 +01:00
|
|
|
take_pc := take_pc_ex || take_pc_wb;
|
2012-01-18 06:12:31 +01:00
|
|
|
|
2012-02-08 13:21:05 +01:00
|
|
|
// replay mem stage PC on a DTLB miss or a long-latency writeback
|
|
|
|
val mem_ll_wb = io.dpath.mem_wb || io.dpath.mul_result_val || io.dpath.div_result_val
|
2012-05-02 03:23:04 +02:00
|
|
|
val dmem_kill_mem = mem_reg_valid && (io.dtlb_miss || io.dmem.resp.bits.nack)
|
2012-04-02 02:02:32 +02:00
|
|
|
val fpu_kill_mem = mem_reg_fp_val && io.fpu.nack_mem
|
|
|
|
val replay_mem = dmem_kill_mem || mem_reg_wen && mem_ll_wb || mem_reg_replay || fpu_kill_mem
|
|
|
|
val kill_mem = dmem_kill_mem || mem_reg_wen && mem_ll_wb || take_pc_wb || mem_exception || mem_reg_kill || fpu_kill_mem
|
2012-02-27 03:53:39 +01:00
|
|
|
val kill_dcache = io.dtlb_miss || mem_reg_wen && mem_ll_wb || take_pc_wb || mem_exception || mem_reg_kill
|
2012-03-19 09:02:06 +01:00
|
|
|
|
2011-11-14 13:13:13 +01:00
|
|
|
// replay execute stage PC when the D$ is blocked, when the D$ misses,
|
|
|
|
// for privileged instructions, and for fence.i instructions
|
2012-02-08 08:54:25 +01:00
|
|
|
val replay_ex = wb_reg_dcache_miss && ex_reg_load_use || mem_reg_flush_inst ||
|
2012-05-02 03:23:04 +02:00
|
|
|
ex_reg_replay || ex_reg_mem_val && !(io.dmem.req.ready && io.dtlb_rdy) ||
|
2012-01-31 06:14:28 +01:00
|
|
|
ex_reg_div_val && !io.dpath.div_rdy ||
|
2012-04-01 23:52:33 +02:00
|
|
|
ex_reg_mul_val && !io.dpath.mul_rdy
|
2012-01-18 08:47:35 +01:00
|
|
|
val kill_ex = take_pc_wb || replay_ex
|
2012-01-18 06:12:31 +01:00
|
|
|
|
2012-02-12 02:20:33 +01:00
|
|
|
mem_reg_replay := replay_ex && !take_pc_wb;
|
|
|
|
mem_reg_kill := kill_ex;
|
2011-12-10 04:42:58 +01:00
|
|
|
|
2012-02-16 02:49:12 +01:00
|
|
|
wb_reg_replay := replay_mem && !take_pc_wb
|
2012-02-12 02:20:33 +01:00
|
|
|
wb_reg_exception := mem_exception && !take_pc_wb;
|
|
|
|
wb_reg_cause := mem_cause;
|
2011-11-02 21:32:32 +01:00
|
|
|
|
2012-02-16 02:49:12 +01:00
|
|
|
val replay_wb = wb_reg_replay || vec_replay
|
|
|
|
|
2012-01-31 02:15:42 +01:00
|
|
|
val wb_badvaddr_wen = wb_reg_exception && ((wb_reg_cause === UFix(10)) || (wb_reg_cause === UFix(11)))
|
|
|
|
|
|
|
|
// write cause to PCR on an exception
|
|
|
|
io.dpath.exception := wb_reg_exception;
|
|
|
|
io.dpath.cause := wb_reg_cause;
|
|
|
|
io.dpath.badvaddr_wen := wb_badvaddr_wen;
|
2012-03-24 21:03:31 +01:00
|
|
|
io.dpath.vec_irq_aux_wen := wb_reg_exception && wb_reg_cause >= UFix(24) && wb_reg_cause < UFix(32)
|
2012-01-31 02:15:42 +01:00
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
io.dpath.sel_pc :=
|
2012-03-24 21:03:31 +01:00
|
|
|
Mux(wb_reg_exception, PC_PCR, // exception
|
2012-02-16 02:49:12 +01:00
|
|
|
Mux(replay_wb, PC_WB, // replay
|
2012-01-18 06:12:31 +01:00
|
|
|
Mux(wb_reg_eret, PC_PCR, // eret instruction
|
2012-02-08 15:47:26 +01:00
|
|
|
Mux(ex_reg_btb_hit && !br_taken, PC_EX4, // mispredicted not taken branch
|
2012-02-09 10:32:52 +01:00
|
|
|
Mux(!ex_reg_btb_hit && br_taken, PC_BR, // mispredicted taken branch
|
|
|
|
Mux(jr_taken, PC_JR, // taken JALR
|
2012-01-02 02:04:14 +01:00
|
|
|
Mux(io.dpath.btb_hit, PC_BTB, // predicted PC from BTB
|
2012-02-09 10:32:52 +01:00
|
|
|
PC_4))))))); // PC+4
|
2012-01-02 02:04:14 +01:00
|
|
|
|
2012-02-09 10:32:52 +01:00
|
|
|
io.dpath.wen_btb := !ex_reg_btb_hit && br_taken
|
2012-02-08 15:47:26 +01:00
|
|
|
io.dpath.clr_btb := ex_reg_btb_hit && !br_taken || id_reg_icmiss;
|
2012-01-18 08:47:35 +01:00
|
|
|
|
2012-02-23 04:30:03 +01:00
|
|
|
io.imem.req_val := !reset.toBool && (take_pc_wb || !mem_reg_replay && !ex_reg_replay && (take_pc_ex || !id_reg_replay))
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-01-02 09:25:11 +01:00
|
|
|
// stall for RAW/WAW hazards on loads, AMOs, and mul/div in execute stage.
|
2012-02-08 08:54:25 +01:00
|
|
|
val data_hazard_ex = ex_reg_wen &&
|
|
|
|
(id_renx1.toBool && id_raddr1 === io.dpath.ex_waddr ||
|
|
|
|
id_renx2.toBool && id_raddr2 === io.dpath.ex_waddr ||
|
|
|
|
id_wen.toBool && id_waddr === io.dpath.ex_waddr)
|
|
|
|
val fp_data_hazard_ex = ex_reg_fp_wen &&
|
2012-02-12 13:36:01 +01:00
|
|
|
(io.fpu.dec.ren1 && id_raddr1 === io.dpath.ex_waddr ||
|
|
|
|
io.fpu.dec.ren2 && id_raddr2 === io.dpath.ex_waddr ||
|
|
|
|
io.fpu.dec.ren3 && id_raddr3 === io.dpath.ex_waddr ||
|
|
|
|
io.fpu.dec.wen && id_waddr === io.dpath.ex_waddr)
|
2012-02-13 05:12:53 +01:00
|
|
|
val id_ex_hazard = data_hazard_ex && (ex_reg_mem_val || ex_reg_div_val || ex_reg_mul_val || ex_reg_fp_val) ||
|
|
|
|
fp_data_hazard_ex && (ex_reg_mem_val || ex_reg_fp_val)
|
2011-11-02 05:25:52 +01:00
|
|
|
|
2012-01-02 09:25:11 +01:00
|
|
|
// stall for RAW/WAW hazards on LB/LH and mul/div in memory stage.
|
2012-02-08 08:54:25 +01:00
|
|
|
val mem_mem_cmd_bh =
|
|
|
|
(mem_reg_mem_type === MT_B) || (mem_reg_mem_type === MT_BU) ||
|
|
|
|
(mem_reg_mem_type === MT_H) || (mem_reg_mem_type === MT_HU)
|
|
|
|
val data_hazard_mem = mem_reg_wen &&
|
|
|
|
(id_renx1.toBool && id_raddr1 === io.dpath.mem_waddr ||
|
|
|
|
id_renx2.toBool && id_raddr2 === io.dpath.mem_waddr ||
|
|
|
|
id_wen.toBool && id_waddr === io.dpath.mem_waddr)
|
|
|
|
val fp_data_hazard_mem = mem_reg_fp_wen &&
|
2012-02-12 13:36:01 +01:00
|
|
|
(io.fpu.dec.ren1 && id_raddr1 === io.dpath.mem_waddr ||
|
|
|
|
io.fpu.dec.ren2 && id_raddr2 === io.dpath.mem_waddr ||
|
|
|
|
io.fpu.dec.ren3 && id_raddr3 === io.dpath.mem_waddr ||
|
|
|
|
io.fpu.dec.wen && id_waddr === io.dpath.mem_waddr)
|
2012-02-13 05:12:53 +01:00
|
|
|
val id_mem_hazard = data_hazard_mem && (mem_reg_mem_val && mem_mem_cmd_bh || mem_reg_div_mul_val || mem_reg_fp_val) ||
|
|
|
|
fp_data_hazard_mem && mem_reg_fp_val
|
2012-02-08 08:54:25 +01:00
|
|
|
id_load_use := mem_reg_mem_val && (data_hazard_mem || fp_data_hazard_mem)
|
2012-01-02 09:25:11 +01:00
|
|
|
|
|
|
|
// stall for RAW/WAW hazards on load/AMO misses and mul/div in writeback.
|
2012-02-08 08:54:25 +01:00
|
|
|
val data_hazard_wb = wb_reg_wen &&
|
|
|
|
(id_renx1.toBool && id_raddr1 === io.dpath.wb_waddr ||
|
|
|
|
id_renx2.toBool && id_raddr2 === io.dpath.wb_waddr ||
|
|
|
|
id_wen.toBool && id_waddr === io.dpath.wb_waddr)
|
|
|
|
val fp_data_hazard_wb = wb_reg_fp_wen &&
|
2012-02-12 13:36:01 +01:00
|
|
|
(io.fpu.dec.ren1 && id_raddr1 === io.dpath.wb_waddr ||
|
|
|
|
io.fpu.dec.ren2 && id_raddr2 === io.dpath.wb_waddr ||
|
|
|
|
io.fpu.dec.ren3 && id_raddr3 === io.dpath.wb_waddr ||
|
|
|
|
io.fpu.dec.wen && id_waddr === io.dpath.wb_waddr)
|
2012-02-08 08:54:25 +01:00
|
|
|
val id_wb_hazard = data_hazard_wb && (wb_reg_dcache_miss || wb_reg_div_mul_val) ||
|
2012-02-13 05:12:53 +01:00
|
|
|
fp_data_hazard_wb && (wb_reg_dcache_miss || wb_reg_fp_val)
|
2012-01-02 09:25:11 +01:00
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
val ctrl_stalld =
|
2011-12-10 04:42:58 +01:00
|
|
|
!take_pc &&
|
2011-10-26 08:02:47 +02:00
|
|
|
(
|
2012-02-07 02:26:45 +01:00
|
|
|
id_ex_hazard || id_mem_hazard || id_wb_hazard ||
|
2012-02-08 08:54:25 +01:00
|
|
|
id_stall_raddr1 || id_stall_raddr2 || id_stall_waddr ||
|
2012-05-02 05:16:36 +02:00
|
|
|
id_fp_val && id_stall_fpu ||
|
2012-05-02 03:23:04 +02:00
|
|
|
id_mem_val.toBool && !(io.dmem.req.ready && io.dtlb_rdy) ||
|
|
|
|
((id_sync === SYNC_D) || (id_sync === SYNC_I)) && !io.dmem.req.ready ||
|
2012-03-04 00:09:42 +01:00
|
|
|
vec_stalld
|
2011-10-26 08:02:47 +02:00
|
|
|
);
|
2012-01-14 05:04:11 +01:00
|
|
|
val ctrl_stallf = ctrl_stalld;
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2011-12-10 04:42:58 +01:00
|
|
|
val ctrl_killd = take_pc || ctrl_stalld;
|
|
|
|
val ctrl_killf = take_pc || !io.imem.resp_val;
|
2011-11-18 08:50:45 +01:00
|
|
|
|
2012-02-09 10:32:52 +01:00
|
|
|
io.dpath.flush_inst := wb_reg_flush_inst;
|
2012-01-14 05:04:11 +01:00
|
|
|
io.dpath.stallf := ctrl_stallf;
|
2011-12-10 04:42:58 +01:00
|
|
|
io.dpath.stalld := ctrl_stalld;
|
|
|
|
io.dpath.killf := ctrl_killf;
|
|
|
|
io.dpath.killd := ctrl_killd;
|
|
|
|
io.dpath.killx := kill_ex;
|
|
|
|
io.dpath.killm := kill_mem;
|
2011-11-02 01:59:27 +01:00
|
|
|
|
2012-02-08 08:54:25 +01:00
|
|
|
io.dpath.mem_load := mem_reg_mem_val && mem_reg_wen
|
2012-01-02 09:25:11 +01:00
|
|
|
io.dpath.ren2 := id_renx2.toBool;
|
|
|
|
io.dpath.ren1 := id_renx1.toBool;
|
2012-05-02 05:16:36 +02:00
|
|
|
io.dpath.sel_alu2 := id_sel_alu2.toUFix
|
2011-11-02 01:59:27 +01:00
|
|
|
io.dpath.fn_dw := id_fn_dw.toBool;
|
2012-05-02 05:16:36 +02:00
|
|
|
io.dpath.fn_alu := id_fn_alu.toUFix
|
|
|
|
io.dpath.div_fn := id_div_fn.toUFix
|
2012-03-01 19:14:49 +01:00
|
|
|
io.dpath.div_val := id_div_val.toBool && id_waddr != UFix(0);
|
2012-05-02 05:16:36 +02:00
|
|
|
io.dpath.mul_fn := id_mul_fn.toUFix
|
2012-03-01 19:14:49 +01:00
|
|
|
io.dpath.mul_val := id_mul_val.toBool && id_waddr != UFix(0);
|
2012-02-08 08:54:25 +01:00
|
|
|
io.dpath.ex_fp_val:= ex_reg_fp_val;
|
2012-02-12 13:36:01 +01:00
|
|
|
io.dpath.mem_fp_val:= mem_reg_fp_val;
|
2012-02-08 08:54:25 +01:00
|
|
|
io.dpath.ex_wen := ex_reg_wen;
|
|
|
|
io.dpath.mem_wen := mem_reg_wen;
|
|
|
|
io.dpath.wb_wen := wb_reg_wen;
|
2012-03-21 01:09:54 +01:00
|
|
|
io.dpath.wb_valid := wb_reg_valid && !vec_replay
|
2011-11-02 01:59:27 +01:00
|
|
|
io.dpath.sel_wa := id_sel_wa.toBool;
|
2012-05-02 05:16:36 +02:00
|
|
|
io.dpath.sel_wb := id_sel_wb.toUFix
|
2012-03-24 21:03:31 +01:00
|
|
|
io.dpath.pcr := wb_reg_pcr.toUFix
|
2011-11-18 08:50:45 +01:00
|
|
|
io.dpath.id_eret := id_eret.toBool;
|
2012-01-03 00:42:39 +01:00
|
|
|
io.dpath.wb_eret := wb_reg_eret;
|
2012-02-12 10:35:55 +01:00
|
|
|
io.dpath.ex_mem_type := ex_reg_mem_type
|
2011-12-10 04:42:58 +01:00
|
|
|
|
2012-05-02 05:16:36 +02:00
|
|
|
io.fpu.valid := !io.dpath.killd && id_fp_val
|
2012-02-12 13:36:01 +01:00
|
|
|
io.fpu.killx := kill_ex
|
|
|
|
io.fpu.killm := kill_mem
|
|
|
|
|
2012-05-02 03:23:04 +02:00
|
|
|
io.dtlb_val := ex_reg_mem_val
|
|
|
|
io.dtlb_kill := mem_reg_kill
|
|
|
|
io.dmem.req.valid := ex_reg_mem_val
|
|
|
|
io.dmem.req.bits.kill := kill_dcache
|
|
|
|
io.dmem.req.bits.cmd := ex_reg_mem_cmd
|
|
|
|
io.dmem.req.bits.typ := ex_reg_mem_type
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|