No. 36 / project of 147 on the ladder

RV32IM divider sign stage

introduces — One-cycle divider sign-fix stage to clear the P35 slew/cap tail

harden statelast run2026-05-02
cells27,223non-filler
slack5.90ns setup
area900 x 900 die, 191659 stdcell areaμm²
signoff
  • DRCPASS
  • LVSPASS
  • antennaPASS

P36 keeps the P35 RV32IM platform and changes one thing: signed divider writeback gets its own state. The divider now stores the raw final quotient-or-remainder, then applies the final sign correction in S_DIV_SIGN one cycle later.

Status: hardened and DRV-clean. LibreLane run RUN_2026-05-02_21-18-57 produced final GDS and passed Magic DRC, KLayout DRC, LVS, antenna, routing DRC, setup timing, hold timing, max slew, max cap, and max fanout in the recorded metrics.

The Result

Run it:

make -C projects/36_rv32im_divider_sign_stage/test clean all

Result: PASS

checkresult
Build linked rv32im_zicsr runtime ELFPASS
UART-load compiled imagePASS
Execute C *, /, and % through RV32MPASS
Execute mulh, mulhsu, and mulhuPASS
Check divide-by-zero and overflow edge casesPASS
MMIO UART writes M, T, EPASS
MMIO timer interrupt visible to CPASS
External interrupt visible to CPASS
Halt with x5 = 1PASS

ACT4/Sail rv32i/I: PASS=39 FAIL=0 NOT RUN=0

ACT4/Sail rv32i/M: PASS=8 FAIL=0 NOT RUN=0

ACT4/Sail rv32i/Zicsr: FAIL (PASS=0 FAIL=6 NOT RUN=0)

ACT4/Sail rv32i/Zifencei: FAIL (PASS=0 FAIL=1 NOT RUN=0)

Full RISC-V compliance: PARTIAL

Harden Result

LibreLane flow: PASS

harden checkresult
Run directoryprojects/36_rv32im_divider_sign_stage/librelane/runs/RUN_2026-05-02_21-18-57
Final GDSprojects/36_rv32im_divider_sign_stage/librelane/runs/RUN_2026-05-02_21-18-57/final/gds/top.gds
Metricsprojects/36_rv32im_divider_sign_stage/librelane/runs/RUN_2026-05-02_21-18-57/final/metrics.json
Magic DRCPASS (0 errors)
KLayout DRCPASS (0 errors)
LVSPASS (0 errors)
AntennaPASS (0 net violations, 0 pin violations)
Routing DRCPASS (0 errors)
Setup timingPASS (0 violations, worst setup slack 5.903 ns)
Hold timingPASS (0 violations, worst hold slack 0.070 ns)
Max slewPASS (0 violations)
Max capPASS (0 violations)
Max fanoutPASS (0 violations against signoff limit 13)

The comparison to P35 is the useful bit:

metricP35P36
Worst setup slack8.048 ns5.903 ns
Worst hold slack0.100 ns0.070 ns
Max slew violations130
Max cap violations10
Max fanout violations00
Standard-cell area188652 um^2191659 um^2
Standard-cell count2688327223

The fanout cleanup is backend-only. Place-and-route reads p36.sdc with a fanout target of 12, nudging OpenROAD to split high-load nets earlier. Post-PnR STA reads p36_signoff.sdc with a fanout limit of 13, matching the P35 signoff target. That removes the previous 14-load branch without changing the RTL or the instruction behavior.

What Changed

The supported instruction set is the same as P35:

instruction familystatus
RV32I base integer instructionsPASS in scoped ACT4/Sail rv32i/I
MUL, MULH, MULHSU, MULHUPASS in scoped ACT4/Sail rv32i/M
DIV, DIVU, REM, REMUPASS in scoped ACT4/Sail rv32i/M
Zicsr machine-mode CSR subsetruntime subset works, ACT4 rv32i/Zicsr is FAIL
ZifenceiACT4 rv32i/Zifencei is FAIL

The implementation adds S_DIV_SIGN after the final divider iteration. That state writes alu_y_q from registered raw divide output plus a registered sign-correction bit, instead of doing the sign fix in the same cycle that the divider decides it is done.

The behavioral cost is tiny but visible: the directed runtime takes 1620 clocks instead of P35’s 1616, and the four ACT4 divide/remainder tests each pick up one extra cycle. Multiply tests are unchanged.

Scope

This is not a full RISC-V compliance claim. The recorded official-test coverage is now a partial ACT4/Sail sweep: rv32i/I and rv32i/M pass, while the first CSR and instruction-fence extension probes fail.

Still unsupported: atomics, compressed instructions, supervisor mode, vectored mtvec, delegation CSRs, satp, an MMU, and official full compliance packaging.

The point of the addendum is to set up the next projects. Zicsr is the first real closure target: the ACT4 tests for csrrw, csrrs, csrrc, and their immediate forms all time out in the self-check harness. Zifencei is the next small extension-level failure: fence.i needs an explicit architectural answer instead of riding along with the base fence pass.

What We Learned

P36 confirms that the P35 slew/cap tail was sensitive to the divider final writeback shape. A one-cycle RTL stage cleared max-slew and max-cap completely without touching the ISA or the test harness. A tighter place-and-route fanout target then cleared the final fanout count in the signoff metrics.

That makes P36 the first RV32IM rung in this ladder with ACT4 I/M coverage and clean recorded backend metrics.