DDCA Ch6 - Part 23: RISC-V Floating-Point Instructions
Floating Point Instructions in RISC-V
In this section, the lecture discusses the floating-point instructions in RISC-V, focusing on the optional extensions (F, D, and Q modes) for handling single, double, and quad precision floating-point numbers.
Floating Point Registers and Precision
- RISC-V has F, D, and Q modes for single, double, and quad precision floating point numbers respectively.
- Registers are 128 bits wide with different precisions stored in specific parts of the register.
Instruction Precision Indicators
- Instructions have 'sq' or 'd' appended to indicate precision levels (e.g., f add.s for single precision addition).
Floating Point Operations
- Arithmetic operations include add, subtract, divide, square root, minimum/maximum comparisons, various multiplications.
Additional Instructions
- Move instructions for converting between precisions; comparison instructions; classification and sign injection operations.
Importance of Multiply Add Instruction
- Floating point multiply-add crucial for signal processing programs involving summing products like fmadd.f.
Example: Floating Point Program
This part illustrates a floating-point program example adding 10 to an array's elements using specific instructions.
Program Execution Steps
- Initialize values: i as 0, t2 as 200 (for comparison), t0 as 10 (to be converted to float).
- Convert integer 10 to single precision float; set up a loop with comparison conditions.
Loop Body Operations
- Calculate memory address based on 'i'; load data into temporary register; perform addition operation.
Instruction Formats