OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [floating_point_test/] [README.md] - Blame information for rev 55

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 55 zero_gravi
# NEORV32 `Zfinx` Floating-Point Extension
2
 
3
The RISC-V `Zfinx` single-precision floating-point extensions uses the integer register file `x` instead of the dedicated floating-point `f` register file (which is
4
defined by the RISC-V `F` single-precision floating-point extension). Hence, the standard data transfer instructions from the `F` extension are **not** available in `Zfinx`:
5
 
6
* floating-point load/store operations (`FLW`, `FSW`) and their compressed versions
7
* integer register file `x` <-> floating point register file `f` move operations (`FMV.W.X`, `FMV.X.W`)
8
 
9
 
10
:information_source: More information regarding the RISC-V `Zfinx` single-precision floating-point extension can be found in the officail GitHub repo:
11
[`github.com/riscv/riscv-zfinx`](https://github.com/riscv/riscv-zfinx).
12
 
13
:warning: The RISC-V `Zfinx` extension is not officially ratified yet, but it is assumed to remain unchanged. Hence, it is not supported by the upstream RISC-V GCC port.
14
Make sure you **do not** use the `f` ISA attribute when compiling applications that use floating-point arithmetic (`-march=rv32i*f*` is **NOT ALLOWED!**).
15
 
16
 
17
## Intrinsic Library
18
 
19
The NEORV32 `Zfinx` floating-point extension can still be used using the provided **intrinsic library**. This library uses "custom" inline assmbly instructions
20
wrapped within normal C-language functions. Each original instruction of the extension can be utilized using an according intrinsic function.
21
 
22
For example, the floating-point addition instruction `FADD.S` can be invoked using the according intrinsic function:
23
 
24
```c
25
float riscv_intrinsic_fadds(float rs1, float rs2)
26
```
27
 
28
The pure-software emulation instruction, which uses the standard builtin functions to execute all floating-point operations, is available via wrapper function. The
29
emulation function for the `FADD.S` instruction is:
30
 
31
```c
32
float riscv_emulate_fadds(float rs1, float rs2)
33
```
34
 
35
The emulation functions as well as the available intrinsics for the `Zfinx` extension are located in `neorv32_zfinx_extension_intrinsics.h`.
36
 
37
The provided test program `main.c` verifies all currently implemented `Zfinx` instructions by checking the functionality against the pure software-based emulation model
38
(GCC soft-float library).

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.