XCORE SDK
XCORE Software Development Kit
xs3_math_types.h
1 // Copyright 2020-2021 XMOS LIMITED.
2 // This Software is subject to the terms of the XMOS Public Licence: Version 1.
3 
4 #pragma once
5 
6 #include <stdint.h>
7 
8 #include "xs3_api.h"
9 
10 
11 
37 C_TYPE
38 typedef struct {
39  int64_t re;
40  int64_t im;
42 
48 C_TYPE
49 typedef struct {
50  int32_t re;
51  int32_t im;
53 
59 C_TYPE
60 typedef struct {
61  int16_t re;
62  int16_t im;
64 
65 
76 typedef int exponent_t;
77 
86 typedef unsigned headroom_t;
87 
98 typedef int right_shift_t;
99 
110 typedef int left_shift_t;
111 
112 
128 typedef int32_t fixed_s32_t;
129 
145 typedef int16_t fixed_s16_t;
146 
147 
148 
166 C_TYPE
167 typedef struct {
168  int32_t mant;
170 } float_s32_t;
171 
189 C_TYPE
190 typedef struct {
191  int64_t mant;
193 } float_s64_t;
194 
204 C_TYPE
205 typedef struct {
209 
219 C_TYPE
220 typedef struct {
224 
234 C_TYPE
235 typedef struct {
239 
240 
241 C_TYPE
249 typedef enum {
256  BFP_FLAG_DYNAMIC = (1 << 0),
257 } bfp_flags_e;
258 
259 
275 C_TYPE
276 typedef struct {
278  int32_t* data;
284  unsigned length;
287 } bfp_s32_t;
289 
290 // astew: The tags around these structs are so that they can be copied into the documentation. Unfortunately it appears
291 // to mess with the documentation in a way that I'm not sure how to fix.
292 
308 C_TYPE
309 typedef struct {
311  int16_t* data;
317  unsigned length;
320 } bfp_s16_t;
322 
339 C_TYPE
340 typedef struct {
348  unsigned length;
353 
370 C_TYPE
371 typedef struct {
373  int16_t* real;
375  int16_t* imag;
381  unsigned length;
386 
387 
388 // Some standard float types required by some of the unit tests. @todo This probably belongs elsewhere
389 
390 
396 C_TYPE
397 typedef struct {
398  float re;
399  float im;
401 
402 
408 C_TYPE
409 typedef struct {
410  double re;
411  double im;
413 
414 
428 C_TYPE
429 typedef struct {
430  int16_t vD[16];
431  uint16_t vR[16];
bfp_flags_e
(Opaque) Flags field for BFP vectors.
Definition: xs3_math_types.h:249
@ BFP_FLAG_DYNAMIC
Definition: xs3_math_types.h:256
int exponent_t
An exponent.
Definition: xs3_math_types.h:76
int left_shift_t
A leftwards arithmetic bit-shift.
Definition: xs3_math_types.h:110
int right_shift_t
A rightwards arithmetic bit-shift.
Definition: xs3_math_types.h:98
int16_t fixed_s16_t
A 16-bit fixed-point scalar.
Definition: xs3_math_types.h:145
int32_t fixed_s32_t
A 32-bit fixed-point scalar.
Definition: xs3_math_types.h:128
unsigned headroom_t
Headroom of some integer or integer array.
Definition: xs3_math_types.h:86
[bfp_complex_s32_t]
Definition: xs3_math_types.h:371
headroom_t hr
Definition: xs3_math_types.h:379
bfp_flags_e flags
Definition: xs3_math_types.h:383
int16_t * real
Definition: xs3_math_types.h:373
int16_t * imag
Definition: xs3_math_types.h:375
unsigned length
Definition: xs3_math_types.h:381
exponent_t exp
Definition: xs3_math_types.h:377
[bfp_s16_t]
Definition: xs3_math_types.h:340
unsigned length
Definition: xs3_math_types.h:348
bfp_flags_e flags
Definition: xs3_math_types.h:350
complex_s32_t * data
Definition: xs3_math_types.h:342
headroom_t hr
Definition: xs3_math_types.h:346
exponent_t exp
Definition: xs3_math_types.h:344
[bfp_s32_t]
Definition: xs3_math_types.h:309
bfp_flags_e flags
Definition: xs3_math_types.h:319
headroom_t hr
Definition: xs3_math_types.h:315
unsigned length
Definition: xs3_math_types.h:317
int16_t * data
Definition: xs3_math_types.h:311
exponent_t exp
Definition: xs3_math_types.h:313
A block floating-point vector of 32-bit elements.
Definition: xs3_math_types.h:276
exponent_t exp
Definition: xs3_math_types.h:280
bfp_flags_e flags
Definition: xs3_math_types.h:286
int32_t * data
Definition: xs3_math_types.h:278
headroom_t hr
Definition: xs3_math_types.h:282
unsigned length
Definition: xs3_math_types.h:284
A complex number with a double-precision floating-point real part and a double-precision floating-poi...
Definition: xs3_math_types.h:409
double im
Imaginary Part.
Definition: xs3_math_types.h:411
double re
Real Part.
Definition: xs3_math_types.h:410
[bfp_complex_s16_t]
Definition: xs3_math_types.h:397
float im
Imaginary Part.
Definition: xs3_math_types.h:399
float re
Real Part.
Definition: xs3_math_types.h:398
A complex number with a 16-bit real part and 16-bit imaginary part.
Definition: xs3_math_types.h:60
int16_t im
Imaginary Part.
Definition: xs3_math_types.h:62
int16_t re
Real Part.
Definition: xs3_math_types.h:61
A complex number with a 32-bit real part and 32-bit imaginary part.
Definition: xs3_math_types.h:49
int32_t re
Real Part.
Definition: xs3_math_types.h:50
int32_t im
Imaginary Part.
Definition: xs3_math_types.h:51
A complex number with a 64-bit real part and 64-bit imaginary part.
Definition: xs3_math_types.h:38
int64_t re
Real Part.
Definition: xs3_math_types.h:39
int64_t im
Imaginary Part.
Definition: xs3_math_types.h:40
A complex floating-point scalar with a complex 16-bit mantissa.
Definition: xs3_math_types.h:205
complex_s16_t mant
complex 16-bit mantissa
Definition: xs3_math_types.h:206
exponent_t exp
exponent
Definition: xs3_math_types.h:207
A complex floating-point scalar with a complex 32-bit mantissa.
Definition: xs3_math_types.h:220
complex_s32_t mant
complex 32-bit mantissa
Definition: xs3_math_types.h:221
exponent_t exp
exponent
Definition: xs3_math_types.h:222
A complex floating-point scalar with a complex 64-bit mantissa.
Definition: xs3_math_types.h:235
exponent_t exp
exponent
Definition: xs3_math_types.h:237
complex_s64_t mant
complex 64-bit mantissa
Definition: xs3_math_types.h:236
A floating-point scalar with a 32-bit mantissa.
Definition: xs3_math_types.h:167
int32_t mant
32-bit mantissa
Definition: xs3_math_types.h:168
exponent_t exp
exponent
Definition: xs3_math_types.h:169
A floating-point scalar with a 64-bit mantissa.
Definition: xs3_math_types.h:190
exponent_t exp
exponent
Definition: xs3_math_types.h:192
int64_t mant
64-bit mantissa
Definition: xs3_math_types.h:191
Holds a set of sixteen 32-bit accumulators in the XS3 VPU's internal format.
Definition: xs3_math_types.h:429