Posts / Tag
#m extension
2 posts
The M Extension: Multiply, Divide, and the Rules for Divide-by-Zero and Overflow
Part 7 of the RISC-V series. Covers the 13 multiply and divide instructions of the M extension and the defined results for divide-by-zero and overflow (no exceptions), then runs 1,948 boundary cases on QEMU and confirms they all match a reference model. Without M, each multiply costs 86 extra instructions.
Implementing the M Extension: Multiply/Divide Units and Divide-by-Zero
Part 19 of the RISC-V series. I implemented the M extension's multiplier and divider as bit-exact Python models. A single 33-bit multiplier handles all three mulh variants, with zero mismatches across 300,000 pairs and 648 QEMU results, and I found a trap when dividing a negative number by zero (5,039 mismatches).
RISC-V