FFTLIB User Guide
FFTLIB_debugPrintVector.h
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2015 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_DEBUGPRINTVECTOR_H_
38 #define COMMON_FFTLIB_UTIL_DEBUGPRINTFECTOR_H_ 1
39 
40 /*******************************************************************************
41  *
42  * INCLUDES
43  *
44  ******************************************************************************/
45 
46 #include "../FFTLIB_types.h"
47 
48 //----------------------------------------------------------------------------------
49 #ifdef __cplusplus
50 #include <c7x_scalable.h> // for device scalability
51 
52 #pragma FUNC_ALWAYS_INLINE
53 static inline void FFTLIB_debugPrintVector (c7x::uchar_vec vector)
54 {
55 #if FFTLIB_DEBUGPRINT
56  for (uint i = 0; i < c7x::element_count_of<c7x::uchar_vec>::value; i++) {
57  FFTLIB_PRINTF ("%04u", *((uchar*) (&vector) + i));
58  }
59 
60  FFTLIB_PRINTF ("%s", "\n");
61 #endif
62 }
63 
64 #pragma FUNC_ALWAYS_INLINE
65 static inline void FFTLIB_debugPrintVector (c7x::char_vec vector)
66 {
67 #if FFTLIB_DEBUGPRINT
68  for (uint i = 0; i < c7x::element_count_of<c7x::char_vec>::value; i++) {
69  FFTLIB_PRINTF ("%04d", *((int8_t*) (&vector) + i));
70  }
71 
72  FFTLIB_PRINTF ("%s", "\n");
73 #endif
74 }
75 
76 #pragma FUNC_ALWAYS_INLINE
77 static inline void FFTLIB_debugPrintVector (c7x::ushort_vec vector)
78 {
79 #if FFTLIB_DEBUGPRINT
80  for (uint i = 0; i < c7x::element_count_of<c7x::ushort_vec>::value; i++) {
81  FFTLIB_PRINTF ("%05u", *((ushort*) (&vector) + i));
82  }
83 
84  FFTLIB_PRINTF ("%s", "\n");
85 #endif
86 }
87 
88 #pragma FUNC_ALWAYS_INLINE
89 static inline void FFTLIB_debugPrintVector (c7x::short_vec vector)
90 {
91 #if FFTLIB_DEBUGPRINT
92  for (uint i = 0; i < c7x::element_count_of<c7x::short_vec>::value; i++) {
93  FFTLIB_PRINTF ("%05d", *((short*) (&vector) + i));
94  }
95 
96  FFTLIB_PRINTF ("%s", "\n");
97 #endif
98 }
99 
100 #pragma FUNC_ALWAYS_INLINE
101 static inline void FFTLIB_debugPrintVector (c7x::uint_vec vector)
102 {
103 #if FFTLIB_DEBUGPRINT
104  for (uint i = 0; i < c7x::element_count_of<c7x::uint_vec>::value; i++) {
105  FFTLIB_PRINTF ("%010u", *((uint*) (&vector) + i));
106  }
107 
108  FFTLIB_PRINTF ("%s", "\n");
109 #endif
110 }
111 
112 #pragma FUNC_ALWAYS_INLINE
113 static inline void FFTLIB_debugPrintVector (c7x::int_vec vector)
114 {
115 #if FFTLIB_DEBUGPRINT
116  for (uint i = 0; i < c7x::element_count_of<c7x::int_vec>::value; i++) {
117  FFTLIB_PRINTF ("%010d", *((int*) (&vector) + i));
118  }
119 
120  FFTLIB_PRINTF ("%s", "\n");
121 #endif
122 }
123 
124 #pragma FUNC_ALWAYS_INLINE
125 static inline void FFTLIB_debugPrintVectorInHex (c7x::long_vec vector)
126 {
127 #if FFTLIB_DEBUGPRINT
128  for (uint i = 0; i < c7x::element_count_of<c7x::long_vec>::value; i++) {
129  FFTLIB_PRINTF ("%016lx", *((long*) (&vector) + i));
130  }
131 
132  FFTLIB_PRINTF ("%s", "\n");
133 #endif
134 }
135 
136 #pragma FUNC_ALWAYS_INLINE
137 static inline void FFTLIB_debugPrintNonScalableVectorInHex (long8 vector)
138 {
139 #if FFTLIB_DEBUGPRINT
140  FFTLIB_PRINTF ("%010lx ", vector.s[7]);
141  FFTLIB_PRINTF ("%010lx ", vector.s[6]);
142  FFTLIB_PRINTF ("%010lx ", vector.s[5]);
143  FFTLIB_PRINTF ("%010lx ", vector.s[4]);
144  FFTLIB_PRINTF ("%010lx ", vector.s[3]);
145  FFTLIB_PRINTF ("%010lx ", vector.s[2]);
146  FFTLIB_PRINTF ("%010lx ", vector.s[1]);
147  FFTLIB_PRINTF ("%010lx ", vector.s[0]);
148 
149  FFTLIB_PRINTF ("%s", "\n");
150 #endif
151  return;
152 }
153 
154 #pragma FUNC_ALWAYS_INLINE
155 static inline void FFTLIB_debugPrintFloatVector (c7x::float_vec reg)
156 {
157  uint32_t elementCount = c7x::element_count_of<c7x::float_vec>::value;
158  uint32_t i = 0;
159  for (i = 0; i < elementCount; i++) {
160  printf ("%.2f, ", reg.s[i]);
161  }
162  printf ("%s", "\n");
163 
164  /* int32_t c; */
165  /* float *elementPtr = (float *) (&var0); */
166 
167  /* for (c = 0; c < 8; c++) { */
168  /* printf ("%.2f ", (*elementPtr)); */
169  /* elementPtr++; */
170  /* } */
171  /* printf ("%s", "\n"); */
172 }
173 
174 #endif //#ifdef __cplusplus
175 #endif /* COMMON_FFTLIB_UTIL_DEBUGPRINTVECTOR_H_ */
#define FFTLIB_PRINTF(fmt,...)
Definition: FFTLIB_types.h:105