journal 2026-05-01

P32 adds RV32M

p32riscvrv32mruntime

P32 adds the RV32M multiply/divide extension.

The implementation is intentionally direct: decode OP with funct7=0000001 and compute the result in the ALU path. That covers MUL, MULH, MULHSU, MULHU, DIV, DIVU, REM, and REMU.

Commands:

make -C projects/32_rv32im_runtime_probe/test
make -C projects/32_rv32im_runtime_probe/test act4
make -C projects/32_rv32im_runtime_probe/test act4_m

Results:

checkresult
Compiled RV32IM runtimePASS
Runtime UART sequence MTEPASS
ACT4/Sail rv32i/IPASS=39 FAIL=0 NOT RUN=0
ACT4/Sail rv32i/MPASS=8 FAIL=0 NOT RUN=0
HardeningPASS with timing cleanup left
Full RISC-V complianceNOT RUN

The first compile did pass but emitted Icarus sorry: constant selects in always_* warnings from 64-bit product slices. Rewriting those slices as shift/truncation temporaries made the sim output quiet.

Follow-up fix: the first P32 version used single-cycle combinational divide and remainder. That passed, but it was not a credible backend shape. The divider is now a 32-cycle restoring divider; multiply stays combinational. The runtime and both ACT4 batches still pass with the multi-cycle divider.

Then we hardened that shape:

harden checkresult
Run directoryprojects/32_rv32im_runtime_probe/librelane/runs/RUN_2026-05-01_12-10-27
Final GDSprojects/32_rv32im_runtime_probe/librelane/runs/RUN_2026-05-01_12-10-27/final/gds/top.gds
Metricsprojects/32_rv32im_runtime_probe/librelane/runs/RUN_2026-05-01_12-10-27/final/metrics.json
Magic DRCPASS
KLayout DRCPASS
LVSPASS
AntennaPASS
Hold timingPASS
Setup timingFAIL, worst setup slack -7.798 ns
Max slew / max capFAIL, 8158 max-slew and 127 max-cap violations

The useful result is that P32 is physically real: route DRC, Magic DRC, KLayout DRC, antenna, and LVS all land cleanly. The less convenient result is that RV32M is exactly where the timing bill shows up. The next cleanup pass should pipeline or otherwise break up the multiply/high-product path, then rerun the same ACT4 I and M batches before another harden.