Skip to content

Commit fcf3db2

Browse files
committed
Fix: control unit was able to support instruction access fault
Fix: memfy blocked if no U-MODE supported New: testcase to check access fault
1 parent f457a01 commit fcf3db2

27 files changed

+1922
-1463
lines changed

doc/TODO.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030

3131
# Testcases
3232

33-
Traps
34-
- [ ] Nested interrupts
35-
- [ ] Vector interrupts
36-
- [ ] Interrupts mixed over exceptions
37-
3833
- [X] Faire varier la periode de l'EIRQ
3934

4035
U-mode
@@ -46,8 +41,8 @@ Traps
4641
- [X] Do something within a loop with interrupt enabled, data needs to be OK
4742
- [X] WFI in u-mode, interrupt enabled, trapped in m-mode
4843
- [X] WFI in u-mode, interrupt disabled, NOP
44+
- [X] Test des exception load/store misaligned
4945
- [ ] Add test for vector table
50-
- [ ] Test des exception load/store misaligned
5146
- [ ] Test MSTATUS.TW
5247

5348
MPU:
@@ -58,11 +53,10 @@ MPU:
5853
- [X] execute instruction outside allowed regions (U-mode)
5954
- [X] write data in U-mode
6055
- [X] read data in U-mode
61-
- [ ] read data in M-mode with MPRV=1 + MPP w/ U-mode
62-
- [ ] write data in M-mode with MPRV=1 + MPP w/ U-mode
63-
- [ ] execute in M-mode without X + locked region
64-
- [ ] locked access to change configuration
65-
- [ ] region's permissions overlap
56+
- [X] read data in M-mode with MPRV=1 + MPP=U-mode
57+
- [X] write data in M-mode with MPRV=1 + MPP=U-mode
58+
- [X] execute in M-mode without X + locked region
59+
- [X] locked access to change configuration
6660

6761
Final:
6862
- Pass compliance with U-mode

doc/project_mgt_hw.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
- [ ] v1.6.0: Kernel-capable Hart
44
- [X] Supporter des set de config du core en test bench.
5-
- [-] Support U-mode
6-
- [-] Support PMP/PMA
7-
- [ ] Atomic operations for single core
8-
- [ ] AXI Exception management with a CLIC
9-
- maange all traps into it?
5+
- [X] Support U-mode
6+
- [X] Support PMP/PMA
7+
- [ ] Atomic operations
8+
- stage to execute the instruction, controlling ldst Stages
9+
- memfy exposes two interfaces for requests.
10+
- memfy drives back response along register write channel
11+
- support exclusive access in cache, don't substitute tag, so support single access
12+
- support exclusive access in memory, track the ID with a LUT
13+
- [ ] Advanced Interrupt controller
14+
- [ ] AXI Exception management
1015
- [ ] Zc extension
1116
- [ ] https://github.com/eembc/coremark
1217

@@ -70,6 +75,9 @@ Any new features should be carefully study to ensure a proper exception and inte
7075
- [ ] Analogue pocket
7176
- [C] Cloud
7277
- [ ] Add registers to configure the core in platform (use custom CSR)
78+
- Caches
79+
- Interconnect
80+
- processing: scheduling, hazard detection
7381
- [ ] Support CLIC controller
7482
- [ ] Random peripheral
7583
- [ ] UART: Support 9/10 bits & parity

rtl/friscv_control.sv

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ module friscv_control
227227
logic ecall_umode;
228228
logic ecall_mmode;
229229
logic [2 -1:0] priv_mode;
230+
logic [2 -1:0] mpp;
230231
logic load_access_fault;
231232
logic store_access_fault;
232233

@@ -359,6 +360,12 @@ module friscv_control
359360
mstatus_wr, mstatus,
360361
mepc_wr, mepc};
361362

363+
generate if (USER_MODE) begin: MPP_UMODE
364+
assign mpp = sb_mstatus[11+:2];
365+
end else begin: MPP_MMODE
366+
assign mpp = `MMODE;
367+
end
368+
endgenerate
362369

363370
///////////////////////////////////////////////////////////////////////////
364371
// Input stage
@@ -501,7 +508,7 @@ module friscv_control
501508
assign proc_instbus[`INST +: `INST_W ] = instruction;
502509
assign proc_instbus[`PC +: `PC_W ] = pc_reg;
503510
assign proc_instbus[`PRIV +: `PRIV_W ] = priv_mode;
504-
assign proc_instbus[`MPP +: `PRIV_W ] = sb_mstatus[11+:2];
511+
assign proc_instbus[`MPP +: `PRIV_W ] = mpp;
505512
assign proc_instbus[`MPRV ] = sb_mstatus[17];
506513

507514
assign csr_instbus = proc_instbus;

0 commit comments

Comments
 (0)