NMSIS-Core
Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
|
Functions that related to the RISC-V FPU (F and D extension). More...
Macros | |
#define | __RISCV_FLEN 64 |
#define | __get_FCSR() __RV_CSR_READ(CSR_FCSR) |
Get FCSR CSR Register. More... | |
#define | __set_FCSR(val) __RV_CSR_WRITE(CSR_FCSR, (val)) |
Set FCSR CSR Register with val. More... | |
#define | __get_FRM() __RV_CSR_READ(CSR_FRM) |
Get FRM CSR Register. More... | |
#define | __set_FRM(val) __RV_CSR_WRITE(CSR_FRM, (val)) |
Set FRM CSR Register with val. More... | |
#define | __get_FFLAGS() __RV_CSR_READ(CSR_FFLAGS) |
Get FFLAGS CSR Register. More... | |
#define | __set_FFLAGS(val) __RV_CSR_WRITE(CSR_FFLAGS, (val)) |
Set FFLAGS CSR Register with val. More... | |
#define | __enable_FPU() |
Enable FPU Unit, and set state to initial. More... | |
#define | __disable_FPU() __RV_CSR_CLEAR(CSR_MSTATUS, MSTATUS_FS) |
Disable FPU Unit. More... | |
#define | __RV_FLW(freg, addr, ofs) |
Load a single-precision value from memory into float point register freg using flw instruction. More... | |
#define | __RV_FSW(freg, addr, ofs) |
Store a single-precision value from float point freg into memory using fsw instruction. More... | |
#define | __RV_FLD(freg, addr, ofs) |
Load a double-precision value from memory into float point register freg using fld instruction. More... | |
#define | __RV_FSD(freg, addr, ofs) |
Store a double-precision value from float point freg into memory using fsd instruction. More... | |
#define | __RV_FLOAD __RV_FLD |
Load a float point value from memory into float point register freg using flw/fld instruction. More... | |
#define | __RV_FSTORE __RV_FSD |
Store a float value from float point freg into memory using fsw/fsd instruction. More... | |
#define | SAVE_FPU_CONTEXT() |
Save FPU context into variables for interrupt nesting. More... | |
#define | RESTORE_FPU_CONTEXT() |
Restore necessary fpu registers from variables for interrupt nesting. More... | |
Typedefs | |
typedef uint64_t | rv_fpu_t |
Type of FPU register, depends on the FLEN defined in RISC-V. More... | |
Functions that related to the RISC-V FPU (F and D extension).
Nuclei provided floating point unit by RISC-V F and D extension.
F extension
adds single-precision floating-point computational instructions compliant with the IEEE 754-2008 arithmetic standard, __RISCV_FLEN = 32. The F extension adds 32 floating-point registers, f0-f31, each 32 bits wide, and a floating-point control and status register fcsr, which contains the operating mode and exception status of the floating-point unit.D extension
adds double-precision floating-point computational instructions compliant with the IEEE 754-2008 arithmetic standard. The D extension widens the 32 floating-point registers, f0-f31, to 64 bits, __RISCV_FLEN = 64 #define __disable_FPU | ( | ) | __RV_CSR_CLEAR(CSR_MSTATUS, MSTATUS_FS) |
Disable FPU Unit.
Definition at line 90 of file core_feature_fpu.h.
#define __enable_FPU | ( | ) |
Enable FPU Unit, and set state to initial.
Definition at line 80 of file core_feature_fpu.h.
#define __get_FCSR | ( | ) | __RV_CSR_READ(CSR_FCSR) |
Get FCSR CSR Register.
Definition at line 67 of file core_feature_fpu.h.
#define __get_FFLAGS | ( | ) | __RV_CSR_READ(CSR_FFLAGS) |
Get FFLAGS CSR Register.
Definition at line 75 of file core_feature_fpu.h.
#define __get_FRM | ( | ) | __RV_CSR_READ(CSR_FRM) |
Get FRM CSR Register.
Definition at line 71 of file core_feature_fpu.h.
#define __RISCV_FLEN 64 |
Definition at line 61 of file core_feature_fpu.h.
#define __RV_FLD | ( | freg, | |
addr, | |||
ofs | |||
) |
Load a double-precision value from memory into float point register freg using fld instruction.
The FLD instruction loads a double-precision floating point value from memory address (addr + ofs) into floating point register freg(f0-f31)
[in] | freg | The floating point register, eg. FREG(0), f0 |
[in] | addr | The memory base address, 8 byte aligned required |
[in] | ofs | a 12-bit immediate signed byte offset value, should be an const value |
Definition at line 151 of file core_feature_fpu.h.
#define __RV_FLOAD __RV_FLD |
Load a float point value from memory into float point register freg using flw/fld instruction.
Definition at line 212 of file core_feature_fpu.h.
#define __RV_FLW | ( | freg, | |
addr, | |||
ofs | |||
) |
Load a single-precision value from memory into float point register freg using flw instruction.
The FLW instruction loads a single-precision floating point value from memory address (addr + ofs) into floating point register freg(f0-f31)
[in] | freg | The floating point register, eg. FREG(0), f0 |
[in] | addr | The memory base address, 4 byte aligned required |
[in] | ofs | a 12-bit immediate signed byte offset value, should be an const value |
Definition at line 107 of file core_feature_fpu.h.
#define __RV_FSD | ( | freg, | |
addr, | |||
ofs | |||
) |
Store a double-precision value from float point freg into memory using fsd instruction.
The FSD instruction stores double-precision value from floating point register to memory
[in] | freg | The floating point register(f0-f31), eg. FREG(0), f0 |
[in] | addr | The memory base address, 8 byte aligned required |
[in] | ofs | a 12-bit immediate signed byte offset value, should be an const value |
Definition at line 174 of file core_feature_fpu.h.
#define __RV_FSTORE __RV_FSD |
Store a float value from float point freg into memory using fsw/fsd instruction.
Definition at line 213 of file core_feature_fpu.h.
#define __RV_FSW | ( | freg, | |
addr, | |||
ofs | |||
) |
Store a single-precision value from float point freg into memory using fsw instruction.
The FSW instruction stores a single-precision value from floating point register to memory
[in] | freg | The floating point register(f0-f31), eg. FREG(0), f0 |
[in] | addr | The memory base address, 4 byte aligned required |
[in] | ofs | a 12-bit immediate signed byte offset value, should be an const value |
Definition at line 128 of file core_feature_fpu.h.
#define __set_FCSR | ( | val | ) | __RV_CSR_WRITE(CSR_FCSR, (val)) |
Set FCSR CSR Register with val.
Definition at line 69 of file core_feature_fpu.h.
#define __set_FFLAGS | ( | val | ) | __RV_CSR_WRITE(CSR_FFLAGS, (val)) |
Set FFLAGS CSR Register with val.
Definition at line 77 of file core_feature_fpu.h.
#define __set_FRM | ( | val | ) | __RV_CSR_WRITE(CSR_FRM, (val)) |
Set FRM CSR Register with val.
Definition at line 73 of file core_feature_fpu.h.
#define RESTORE_FPU_CONTEXT | ( | ) |
Restore necessary fpu registers from variables for interrupt nesting.
This macro is used restore necessary fpu registers from pre-defined variables in SAVE_FPU_CONTEXT macro.
Definition at line 278 of file core_feature_fpu.h.
#define SAVE_FPU_CONTEXT | ( | ) |
Save FPU context into variables for interrupt nesting.
This macro is used to declare variables which are used for saving FPU context, and it will store the nessary fpu registers into these variables, it need to be used in a interrupt when in this interrupt fpu registers are used.
Definition at line 247 of file core_feature_fpu.h.
typedef uint64_t rv_fpu_t |
Type of FPU register, depends on the FLEN defined in RISC-V.
Definition at line 215 of file core_feature_fpu.h.