From the course: Getting Started with RISC-V
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Multiplication and division - Raspberry Pi Tutorial
From the course: Getting Started with RISC-V
Multiplication and division
- [Instructor] Let's look at some RISC-V ISA extensions. We'll start with the RV32M extension for multiplication and division. This is a very simple one with only eight instructions. First, we have the multiplication instruction mul, which multiplies two registers and stores the lower word of the result in a third register. Then, we have three instructions to store the high half of the result. Mulh multiplies both upper ends as signed integers. Mulhu multiplies both as unsigned integers, and mulhsu multiplies one as signed and the other as unsigned. These instructions can also help in detecting an overflow. As for division, we have two instructions, div for signed integers and divu for unsigned integers. This instruction calculates the quotient. Lastly, we have remainder instructions for signed and unsigned integers. This is a modest extension indeed, but only in terms of the instructions it adds to the processor.…