提交 a03726a8 编写于 作者: W William Wang

fix(LSU, CSR): SPF/LPF now redirect correctly

When SPF/LPF was raised, LSU used to wait until its FSM go back to s_idle then commit.
However, CSR will modify mode/status immediately when it gets PF signal.
Here comes the problem: when a PF is raised, redirect may not happen because mode/status i not right.
上级 fd237745
......@@ -564,7 +564,8 @@ class CSR(implicit val p: NOOPConfig) extends NOOPModule with HasCSRConst{
Debug(){
when(raiseExceptionIntr){
printf("[CSR] int/exc: pc %x int (%d):%x exc: (%d):%x\n",io.cfIn.pc, intrNO, io.cfIn.intrVec.asUInt, exceptionNO, io.cfIn.exceptionVec.asUInt)
printf("[CSR] int/exc: pc %x int (%d):%x exc: (%d):%x\n",io.cfIn.pc, intrNO, io.cfIn.intrVec.asUInt, exceptionNO, raiseExceptionVec.asUInt)
printf("[MST] time %d pc %x mstatus %x mideleg %x medeleg %x mode %x\n", GTimer(), io.cfIn.pc, mstatus, mideleg , medeleg, priviledgeMode)
}
when(io.redirect.valid){
printf("[CSR] redirect to %x\n", io.redirect.target)
......
......@@ -136,6 +136,14 @@ class LSU extends NOOPModule {
val scInvalid = !(src1 === lrAddr) && scReq
// PF signal from TLB
val dtlbFinish = WireInit(false.B)
val dtlbPF = WireInit(false.B)
val dtlbEnable = WireInit(false.B)
BoringUtils.addSink(dtlbFinish, "DTLBFINISH")
BoringUtils.addSink(dtlbPF, "DTLBPF")
BoringUtils.addSink(dtlbEnable, "DTLBENABLE")
// LSU control FSM state
val s_idle :: s_load :: s_lr :: s_sc :: s_amo_l :: s_amo_a :: s_amo_s :: Nil = Enum(7)
......@@ -292,6 +300,11 @@ class LSU extends NOOPModule {
}
}
}
when(dtlbPF){
state := s_idle
io.out.valid := true.B
io.in.ready := true.B
}
// controled by FSM
// io.in.ready := lsExecUnit.io.in.ready
......
......@@ -21,7 +21,7 @@ static int uart_dequeue(void) {
f = (f + 1) % QUEUE_SIZE;
} else {
// generate a random key every 1s for pal
k = "uiojkl"[rand()% 6];
k = -1;//"uiojkl"[rand()% 6];
}
return k;
}
......@@ -32,10 +32,10 @@ extern "C" void uart_getc(uint8_t *ch) {
uint32_t now = uptime();
*ch = -1;
if (now - lasttime > 3000) {
lasttime = now;
// if (now - lasttime > 3000) {
// lasttime = now;
*ch = uart_dequeue();
}
// }
}
void uart_putc(char c) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册