P27 is the first system-core rung after the ACT4 base-integer milestone.
It keeps the P17 external-memory shell shape but teaches the core how to
enter machine-mode traps, expose basic machine CSRs, and return with mret.
Status: Hardened logic-only shell. Directed CSR/trap tests pass, the scoped ACT4/Sail
rv32i/Iset passes on P27, and official privileged tests are still NOT RUN.
The Result
Run it:
make -C projects/27_rv32i_machine_traps/test
Result: PASS
| test | result |
|---|---|
| CSR read/write and immediate set | PASS |
ecall trap and mret resume | PASS |
illegal-instruction trap and mret resume | PASS |
ebreak trap and mret resume | PASS |
| misaligned load trap | PASS |
| misaligned store trap | PASS |
ACT4/Sail rv32i/I: PASS=39 FAIL=0 NOT RUN=0
Harden status: PASS
Hardened Shell
Run it:
scripts/run_librelane.sh projects/27_rv32i_machine_traps
| check | result |
|---|---|
| Run directory | projects/27_rv32i_machine_traps/librelane/runs/RUN_2026-05-01_08-07-22 |
| Final GDS | projects/27_rv32i_machine_traps/librelane/runs/RUN_2026-05-01_08-07-22/final/gds/top.gds |
| Metrics | projects/27_rv32i_machine_traps/librelane/runs/RUN_2026-05-01_08-07-22/final/metrics.json |
| Standard cells | 22710 |
| Standard-cell area | 150303 |
| Route DRC | PASS (0) |
| Magic DRC | PASS (0) |
| KLayout DRC | PASS (0) |
| LVS | PASS (0) |
| Antenna | PASS (0) |
| Setup timing | PASS |
| Hold timing | PASS |
| Max slew checker | PARTIAL (4132 warnings) |
| Max capacitance checker | PARTIAL (52 warnings) |
The final run has clean RTL lint and passes DRC/LVS/antenna. The slew and capacitance warnings are still real backend cleanup work.
What Changed
The core now supports these SYSTEM instructions:
CSRRW, CSRRS, CSRRC, CSRRWI, CSRRSI, CSRRCI, ECALL,
EBREAK, and MRET.
Implemented CSRs:
| CSR | behavior |
|---|---|
mstatus | writable storage, no real privilege-stack side effects yet |
misa | read-only RV32I marker |
mtvec | writable direct-mode trap base |
mepc | saved trap PC |
mcause | saved trap cause |
mtval | saved trap value |
marchid, mimpid, mhartid | simple read-only IDs |
Trap entry writes mepc, mcause, and mtval, then jumps to
{mtvec[31:2], 2'b00}. mret jumps back to mepc.
What This Proves
P26 proved a strong base-integer instruction milestone through ACT4/Sail.
P27 reruns that same scoped rv32i/I directory on the modified core and keeps
the result at PASS=39 FAIL=0 NOT RUN=0.
P27 also proves a different thing: the core can now hand control to software when something exceptional happens.
That means a handler can:
- read
mcause; - read
mepcandmtval; - advance
mepcpast the trapped instruction; - return with
mret.
That path works for ecall, ebreak, illegal instruction, misaligned load,
and misaligned store in directed RTL simulation.
Scope
Still unsupported: supervisor mode, interrupts, timer CSRs, delegation CSRs,
satp, an MMU, vectored mtvec, precise mstatus privilege-stack behavior,
and official privileged architecture tests.
So the honest label is narrow: PASS for directed machine-mode CSR/trap RTL
tests, PASS for scoped ACT4/Sail rv32i/I, PASS for hardening signoff
checks, and NOT RUN for official privileged compliance.