Edge AI Add-on API 2.2.0
Loading...
Searching...
No Matches
nrf_dsp_f24.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
15#ifndef _NRF_DSP_SUPPORT_FLOAT24_H_
16#define _NRF_DSP_SUPPORT_FLOAT24_H_
17
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define NRF_DSP_F24_SIGNED 0x40
26#define NRF_DSP_F24_UNSIGNED 0
27#define NRF_DSP_F24_SIGN(x) ((uint8_t)(x.exps & NRF_DSP_F24_SIGNED))
28
29// ///////////////////////////////////////////////////////////////////////////
31#define f24_init nrf_dsp_f24_init
32#define i16_to_f24 nrf_dsp_i16_to_f24
33#define i8_to_f24 nrf_dsp_i8_to_f24
34#define f24_to_i32 nrf_dsp_f24_to_i32
35#define f24_mul nrf_dsp_f24_mul
36#define f24_add nrf_dsp_f24_add
37#define f24_addx nrf_dsp_f24_addx
38#define f24_div nrf_dsp_f24_div
39#define f24_sqrt nrf_dsp_f24_sqrt
40#define f24_get_exp nrf_dsp_f24_get_exp
41
42// ///////////////////////////////////////////////////////////////////////////
43
48typedef struct nrf_dsp_f24_s
49{
51 uint16_t man;
52
54 uint8_t exps;
56
61
66
75int32_t nrf_dsp_f24_to_i32(nrf_dsp_f24_t x, int8_t required_exp);
76
81
86
91
96
106nrf_dsp_f24_t nrf_dsp_f24_init(uint16_t mantissa, int8_t exp, uint8_t sign);
107
122 int8_t x_exp,
123 uint8_t x_sign,
124 uint16_t y_man,
125 int8_t y_exp,
126 uint8_t y_sign);
127
133
137__NRF_DSP_STATIC_FORCEINLINE
139{
140 return (int8_t)((x.exps & 0x80) ? -(x.exps & 0x3F) : (x.exps & 0x3F));
141}
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif /* _NRF_DSP_SUPPORT_FLOAT24_H_ */
148
nrf_dsp_f24_t nrf_dsp_f24_add(nrf_dsp_f24_t x, nrf_dsp_f24_t y)
Float24 addition (x + y) -> z.
nrf_dsp_f24_t nrf_dsp_f24_mul(nrf_dsp_f24_t x, nrf_dsp_f24_t y)
Float24 multiplication (x * y) -> z.
int32_t nrf_dsp_f24_to_i32(nrf_dsp_f24_t x, int8_t required_exp)
Convert Float24 to INT32 value.
__NRF_DSP_STATIC_FORCEINLINE int8_t nrf_dsp_f24_get_exp(nrf_dsp_f24_t x)
Get exponent of Float24 value.
Definition nrf_dsp_f24.h:138
nrf_dsp_f24_t nrf_dsp_i8_to_f24(int8_t x)
Convert INT8 to Float24.
const uint8_t * nrf_dsp_f24_get_highbit_helper(void)
Get a pointer to an internal utility array [0-255] to help figure out how many bits is occupied in by...
nrf_dsp_f24_t nrf_dsp_i16_to_f24(int16_t x)
Convert INT16 to Float24.
nrf_dsp_f24_t nrf_dsp_f24_sqrt(nrf_dsp_f24_t x)
Float24 square root (sqrt(x)) -> z.
nrf_dsp_f24_t nrf_dsp_f24_div(nrf_dsp_f24_t x, nrf_dsp_f24_t y)
Float24 division (x / y) -> z.
nrf_dsp_f24_t nrf_dsp_f24_init(uint16_t mantissa, int8_t exp, uint8_t sign)
Initialize Float24 value from metainformaton.
nrf_dsp_f24_t nrf_dsp_f24_addx(uint16_t x_man, int8_t x_exp, uint8_t x_sign, uint16_t y_man, int8_t y_exp, uint8_t y_sign)
Extended Float24 addition function (x + y) -> z.
struct nrf_dsp_f24_s nrf_dsp_f24_t
Container for Float24 representation.
uint8_t exps
Definition nrf_dsp_f24.h:54
uint16_t man
Definition nrf_dsp_f24.h:51
Container for Float24 representation.
Definition nrf_dsp_f24.h:49