FFTLIB User Guide
FFTLIB_UTIL_fillBPanel.cpp
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 #ifndef COMMON_FFTLIB_UTIL_FILLBPANEL_H_
38 #define COMMON_FFTLIB_UTIL_FILLBPANEL_H_ 1
39 
40 /*******************************************************************************
41  *
42  * INCLUDES
43  *
44  ******************************************************************************/
45 
46 #include "../FFTLIB_types.h"
47 
48 /*******************************************************************************
49  *
50  * FUNCTIONS
51  *
52  ******************************************************************************/
53 
54 /******************************************************************************/
75 /******************************************************************************/
76 
78 FFTLIB_STATUS FFTLIB_UTIL_fillBPanel(const int32_t *pValue, uint32_t dataType, uint32_t startRow, int32_t numRows)
79 {
80  int32_t r;
81  int32_t panel;
82 
83  // initialize the config to one of the common configurations
84  FFTLIB_MMA_CONFIG_REG mmaConfig;
85  switch (dataType) {
86  case FFTLIB_INT8:
88  break;
89  case FFTLIB_INT16:
91  break;
92  default:
94  break;
95  }
96 
97  // initialize the offset register
98  __HWA_OFFSET_REG mmaOffset = offsetRegStruct_zeros;
99 
100  // update MMA configuration based on function arguments
101  // set starting row
102  mmaConfig.B_BOFFSET = startRow;
103  // swap panels after numRows
104  mmaConfig.B_BSWPER = numRows;
105  // reset after numRows
106  mmaConfig.B_BRSTPER = numRows;
107 
108  // open MMA
109  __HWAOPEN(mmaConfig, mmaOffset, __MMA_OPEN_FSM_RESET);
110  __HWAADV();
111 
112  switch (dataType) {
113  case FFTLIB_INT8: {
114  int8_t fillValue; // using int8_t produces compiler warning?
115 
116  // loop over the B panels
117  for (panel = 0; panel < 2; panel++) {
118  // fill a B panel
119  _nassert(numRows > 1);
120  for (r = 0; r < numRows; r++) {
121  // extract the fill value from pValue
122  fillValue = (int8_t) pValue[r];
123  // duplicate across vector
124  c7x::char_vec VB0 = __duplicate(fillValue);
125  __HWALDB(__as_mma_vec(VB0));
126  __HWAADV();
127  }
128  }
129  break;
130  }
131  case FFTLIB_INT16: {
132  int16_t fillValue;
133 
134  // loop over the B panels
135  for (panel = 0; panel < 2; panel++) {
136  // fill the B panel
137  _nassert(numRows > 1);
138  for (r = 0; r < numRows; r++) {
139  // extract the fill value from pValue
140  fillValue = (int16_t) pValue[r];
141  // duplicate across vector
142  c7x::short_vec VB0 = __duplicate(fillValue);
143  __HWALDB(__as_mma_vec(VB0));
144  __HWAADV();
145  }
146  }
147  break;
148  }
149  default: {
150  int32_t fillValue;
151 
152  // loop over the B panels
153  for (panel = 0; panel < 2; panel++) {
154  // fill the B panel
155  _nassert(numRows > 1);
156  for (r = 0; r < numRows; r++) {
157  // extract the fill value from pValue
158  fillValue = (int32_t) pValue[r];
159  // duplicate across vector
160  c7x::int_vec VB0 = __duplicate(fillValue);
161  __HWALDB(__as_mma_vec(VB0));
162  __HWAADV();
163  }
164  }
165  break;
166  }
167  }
168 
169  return FFTLIB_SUCCESS;
170 }
171 #endif /* COMMON_FFTLIB_UTIL_FILLBPANEL_H_ */
FFTLIB_STATUS FFTLIB_UTIL_fillBPanel(const int32_t *pValue, uint32_t dataType, uint32_t startRow, int32_t numRows)
@ FFTLIB_INT16
@ FFTLIB_INT8
FFTLIB_STATUS_NAME
The enumeration of all status codes.
Definition: FFTLIB_types.h:172
@ FFTLIB_SUCCESS
Definition: FFTLIB_types.h:173
#define __INLINE_FUNC(x)
Definition: FFTLIB_types.h:67
const __HWA_OFFSET_REG offsetRegStruct_zeros
const FFTLIB_MMA_CONFIG_REG configRegisterStruct_i16s_i16s_o16s
const FFTLIB_MMA_CONFIG_REG configRegisterStruct_i32s_i32s_o32s
const FFTLIB_MMA_CONFIG_REG configRegisterStruct_i8s_i8s_o8s
#define FFTLIB_MMA_CONFIG_REG