ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_fft2r_fc32_ae32.c
Go to the documentation of this file.
1// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "dsps_fft2r.h"
16#include "dsp_common.h"
17#include "dsp_types.h"
18#include <math.h>
19#include "esp_attr.h"
20#include "dsps_fft2r_platform.h"
21
22#if (dsps_bit_rev_lookup_fc32_ae32_enabled == 1)
23
24esp_err_t dsps_bit_rev_lookup_fc32_ae32(float *data, int reverse_size, uint16_t *reverse_tab)
25{
26 int idx_0, idx_1;
27 int idx_2, idx_3;
28
29 float *data_i;
30
31 asm volatile ("addi %0, %1, 4" : "=a" (data_i) : "a" (data));
32 asm volatile ("srli %0, %0, 1" : "+a" (reverse_size));
33 asm volatile ("loopnez %0, __loop_end_radix2_reorder_lookup_table" :: "a" (reverse_size));
34 asm volatile ("l16ui %0, %1, 0" : "=a" (idx_0) : "a" (reverse_tab)); //idx_0 = *(reverse_tab + 0); ///idx_0 = reverse_tab[i * 2 + 0];
35 asm volatile ("l16ui %0, %1, 2" : "=a" (idx_1) : "a" (reverse_tab)); //idx_1 = *(reverse_tab + 1); ///idx_1 = reverse_tab[i * 2 + 1];
36 asm volatile ("l16ui %0, %1, 4" : "=a" (idx_2) : "a" (reverse_tab)); //idx_2 = *(reverse_tab + 2); ///idx_2 = reverse_tab[i * 2 + 2];
37 asm volatile ("l16ui %0, %1, 6" : "=a" (idx_3) : "a" (reverse_tab)); //idx_3 = *(reverse_tab + 3); ///idx_3 = reverse_tab[i * 2 + 3];
38 asm volatile ("addi %0, %0, 8" : "+a" (reverse_tab)); // reverse_tab += 4;
39
40 asm volatile ("lsx f0, %0, %1" :: "a" (data), "a" (idx_0)); // f0 = *(data + idx_0); //f0 = data[idx_0 + 0];
41 asm volatile ("lsx f2, %0, %1" :: "a" (data_i), "a" (idx_0)); // f2 = *(data_i + idx_0); //f2 = data[idx_0 + 1];
42 asm volatile ("lsx f1, %0, %1" :: "a" (data), "a" (idx_1)); //f1 = *(data + idx_1); //f1 = data[idx_1 + 0];
43 asm volatile ("lsx f3, %0, %1" :: "a" (data_i), "a" (idx_1)); //f3 = *(data_i + idx_1); //f3 = data[idx_1 + 1];
44
45 asm volatile ("ssx f0, %0, %1" :: "a" (data), "a" (idx_1)); //*(data + idx_1) = f0; //data[idx_1 + 0] = f0;
46 asm volatile ("ssx f2, %0, %1" :: "a" (data_i), "a" (idx_1)); //*(data_i + idx_1) = f2; //data[idx_1 + 1] = f2;
47 asm volatile ("ssx f1, %0, %1" :: "a" (data), "a" (idx_0)); //*(data + idx_0) = f1; //data[idx_0 + 0] = f1;
48 asm volatile ("ssx f3, %0, %1" :: "a" (data_i), "a" (idx_0)); //*(data_i + idx_0) = f3;//data[idx_0 + 1] = f3;
49
50 asm volatile ("lsx f0, %0, %1" :: "a" (data), "a" (idx_2)); // f0 = *(data + idx_2); //f0 = data[idx_2 + 0];
51 asm volatile ("lsx f2, %0, %1" :: "a" (data_i), "a" (idx_2)); // f2 = *(data_i + idx_2); //f2 = data[idx_2 + 1];
52 asm volatile ("lsx f1, %0, %1" :: "a" (data), "a" (idx_3)); //f1 = *(data + idx_3); //f1 = data[idx_3 + 0];
53 asm volatile ("lsx f3, %0, %1" :: "a" (data_i), "a" (idx_3)); //f3 = *(data_i + idx_3); //f3 = data[idx_3 + 1];
54
55 asm volatile ("ssx f0, %0, %1" :: "a" (data), "a" (idx_3)); //*(data + idx_3) = f0; //data[idx_3 + 0] = f0;
56 asm volatile ("ssx f2, %0, %1" :: "a" (data_i), "a" (idx_3)); //*(data_i + idx_3) = f2; //data[idx_3 + 1] = f2;
57 asm volatile ("ssx f1, %0, %1" :: "a" (data), "a" (idx_2)); //*(data + idx_2) = f1; //data[idx_2 + 0] = f1;
58 asm volatile ("ssx f3, %0, %1" :: "a" (data_i), "a" (idx_2)); //*(data_i + idx_2) = f3; //data[idx_2 + 1] = f3;
59 //}
60 asm volatile("__loop_end_radix2_reorder_lookup_table: nop");
61 return ESP_OK;
62}
63#endif // dsps_bit_rev_lookup_fc32_ae32_enabled
esp_err_t dsps_bit_rev_lookup_fc32_ae32(float *data, int reverse_size, uint16_t *reverse_tab)
int esp_err_t
Definition esp_err.h:21
#define ESP_OK
Definition esp_err.h:23
static float data[128 *2]
Definition test_fft2r.c:34