Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- firmware/ap_types/ap_common.h +376 -0
- firmware/ap_types/ap_decl.h +212 -0
- firmware/ap_types/ap_fixed.h +360 -0
- firmware/ap_types/ap_fixed_base.h +2354 -0
- firmware/ap_types/ap_fixed_ref.h +718 -0
- firmware/ap_types/ap_fixed_special.h +230 -0
- firmware/ap_types/ap_float.h +186 -0
- firmware/ap_types/ap_int.h +330 -0
- firmware/ap_types/ap_int_base.h +1885 -0
- firmware/ap_types/ap_int_ref.h +1346 -0
- firmware/ap_types/ap_int_special.h +223 -0
- firmware/ap_types/ap_shift_reg.h +138 -0
- firmware/ap_types/etc/ap_private.h +0 -0
- firmware/ap_types/hls_math.h +27 -0
- firmware/ap_types/hls_stream.h +263 -0
- firmware/ap_types/utils/x_hls_utils.h +80 -0
- firmware/nnet_utils/nnet_code_gen.h +28 -0
- firmware/nnet_utils/nnet_conv1d_stream.h +37 -0
- firmware/nnet_utils/nnet_conv2d_latency.h +90 -0
- firmware/nnet_utils/nnet_conv2d_resource.h +108 -0
- firmware/nnet_utils/nnet_embed_stream.h +33 -0
- firmware/nnet_utils/nnet_helpers.h +382 -0
- firmware/nnet_utils/nnet_sepconv2d.h +51 -0
- firmware/nnet_utils/nnet_transpose.h +39 -0
- firmware/nnet_utils/nnet_types.h +80 -0
- logs/hls_run_tcl.log +0 -0
- logs/hls_run_tcl_137509.backup.log +0 -0
- logs/hls_run_tcl_17873.backup.log +0 -0
- logs/hls_run_tcl_181235.backup.log +0 -0
- logs/hls_run_tcl_184335.backup.log +0 -0
- logs/hls_run_tcl_185829.backup.log +0 -0
- logs/hls_run_tcl_20622.backup.log +170 -0
- logs/hls_run_tcl_21278.backup.log +104 -0
- logs/hls_run_tcl_450811.backup.log +0 -0
- logs/hls_run_tcl_4666.backup.log +0 -0
- logs/hls_run_tcl_6671.backup.log +0 -0
- logs/hls_run_tcl_7008.backup.log +0 -0
- myproject_prj/hls.app +12 -0
- myproject_prj/solution1/solution1.aps +24 -0
- myproject_prj/solution1/solution1.directive +10 -0
- myproject_prj/solution1/solution1_data.json +0 -0
- myproject_prj/solution1/syn/report/clone_stream_array_ap_fixed_32u_array_ap_fixed_16_6_5_3_0_32u_8192_s_csynth.xml +356 -0
- myproject_prj/solution1/syn/report/clone_stream_array_ap_fixed_8u_array_ap_fixed_16_6_5_3_0_8u_32768_s_csynth.xml +356 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_32u_config12_s_csynth.rpt +335 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_8u_config35_s_csynth.rpt +421 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_16u_config29_s_csynth.xml +710 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_32u_config14_s_csynth.rpt +525 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_32u_config25_s_csynth.rpt +495 -0
- myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_43_23_5_3_0_32u_config23_s_csynth.rpt +0 -0
- myproject_prj/solution1/syn/report/concatenate3d_2_array_array_array_ap_fixed_16_6_5_3_0_24u_config34_s_csynth.xml +312 -0
firmware/ap_types/ap_common.h
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_COMMON_H__
|
| 18 |
+
#define __AP_COMMON_H__
|
| 19 |
+
|
| 20 |
+
// ----------------------------------------------------------------------
|
| 21 |
+
|
| 22 |
+
// Forward declaration of all AP types.
|
| 23 |
+
#include <ap_decl.h>
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
#ifdef __SYNTHESIS__
|
| 27 |
+
#error "The open-source version of AP types does not support synthesis."
|
| 28 |
+
#endif // ifdef __SYNTHESIS__
|
| 29 |
+
#define _AP_ENABLE_HALF_ 0
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 33 |
+
// Before ap_private definition.
|
| 34 |
+
#ifdef __SYNTHESIS__
|
| 35 |
+
#define _HLS_HALF_DEFINED_
|
| 36 |
+
typedef __fp16 half;
|
| 37 |
+
#else
|
| 38 |
+
class half;
|
| 39 |
+
#endif // __SYNTHESIS__
|
| 40 |
+
#endif // _AP_ENABLE_HALF_
|
| 41 |
+
|
| 42 |
+
// ----------------------------------------------------------------------
|
| 43 |
+
|
| 44 |
+
// Macro functions
|
| 45 |
+
#define AP_MAX(a, b) ((a) > (b) ? (a) : (b))
|
| 46 |
+
#define AP_MIN(a, b) ((a) < (b) ? (a) : (b))
|
| 47 |
+
#define AP_ABS(a) ((a) >= 0 ? (a) : -(a))
|
| 48 |
+
|
| 49 |
+
#ifndef AP_ASSERT
|
| 50 |
+
#ifndef __SYNTHESIS__
|
| 51 |
+
#include <assert.h>
|
| 52 |
+
#define AP_ASSERT(cond, msg) assert((cond) && (msg))
|
| 53 |
+
#else
|
| 54 |
+
#define AP_ASSERT(cond, msg)
|
| 55 |
+
#endif // ifndef __SYNTHESIS__
|
| 56 |
+
#endif // ifndef AP_ASSERT
|
| 57 |
+
|
| 58 |
+
#ifndef __SYNTHESIS__
|
| 59 |
+
// for fprintf messages.
|
| 60 |
+
#include <stdio.h>
|
| 61 |
+
// for exit on error.
|
| 62 |
+
#include <stdlib.h>
|
| 63 |
+
#endif
|
| 64 |
+
|
| 65 |
+
// same disable condition as assert.
|
| 66 |
+
#if !defined(__SYNTHESIS__) && !defined(NDEBUG)
|
| 67 |
+
|
| 68 |
+
#define _AP_DEBUG(cond, ...) \
|
| 69 |
+
do { \
|
| 70 |
+
if ((cond)) { \
|
| 71 |
+
fprintf(stderr, "DEBUG: " __VA_ARGS__); \
|
| 72 |
+
fprintf(stderr, "\n"); \
|
| 73 |
+
} \
|
| 74 |
+
} while (0)
|
| 75 |
+
#define _AP_WARNING(cond, ...) \
|
| 76 |
+
do { \
|
| 77 |
+
if ((cond)) { \
|
| 78 |
+
fprintf(stderr, "WARNING: " __VA_ARGS__); \
|
| 79 |
+
fprintf(stderr, "\n"); \
|
| 80 |
+
} \
|
| 81 |
+
} while (0)
|
| 82 |
+
#define _AP_ERROR(cond, ...) \
|
| 83 |
+
do { \
|
| 84 |
+
if ((cond)) { \
|
| 85 |
+
fprintf(stderr, "ERROR: " __VA_ARGS__); \
|
| 86 |
+
fprintf(stderr, "\n"); \
|
| 87 |
+
abort(); \
|
| 88 |
+
} \
|
| 89 |
+
} while (0)
|
| 90 |
+
|
| 91 |
+
#else // if !defined(__SYNTHESIS__) && !defined(NDEBUG)
|
| 92 |
+
|
| 93 |
+
#define __AP_VOID_CAST static_cast<void>
|
| 94 |
+
#define _AP_DEBUG(cond, ...) (__AP_VOID_CAST(0))
|
| 95 |
+
#define _AP_WARNING(cond, ...) (__AP_VOID_CAST(0))
|
| 96 |
+
#define _AP_ERROR(cond, ...) (__AP_VOID_CAST(0))
|
| 97 |
+
|
| 98 |
+
#endif // if !defined(__SYNTHESIS__) && !defined(NDEBUG) else
|
| 99 |
+
|
| 100 |
+
// ----------------------------------------------------------------------
|
| 101 |
+
|
| 102 |
+
// Attribute only for synthesis
|
| 103 |
+
#ifdef __SYNTHESIS__
|
| 104 |
+
#define INLINE inline __attribute__((always_inline))
|
| 105 |
+
//#define INLINE inline __attribute__((noinline))
|
| 106 |
+
#else
|
| 107 |
+
#define INLINE inline
|
| 108 |
+
#endif
|
| 109 |
+
|
| 110 |
+
#define AP_WEAK
|
| 111 |
+
// __attribute__((weak))
|
| 112 |
+
|
| 113 |
+
#ifndef AP_INT_MAX_W
|
| 114 |
+
#define AP_INT_MAX_W 1024
|
| 115 |
+
#endif
|
| 116 |
+
|
| 117 |
+
#define BIT_WIDTH_UPPER_LIMIT (1 << 15)
|
| 118 |
+
#if AP_INT_MAX_W > BIT_WIDTH_UPPER_LIMIT
|
| 119 |
+
#error "Bitwidth exceeds 32768 (1 << 15), the maximum allowed value"
|
| 120 |
+
#endif
|
| 121 |
+
|
| 122 |
+
#define MAX_MODE(BITS) ((BITS + 1023) / 1024)
|
| 123 |
+
|
| 124 |
+
// ----------------------------------------------------------------------
|
| 125 |
+
|
| 126 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 127 |
+
#ifndef AP_AUTOCC
|
| 128 |
+
#ifndef __SYNTHESIS__
|
| 129 |
+
// for overload operator<<
|
| 130 |
+
#include <iostream>
|
| 131 |
+
#endif
|
| 132 |
+
#endif // ifndef AP_AUTOCC
|
| 133 |
+
|
| 134 |
+
#ifndef __SYNTHESIS__
|
| 135 |
+
// for string format.
|
| 136 |
+
#include <sstream>
|
| 137 |
+
// for string.
|
| 138 |
+
#include <string>
|
| 139 |
+
#endif
|
| 140 |
+
|
| 141 |
+
// for detecting if char is signed.
|
| 142 |
+
enum { CHAR_IS_SIGNED = (char)-1 < 0 };
|
| 143 |
+
|
| 144 |
+
// TODO we have similar traits in x_hls_utils.h, should consider unify.
|
| 145 |
+
namespace _ap_type {
|
| 146 |
+
template <typename _Tp>
|
| 147 |
+
struct is_signed {
|
| 148 |
+
static const bool value = _Tp(-1) < _Tp(1);
|
| 149 |
+
};
|
| 150 |
+
|
| 151 |
+
template <typename _Tp>
|
| 152 |
+
struct is_integral {
|
| 153 |
+
static const bool value = false;
|
| 154 |
+
};
|
| 155 |
+
#define DEF_IS_INTEGRAL(CTYPE) \
|
| 156 |
+
template <> \
|
| 157 |
+
struct is_integral<CTYPE> { \
|
| 158 |
+
static const bool value = true; \
|
| 159 |
+
};
|
| 160 |
+
DEF_IS_INTEGRAL(bool)
|
| 161 |
+
DEF_IS_INTEGRAL(char)
|
| 162 |
+
DEF_IS_INTEGRAL(signed char)
|
| 163 |
+
DEF_IS_INTEGRAL(unsigned char)
|
| 164 |
+
DEF_IS_INTEGRAL(short)
|
| 165 |
+
DEF_IS_INTEGRAL(unsigned short)
|
| 166 |
+
DEF_IS_INTEGRAL(int)
|
| 167 |
+
DEF_IS_INTEGRAL(unsigned int)
|
| 168 |
+
DEF_IS_INTEGRAL(long)
|
| 169 |
+
DEF_IS_INTEGRAL(unsigned long)
|
| 170 |
+
DEF_IS_INTEGRAL(ap_slong)
|
| 171 |
+
DEF_IS_INTEGRAL(ap_ulong)
|
| 172 |
+
#undef DEF_IS_INTEGRAL
|
| 173 |
+
|
| 174 |
+
template <bool, typename _Tp = void>
|
| 175 |
+
struct enable_if {};
|
| 176 |
+
// partial specialization for true
|
| 177 |
+
template <typename _Tp>
|
| 178 |
+
struct enable_if<true, _Tp> {
|
| 179 |
+
typedef _Tp type;
|
| 180 |
+
};
|
| 181 |
+
|
| 182 |
+
template <typename _Tp>
|
| 183 |
+
struct remove_const {
|
| 184 |
+
typedef _Tp type;
|
| 185 |
+
};
|
| 186 |
+
|
| 187 |
+
template <typename _Tp>
|
| 188 |
+
struct remove_const<_Tp const> {
|
| 189 |
+
typedef _Tp type;
|
| 190 |
+
};
|
| 191 |
+
} // namespace _ap_type
|
| 192 |
+
|
| 193 |
+
// ----------------------------------------------------------------------
|
| 194 |
+
|
| 195 |
+
// Define ssdm_int and _ssdm_op.
|
| 196 |
+
// XXX deleted in open-source version
|
| 197 |
+
|
| 198 |
+
#ifndef NON_C99STRING
|
| 199 |
+
#define _AP_C99 true
|
| 200 |
+
#else
|
| 201 |
+
#define _AP_C99 false
|
| 202 |
+
#endif
|
| 203 |
+
|
| 204 |
+
static inline unsigned char guess_radix(const char* s) {
|
| 205 |
+
unsigned char rd = 10; ///< default radix
|
| 206 |
+
const char* p = s;
|
| 207 |
+
// skip neg sign if it exists
|
| 208 |
+
if (p[0] == '-' || p[0] == '+') ++p;
|
| 209 |
+
// guess based on following two bits.
|
| 210 |
+
if (p[0] == '0') {
|
| 211 |
+
if (p[1] == 'b' || p[1] == 'B') {
|
| 212 |
+
rd = 2;
|
| 213 |
+
} else if (p[1] == 'o' || p[1] == 'O') {
|
| 214 |
+
rd = 8;
|
| 215 |
+
} else if (p[1] == 'x' || p[1] == 'X') {
|
| 216 |
+
rd = 16;
|
| 217 |
+
} else if (p[1] == 'd' || p[1] == 'D') {
|
| 218 |
+
rd = 10;
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
return rd;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
// ----------------------------------------------------------------------
|
| 225 |
+
|
| 226 |
+
// Basic integral struct upon which ap_int and ap_fixed are defined.
|
| 227 |
+
#ifdef __SYNTHESIS__
|
| 228 |
+
// Use ssdm_int, a compiler dependent, attribute constrained integeral type as
|
| 229 |
+
// basic data type.
|
| 230 |
+
#define _AP_ROOT_TYPE ssdm_int
|
| 231 |
+
// Basic ops.
|
| 232 |
+
#define _AP_ROOT_op_concat(Ret, X, Y) _ssdm_op_concat(Ret, X, Y)
|
| 233 |
+
#define _AP_ROOT_op_get_bit(Val, Bit) _ssdm_op_get_bit(Val, Bit)
|
| 234 |
+
#define _AP_ROOT_op_set_bit(Val, Bit, Repl) _ssdm_op_set_bit(Val, Bit, Repl)
|
| 235 |
+
#define _AP_ROOT_op_get_range(Val, Lo, Hi) _ssdm_op_get_range(Val, Lo, Hi)
|
| 236 |
+
#define _AP_ROOT_op_set_range(Val, Lo, Hi, Repl) \
|
| 237 |
+
_ssdm_op_set_range(Val, Lo, Hi, Repl)
|
| 238 |
+
#define _AP_ROOT_op_reduce(Op, Val) _ssdm_op_reduce(Op, Val)
|
| 239 |
+
#else // ifdef __SYNTHESIS__
|
| 240 |
+
// Use ap_private for compiler-independent basic data type
|
| 241 |
+
template <int _AP_W, bool _AP_S, bool _AP_C = _AP_W <= 64>
|
| 242 |
+
class ap_private;
|
| 243 |
+
/// model ssdm_int in standard C++ for simulation.
|
| 244 |
+
template <int _AP_W, bool _AP_S>
|
| 245 |
+
struct ssdm_int_sim {
|
| 246 |
+
/// integral type with template-specified width and signedness.
|
| 247 |
+
ap_private<_AP_W, _AP_S> V;
|
| 248 |
+
ssdm_int_sim() {}
|
| 249 |
+
};
|
| 250 |
+
#define _AP_ROOT_TYPE ssdm_int_sim
|
| 251 |
+
// private's ref uses _AP_ROOT_TYPE.
|
| 252 |
+
#include <etc/ap_private.h>
|
| 253 |
+
// XXX The C-sim model cannot use GCC-extension
|
| 254 |
+
// Basic ops. Ret and Val are ap_private.
|
| 255 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
| 256 |
+
inline _Tp1 _AP_ROOT_op_concat(const _Tp1& Ret, const _Tp2& X, const _Tp3& Y) {
|
| 257 |
+
_Tp1 r = (X).operator,(Y);
|
| 258 |
+
return r;
|
| 259 |
+
}
|
| 260 |
+
#define _AP_ROOT_op_get_bit(Val, Bit) (Val).get_bit((Bit))
|
| 261 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
| 262 |
+
inline _Tp1& _AP_ROOT_op_set_bit(_Tp1& Val, const _Tp2& Bit, const _Tp3& Repl) {
|
| 263 |
+
(Val).set_bit((Bit), (Repl));
|
| 264 |
+
return Val;
|
| 265 |
+
}
|
| 266 |
+
// notice the order of high and low index is different in ssdm call and
|
| 267 |
+
// ap_private.range()...
|
| 268 |
+
#define _AP_ROOT_op_get_range(Val, Lo, Hi) (Val).range((Hi), (Lo))
|
| 269 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
|
| 270 |
+
inline _Tp1& _AP_ROOT_op_set_range(_Tp1& Val, const _Tp2& Lo, const _Tp3& Hi,
|
| 271 |
+
const _Tp4& Repl) {
|
| 272 |
+
(Val).range((Hi), (Lo)) = Repl;
|
| 273 |
+
return (Val);
|
| 274 |
+
}
|
| 275 |
+
#define _AP_ROOT_op_and_reduce(Val) (Val).and_reduce()
|
| 276 |
+
#define _AP_ROOT_op_nand_reduce(Val) (Val).nand_reduce()
|
| 277 |
+
#define _AP_ROOT_op_or_reduce(Val) (Val).or_reduce()
|
| 278 |
+
#define _AP_ROOT_op_xor_reduce(Val) (Val).xor_reduce()
|
| 279 |
+
// ## is the concatenation in preprocessor:
|
| 280 |
+
#define _AP_ROOT_op_reduce(Op, Val) _AP_ROOT_op_##Op##_reduce(Val)
|
| 281 |
+
#endif // ifdef __SYNTHESIS__ else
|
| 282 |
+
|
| 283 |
+
// ----------------------------------------------------------------------
|
| 284 |
+
|
| 285 |
+
// Constants for half, single, double pricision floating points
|
| 286 |
+
#define HALF_MAN 10
|
| 287 |
+
#define FLOAT_MAN 23
|
| 288 |
+
#define DOUBLE_MAN 52
|
| 289 |
+
|
| 290 |
+
#define HALF_EXP 5
|
| 291 |
+
#define FLOAT_EXP 8
|
| 292 |
+
#define DOUBLE_EXP 11
|
| 293 |
+
|
| 294 |
+
#define BIAS(e) ((1L << (e - 1L)) - 1L)
|
| 295 |
+
#define HALF_BIAS BIAS(HALF_EXP)
|
| 296 |
+
#define FLOAT_BIAS BIAS(FLOAT_EXP)
|
| 297 |
+
#define DOUBLE_BIAS BIAS(DOUBLE_EXP)
|
| 298 |
+
|
| 299 |
+
#define APFX_IEEE_DOUBLE_E_MAX DOUBLE_BIAS
|
| 300 |
+
#define APFX_IEEE_DOUBLE_E_MIN (-DOUBLE_BIAS + 1)
|
| 301 |
+
|
| 302 |
+
INLINE ap_ulong doubleToRawBits(double pf) {
|
| 303 |
+
union {
|
| 304 |
+
ap_ulong __L;
|
| 305 |
+
double __D;
|
| 306 |
+
} LD;
|
| 307 |
+
LD.__D = pf;
|
| 308 |
+
return LD.__L;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
INLINE unsigned int floatToRawBits(float pf) {
|
| 312 |
+
union {
|
| 313 |
+
unsigned int __L;
|
| 314 |
+
float __D;
|
| 315 |
+
} LD;
|
| 316 |
+
LD.__D = pf;
|
| 317 |
+
return LD.__L;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 321 |
+
INLINE unsigned short halfToRawBits(half pf) {
|
| 322 |
+
#ifdef __SYNTHESIS__
|
| 323 |
+
union {
|
| 324 |
+
unsigned short __L;
|
| 325 |
+
half __D;
|
| 326 |
+
} LD;
|
| 327 |
+
LD.__D = pf;
|
| 328 |
+
return LD.__L;
|
| 329 |
+
#else
|
| 330 |
+
return pf.get_bits();
|
| 331 |
+
#endif
|
| 332 |
+
}
|
| 333 |
+
#endif
|
| 334 |
+
|
| 335 |
+
// usigned long long is at least 64-bit
|
| 336 |
+
INLINE double rawBitsToDouble(ap_ulong pi) {
|
| 337 |
+
union {
|
| 338 |
+
ap_ulong __L;
|
| 339 |
+
double __D;
|
| 340 |
+
} LD;
|
| 341 |
+
LD.__L = pi;
|
| 342 |
+
return LD.__D;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// long is at least 32-bit
|
| 346 |
+
INLINE float rawBitsToFloat(unsigned long pi) {
|
| 347 |
+
union {
|
| 348 |
+
unsigned int __L;
|
| 349 |
+
float __D;
|
| 350 |
+
} LD;
|
| 351 |
+
LD.__L = pi;
|
| 352 |
+
return LD.__D;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 356 |
+
// short is at least 16-bit
|
| 357 |
+
INLINE half rawBitsToHalf(unsigned short pi) {
|
| 358 |
+
#ifdef __SYNTHESIS__
|
| 359 |
+
union {
|
| 360 |
+
unsigned short __L;
|
| 361 |
+
half __D;
|
| 362 |
+
} LD;
|
| 363 |
+
LD.__L = pi;
|
| 364 |
+
return LD.__D;
|
| 365 |
+
#else
|
| 366 |
+
// sim model of half has a non-trivial constructor
|
| 367 |
+
half __D;
|
| 368 |
+
__D.set_bits(pi);
|
| 369 |
+
return __D;
|
| 370 |
+
#endif
|
| 371 |
+
}
|
| 372 |
+
#endif
|
| 373 |
+
|
| 374 |
+
#endif // ifndef __AP_COMMON_H__
|
| 375 |
+
|
| 376 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_decl.h
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_DECL_H__
|
| 18 |
+
#define __AP_DECL_H__
|
| 19 |
+
|
| 20 |
+
// ----------------------------------------------------------------------
|
| 21 |
+
|
| 22 |
+
#if !defined(__AP_FIXED_H__) && !defined(__AP_INT_H__) && !defined(__AUTOPILOT_CBE_H__) && !defined(__HLS_HALF_H__)
|
| 23 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 24 |
+
#endif
|
| 25 |
+
|
| 26 |
+
// Test __SYNTHESIS__ only for mode
|
| 27 |
+
#if !defined(__SYNTHESIS__) && (defined(AESL_SYN) || defined(__HLS_SYN__))
|
| 28 |
+
//#pragma message "AESL_SYN and __HLS_SYN__ should be replaced by __SYNTHESIS__"
|
| 29 |
+
#define __SYNTHESIS__
|
| 30 |
+
#endif
|
| 31 |
+
|
| 32 |
+
/* for safety*/
|
| 33 |
+
#if (defined(_AP_N) || defined(_AP_C))
|
| 34 |
+
#error One or more of the following is defined: _AP_N, _AP_C. Definition conflicts with their usage as template parameters.
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
/* for safety*/
|
| 38 |
+
#if (defined(_AP_W) || defined(_AP_I) || defined(_AP_S) || defined(_AP_Q) || \
|
| 39 |
+
defined(_AP_O) || defined(_AP_W2) || defined(_AP_I2) || \
|
| 40 |
+
defined(_AP_S2) || defined(_AP_Q2) || defined(_AP_O2) || \
|
| 41 |
+
defined(_AP_N) || defined(_AP_N2))
|
| 42 |
+
#error \
|
| 43 |
+
"One or more of the following is defined: _AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N, _AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2. Definition conflicts with their usage as template parameters."
|
| 44 |
+
#endif
|
| 45 |
+
|
| 46 |
+
/*for safety*/
|
| 47 |
+
#if (defined(_AP_W3) || defined(_AP_S3) || defined(_AP_W4) || defined(_AP_S4))
|
| 48 |
+
#error \
|
| 49 |
+
"One or more of the following is defined: _AP_W3, _AP_S3, _AP_W4,_AP_S4. Definition conflicts with their usage as template parameters."
|
| 50 |
+
#endif
|
| 51 |
+
|
| 52 |
+
#if (defined(_AP_W1) || defined(_AP_S1) || defined(_AP_T) || \
|
| 53 |
+
defined(_AP_T1) || defined(_AP_T2) || defined(_AP_T3) || defined(_AP_T4))
|
| 54 |
+
#error \
|
| 55 |
+
"One or more of the following is defined: _AP_W1, _AP_S1, _AP_T, _AP_T1, _AP_T2, _AP_T3, _AP_T4. Definition conflicts with their usage as template parameters."
|
| 56 |
+
#endif
|
| 57 |
+
|
| 58 |
+
#ifndef __cplusplus
|
| 59 |
+
#error "AP data type can only be used in C++"
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
// ----------------------------------------------------------------------
|
| 63 |
+
|
| 64 |
+
#ifndef __SC_COMPATIBLE__
|
| 65 |
+
/// ap_fixed quantification mode
|
| 66 |
+
enum ap_q_mode {
|
| 67 |
+
AP_RND, //< rounding to plus infinity
|
| 68 |
+
AP_RND_ZERO, //< rounding to zero
|
| 69 |
+
AP_RND_MIN_INF, //< rounding to minus infinity
|
| 70 |
+
AP_RND_INF, //< rounding to infinity
|
| 71 |
+
AP_RND_CONV, //< convergent rounding
|
| 72 |
+
AP_TRN, //< truncation
|
| 73 |
+
AP_TRN_ZERO, //< truncation to zero
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
// FIXME for legacy code
|
| 77 |
+
#ifndef SYSTEMC_INCLUDED
|
| 78 |
+
#define SC_RND AP_RND
|
| 79 |
+
#define SC_RND_ZERO AP_RND_ZERO
|
| 80 |
+
#define SC_RND_MIN_INF AP_RND_MIN_INF
|
| 81 |
+
#define SC_RND_INF AP_RND_INF
|
| 82 |
+
#define SC_RND_CONV AP_RND_CONV
|
| 83 |
+
#define SC_TRN AP_TRN
|
| 84 |
+
#define SC_TRN_ZERO AP_TRN_ZERO
|
| 85 |
+
#endif // !defined(SYSTEMC_INCLUDED)
|
| 86 |
+
|
| 87 |
+
/// ap_fixed saturation mode
|
| 88 |
+
enum ap_o_mode {
|
| 89 |
+
AP_SAT, //< saturation
|
| 90 |
+
AP_SAT_ZERO, //< saturation to zero
|
| 91 |
+
AP_SAT_SYM, //< symmetrical saturation
|
| 92 |
+
AP_WRAP, //< wrap-around (*)
|
| 93 |
+
AP_WRAP_SM, //< sign magnitude wrap-around (*)
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
// FIXME for legacy code
|
| 97 |
+
#ifndef SYSTEMC_INCLUDED
|
| 98 |
+
#define SC_SAT AP_SAT
|
| 99 |
+
#define SC_SAT_ZERO AP_SAT_ZERO
|
| 100 |
+
#define SC_SAT_SYM AP_SAT_SYM
|
| 101 |
+
#define SC_WRAP AP_WRAP
|
| 102 |
+
#define SC_WRAP_SM AP_WRAP_SM
|
| 103 |
+
#endif // !defined(SYSTEMC_INCLUDED)
|
| 104 |
+
|
| 105 |
+
#else // defined(__SC_COMPATIBLE__)
|
| 106 |
+
|
| 107 |
+
// There will not be sc_fxdefs.h, and the emu should be defined by ap_fixed.
|
| 108 |
+
|
| 109 |
+
/// ap_fixed quantification mode
|
| 110 |
+
enum ap_q_mode {
|
| 111 |
+
SC_RND, //< rounding to plus infinity
|
| 112 |
+
SC_RND_ZERO, //< rounding to zero
|
| 113 |
+
SC_RND_MIN_INF, //< rounding to minus infinity
|
| 114 |
+
SC_RND_INF, //< rounding to infinity
|
| 115 |
+
SC_RND_CONV, //< convergent rounding
|
| 116 |
+
SC_TRN, //< truncation
|
| 117 |
+
SC_TRN_ZERO, //< truncation to zero
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
#define AP_RND SC_RND
|
| 121 |
+
#define AP_RND_ZERO SC_RND_ZERO
|
| 122 |
+
#define AP_RND_MIN_INF SC_RND_MIN_INF
|
| 123 |
+
#define AP_RND_INF SC_RND_INF
|
| 124 |
+
#define AP_RND_CONV SC_RND_CONV
|
| 125 |
+
#define AP_TRN SC_TRN
|
| 126 |
+
#define AP_TRN_ZERO SC_TRN_ZERO
|
| 127 |
+
|
| 128 |
+
/// ap_fixed saturation mode
|
| 129 |
+
enum ap_o_mode {
|
| 130 |
+
SC_SAT, //< saturation
|
| 131 |
+
SC_SAT_ZERO, //< saturation to zero
|
| 132 |
+
SC_SAT_SYM, //< symmetrical saturation
|
| 133 |
+
SC_WRAP, //< wrap-around (*)
|
| 134 |
+
SC_WRAP_SM, //< sign magnitude wrap-around (*)
|
| 135 |
+
};
|
| 136 |
+
|
| 137 |
+
#define AP_SAT SC_SAT
|
| 138 |
+
#define AP_SAT_ZERO SC_SAT_ZERO
|
| 139 |
+
#define AP_SAT_SYM SC_SAT_SYM
|
| 140 |
+
#define AP_WRAP SC_WRAP
|
| 141 |
+
#define AP_WRAP_SM SC_WRAP_SM
|
| 142 |
+
|
| 143 |
+
#endif // defined(__SC_COMPATIBLE__)
|
| 144 |
+
|
| 145 |
+
template <int _AP_W, bool _AP_S>
|
| 146 |
+
struct ap_int_base;
|
| 147 |
+
|
| 148 |
+
template <int _AP_W>
|
| 149 |
+
struct ap_int;
|
| 150 |
+
|
| 151 |
+
template <int _AP_W>
|
| 152 |
+
struct ap_uint;
|
| 153 |
+
|
| 154 |
+
template <int _AP_W, bool _AP_S>
|
| 155 |
+
struct ap_range_ref;
|
| 156 |
+
|
| 157 |
+
template <int _AP_W, bool _AP_S>
|
| 158 |
+
struct ap_bit_ref;
|
| 159 |
+
|
| 160 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2>
|
| 161 |
+
struct ap_concat_ref;
|
| 162 |
+
|
| 163 |
+
template <int _AP_W, int _AP_I, bool _AP_S = true, ap_q_mode _AP_Q = AP_TRN,
|
| 164 |
+
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
| 165 |
+
struct ap_fixed_base;
|
| 166 |
+
|
| 167 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
|
| 168 |
+
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
| 169 |
+
struct ap_fixed;
|
| 170 |
+
|
| 171 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
|
| 172 |
+
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
| 173 |
+
struct ap_ufixed;
|
| 174 |
+
|
| 175 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 176 |
+
int _AP_N>
|
| 177 |
+
struct af_range_ref;
|
| 178 |
+
|
| 179 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 180 |
+
int _AP_N>
|
| 181 |
+
struct af_bit_ref;
|
| 182 |
+
|
| 183 |
+
/// string base mode
|
| 184 |
+
enum BaseMode { AP_BIN = 2, AP_OCT = 8, AP_DEC = 10, AP_HEX = 16 };
|
| 185 |
+
|
| 186 |
+
#ifndef SYSTEMC_INCLUDED
|
| 187 |
+
#define SC_BIN 2
|
| 188 |
+
#define SC_OCT 8
|
| 189 |
+
#define SC_DEC 10
|
| 190 |
+
#define SC_HEX 16
|
| 191 |
+
#endif // !defined(SYSTEMC_INCLUDED)
|
| 192 |
+
|
| 193 |
+
// Alias C data types
|
| 194 |
+
#ifdef _MSC_VER
|
| 195 |
+
typedef signed __int64 ap_slong;
|
| 196 |
+
typedef unsigned __int64 ap_ulong;
|
| 197 |
+
#else // !defined(_MSC_VER)
|
| 198 |
+
typedef signed long long ap_slong;
|
| 199 |
+
typedef unsigned long long ap_ulong;
|
| 200 |
+
#endif // !defined(_MSC_VER)
|
| 201 |
+
|
| 202 |
+
enum {
|
| 203 |
+
_AP_SIZE_char = 8,
|
| 204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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_FIXED_H__
|
| 18 |
+
#define __AP_FIXED_H__
|
| 19 |
+
|
| 20 |
+
#include <ap_common.h>
|
| 21 |
+
#include <ap_fixed_base.h>
|
| 22 |
+
#include <ap_fixed_ref.h>
|
| 23 |
+
|
| 24 |
+
//---------------------------------------------------------------
|
| 25 |
+
|
| 26 |
+
/// Signed Arbitrary Precision Fixed-Point Type.
|
| 27 |
+
// default for _AP_Q, _AP_O and _AP_N set in ap_decl.h
|
| 28 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 29 |
+
struct ap_fixed : ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> {
|
| 30 |
+
typedef ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> Base;
|
| 31 |
+
// Constructor
|
| 32 |
+
/// default ctor
|
| 33 |
+
INLINE ap_fixed() : Base() {}
|
| 34 |
+
|
| 35 |
+
/// default copy ctor
|
| 36 |
+
INLINE ap_fixed(const ap_fixed& op) { Base::V = op.V; }
|
| 37 |
+
|
| 38 |
+
/// copy ctor from ap_fixed_base.
|
| 39 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 40 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 41 |
+
INLINE ap_fixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
| 42 |
+
_AP_O2, _AP_N2>& op)
|
| 43 |
+
: Base(op) {}
|
| 44 |
+
|
| 45 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 46 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 47 |
+
INLINE ap_fixed(const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
| 48 |
+
_AP_O2, _AP_N2>& op)
|
| 49 |
+
: Base(op) {}
|
| 50 |
+
|
| 51 |
+
//// from ap_fixed
|
| 52 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 53 |
+
// int _AP_N2>
|
| 54 |
+
//INLINE ap_fixed(
|
| 55 |
+
// const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 56 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
| 57 |
+
|
| 58 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 59 |
+
// int _AP_N2>
|
| 60 |
+
//INLINE ap_fixed(
|
| 61 |
+
// const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 62 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
| 63 |
+
|
| 64 |
+
//// from ap_ufixed.
|
| 65 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 66 |
+
// int _AP_N2>
|
| 67 |
+
//INLINE ap_fixed(
|
| 68 |
+
// const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 69 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
| 70 |
+
//}
|
| 71 |
+
|
| 72 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 73 |
+
// int _AP_N2>
|
| 74 |
+
//INLINE ap_fixed(
|
| 75 |
+
// const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 76 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
| 77 |
+
//}
|
| 78 |
+
|
| 79 |
+
/// copy ctor from ap_int_base.
|
| 80 |
+
template <int _AP_W2, bool _AP_S2>
|
| 81 |
+
INLINE ap_fixed(const ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 82 |
+
|
| 83 |
+
template <int _AP_W2, bool _AP_S2>
|
| 84 |
+
INLINE ap_fixed(const volatile ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 85 |
+
|
| 86 |
+
//// from ap_int.
|
| 87 |
+
//template <int _AP_W2>
|
| 88 |
+
//INLINE ap_fixed(const ap_int<_AP_W2>& op)
|
| 89 |
+
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
| 90 |
+
|
| 91 |
+
//template <int _AP_W2>
|
| 92 |
+
//INLINE ap_fixed(const volatile ap_int<_AP_W2>& op)
|
| 93 |
+
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
| 94 |
+
|
| 95 |
+
//// from ap_uint.
|
| 96 |
+
//template <int _AP_W2>
|
| 97 |
+
//INLINE ap_fixed(const ap_uint<_AP_W2>& op)
|
| 98 |
+
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
| 99 |
+
|
| 100 |
+
//template <int _AP_W2>
|
| 101 |
+
//INLINE ap_fixed(const volatile ap_uint<_AP_W2>& op)
|
| 102 |
+
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
| 103 |
+
|
| 104 |
+
// from ap_bit_ref.
|
| 105 |
+
template <int _AP_W2, bool _AP_S2>
|
| 106 |
+
INLINE ap_fixed(const ap_bit_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 107 |
+
|
| 108 |
+
// from ap_range_ref.
|
| 109 |
+
template <int _AP_W2, bool _AP_S2>
|
| 110 |
+
INLINE ap_fixed(const ap_range_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 111 |
+
|
| 112 |
+
// from ap_concat_ref.
|
| 113 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 114 |
+
INLINE ap_fixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op)
|
| 115 |
+
: Base(op) {}
|
| 116 |
+
|
| 117 |
+
// from af_bit_ref.
|
| 118 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 119 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 120 |
+
INLINE ap_fixed(
|
| 121 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 122 |
+
: Base(op) {}
|
| 123 |
+
|
| 124 |
+
// from af_range_ref.
|
| 125 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 126 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 127 |
+
INLINE ap_fixed(
|
| 128 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 129 |
+
: Base(op) {}
|
| 130 |
+
|
| 131 |
+
// from c types.
|
| 132 |
+
#define CTOR(TYPE) \
|
| 133 |
+
INLINE ap_fixed(TYPE v) : Base(v) {}
|
| 134 |
+
|
| 135 |
+
CTOR(bool)
|
| 136 |
+
CTOR(char)
|
| 137 |
+
CTOR(signed char)
|
| 138 |
+
CTOR(unsigned char)
|
| 139 |
+
CTOR(short)
|
| 140 |
+
CTOR(unsigned short)
|
| 141 |
+
CTOR(int)
|
| 142 |
+
CTOR(unsigned int)
|
| 143 |
+
CTOR(long)
|
| 144 |
+
CTOR(unsigned long)
|
| 145 |
+
CTOR(ap_slong)
|
| 146 |
+
CTOR(ap_ulong)
|
| 147 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 148 |
+
CTOR(half)
|
| 149 |
+
#endif
|
| 150 |
+
CTOR(float)
|
| 151 |
+
CTOR(double)
|
| 152 |
+
#undef CTOR
|
| 153 |
+
|
| 154 |
+
INLINE ap_fixed(const char* s) : Base(s) {}
|
| 155 |
+
|
| 156 |
+
INLINE ap_fixed(const char* s, signed char rd) : Base(s, rd) {}
|
| 157 |
+
|
| 158 |
+
// Assignment
|
| 159 |
+
// The assignment operator is technically inherited; however, it is always
|
| 160 |
+
// hidden by an explicitly or implicitly defined assignment operator for the
|
| 161 |
+
// derived class.
|
| 162 |
+
/* XXX ctor will be used when right is not of proper type. */
|
| 163 |
+
INLINE ap_fixed& operator=(
|
| 164 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
| 165 |
+
Base::V = op.V;
|
| 166 |
+
return *this;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
INLINE void operator=(
|
| 170 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
| 171 |
+
Base::V = op.V;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
INLINE ap_fixed& operator=(
|
| 175 |
+
const volatile ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
| 176 |
+
Base::V = op.V;
|
| 177 |
+
return *this;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
INLINE void operator=(
|
| 181 |
+
const volatile ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
| 182 |
+
Base::V = op.V;
|
| 183 |
+
}
|
| 184 |
+
}; // struct ap_fixed.
|
| 185 |
+
|
| 186 |
+
//-------------------------------------------------------------------
|
| 187 |
+
|
| 188 |
+
// Unsigned Arbitrary Precision Fixed-Point Type.
|
| 189 |
+
// default for _AP_Q, _AP_O and _AP_N set in ap_decl.h
|
| 190 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 191 |
+
struct ap_ufixed : ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> {
|
| 192 |
+
typedef ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> Base;
|
| 193 |
+
// Constructor
|
| 194 |
+
/// default ctor
|
| 195 |
+
INLINE ap_ufixed() : Base() {}
|
| 196 |
+
|
| 197 |
+
/// default copy ctor
|
| 198 |
+
INLINE ap_ufixed(const ap_ufixed& op) { Base::V = op.V; }
|
| 199 |
+
|
| 200 |
+
/// copy ctor from ap_fixed_base
|
| 201 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 202 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 203 |
+
INLINE ap_ufixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
| 204 |
+
_AP_O2, _AP_N2>& op)
|
| 205 |
+
: Base(op) {}
|
| 206 |
+
|
| 207 |
+
/// copy ctor from ap_fixed_base
|
| 208 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 209 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 210 |
+
INLINE ap_ufixed(const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
| 211 |
+
_AP_O2, _AP_N2>& op)
|
| 212 |
+
: Base(op) {}
|
| 213 |
+
|
| 214 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 215 |
+
// int _AP_N2>
|
| 216 |
+
//INLINE ap_ufixed(
|
| 217 |
+
// const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 218 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
| 219 |
+
|
| 220 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 221 |
+
// int _AP_N2>
|
| 222 |
+
//INLINE ap_ufixed(
|
| 223 |
+
// const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 224 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
| 225 |
+
|
| 226 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 227 |
+
// int _AP_N2>
|
| 228 |
+
//INLINE ap_ufixed(
|
| 229 |
+
// const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 230 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
| 231 |
+
//}
|
| 232 |
+
|
| 233 |
+
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 234 |
+
// int _AP_N2>
|
| 235 |
+
//INLINE ap_ufixed(
|
| 236 |
+
// const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 237 |
+
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
| 238 |
+
//}
|
| 239 |
+
|
| 240 |
+
/// copy ctor from ap_int_base.
|
| 241 |
+
template <int _AP_W2, bool _AP_S2>
|
| 242 |
+
INLINE ap_ufixed(const ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 243 |
+
|
| 244 |
+
template <int _AP_W2, bool _AP_S2>
|
| 245 |
+
INLINE ap_ufixed(const volatile ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 246 |
+
|
| 247 |
+
//template <int _AP_W2>
|
| 248 |
+
//INLINE ap_ufixed(const ap_int<_AP_W2>& op)
|
| 249 |
+
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
| 250 |
+
|
| 251 |
+
//template <int _AP_W2>
|
| 252 |
+
//INLINE ap_ufixed(const volatile ap_int<_AP_W2>& op)
|
| 253 |
+
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
| 254 |
+
|
| 255 |
+
//template <int _AP_W2>
|
| 256 |
+
//INLINE ap_ufixed(const ap_uint<_AP_W2>& op)
|
| 257 |
+
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
| 258 |
+
|
| 259 |
+
//template <int _AP_W2>
|
| 260 |
+
//INLINE ap_ufixed(const volatile ap_uint<_AP_W2>& op)
|
| 261 |
+
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
| 262 |
+
|
| 263 |
+
template <int _AP_W2, bool _AP_S2>
|
| 264 |
+
INLINE ap_ufixed(const ap_bit_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 265 |
+
|
| 266 |
+
template <int _AP_W2, bool _AP_S2>
|
| 267 |
+
INLINE ap_ufixed(const ap_range_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
| 268 |
+
|
| 269 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 270 |
+
INLINE ap_ufixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op)
|
| 271 |
+
: Base(op) {}
|
| 272 |
+
|
| 273 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 274 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 275 |
+
INLINE ap_ufixed(
|
| 276 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 277 |
+
: Base(op) {}
|
| 278 |
+
|
| 279 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 280 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 281 |
+
INLINE ap_ufixed(
|
| 282 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 283 |
+
: Base(op) {}
|
| 284 |
+
|
| 285 |
+
#define CTOR(TYPE) \
|
| 286 |
+
INLINE ap_ufixed(TYPE v) : Base(v) {}
|
| 287 |
+
|
| 288 |
+
CTOR(bool)
|
| 289 |
+
CTOR(char)
|
| 290 |
+
CTOR(signed char)
|
| 291 |
+
CTOR(unsigned char)
|
| 292 |
+
CTOR(short)
|
| 293 |
+
CTOR(unsigned short)
|
| 294 |
+
CTOR(int)
|
| 295 |
+
CTOR(unsigned int)
|
| 296 |
+
CTOR(long)
|
| 297 |
+
CTOR(unsigned long)
|
| 298 |
+
CTOR(ap_slong)
|
| 299 |
+
CTOR(ap_ulong)
|
| 300 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 301 |
+
CTOR(half)
|
| 302 |
+
#endif
|
| 303 |
+
CTOR(float)
|
| 304 |
+
CTOR(double)
|
| 305 |
+
#undef CTOR
|
| 306 |
+
|
| 307 |
+
INLINE ap_ufixed(const char* s) : Base(s) {}
|
| 308 |
+
|
| 309 |
+
INLINE ap_ufixed(const char* s, signed char rd) : Base(s, rd) {}
|
| 310 |
+
|
| 311 |
+
// Assignment
|
| 312 |
+
INLINE ap_ufixed& operator=(
|
| 313 |
+
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
| 314 |
+
Base::V = op.V;
|
| 315 |
+
return *this;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
INLINE void operator=(
|
| 319 |
+
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
| 320 |
+
Base::V = op.V;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
INLINE ap_ufixed& operator=(
|
| 324 |
+
const volatile ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
| 325 |
+
Base::V = op.V;
|
| 326 |
+
return *this;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
INLINE void operator=(const volatile ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O,
|
| 330 |
+
_AP_N>& op) volatile {
|
| 331 |
+
Base::V = op.V;
|
| 332 |
+
}
|
| 333 |
+
}; // struct ap_ufixed
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
#if !defined(__SYNTHESIS__) && (defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED))
|
| 337 |
+
// XXX sc_trace overload for ap_fixed is already included in
|
| 338 |
+
// "ap_sysc/ap_sc_extras.h", so do not define in synthesis.
|
| 339 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 340 |
+
INLINE void sc_trace(sc_core::sc_trace_file* tf,
|
| 341 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op,
|
| 342 |
+
const std::string& name) {
|
| 343 |
+
tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 347 |
+
INLINE void sc_trace(sc_core::sc_trace_file* tf,
|
| 348 |
+
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op,
|
| 349 |
+
const std::string& name) {
|
| 350 |
+
tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
| 351 |
+
}
|
| 352 |
+
#endif // System C sim
|
| 353 |
+
|
| 354 |
+
// Specialization of std containers, so that std::complex<ap_fixed> can have its
|
| 355 |
+
// image part automatically zero-initialized when only real part is provided.
|
| 356 |
+
#include <ap_fixed_special.h>
|
| 357 |
+
|
| 358 |
+
#endif // ifndef __AP_FIXED_H__
|
| 359 |
+
|
| 360 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_fixed_base.h
ADDED
|
@@ -0,0 +1,2354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_FIXED_BASE_H__
|
| 18 |
+
#define __AP_FIXED_BASE_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_FIXED_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
// for ap_int_base and its reference types.
|
| 25 |
+
#include <ap_int.h>
|
| 26 |
+
#ifndef __SYNTHESIS__
|
| 27 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 28 |
+
// for half type
|
| 29 |
+
#include <hls_half.h>
|
| 30 |
+
#endif
|
| 31 |
+
// for std io
|
| 32 |
+
#include <iostream>
|
| 33 |
+
#endif
|
| 34 |
+
|
| 35 |
+
#ifndef __cplusplus
|
| 36 |
+
#error "C++ is required to include this header file"
|
| 37 |
+
#else // __cplusplus
|
| 38 |
+
|
| 39 |
+
// for warning on unsupported rounding mode in conversion to float/double.
|
| 40 |
+
#if !defined(__SYNTHESIS__) && __cplusplus >= 201103L && \
|
| 41 |
+
(defined(__gnu_linux__) || defined(_WIN32))
|
| 42 |
+
#define AP_FIXED_ENABLE_CPP_FENV 1
|
| 43 |
+
#include <cfenv>
|
| 44 |
+
#endif
|
| 45 |
+
|
| 46 |
+
// ----------------------------------------------------------------------
|
| 47 |
+
|
| 48 |
+
/* Major TODO
|
| 49 |
+
long double support: constructor, assign and other operators.
|
| 50 |
+
binary operators with ap_fixed_base and const char*.
|
| 51 |
+
return ap_fixed/ap_ufixed when result signedness is known.
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
// Helper function in conversion to floating point types.
|
| 55 |
+
|
| 56 |
+
#ifdef __SYNTHESIS__
|
| 57 |
+
#define _AP_ctype_op_get_bit(var, index) _AP_ROOT_op_get_bit(var, index)
|
| 58 |
+
#define _AP_ctype_op_set_bit(var, index, x) _AP_ROOT_op_set_bit(var, index, x)
|
| 59 |
+
#define _AP_ctype_op_get_range(var, low, high) \
|
| 60 |
+
_AP_ROOT_op_get_range(var, low, high)
|
| 61 |
+
#define _AP_ctype_op_set_range(var, low, high, x) \
|
| 62 |
+
_AP_ROOT_op_set_range(var, low, high, x)
|
| 63 |
+
#else // ifdef __SYNTHESIS__
|
| 64 |
+
template <typename _Tp1, typename _Tp2>
|
| 65 |
+
inline bool _AP_ctype_op_get_bit(_Tp1& var, const _Tp2& index) {
|
| 66 |
+
return !!(var & (1ull << (index)));
|
| 67 |
+
}
|
| 68 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
| 69 |
+
inline _Tp1 _AP_ctype_op_set_bit(_Tp1& var, const _Tp2& index, const _Tp3& x) {
|
| 70 |
+
var |= (((x) ? 1ull : 0ull) << (index));
|
| 71 |
+
return var;
|
| 72 |
+
}
|
| 73 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
| 74 |
+
inline _Tp1 _AP_ctype_op_get_range(_Tp1& var, const _Tp2& low,
|
| 75 |
+
const _Tp3& high) {
|
| 76 |
+
_Tp1 r = var;
|
| 77 |
+
ap_ulong mask = -1ll;
|
| 78 |
+
mask >>= (sizeof(_Tp1) * 8 - ((high) - (low) + 1));
|
| 79 |
+
r >>= (low);
|
| 80 |
+
r &= mask;
|
| 81 |
+
return r;
|
| 82 |
+
}
|
| 83 |
+
template <typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
|
| 84 |
+
inline _Tp1 _AP_ctype_op_set_range(_Tp1& var, const _Tp2& low, const _Tp3& high,
|
| 85 |
+
const _Tp4& x) {
|
| 86 |
+
ap_ulong mask = -1ll;
|
| 87 |
+
mask >>= (_AP_SIZE_ap_slong - ((high) - (low) + 1));
|
| 88 |
+
var &= ~(mask << (low));
|
| 89 |
+
var |= ((mask & x) << (low));
|
| 90 |
+
return var;
|
| 91 |
+
}
|
| 92 |
+
#endif // ifdef __SYNTHESIS__
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
// trait for letting base class to return derived class.
|
| 96 |
+
// Notice that derived class template is incomplete, and we cannot use
|
| 97 |
+
// the member of the derived class.
|
| 98 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2>
|
| 99 |
+
struct _ap_fixed_factory;
|
| 100 |
+
template <int _AP_W2, int _AP_I2>
|
| 101 |
+
struct _ap_fixed_factory<_AP_W2, _AP_I2, true> {
|
| 102 |
+
typedef ap_fixed<_AP_W2, _AP_I2> type;
|
| 103 |
+
};
|
| 104 |
+
template <int _AP_W2, int _AP_I2>
|
| 105 |
+
struct _ap_fixed_factory<_AP_W2, _AP_I2, false> {
|
| 106 |
+
typedef ap_ufixed<_AP_W2, _AP_I2> type;
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
/// ap_fixed_base: AutoPilot fixed point.
|
| 110 |
+
/** partial specialization of signed.
|
| 111 |
+
@tparam _AP_W width.
|
| 112 |
+
@tparam _AP_I integral part width.
|
| 113 |
+
@tparam _AP_S signed.
|
| 114 |
+
@tparam _AP_Q quantization mode. Default is AP_TRN.
|
| 115 |
+
@tparam _AP_O saturation mode. Default is AP_WRAP.
|
| 116 |
+
@tparam _AP_N saturation wrap value. Default is 0.
|
| 117 |
+
*/
|
| 118 |
+
// default for _AP_Q, _AP_O and _AP_N set in ap_decl.h
|
| 119 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 120 |
+
int _AP_N>
|
| 121 |
+
struct ap_fixed_base : _AP_ROOT_TYPE<_AP_W, _AP_S> {
|
| 122 |
+
public:
|
| 123 |
+
typedef _AP_ROOT_TYPE<_AP_W, _AP_S> Base;
|
| 124 |
+
static const int width = _AP_W;
|
| 125 |
+
static const int iwidth = _AP_I;
|
| 126 |
+
static const ap_q_mode qmode = _AP_Q;
|
| 127 |
+
static const ap_o_mode omode = _AP_O;
|
| 128 |
+
|
| 129 |
+
/// Return type trait.
|
| 130 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2>
|
| 131 |
+
struct RType {
|
| 132 |
+
enum {
|
| 133 |
+
_AP_F = _AP_W - _AP_I,
|
| 134 |
+
F2 = _AP_W2 - _AP_I2,
|
| 135 |
+
mult_w = _AP_W + _AP_W2,
|
| 136 |
+
mult_i = _AP_I + _AP_I2,
|
| 137 |
+
mult_s = _AP_S || _AP_S2,
|
| 138 |
+
plus_w = AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)) +
|
| 139 |
+
1 + AP_MAX(_AP_F, F2),
|
| 140 |
+
plus_i =
|
| 141 |
+
AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)) + 1,
|
| 142 |
+
plus_s = _AP_S || _AP_S2,
|
| 143 |
+
minus_w =
|
| 144 |
+
AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)) + 1 +
|
| 145 |
+
AP_MAX(_AP_F, F2),
|
| 146 |
+
minus_i =
|
| 147 |
+
AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)) + 1,
|
| 148 |
+
minus_s = true,
|
| 149 |
+
#ifndef __SC_COMPATIBLE__
|
| 150 |
+
div_w = _AP_S2 + _AP_W + AP_MAX(F2, 0),
|
| 151 |
+
#else
|
| 152 |
+
div_w = _AP_S2 + _AP_W + AP_MAX(F2, 0) + AP_MAX(_AP_I2, 0),
|
| 153 |
+
#endif
|
| 154 |
+
div_i = _AP_S2 + _AP_I + F2,
|
| 155 |
+
div_s = _AP_S || _AP_S2,
|
| 156 |
+
logic_w =
|
| 157 |
+
AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)) +
|
| 158 |
+
AP_MAX(_AP_F, F2),
|
| 159 |
+
logic_i = AP_MAX(_AP_I + (_AP_S2 && !_AP_S), _AP_I2 + (_AP_S && !_AP_S2)),
|
| 160 |
+
logic_s = _AP_S || _AP_S2
|
| 161 |
+
};
|
| 162 |
+
|
| 163 |
+
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S> lhs;
|
| 164 |
+
typedef ap_fixed_base<_AP_W2, _AP_I2, _AP_S2> rhs;
|
| 165 |
+
|
| 166 |
+
typedef ap_fixed_base<mult_w, mult_i, mult_s> mult_base;
|
| 167 |
+
typedef ap_fixed_base<plus_w, plus_i, plus_s> plus_base;
|
| 168 |
+
typedef ap_fixed_base<minus_w, minus_i, minus_s> minus_base;
|
| 169 |
+
typedef ap_fixed_base<logic_w, logic_i, logic_s> logic_base;
|
| 170 |
+
typedef ap_fixed_base<div_w, div_i, div_s> div_base;
|
| 171 |
+
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S> arg1_base;
|
| 172 |
+
|
| 173 |
+
typedef typename _ap_fixed_factory<mult_w, mult_i, mult_s>::type mult;
|
| 174 |
+
typedef typename _ap_fixed_factory<plus_w, plus_i, plus_s>::type plus;
|
| 175 |
+
typedef typename _ap_fixed_factory<minus_w, minus_i, minus_s>::type minus;
|
| 176 |
+
typedef typename _ap_fixed_factory<logic_w, logic_i, logic_s>::type logic;
|
| 177 |
+
typedef typename _ap_fixed_factory<div_w, div_i, div_s>::type div;
|
| 178 |
+
typedef typename _ap_fixed_factory<_AP_W, _AP_I, _AP_S>::type arg1;
|
| 179 |
+
};
|
| 180 |
+
|
| 181 |
+
private:
|
| 182 |
+
#ifndef __SYNTHESIS__
|
| 183 |
+
// This cannot handle hex float format string.
|
| 184 |
+
void fromString(const std::string& val, unsigned char radix) {
|
| 185 |
+
_AP_ERROR(!(radix == 2 || radix == 8 || radix == 10 || radix == 16),
|
| 186 |
+
"ap_fixed_base::fromString(%s, %d)", val.c_str(), radix);
|
| 187 |
+
|
| 188 |
+
Base::V = 0;
|
| 189 |
+
int startPos = 0;
|
| 190 |
+
int endPos = val.length();
|
| 191 |
+
int decPos = val.find(".");
|
| 192 |
+
if (decPos == -1) decPos = endPos;
|
| 193 |
+
|
| 194 |
+
// handle sign
|
| 195 |
+
bool isNegative = false;
|
| 196 |
+
if (val[0] == '-') {
|
| 197 |
+
isNegative = true;
|
| 198 |
+
++startPos;
|
| 199 |
+
} else if (val[0] == '+')
|
| 200 |
+
++startPos;
|
| 201 |
+
|
| 202 |
+
// If there are no integer bits, e.g.:
|
| 203 |
+
// .0000XXXX, then keep at least one bit.
|
| 204 |
+
// If the width is greater than the number of integer bits, e.g.:
|
| 205 |
+
// XXXX.XXXX, then we keep the integer bits
|
| 206 |
+
// if the number of integer bits is greater than the width, e.g.:
|
| 207 |
+
// XXX000 then we keep the integer bits.
|
| 208 |
+
// Always keep one bit.
|
| 209 |
+
ap_fixed_base<AP_MAX(_AP_I, 4) + 4, AP_MAX(_AP_I, 4) + 4, false>
|
| 210 |
+
integer_bits = 0;
|
| 211 |
+
|
| 212 |
+
// Figure out if we can shift instead of multiply
|
| 213 |
+
unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
|
| 214 |
+
|
| 215 |
+
//std::cout << "\n\n" << val << "\n";
|
| 216 |
+
//std::cout << startPos << " " << decPos << " " << endPos << "\n";
|
| 217 |
+
|
| 218 |
+
bool sticky_int = false;
|
| 219 |
+
|
| 220 |
+
// Traverse the integer digits from the MSD, multiplying by radix as we go.
|
| 221 |
+
for (int i = startPos; i < decPos; i++) {
|
| 222 |
+
// Get a digit
|
| 223 |
+
char cdigit = val[i];
|
| 224 |
+
if (cdigit == '\0') continue;
|
| 225 |
+
unsigned digit = ap_private_ops::decode_digit(cdigit, radix);
|
| 226 |
+
|
| 227 |
+
sticky_int |= integer_bits[AP_MAX(_AP_I, 4) + 4 - 1] |
|
| 228 |
+
integer_bits[AP_MAX(_AP_I, 4) + 4 - 2] |
|
| 229 |
+
integer_bits[AP_MAX(_AP_I, 4) + 4 - 3] |
|
| 230 |
+
integer_bits[AP_MAX(_AP_I, 4) + 4 - 4];
|
| 231 |
+
// Shift or multiply the value by the radix
|
| 232 |
+
if (shift)
|
| 233 |
+
integer_bits <<= shift;
|
| 234 |
+
else
|
| 235 |
+
integer_bits *= radix;
|
| 236 |
+
|
| 237 |
+
// Add in the digit we just interpreted
|
| 238 |
+
integer_bits += digit;
|
| 239 |
+
//std::cout << "idigit = " << digit << " " << integer_bits.to_string()
|
| 240 |
+
// << " " << sticky_int << "\n";
|
| 241 |
+
}
|
| 242 |
+
integer_bits[AP_MAX(_AP_I, 4) + 4 - 3] =
|
| 243 |
+
integer_bits[AP_MAX(_AP_I, 4) + 4 - 3] | sticky_int;
|
| 244 |
+
|
| 245 |
+
ap_fixed_base<AP_MAX(_AP_W - _AP_I, 0) + 4 + 4, 4, false> fractional_bits = 0;
|
| 246 |
+
bool sticky = false;
|
| 247 |
+
|
| 248 |
+
// Traverse the fractional digits from the LSD, dividing by radix as we go.
|
| 249 |
+
for (int i = endPos - 1; i >= decPos + 1; i--) {
|
| 250 |
+
// Get a digit
|
| 251 |
+
char cdigit = val[i];
|
| 252 |
+
if (cdigit == '\0') continue;
|
| 253 |
+
unsigned digit = ap_private_ops::decode_digit(cdigit, radix);
|
| 254 |
+
// Add in the digit we just interpreted
|
| 255 |
+
fractional_bits += digit;
|
| 256 |
+
|
| 257 |
+
sticky |= fractional_bits[0] | fractional_bits[1] | fractional_bits[2] |
|
| 258 |
+
fractional_bits[3];
|
| 259 |
+
// Shift or divide the value by the radix
|
| 260 |
+
if (shift)
|
| 261 |
+
fractional_bits >>= shift;
|
| 262 |
+
else
|
| 263 |
+
fractional_bits /= radix;
|
| 264 |
+
|
| 265 |
+
//std::cout << "fdigit = " << digit << " " << fractional_bits.to_string()
|
| 266 |
+
// << " " << sticky << "\n";
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
//std::cout << "Int =" << integer_bits.to_string() << " " <<
|
| 270 |
+
// fractional_bits.to_string() << "\n";
|
| 271 |
+
|
| 272 |
+
fractional_bits[0] = fractional_bits[0] | sticky;
|
| 273 |
+
|
| 274 |
+
if (isNegative)
|
| 275 |
+
*this = -(integer_bits + fractional_bits);
|
| 276 |
+
else
|
| 277 |
+
*this = integer_bits + fractional_bits;
|
| 278 |
+
|
| 279 |
+
//std::cout << "end = " << this->to_string(16) << "\n";
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/// report invalid constrction of ap_fixed_base
|
| 283 |
+
INLINE void report() {
|
| 284 |
+
if (!_AP_S && _AP_O == AP_WRAP_SM) {
|
| 285 |
+
fprintf(stderr, "ap_ufxied<...> cannot support AP_WRAP_SM.\n");
|
| 286 |
+
exit(1);
|
| 287 |
+
}
|
| 288 |
+
if (_AP_W > MAX_MODE(AP_INT_MAX_W) * 1024) {
|
| 289 |
+
fprintf(stderr,
|
| 290 |
+
"[E] ap_%sfixed<%d, ...>: Bitwidth exceeds the "
|
| 291 |
+
"default max value %d. Please use macro "
|
| 292 |
+
"AP_INT_MAX_W to set a larger max value.\n",
|
| 293 |
+
_AP_S ? "" : "u", _AP_W, MAX_MODE(AP_INT_MAX_W) * 1024);
|
| 294 |
+
exit(1);
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
#else
|
| 298 |
+
INLINE void report() {}
|
| 299 |
+
#endif // ifdef __SYNTHESIS__
|
| 300 |
+
|
| 301 |
+
/// @name helper functions.
|
| 302 |
+
// @{
|
| 303 |
+
INLINE void overflow_adjust(bool underflow, bool overflow, bool lD,
|
| 304 |
+
bool sign) {
|
| 305 |
+
if (!underflow && !overflow) return;
|
| 306 |
+
if (_AP_O == AP_WRAP) {
|
| 307 |
+
if (_AP_N == 0) return;
|
| 308 |
+
if (_AP_S) {
|
| 309 |
+
// signed AP_WRAP
|
| 310 |
+
// n_bits == 1
|
| 311 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, _AP_W - 1, sign);
|
| 312 |
+
if (_AP_N > 1) {
|
| 313 |
+
// n_bits > 1
|
| 314 |
+
ap_int_base<_AP_W, false> mask(-1);
|
| 315 |
+
if (sign) mask.V = 0;
|
| 316 |
+
Base::V =
|
| 317 |
+
_AP_ROOT_op_set_range(Base::V, _AP_W - _AP_N, _AP_W - 2, mask.V);
|
| 318 |
+
}
|
| 319 |
+
} else {
|
| 320 |
+
// unsigned AP_WRAP
|
| 321 |
+
ap_int_base<_AP_W, false> mask(-1);
|
| 322 |
+
Base::V =
|
| 323 |
+
_AP_ROOT_op_set_range(Base::V, _AP_W - _AP_N, _AP_W - 1, mask.V);
|
| 324 |
+
}
|
| 325 |
+
} else if (_AP_O == AP_SAT_ZERO) {
|
| 326 |
+
Base::V = 0;
|
| 327 |
+
} else if (_AP_O == AP_WRAP_SM && _AP_S) {
|
| 328 |
+
bool Ro = _AP_ROOT_op_get_bit(Base::V, _AP_W - 1);
|
| 329 |
+
if (_AP_N == 0) {
|
| 330 |
+
if (lD != Ro) {
|
| 331 |
+
Base::V = ~Base::V;
|
| 332 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, _AP_W - 1, lD);
|
| 333 |
+
}
|
| 334 |
+
} else {
|
| 335 |
+
if (_AP_N == 1 && sign != Ro) {
|
| 336 |
+
Base::V = ~Base::V;
|
| 337 |
+
} else if (_AP_N > 1) {
|
| 338 |
+
bool lNo = _AP_ROOT_op_get_bit(Base::V, _AP_W - _AP_N);
|
| 339 |
+
if (lNo == sign) Base::V = ~Base::V;
|
| 340 |
+
ap_int_base<_AP_W, false> mask(-1);
|
| 341 |
+
if (sign) mask.V = 0;
|
| 342 |
+
Base::V =
|
| 343 |
+
_AP_ROOT_op_set_range(Base::V, _AP_W - _AP_N, _AP_W - 2, mask.V);
|
| 344 |
+
}
|
| 345 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, _AP_W - 1, sign);
|
| 346 |
+
}
|
| 347 |
+
} else {
|
| 348 |
+
if (_AP_S) {
|
| 349 |
+
if (overflow) {
|
| 350 |
+
Base::V = 1;
|
| 351 |
+
Base::V <<= _AP_W - 1;
|
| 352 |
+
Base::V = ~Base::V;
|
| 353 |
+
} else if (underflow) {
|
| 354 |
+
Base::V = 1;
|
| 355 |
+
Base::V <<= _AP_W - 1;
|
| 356 |
+
if (_AP_O == AP_SAT_SYM) Base::V |= 1;
|
| 357 |
+
}
|
| 358 |
+
} else {
|
| 359 |
+
if (overflow)
|
| 360 |
+
Base::V = ~(ap_int_base<_AP_W, false>(0).V);
|
| 361 |
+
else if (underflow)
|
| 362 |
+
Base::V = 0;
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
INLINE bool quantization_adjust(bool qb, bool r, bool s) {
|
| 368 |
+
bool carry = (bool)_AP_ROOT_op_get_bit(Base::V, _AP_W - 1);
|
| 369 |
+
if (_AP_Q == AP_TRN) return false;
|
| 370 |
+
if (_AP_Q == AP_RND_ZERO)
|
| 371 |
+
qb &= s || r;
|
| 372 |
+
else if (_AP_Q == AP_RND_MIN_INF)
|
| 373 |
+
qb &= r;
|
| 374 |
+
else if (_AP_Q == AP_RND_INF)
|
| 375 |
+
qb &= !s || r;
|
| 376 |
+
else if (_AP_Q == AP_RND_CONV)
|
| 377 |
+
qb &= _AP_ROOT_op_get_bit(Base::V, 0) || r;
|
| 378 |
+
else if (_AP_Q == AP_TRN_ZERO)
|
| 379 |
+
qb = s && (qb || r);
|
| 380 |
+
Base::V += qb;
|
| 381 |
+
return carry && (!(bool)_AP_ROOT_op_get_bit(Base::V, _AP_W - 1));
|
| 382 |
+
}
|
| 383 |
+
// @}
|
| 384 |
+
|
| 385 |
+
public:
|
| 386 |
+
/// @name constructors.
|
| 387 |
+
// @{
|
| 388 |
+
/// default ctor.
|
| 389 |
+
INLINE ap_fixed_base() {}
|
| 390 |
+
|
| 391 |
+
/// copy ctor.
|
| 392 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 393 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 394 |
+
INLINE ap_fixed_base(
|
| 395 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 396 |
+
operator=(op);
|
| 397 |
+
report();
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 401 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 402 |
+
INLINE ap_fixed_base(
|
| 403 |
+
const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 404 |
+
operator=(op);
|
| 405 |
+
report();
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
template <int _AP_W2, bool _AP_S2>
|
| 409 |
+
INLINE ap_fixed_base(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 410 |
+
ap_fixed_base<_AP_W2, _AP_W2, _AP_S2> tmp;
|
| 411 |
+
tmp.V = op.V;
|
| 412 |
+
operator=(tmp);
|
| 413 |
+
report();
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
template <int _AP_W2, bool _AP_S2>
|
| 417 |
+
INLINE ap_fixed_base(const volatile ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 418 |
+
ap_fixed_base<_AP_W2, _AP_W2, _AP_S2> tmp;
|
| 419 |
+
tmp.V = op.V;
|
| 420 |
+
operator=(tmp);
|
| 421 |
+
report();
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
#ifndef __SYNTHESIS__
|
| 425 |
+
#ifndef NON_C99STRING
|
| 426 |
+
INLINE ap_fixed_base(const char* s, signed char rd = 0) {
|
| 427 |
+
unsigned char radix = rd;
|
| 428 |
+
std::string str = ap_private_ops::parseString(s, radix); // will guess rd, default 10
|
| 429 |
+
_AP_ERROR(radix == 0, "ap_fixed_base(const char* \"%s\", %d), str=%s, radix = %d",
|
| 430 |
+
s, rd, str.c_str(), radix); // TODO remove this check
|
| 431 |
+
fromString(str, radix);
|
| 432 |
+
}
|
| 433 |
+
#else
|
| 434 |
+
INLINE ap_fixed_base(const char* s, signed char rd = 10) {
|
| 435 |
+
ap_int_base<_AP_W, _AP_S> t(s, rd);
|
| 436 |
+
Base::V = t.V;
|
| 437 |
+
}
|
| 438 |
+
#endif // ifndef NON_C99STRING
|
| 439 |
+
#else // ifndef __SYNTHESIS__
|
| 440 |
+
// XXX _ssdm_string2bits only takes const string and const radix.
|
| 441 |
+
// It seems XFORM will do compile time processing of the string.
|
| 442 |
+
INLINE ap_fixed_base(const char* s) {
|
| 443 |
+
typeof(Base::V) t;
|
| 444 |
+
_ssdm_string2bits((void*)(&t), (const char*)(s), 10, _AP_I, _AP_S, _AP_Q,
|
| 445 |
+
_AP_O, _AP_N, _AP_C99);
|
| 446 |
+
Base::V = t;
|
| 447 |
+
}
|
| 448 |
+
INLINE ap_fixed_base(const char* s, signed char rd) {
|
| 449 |
+
typeof(Base::V) t;
|
| 450 |
+
_ssdm_string2bits((void*)(&t), (const char*)(s), rd, _AP_I, _AP_S, _AP_Q,
|
| 451 |
+
_AP_O, _AP_N, _AP_C99);
|
| 452 |
+
Base::V = t;
|
| 453 |
+
}
|
| 454 |
+
#endif // ifndef __SYNTHESIS__ else
|
| 455 |
+
|
| 456 |
+
template <int _AP_W2, bool _AP_S2>
|
| 457 |
+
INLINE ap_fixed_base(const ap_bit_ref<_AP_W2, _AP_S2>& op) {
|
| 458 |
+
*this = ((bool)op);
|
| 459 |
+
report();
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
template <int _AP_W2, bool _AP_S2>
|
| 463 |
+
INLINE ap_fixed_base(const ap_range_ref<_AP_W2, _AP_S2>& op) {
|
| 464 |
+
*this = (ap_int_base<_AP_W2, false>(op));
|
| 465 |
+
report();
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 469 |
+
INLINE ap_fixed_base(
|
| 470 |
+
const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op) {
|
| 471 |
+
*this = (ap_int_base<_AP_W2 + _AP_W3, false>(op));
|
| 472 |
+
report();
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 476 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 477 |
+
INLINE ap_fixed_base(
|
| 478 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 479 |
+
*this = (bool(op));
|
| 480 |
+
report();
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 484 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 485 |
+
INLINE ap_fixed_base(
|
| 486 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 487 |
+
*this = (ap_int_base<_AP_W2, false>(op));
|
| 488 |
+
report();
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
// ctors from c types.
|
| 492 |
+
// make a temp ap_fixed_base first, and use ap_fixed_base.operator=
|
| 493 |
+
#define CTOR_FROM_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 494 |
+
INLINE ap_fixed_base(const C_TYPE x) { \
|
| 495 |
+
ap_fixed_base<(_AP_W2), (_AP_W2), (_AP_S2)> tmp; \
|
| 496 |
+
tmp.V = x; \
|
| 497 |
+
*this = tmp; \
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
CTOR_FROM_INT(bool, 1, false)
|
| 501 |
+
CTOR_FROM_INT(char, 8, CHAR_IS_SIGNED)
|
| 502 |
+
CTOR_FROM_INT(signed char, 8, true)
|
| 503 |
+
CTOR_FROM_INT(unsigned char, 8, false)
|
| 504 |
+
CTOR_FROM_INT(short, _AP_SIZE_short, true)
|
| 505 |
+
CTOR_FROM_INT(unsigned short, _AP_SIZE_short, false)
|
| 506 |
+
CTOR_FROM_INT(int, _AP_SIZE_int, true)
|
| 507 |
+
CTOR_FROM_INT(unsigned int, _AP_SIZE_int, false)
|
| 508 |
+
CTOR_FROM_INT(long, _AP_SIZE_long, true)
|
| 509 |
+
CTOR_FROM_INT(unsigned long, _AP_SIZE_long, false)
|
| 510 |
+
CTOR_FROM_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 511 |
+
CTOR_FROM_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 512 |
+
#undef CTOR_FROM_INT
|
| 513 |
+
/*
|
| 514 |
+
* TODO:
|
| 515 |
+
*Theere used to be several funtions which were AP_WEAK.
|
| 516 |
+
*Now they're all INLINE expect ap_fixed_base(double d)
|
| 517 |
+
*Maybe we can use '#pragma HLS inline' instead of INLINE.
|
| 518 |
+
*/
|
| 519 |
+
AP_WEAK ap_fixed_base(double d) {
|
| 520 |
+
ap_int_base<64, false> ireg;
|
| 521 |
+
ireg.V = doubleToRawBits(d);
|
| 522 |
+
bool isneg = _AP_ROOT_op_get_bit(ireg.V, 63);
|
| 523 |
+
|
| 524 |
+
ap_int_base<DOUBLE_EXP + 1, true> exp;
|
| 525 |
+
ap_int_base<DOUBLE_EXP, false> exp_tmp;
|
| 526 |
+
exp_tmp.V =
|
| 527 |
+
_AP_ROOT_op_get_range(ireg.V, DOUBLE_MAN, DOUBLE_MAN + DOUBLE_EXP - 1);
|
| 528 |
+
exp = exp_tmp - DOUBLE_BIAS;
|
| 529 |
+
ap_int_base<DOUBLE_MAN + 2, true> man;
|
| 530 |
+
man.V = _AP_ROOT_op_get_range(ireg.V, 0, DOUBLE_MAN - 1);
|
| 531 |
+
// do not support NaN
|
| 532 |
+
_AP_WARNING(exp == APFX_IEEE_DOUBLE_E_MAX + 1 && man.V != 0,
|
| 533 |
+
"assign NaN to fixed point value");
|
| 534 |
+
man.V = _AP_ROOT_op_set_bit(man.V, DOUBLE_MAN, 1);
|
| 535 |
+
if (isneg) man = -man;
|
| 536 |
+
if ((ireg.V & 0x7fffffffffffffffLL) == 0) {
|
| 537 |
+
Base::V = 0;
|
| 538 |
+
} else {
|
| 539 |
+
int _AP_W2 = DOUBLE_MAN + 2, _AP_I2 = exp.V + 2, _AP_F = _AP_W - _AP_I,
|
| 540 |
+
F2 = _AP_W2 - _AP_I2;
|
| 541 |
+
bool _AP_S2 = true,
|
| 542 |
+
QUAN_INC = F2 > _AP_F &&
|
| 543 |
+
!(_AP_Q == AP_TRN || (_AP_Q == AP_TRN_ZERO && !_AP_S2));
|
| 544 |
+
bool carry = false;
|
| 545 |
+
// handle quantization
|
| 546 |
+
unsigned sh_amt = (F2 > _AP_F) ? F2 - _AP_F : _AP_F - F2;
|
| 547 |
+
if (F2 == _AP_F)
|
| 548 |
+
Base::V = man.V;
|
| 549 |
+
else if (F2 > _AP_F) {
|
| 550 |
+
if (sh_amt < DOUBLE_MAN + 2)
|
| 551 |
+
Base::V = man.V >> sh_amt;
|
| 552 |
+
else {
|
| 553 |
+
Base::V = isneg ? -1 : 0;
|
| 554 |
+
}
|
| 555 |
+
if ((_AP_Q != AP_TRN) && !((_AP_Q == AP_TRN_ZERO) && !_AP_S2)) {
|
| 556 |
+
bool qb = (F2 - _AP_F > _AP_W2) ? isneg : (bool)_AP_ROOT_op_get_bit(
|
| 557 |
+
man.V, F2 - _AP_F - 1);
|
| 558 |
+
bool r =
|
| 559 |
+
(F2 > _AP_F + 1)
|
| 560 |
+
? _AP_ROOT_op_get_range(man.V, 0, (F2 - _AP_F - 2 < _AP_W2)
|
| 561 |
+
? (F2 - _AP_F - 2)
|
| 562 |
+
: (_AP_W2 - 1)) != 0
|
| 563 |
+
: false;
|
| 564 |
+
carry = quantization_adjust(qb, r, isneg);
|
| 565 |
+
}
|
| 566 |
+
} else { // no quantization
|
| 567 |
+
Base::V = man.V;
|
| 568 |
+
if (sh_amt < _AP_W)
|
| 569 |
+
Base::V = Base::V << sh_amt;
|
| 570 |
+
else
|
| 571 |
+
Base::V = 0;
|
| 572 |
+
}
|
| 573 |
+
// handle overflow/underflow
|
| 574 |
+
if ((_AP_O != AP_WRAP || _AP_N != 0) &&
|
| 575 |
+
((!_AP_S && _AP_S2) ||
|
| 576 |
+
_AP_I - _AP_S <
|
| 577 |
+
_AP_I2 - _AP_S2 +
|
| 578 |
+
(QUAN_INC ||
|
| 579 |
+
(_AP_S2 && (_AP_O == AP_SAT_SYM))))) { // saturation
|
| 580 |
+
bool deleted_zeros = _AP_S2 ? true : !carry, deleted_ones = true;
|
| 581 |
+
bool neg_src = isneg;
|
| 582 |
+
bool lD = false;
|
| 583 |
+
int pos1 = F2 - _AP_F + _AP_W;
|
| 584 |
+
int pos2 = F2 - _AP_F + _AP_W + 1;
|
| 585 |
+
bool newsignbit = _AP_ROOT_op_get_bit(Base::V, _AP_W - 1);
|
| 586 |
+
if (pos1 < _AP_W2 && pos1 >= 0)
|
| 587 |
+
// lD = _AP_ROOT_op_get_bit(man.V, pos1);
|
| 588 |
+
lD = (man.V >> pos1) & 1;
|
| 589 |
+
if (pos1 < _AP_W2) {
|
| 590 |
+
bool Range1_all_ones = true;
|
| 591 |
+
bool Range1_all_zeros = true;
|
| 592 |
+
bool Range2_all_ones = true;
|
| 593 |
+
ap_int_base<DOUBLE_MAN + 2, false> Range2;
|
| 594 |
+
ap_int_base<DOUBLE_MAN + 2, false> all_ones(-1);
|
| 595 |
+
|
| 596 |
+
if (pos2 >= 0 && pos2 < _AP_W2) {
|
| 597 |
+
// Range2.V = _AP_ROOT_op_get_range(man.V,
|
| 598 |
+
// pos2, _AP_W2 - 1);
|
| 599 |
+
Range2.V = man.V;
|
| 600 |
+
Range2.V >>= pos2;
|
| 601 |
+
Range2_all_ones = Range2 == (all_ones >> pos2);
|
| 602 |
+
} else if (pos2 < 0)
|
| 603 |
+
Range2_all_ones = false;
|
| 604 |
+
if (pos1 >= 0 && pos2 < _AP_W2) {
|
| 605 |
+
Range1_all_ones = Range2_all_ones && lD;
|
| 606 |
+
Range1_all_zeros = !Range2.V && !lD;
|
| 607 |
+
} else if (pos2 == _AP_W2) {
|
| 608 |
+
Range1_all_ones = lD;
|
| 609 |
+
Range1_all_zeros = !lD;
|
| 610 |
+
} else if (pos1 < 0) {
|
| 611 |
+
Range1_all_zeros = !man.V;
|
| 612 |
+
Range1_all_ones = false;
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
deleted_zeros =
|
| 616 |
+
deleted_zeros && (carry ? Range1_all_ones : Range1_all_zeros);
|
| 617 |
+
deleted_ones =
|
| 618 |
+
carry ? Range2_all_ones && (pos1 < 0 || !lD) : Range1_all_ones;
|
| 619 |
+
neg_src = isneg && !(carry && Range1_all_ones);
|
| 620 |
+
} else
|
| 621 |
+
neg_src = isneg && newsignbit;
|
| 622 |
+
bool neg_trg = _AP_S && newsignbit;
|
| 623 |
+
bool overflow = (neg_trg || !deleted_zeros) && !isneg;
|
| 624 |
+
bool underflow = (!neg_trg || !deleted_ones) && neg_src;
|
| 625 |
+
if ((_AP_O == AP_SAT_SYM) && _AP_S2 && _AP_S)
|
| 626 |
+
underflow |=
|
| 627 |
+
neg_src &&
|
| 628 |
+
(_AP_W > 1 ? _AP_ROOT_op_get_range(Base::V, 0, _AP_W - 2) == 0
|
| 629 |
+
: true);
|
| 630 |
+
overflow_adjust(underflow, overflow, lD, neg_src);
|
| 631 |
+
}
|
| 632 |
+
}
|
| 633 |
+
report();
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
// TODO more optimized implementation.
|
| 637 |
+
INLINE ap_fixed_base(float d) { *this = ap_fixed_base(double(d)); }
|
| 638 |
+
|
| 639 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 640 |
+
// TODO more optimized implementation.
|
| 641 |
+
INLINE ap_fixed_base(half d) { *this = ap_fixed_base(double(d)); }
|
| 642 |
+
#endif
|
| 643 |
+
// @}
|
| 644 |
+
|
| 645 |
+
/// @name assign operator
|
| 646 |
+
/// assign, using another ap_fixed_base of same template parameters.
|
| 647 |
+
/*
|
| 648 |
+
INLINE ap_fixed_base& operator=(
|
| 649 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) {
|
| 650 |
+
Base::V = op.V;
|
| 651 |
+
return *this;
|
| 652 |
+
}
|
| 653 |
+
*/
|
| 654 |
+
|
| 655 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 656 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 657 |
+
INLINE ap_fixed_base& operator=(
|
| 658 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 659 |
+
|
| 660 |
+
const int _AP_F = _AP_W - _AP_I;
|
| 661 |
+
const int F2 = _AP_W2 - _AP_I2;
|
| 662 |
+
const int QUAN_INC =
|
| 663 |
+
F2 > _AP_F && !(_AP_Q == AP_TRN || (_AP_Q == AP_TRN_ZERO && !_AP_S2));
|
| 664 |
+
|
| 665 |
+
if (!op) Base::V = 0;
|
| 666 |
+
bool carry = false;
|
| 667 |
+
bool signbit = _AP_ROOT_op_get_bit(op.V, _AP_W2 - 1);
|
| 668 |
+
bool isneg = signbit && _AP_S2;
|
| 669 |
+
if (F2 == _AP_F)
|
| 670 |
+
Base::V = op.V;
|
| 671 |
+
else if (F2 > _AP_F) {
|
| 672 |
+
unsigned int sh_amt = F2 - _AP_F;
|
| 673 |
+
// moves bits right, handle quantization.
|
| 674 |
+
if (sh_amt < _AP_W2) {
|
| 675 |
+
Base::V = op.V >> sh_amt;
|
| 676 |
+
} else {
|
| 677 |
+
Base::V = isneg ? -1 : 0;
|
| 678 |
+
}
|
| 679 |
+
if (_AP_Q != AP_TRN && !(_AP_Q == AP_TRN_ZERO && !_AP_S2)) {
|
| 680 |
+
bool qbit = _AP_ROOT_op_get_bit(op.V, F2 - _AP_F - 1);
|
| 681 |
+
// bit after LSB.
|
| 682 |
+
bool qb = (F2 - _AP_F > _AP_W2) ? _AP_S2 && signbit : qbit;
|
| 683 |
+
enum { hi = ((F2 - _AP_F - 2) < _AP_W2) ? (F2 - _AP_F - 2) : (_AP_W2 - 1) };
|
| 684 |
+
// bits after qb.
|
| 685 |
+
bool r = (F2 > _AP_F + 1) ? (_AP_ROOT_op_get_range(op.V, 0, hi) != 0) : false;
|
| 686 |
+
carry = quantization_adjust(qb, r, isneg);
|
| 687 |
+
}
|
| 688 |
+
} else {
|
| 689 |
+
unsigned sh_amt = _AP_F - F2;
|
| 690 |
+
// moves bits left, no quantization
|
| 691 |
+
if (sh_amt < _AP_W) {
|
| 692 |
+
if (_AP_W > _AP_W2) {
|
| 693 |
+
// extend and then shift, avoid losing bits.
|
| 694 |
+
Base::V = op.V;
|
| 695 |
+
Base::V <<= sh_amt;
|
| 696 |
+
} else {
|
| 697 |
+
// shift and truncate.
|
| 698 |
+
Base::V = op.V << sh_amt;
|
| 699 |
+
}
|
| 700 |
+
} else {
|
| 701 |
+
Base::V = 0;
|
| 702 |
+
}
|
| 703 |
+
}
|
| 704 |
+
// handle overflow/underflow
|
| 705 |
+
if ((_AP_O != AP_WRAP || _AP_N != 0) &&
|
| 706 |
+
((!_AP_S && _AP_S2) ||
|
| 707 |
+
_AP_I - _AP_S <
|
| 708 |
+
_AP_I2 - _AP_S2 +
|
| 709 |
+
(QUAN_INC || (_AP_S2 && _AP_O == AP_SAT_SYM)))) { // saturation
|
| 710 |
+
bool deleted_zeros = _AP_S2 ? true : !carry;
|
| 711 |
+
bool deleted_ones = true;
|
| 712 |
+
bool neg_src = isneg;
|
| 713 |
+
bool newsignbit = _AP_ROOT_op_get_bit(Base::V, _AP_W - 1);
|
| 714 |
+
enum { pos1 = F2 - _AP_F + _AP_W, pos2 = F2 - _AP_F + _AP_W + 1 };
|
| 715 |
+
bool lD = (pos1 < _AP_W2 && pos1 >= 0) ? _AP_ROOT_op_get_bit(op.V, pos1)
|
| 716 |
+
: false;
|
| 717 |
+
if (pos1 < _AP_W2) {
|
| 718 |
+
bool Range1_all_ones = true;
|
| 719 |
+
bool Range1_all_zeros = true;
|
| 720 |
+
bool Range2_all_ones = true;
|
| 721 |
+
ap_int_base<_AP_W2, false> all_ones(-1);
|
| 722 |
+
|
| 723 |
+
if (pos2 < _AP_W2 && pos2 >= 0) {
|
| 724 |
+
ap_int_base<_AP_W2, false> Range2;
|
| 725 |
+
Range2.V = _AP_ROOT_op_get_range(op.V, pos2, _AP_W2 - 1);
|
| 726 |
+
Range2_all_ones = Range2 == (all_ones >> pos2);
|
| 727 |
+
} else if (pos2 < 0) {
|
| 728 |
+
Range2_all_ones = false;
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
if (pos1 >= 0 && pos2 < _AP_W2) {
|
| 732 |
+
ap_int_base<_AP_W2, false> Range1;
|
| 733 |
+
Range1.V = _AP_ROOT_op_get_range(op.V, pos1, _AP_W2 - 1);
|
| 734 |
+
Range1_all_ones = Range1 == (all_ones >> pos1);
|
| 735 |
+
Range1_all_zeros = !Range1.V;
|
| 736 |
+
} else if (pos2 == _AP_W2) {
|
| 737 |
+
Range1_all_ones = lD;
|
| 738 |
+
Range1_all_zeros = !lD;
|
| 739 |
+
} else if (pos1 < 0) {
|
| 740 |
+
Range1_all_zeros = !op.V;
|
| 741 |
+
Range1_all_ones = false;
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
deleted_zeros =
|
| 745 |
+
deleted_zeros && (carry ? Range1_all_ones : Range1_all_zeros);
|
| 746 |
+
deleted_ones =
|
| 747 |
+
carry ? Range2_all_ones && (pos1 < 0 || !lD) : Range1_all_ones;
|
| 748 |
+
neg_src = isneg && !(carry && Range1_all_ones);
|
| 749 |
+
} else
|
| 750 |
+
neg_src = isneg && newsignbit;
|
| 751 |
+
bool neg_trg = _AP_S && newsignbit;
|
| 752 |
+
bool overflow = (neg_trg || !deleted_zeros) && !isneg;
|
| 753 |
+
bool underflow = (!neg_trg || !deleted_ones) && neg_src;
|
| 754 |
+
if ((_AP_O == AP_SAT_SYM) && _AP_S2 && _AP_S)
|
| 755 |
+
underflow |=
|
| 756 |
+
neg_src &&
|
| 757 |
+
(_AP_W > 1 ? _AP_ROOT_op_get_range(Base::V, 0, _AP_W - 2) == 0
|
| 758 |
+
: true);
|
| 759 |
+
|
| 760 |
+
overflow_adjust(underflow, overflow, lD, neg_src);
|
| 761 |
+
}
|
| 762 |
+
return *this;
|
| 763 |
+
} // operator=
|
| 764 |
+
|
| 765 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 766 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 767 |
+
INLINE ap_fixed_base& operator=(
|
| 768 |
+
const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 769 |
+
operator=(const_cast<const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(op));
|
| 770 |
+
return *this;
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
/// Set this ap_fixed_base with ULL.
|
| 774 |
+
INLINE ap_fixed_base& setBits(ap_ulong bv) {
|
| 775 |
+
// TODO when ull is not be long enough...
|
| 776 |
+
Base::V = bv;
|
| 777 |
+
return *this;
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
/// Return a ap_fixed_base object whose this->V is assigned by bv.
|
| 781 |
+
static INLINE ap_fixed_base bitsToFixed(ap_ulong bv) {
|
| 782 |
+
// TODO fix when ull is not be long enough...
|
| 783 |
+
ap_fixed_base t;
|
| 784 |
+
#ifdef __SYNTHESIS__
|
| 785 |
+
t.V = bv;
|
| 786 |
+
#else
|
| 787 |
+
t.V.set_bits(bv);
|
| 788 |
+
#endif
|
| 789 |
+
return t;
|
| 790 |
+
}
|
| 791 |
+
|
| 792 |
+
// Explicit conversion functions to ap_int_base.
|
| 793 |
+
/** Captures all integer bits, in truncate mode.
|
| 794 |
+
* @param[in] Cnative follow conversion from double to int.
|
| 795 |
+
*/
|
| 796 |
+
INLINE ap_int_base<AP_MAX(_AP_I, 1), _AP_S> to_ap_int_base(
|
| 797 |
+
bool Cnative = true) const {
|
| 798 |
+
ap_int_base<AP_MAX(_AP_I, 1), _AP_S> ret;
|
| 799 |
+
if (_AP_I == 0) {
|
| 800 |
+
ret.V = 0;
|
| 801 |
+
} else if (_AP_I > 0 && _AP_I <= _AP_W) {
|
| 802 |
+
ret.V = _AP_ROOT_op_get_range(Base::V, _AP_W - _AP_I, _AP_W - 1);
|
| 803 |
+
} else if (_AP_I > _AP_W) {
|
| 804 |
+
ret.V = _AP_ROOT_op_get_range(Base::V, 0, _AP_W - 1);
|
| 805 |
+
ret.V <<= (_AP_I - _AP_W);
|
| 806 |
+
}
|
| 807 |
+
/* Consider the following case
|
| 808 |
+
* float f = -7.5f;
|
| 809 |
+
* ap_fixed<8,4> t = f; // -8 0 0 0 . 0.5
|
| 810 |
+
* int i = t.to_int();
|
| 811 |
+
* the result should be -7 instead of -8.
|
| 812 |
+
* Therefore, after truncation, the value should be increated by 1.
|
| 813 |
+
* For (-1, 0), carry to MSB will happen, but result 0 is still correct.
|
| 814 |
+
*/
|
| 815 |
+
if (Cnative && _AP_I < _AP_W) {
|
| 816 |
+
// Follow C native data type, conversion from double to int
|
| 817 |
+
if (_AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1) && (_AP_I < _AP_W) &&
|
| 818 |
+
(_AP_ROOT_op_get_range(
|
| 819 |
+
Base::V, 0, _AP_I < 0 ? _AP_W - 1 : _AP_W - _AP_I - 1) != 0))
|
| 820 |
+
++ret;
|
| 821 |
+
} else {
|
| 822 |
+
// Follow OSCI library, conversion from sc_fixed to sc_int
|
| 823 |
+
}
|
| 824 |
+
return ret;
|
| 825 |
+
};
|
| 826 |
+
|
| 827 |
+
public:
|
| 828 |
+
template <int _AP_W2, bool _AP_S2>
|
| 829 |
+
INLINE operator ap_int_base<_AP_W2, _AP_S2>() const {
|
| 830 |
+
return ap_int_base<_AP_W2, _AP_S2>(to_ap_int_base());
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
// Explicit conversion function to C built-in integral type.
|
| 834 |
+
INLINE char to_char() const { return to_ap_int_base().to_char(); }
|
| 835 |
+
|
| 836 |
+
INLINE int to_int() const { return to_ap_int_base().to_int(); }
|
| 837 |
+
|
| 838 |
+
INLINE unsigned to_uint() const { return to_ap_int_base().to_uint(); }
|
| 839 |
+
|
| 840 |
+
INLINE ap_slong to_int64() const { return to_ap_int_base().to_int64(); }
|
| 841 |
+
|
| 842 |
+
INLINE ap_ulong to_uint64() const { return to_ap_int_base().to_uint64(); }
|
| 843 |
+
|
| 844 |
+
/// covert function to double.
|
| 845 |
+
/** only round-half-to-even mode supported, does not obey FE env. */
|
| 846 |
+
INLINE double to_double() const {
|
| 847 |
+
#if defined(AP_FIXED_ENABLE_CPP_FENV)
|
| 848 |
+
_AP_WARNING(std::fegetround() != FE_TONEAREST,
|
| 849 |
+
"Only FE_TONEAREST is supported");
|
| 850 |
+
#endif
|
| 851 |
+
enum { BITS = DOUBLE_MAN + DOUBLE_EXP + 1 };
|
| 852 |
+
if (!Base::V) return 0.0f;
|
| 853 |
+
bool s = _AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1); ///< sign.
|
| 854 |
+
ap_int_base<_AP_W, false> tmp;
|
| 855 |
+
if (s)
|
| 856 |
+
tmp.V = -Base::V; // may truncate one bit extra from neg in sim.
|
| 857 |
+
else
|
| 858 |
+
tmp.V = Base::V;
|
| 859 |
+
int l = tmp.countLeadingZeros(); ///< number of leading zeros.
|
| 860 |
+
int e = _AP_I - l - 1 + DOUBLE_BIAS; ///< exponent
|
| 861 |
+
int lsb_index = _AP_W - l - 1 - DOUBLE_MAN;
|
| 862 |
+
// more than 0.5?
|
| 863 |
+
bool a = (lsb_index >=2) ?
|
| 864 |
+
(_AP_ROOT_op_get_range(tmp.V, 0, lsb_index - 2) != 0) : 0;
|
| 865 |
+
// round to even
|
| 866 |
+
a |= (lsb_index >=0) ? _AP_ROOT_op_get_bit(tmp.V, lsb_index) : 0;
|
| 867 |
+
// ull is at least 64-bit
|
| 868 |
+
ap_ulong m;
|
| 869 |
+
// may actually left shift, ensure buffer is wide enough.
|
| 870 |
+
if (_AP_W > BITS) {
|
| 871 |
+
m = (lsb_index >= 1) ? (ap_ulong)(tmp.V >> (lsb_index - 1))
|
| 872 |
+
: (ap_ulong)(tmp.V << (1 - lsb_index));
|
| 873 |
+
} else {
|
| 874 |
+
m = (ap_ulong)tmp.V;
|
| 875 |
+
m = (lsb_index >= 1) ? (m >> (lsb_index - 1))
|
| 876 |
+
: (m << (1 - lsb_index));
|
| 877 |
+
}
|
| 878 |
+
m += a;
|
| 879 |
+
m >>= 1;
|
| 880 |
+
//std::cout << '\n' << std::hex << m << '\n'; // TODO delete this
|
| 881 |
+
// carry to MSB, increase exponent
|
| 882 |
+
if (_AP_ctype_op_get_bit(m, DOUBLE_MAN + 1)) {
|
| 883 |
+
e += 1;
|
| 884 |
+
}
|
| 885 |
+
// set sign and exponent
|
| 886 |
+
m = _AP_ctype_op_set_bit(m, BITS - 1, s);
|
| 887 |
+
//std::cout << m << '\n'; // TODO delete this
|
| 888 |
+
m = _AP_ctype_op_set_range(m, DOUBLE_MAN, DOUBLE_MAN + DOUBLE_EXP - 1, e);
|
| 889 |
+
//std::cout << std::hex << m << std::dec << std::endl; // TODO delete this
|
| 890 |
+
// cast to fp
|
| 891 |
+
return rawBitsToDouble(m);
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
/// convert function to float.
|
| 895 |
+
/** only round-half-to-even mode supported, does not obey FE env. */
|
| 896 |
+
INLINE float to_float() const {
|
| 897 |
+
#if defined(AP_FIXED_ENABLE_CPP_FENV)
|
| 898 |
+
_AP_WARNING(std::fegetround() != FE_TONEAREST,
|
| 899 |
+
"Only FE_TONEAREST is supported");
|
| 900 |
+
#endif
|
| 901 |
+
enum { BITS = FLOAT_MAN + FLOAT_EXP + 1 };
|
| 902 |
+
if (!Base::V) return 0.0f;
|
| 903 |
+
bool s = _AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1); ///< sign.
|
| 904 |
+
ap_int_base<_AP_W, false> tmp;
|
| 905 |
+
if (s)
|
| 906 |
+
tmp.V = -Base::V; // may truncate one bit extra from neg in sim.
|
| 907 |
+
else
|
| 908 |
+
tmp.V = Base::V;
|
| 909 |
+
int l = tmp.countLeadingZeros(); ///< number of leading zeros.
|
| 910 |
+
int e = _AP_I - l - 1 + FLOAT_BIAS; ///< exponent
|
| 911 |
+
int lsb_index = _AP_W - l - 1 - FLOAT_MAN;
|
| 912 |
+
// more than 0.5?
|
| 913 |
+
bool a = (lsb_index >=2) ?
|
| 914 |
+
(_AP_ROOT_op_get_range(tmp.V, 0, lsb_index - 2) != 0) : 0;
|
| 915 |
+
// round to even
|
| 916 |
+
a |= (lsb_index >=0) ? _AP_ROOT_op_get_bit(tmp.V, lsb_index) : 0;
|
| 917 |
+
// ul is at least 32-bit
|
| 918 |
+
unsigned long m;
|
| 919 |
+
// may actually left shift, ensure buffer is wide enough.
|
| 920 |
+
if (_AP_W > BITS) {
|
| 921 |
+
m = (lsb_index >= 1) ? (unsigned long)(tmp.V >> (lsb_index - 1))
|
| 922 |
+
: (unsigned long)(tmp.V << (1 - lsb_index));
|
| 923 |
+
} else {
|
| 924 |
+
m = (unsigned long)tmp.V;
|
| 925 |
+
m = (lsb_index >= 1) ? (m >> (lsb_index - 1))
|
| 926 |
+
: (m << (1 - lsb_index));
|
| 927 |
+
}
|
| 928 |
+
m += a;
|
| 929 |
+
m >>= 1;
|
| 930 |
+
// carry to MSB, increase exponent
|
| 931 |
+
if (_AP_ctype_op_get_bit(m, FLOAT_MAN + 1)) {
|
| 932 |
+
e += 1;
|
| 933 |
+
}
|
| 934 |
+
// set sign and exponent
|
| 935 |
+
m = _AP_ctype_op_set_bit(m, BITS - 1, s);
|
| 936 |
+
m = _AP_ctype_op_set_range(m, FLOAT_MAN, FLOAT_MAN + FLOAT_EXP - 1, e);
|
| 937 |
+
// cast to fp
|
| 938 |
+
return rawBitsToFloat(m);
|
| 939 |
+
}
|
| 940 |
+
|
| 941 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 942 |
+
/// convert function to half.
|
| 943 |
+
/** only round-half-to-even mode supported, does not obey FE env. */
|
| 944 |
+
INLINE half to_half() const {
|
| 945 |
+
#if defined(AP_FIXED_ENABLE_CPP_FENV)
|
| 946 |
+
_AP_WARNING(std::fegetround() != FE_TONEAREST,
|
| 947 |
+
"Only FE_TONEAREST is supported");
|
| 948 |
+
#endif
|
| 949 |
+
enum { BITS = HALF_MAN + HALF_EXP + 1 };
|
| 950 |
+
if (!Base::V) return 0.0f;
|
| 951 |
+
bool s = _AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1); ///< sign.
|
| 952 |
+
ap_int_base<_AP_W, false> tmp;
|
| 953 |
+
if (s)
|
| 954 |
+
tmp.V = -Base::V; // may truncate one bit extra from neg in sim.
|
| 955 |
+
else
|
| 956 |
+
tmp.V = Base::V;
|
| 957 |
+
int l = tmp.countLeadingZeros(); ///< number of leading zeros.
|
| 958 |
+
int e = _AP_I - l - 1 + HALF_BIAS; ///< exponent
|
| 959 |
+
int lsb_index = _AP_W - l - 1 - HALF_MAN;
|
| 960 |
+
// more than 0.5?
|
| 961 |
+
bool a = (lsb_index >=2) ?
|
| 962 |
+
(_AP_ROOT_op_get_range(tmp.V, 0, lsb_index - 2) != 0) : 0;
|
| 963 |
+
// round to even
|
| 964 |
+
a |= (lsb_index >=0) ? _AP_ROOT_op_get_bit(tmp.V, lsb_index) : 0;
|
| 965 |
+
// short is at least 16-bit
|
| 966 |
+
unsigned short m;
|
| 967 |
+
// may actually left shift, ensure buffer is wide enough.
|
| 968 |
+
if (_AP_W > BITS) {
|
| 969 |
+
m = (lsb_index >= 1) ? (unsigned short)(tmp.V >> (lsb_index - 1))
|
| 970 |
+
: (unsigned short)(tmp.V << (1 - lsb_index));
|
| 971 |
+
} else {
|
| 972 |
+
m = (unsigned short)tmp.V;
|
| 973 |
+
m = (lsb_index >= 1) ? (m >> (lsb_index - 1))
|
| 974 |
+
: (m << (1 - lsb_index));
|
| 975 |
+
}
|
| 976 |
+
m += a;
|
| 977 |
+
m >>= 1;
|
| 978 |
+
// carry to MSB, increase exponent
|
| 979 |
+
if (_AP_ctype_op_get_bit(m, HALF_MAN + 1)) {
|
| 980 |
+
e += 1;
|
| 981 |
+
}
|
| 982 |
+
// set sign and exponent
|
| 983 |
+
m = _AP_ctype_op_set_bit(m, BITS - 1, s);
|
| 984 |
+
m = _AP_ctype_op_set_range(m, HALF_MAN, HALF_MAN + HALF_EXP - 1, e);
|
| 985 |
+
// cast to fp
|
| 986 |
+
return rawBitsToHalf(m);
|
| 987 |
+
}
|
| 988 |
+
#endif
|
| 989 |
+
|
| 990 |
+
// FIXME inherited from old code, this may loose precision!
|
| 991 |
+
INLINE operator long double() const { return (long double)to_double(); }
|
| 992 |
+
|
| 993 |
+
INLINE operator double() const { return to_double(); }
|
| 994 |
+
|
| 995 |
+
INLINE operator float() const { return to_float(); }
|
| 996 |
+
|
| 997 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 998 |
+
INLINE operator half() const { return to_half(); }
|
| 999 |
+
#endif
|
| 1000 |
+
|
| 1001 |
+
INLINE operator bool() const { return (bool)Base::V != 0; }
|
| 1002 |
+
|
| 1003 |
+
INLINE operator char() const { return (char)to_int(); }
|
| 1004 |
+
|
| 1005 |
+
INLINE operator signed char() const { return (signed char)to_int(); }
|
| 1006 |
+
|
| 1007 |
+
INLINE operator unsigned char() const { return (unsigned char)to_uint(); }
|
| 1008 |
+
|
| 1009 |
+
INLINE operator short() const { return (short)to_int(); }
|
| 1010 |
+
|
| 1011 |
+
INLINE operator unsigned short() const { return (unsigned short)to_uint(); }
|
| 1012 |
+
|
| 1013 |
+
INLINE operator int() const { return to_int(); }
|
| 1014 |
+
|
| 1015 |
+
INLINE operator unsigned int() const { return to_uint(); }
|
| 1016 |
+
|
| 1017 |
+
// FIXME don't assume data width...
|
| 1018 |
+
#ifdef __x86_64__
|
| 1019 |
+
INLINE operator long() const { return (long)to_int64(); }
|
| 1020 |
+
|
| 1021 |
+
INLINE operator unsigned long() const { return (unsigned long)to_uint64(); }
|
| 1022 |
+
#else
|
| 1023 |
+
INLINE operator long() const { return (long)to_int(); }
|
| 1024 |
+
|
| 1025 |
+
INLINE operator unsigned long() const { return (unsigned long)to_uint(); }
|
| 1026 |
+
#endif // ifdef __x86_64__ else
|
| 1027 |
+
|
| 1028 |
+
INLINE operator ap_ulong() const { return to_uint64(); }
|
| 1029 |
+
|
| 1030 |
+
INLINE operator ap_slong() const { return to_int64(); }
|
| 1031 |
+
|
| 1032 |
+
INLINE int length() const { return _AP_W; };
|
| 1033 |
+
|
| 1034 |
+
// bits_to_int64 deleted.
|
| 1035 |
+
#ifndef __SYNTHESIS__
|
| 1036 |
+
// Used in autowrap, when _AP_W < 64.
|
| 1037 |
+
INLINE ap_ulong bits_to_uint64() const {
|
| 1038 |
+
return (Base::V).to_uint64();
|
| 1039 |
+
}
|
| 1040 |
+
#endif
|
| 1041 |
+
|
| 1042 |
+
// Count the number of zeros from the most significant bit
|
| 1043 |
+
// to the first one bit. Note this is only for ap_fixed_base whose
|
| 1044 |
+
// _AP_W <= 64, otherwise will incur assertion.
|
| 1045 |
+
INLINE int countLeadingZeros() {
|
| 1046 |
+
#ifdef __SYNTHESIS__
|
| 1047 |
+
// TODO: used llvm.ctlz intrinsic ?
|
| 1048 |
+
if (_AP_W <= 32) {
|
| 1049 |
+
ap_int_base<32, false> t(-1ULL);
|
| 1050 |
+
t.range(_AP_W - 1, 0) = this->range(0, _AP_W - 1);
|
| 1051 |
+
return __builtin_ctz(t.V);
|
| 1052 |
+
} else if (_AP_W <= 64) {
|
| 1053 |
+
ap_int_base<64, false> t(-1ULL);
|
| 1054 |
+
t.range(_AP_W - 1, 0) = this->range(0, _AP_W - 1);
|
| 1055 |
+
return __builtin_ctzll(t.V);
|
| 1056 |
+
} else {
|
| 1057 |
+
enum {__N = (_AP_W + 63) / 64};
|
| 1058 |
+
int NZeros = 0;
|
| 1059 |
+
int i = 0;
|
| 1060 |
+
bool hitNonZero = false;
|
| 1061 |
+
for (i = 0; i < __N - 1; ++i) {
|
| 1062 |
+
ap_int_base<64, false> t;
|
| 1063 |
+
t.range(0, 63) = this->range(_AP_W - i * 64 - 64, _AP_W - i * 64 - 1);
|
| 1064 |
+
NZeros += hitNonZero ? 0 : __builtin_clzll(t.V);
|
| 1065 |
+
hitNonZero |= (t != 0);
|
| 1066 |
+
}
|
| 1067 |
+
if (!hitNonZero) {
|
| 1068 |
+
ap_int_base<64, false> t(-1ULL);
|
| 1069 |
+
t.range(63 - (_AP_W - 1) % 64, 63) = this->range(0, (_AP_W - 1) % 64);
|
| 1070 |
+
NZeros += __builtin_clzll(t.V);
|
| 1071 |
+
}
|
| 1072 |
+
return NZeros;
|
| 1073 |
+
}
|
| 1074 |
+
#else
|
| 1075 |
+
return Base::V.countLeadingZeros();
|
| 1076 |
+
#endif
|
| 1077 |
+
}
|
| 1078 |
+
|
| 1079 |
+
// Arithmetic : Binary
|
| 1080 |
+
// -------------------------------------------------------------------------
|
| 1081 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1082 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1083 |
+
INLINE typename RType<_AP_W2, _AP_I2, _AP_S2>::mult operator*(
|
| 1084 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2)
|
| 1085 |
+
const {
|
| 1086 |
+
typename RType<_AP_W2, _AP_I2, _AP_S2>::mult_base r, t;
|
| 1087 |
+
r.V = Base::V;
|
| 1088 |
+
t.V = op2.V;
|
| 1089 |
+
r.V *= op2.V;
|
| 1090 |
+
return r;
|
| 1091 |
+
}
|
| 1092 |
+
|
| 1093 |
+
// multiply function deleted.
|
| 1094 |
+
|
| 1095 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1096 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1097 |
+
INLINE typename RType<_AP_W2, _AP_I2, _AP_S2>::div operator/(
|
| 1098 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2)
|
| 1099 |
+
const {
|
| 1100 |
+
typename RType<_AP_W2, _AP_I2, _AP_S2>::div_base r;
|
| 1101 |
+
#ifndef __SYNTHESIS__
|
| 1102 |
+
enum {F2 = _AP_W2-_AP_I2,
|
| 1103 |
+
_W1=AP_MAX(_AP_W + AP_MAX(F2, 0) + ((_AP_S2 && !_AP_S) ? 1 : 0), _AP_W2 + ((_AP_S && !_AP_S2) ? 1 : 0))};
|
| 1104 |
+
ap_int_base<_W1,_AP_S||_AP_S2> dividend,divisior;
|
| 1105 |
+
ap_int_base<_W1,_AP_S> tmp1;
|
| 1106 |
+
ap_int_base<_W1,_AP_S2> tmp2;
|
| 1107 |
+
tmp1.V = Base::V;
|
| 1108 |
+
tmp1.V <<= AP_MAX(F2,0);
|
| 1109 |
+
tmp2.V = op2.V;
|
| 1110 |
+
dividend = tmp1;
|
| 1111 |
+
divisior = tmp2;
|
| 1112 |
+
r.V = ((_AP_S||_AP_S2) ? dividend.V.sdiv(divisior.V): dividend.V.udiv(divisior.V));
|
| 1113 |
+
#else
|
| 1114 |
+
#ifndef __SC_COMPATIBLE__
|
| 1115 |
+
ap_fixed_base<_AP_W + AP_MAX(_AP_W2 - _AP_I2, 0),_AP_I, _AP_S> t(*this);
|
| 1116 |
+
#else
|
| 1117 |
+
ap_fixed_base<_AP_W + AP_MAX(_AP_W2 - _AP_I2, 0) + AP_MAX(_AP_I2, 0),_AP_I, _AP_S> t(*this);
|
| 1118 |
+
#endif
|
| 1119 |
+
r.V = t.V / op2.V;
|
| 1120 |
+
#endif
|
| 1121 |
+
/*
|
| 1122 |
+
enum {
|
| 1123 |
+
F2 = _AP_W2 - _AP_I2,
|
| 1124 |
+
shl = AP_MAX(F2, 0) + AP_MAX(_AP_I2, 0),
|
| 1125 |
+
#ifndef __SC_COMPATIBLE__
|
| 1126 |
+
shr = AP_MAX(_AP_I2, 0),
|
| 1127 |
+
#else
|
| 1128 |
+
shr = 0,
|
| 1129 |
+
#endif
|
| 1130 |
+
W3 = _AP_S2 + _AP_W + shl,
|
| 1131 |
+
S3 = _AP_S || _AP_S2,
|
| 1132 |
+
};
|
| 1133 |
+
ap_int_base<W3, S3> dividend, t;
|
| 1134 |
+
dividend.V = Base::V;
|
| 1135 |
+
// multiply both by (1 << F2), and than do integer division.
|
| 1136 |
+
dividend.V <<= (int) shl;
|
| 1137 |
+
#ifdef __SYNTHESIS__
|
| 1138 |
+
// .V's have right signedness, and will have right extending.
|
| 1139 |
+
t.V = dividend.V / op2.V;
|
| 1140 |
+
#else
|
| 1141 |
+
// XXX op2 may be wider than dividend, and sdiv and udiv takes the same with
|
| 1142 |
+
// as left hand operand, so data might be truncated by mistake if not
|
| 1143 |
+
// handled here.
|
| 1144 |
+
t.V = S3 ? dividend.V.sdiv(op2.V) : dividend.V.udiv(op2.V);
|
| 1145 |
+
#endif
|
| 1146 |
+
r.V = t.V >> (int) shr;
|
| 1147 |
+
*/
|
| 1148 |
+
return r;
|
| 1149 |
+
}
|
| 1150 |
+
|
| 1151 |
+
#define OP_BIN_AF(Sym, Rty) \
|
| 1152 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2, \
|
| 1153 |
+
ap_o_mode _AP_O2, int _AP_N2> \
|
| 1154 |
+
INLINE typename RType<_AP_W2, _AP_I2, _AP_S2>::Rty operator Sym( \
|
| 1155 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& \
|
| 1156 |
+
op2) const { \
|
| 1157 |
+
typename RType<_AP_W2, _AP_I2, _AP_S2>::Rty##_base ret, lhs(*this), \
|
| 1158 |
+
rhs(op2); \
|
| 1159 |
+
ret.V = lhs.V Sym rhs.V; \
|
| 1160 |
+
return ret; \
|
| 1161 |
+
}
|
| 1162 |
+
|
| 1163 |
+
OP_BIN_AF(+, plus)
|
| 1164 |
+
OP_BIN_AF(-, minus)
|
| 1165 |
+
OP_BIN_AF(&, logic)
|
| 1166 |
+
OP_BIN_AF(|, logic)
|
| 1167 |
+
OP_BIN_AF(^, logic)
|
| 1168 |
+
|
| 1169 |
+
// Arithmetic : assign
|
| 1170 |
+
// -------------------------------------------------------------------------
|
| 1171 |
+
#define OP_ASSIGN_AF(Sym) \
|
| 1172 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2, \
|
| 1173 |
+
ap_o_mode _AP_O2, int _AP_N2> \
|
| 1174 |
+
INLINE ap_fixed_base& operator Sym##=( \
|
| 1175 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& \
|
| 1176 |
+
op2) { \
|
| 1177 |
+
*this = operator Sym(op2); \
|
| 1178 |
+
return *this; \
|
| 1179 |
+
}
|
| 1180 |
+
|
| 1181 |
+
OP_ASSIGN_AF(*)
|
| 1182 |
+
OP_ASSIGN_AF(/)
|
| 1183 |
+
OP_ASSIGN_AF(+)
|
| 1184 |
+
OP_ASSIGN_AF(-)
|
| 1185 |
+
OP_ASSIGN_AF(&)
|
| 1186 |
+
OP_ASSIGN_AF(|)
|
| 1187 |
+
OP_ASSIGN_AF(^)
|
| 1188 |
+
|
| 1189 |
+
// Prefix and postfix increment and decrement.
|
| 1190 |
+
// -------------------------------------------------------------------------
|
| 1191 |
+
|
| 1192 |
+
/// Prefix increment
|
| 1193 |
+
INLINE ap_fixed_base& operator++() {
|
| 1194 |
+
operator+=(ap_fixed_base<_AP_W - _AP_I + 1, 1, false>(1));
|
| 1195 |
+
return *this;
|
| 1196 |
+
}
|
| 1197 |
+
|
| 1198 |
+
/// Prefix decrement.
|
| 1199 |
+
INLINE ap_fixed_base& operator--() {
|
| 1200 |
+
operator-=(ap_fixed_base<_AP_W - _AP_I + 1, 1, false>(1));
|
| 1201 |
+
return *this;
|
| 1202 |
+
}
|
| 1203 |
+
|
| 1204 |
+
/// Postfix increment
|
| 1205 |
+
INLINE const ap_fixed_base operator++(int) {
|
| 1206 |
+
ap_fixed_base r(*this);
|
| 1207 |
+
operator++();
|
| 1208 |
+
return r;
|
| 1209 |
+
}
|
| 1210 |
+
|
| 1211 |
+
/// Postfix decrement
|
| 1212 |
+
INLINE const ap_fixed_base operator--(int) {
|
| 1213 |
+
ap_fixed_base r(*this);
|
| 1214 |
+
operator--();
|
| 1215 |
+
return r;
|
| 1216 |
+
}
|
| 1217 |
+
|
| 1218 |
+
// Unary arithmetic.
|
| 1219 |
+
// -------------------------------------------------------------------------
|
| 1220 |
+
INLINE ap_fixed_base operator+() { return *this; }
|
| 1221 |
+
|
| 1222 |
+
INLINE ap_fixed_base<_AP_W + 1, _AP_I + 1, true> operator-() const {
|
| 1223 |
+
ap_fixed_base<_AP_W + 1, _AP_I + 1, true> r(*this);
|
| 1224 |
+
r.V = -r.V;
|
| 1225 |
+
return r;
|
| 1226 |
+
}
|
| 1227 |
+
|
| 1228 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> getNeg() {
|
| 1229 |
+
ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> r(*this);
|
| 1230 |
+
r.V = -r.V;
|
| 1231 |
+
return r;
|
| 1232 |
+
}
|
| 1233 |
+
|
| 1234 |
+
// Not (!)
|
| 1235 |
+
// -------------------------------------------------------------------------
|
| 1236 |
+
INLINE bool operator!() const { return Base::V == 0; }
|
| 1237 |
+
|
| 1238 |
+
// Bitwise complement
|
| 1239 |
+
// -------------------------------------------------------------------------
|
| 1240 |
+
// XXX different from Mentor's ac_fixed.
|
| 1241 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, _AP_S> operator~() const {
|
| 1242 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S> r;
|
| 1243 |
+
r.V = ~Base::V;
|
| 1244 |
+
return r;
|
| 1245 |
+
}
|
| 1246 |
+
|
| 1247 |
+
// Shift
|
| 1248 |
+
// -------------------------------------------------------------------------
|
| 1249 |
+
// left shift is the same as moving point right, i.e. increate I.
|
| 1250 |
+
template <int _AP_SHIFT>
|
| 1251 |
+
INLINE ap_fixed_base<_AP_W, _AP_I + _AP_SHIFT, _AP_S> lshift() const {
|
| 1252 |
+
ap_fixed_base<_AP_W, _AP_I + _AP_SHIFT, _AP_S> r;
|
| 1253 |
+
r.V = Base::V;
|
| 1254 |
+
return r;
|
| 1255 |
+
}
|
| 1256 |
+
|
| 1257 |
+
template <int _AP_SHIFT>
|
| 1258 |
+
INLINE ap_fixed_base<_AP_W, _AP_I - _AP_SHIFT, _AP_S> rshift() const {
|
| 1259 |
+
ap_fixed_base<_AP_W, _AP_I - _AP_SHIFT, _AP_S> r;
|
| 1260 |
+
r.V = Base::V;
|
| 1261 |
+
return r;
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
// Because the return type is the type of the the first operand, shift assign
|
| 1265 |
+
// operators do not carry out any quantization or overflow
|
| 1266 |
+
// While systemc, shift assigns for sc_fixed/sc_ufixed will result in
|
| 1267 |
+
// quantization or overflow (depending on the mode of the first operand)
|
| 1268 |
+
INLINE ap_fixed_base operator<<(unsigned int sh) const {
|
| 1269 |
+
ap_fixed_base r;
|
| 1270 |
+
r.V = Base::V << sh;
|
| 1271 |
+
// TODO check shift overflow?
|
| 1272 |
+
#ifdef __SC_COMPATIBLE__
|
| 1273 |
+
if (sh == 0) return r;
|
| 1274 |
+
if (_AP_O != AP_WRAP || _AP_N != 0) {
|
| 1275 |
+
bool neg_src = _AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1);
|
| 1276 |
+
bool allones, allzeros;
|
| 1277 |
+
ap_int_base<_AP_W, false> ones(-1);
|
| 1278 |
+
if (sh <= _AP_W) {
|
| 1279 |
+
ap_int_base<_AP_W, false> range1;
|
| 1280 |
+
range1.V = _AP_ROOT_op_get_range(
|
| 1281 |
+
const_cast<ap_fixed_base*>(this)->Base::V, _AP_W - sh, _AP_W - 1);
|
| 1282 |
+
allones = range1 == (ones >> (_AP_W - sh));
|
| 1283 |
+
allzeros = range1 == 0;
|
| 1284 |
+
} else {
|
| 1285 |
+
allones = false;
|
| 1286 |
+
allzeros = Base::V == 0;
|
| 1287 |
+
}
|
| 1288 |
+
bool overflow = !allzeros && !neg_src;
|
| 1289 |
+
bool underflow = !allones && neg_src;
|
| 1290 |
+
if ((_AP_O == AP_SAT_SYM) && _AP_S)
|
| 1291 |
+
underflow |=
|
| 1292 |
+
neg_src &&
|
| 1293 |
+
(_AP_W > 1 ? _AP_ROOT_op_get_range(r.V, 0, _AP_W - 2) == 0 : true);
|
| 1294 |
+
bool lD = false;
|
| 1295 |
+
if (sh < _AP_W) lD = _AP_ROOT_op_get_bit(Base::V, _AP_W - sh - 1);
|
| 1296 |
+
r.overflow_adjust(underflow, overflow, lD, neg_src);
|
| 1297 |
+
}
|
| 1298 |
+
#endif
|
| 1299 |
+
return r;
|
| 1300 |
+
}
|
| 1301 |
+
|
| 1302 |
+
INLINE ap_fixed_base operator>>(unsigned int sh) const {
|
| 1303 |
+
ap_fixed_base r;
|
| 1304 |
+
r.V = Base::V >> sh;
|
| 1305 |
+
// TODO check shift overflow?
|
| 1306 |
+
#ifdef __SC_COMPATIBLE__
|
| 1307 |
+
if (sh == 0) return r;
|
| 1308 |
+
if (_AP_Q != AP_TRN) {
|
| 1309 |
+
bool qb = false;
|
| 1310 |
+
if (sh <= _AP_W) qb = _AP_ROOT_op_get_bit(Base::V, sh - 1);
|
| 1311 |
+
bool rb = false;
|
| 1312 |
+
if (sh > 1 && sh <= _AP_W)
|
| 1313 |
+
rb = _AP_ROOT_op_get_range(const_cast<ap_fixed_base*>(this)->Base::V, 0,
|
| 1314 |
+
sh - 2) != 0;
|
| 1315 |
+
else if (sh > _AP_W)
|
| 1316 |
+
rb = Base::V != 0;
|
| 1317 |
+
r.quantization_adjust(qb, rb,
|
| 1318 |
+
_AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1));
|
| 1319 |
+
}
|
| 1320 |
+
#endif
|
| 1321 |
+
return r;
|
| 1322 |
+
}
|
| 1323 |
+
|
| 1324 |
+
// left and right shift for int
|
| 1325 |
+
INLINE ap_fixed_base operator<<(int sh) const {
|
| 1326 |
+
ap_fixed_base r;
|
| 1327 |
+
bool isNeg = sh < 0;
|
| 1328 |
+
unsigned int ush = isNeg ? -sh : sh;
|
| 1329 |
+
if (isNeg) {
|
| 1330 |
+
return operator>>(ush);
|
| 1331 |
+
} else {
|
| 1332 |
+
return operator<<(ush);
|
| 1333 |
+
}
|
| 1334 |
+
}
|
| 1335 |
+
|
| 1336 |
+
INLINE ap_fixed_base operator>>(int sh) const {
|
| 1337 |
+
bool isNeg = sh < 0;
|
| 1338 |
+
unsigned int ush = isNeg ? -sh : sh;
|
| 1339 |
+
if (isNeg) {
|
| 1340 |
+
return operator<<(ush);
|
| 1341 |
+
} else {
|
| 1342 |
+
return operator>>(ush);
|
| 1343 |
+
}
|
| 1344 |
+
}
|
| 1345 |
+
|
| 1346 |
+
// left and right shift for ap_int.
|
| 1347 |
+
template <int _AP_W2>
|
| 1348 |
+
INLINE ap_fixed_base operator<<(const ap_int_base<_AP_W2, true>& op2) const {
|
| 1349 |
+
// TODO the code seems not optimal. ap_fixed<8,8> << ap_int<2> needs only a
|
| 1350 |
+
// small mux, but integer need a big one!
|
| 1351 |
+
int sh = op2.to_int();
|
| 1352 |
+
return operator<<(sh);
|
| 1353 |
+
}
|
| 1354 |
+
|
| 1355 |
+
template <int _AP_W2>
|
| 1356 |
+
INLINE ap_fixed_base operator>>(const ap_int_base<_AP_W2, true>& op2) const {
|
| 1357 |
+
int sh = op2.to_int();
|
| 1358 |
+
return operator>>(sh);
|
| 1359 |
+
}
|
| 1360 |
+
|
| 1361 |
+
// left and right shift for ap_uint.
|
| 1362 |
+
template <int _AP_W2>
|
| 1363 |
+
INLINE ap_fixed_base operator<<(const ap_int_base<_AP_W2, false>& op2) const {
|
| 1364 |
+
unsigned int sh = op2.to_uint();
|
| 1365 |
+
return operator<<(sh);
|
| 1366 |
+
}
|
| 1367 |
+
|
| 1368 |
+
template <int _AP_W2>
|
| 1369 |
+
INLINE ap_fixed_base operator>>(const ap_int_base<_AP_W2, false>& op2) const {
|
| 1370 |
+
unsigned int sh = op2.to_uint();
|
| 1371 |
+
return operator>>(sh);
|
| 1372 |
+
}
|
| 1373 |
+
|
| 1374 |
+
// left and right shift for ap_fixed
|
| 1375 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1376 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1377 |
+
INLINE ap_fixed_base operator<<(
|
| 1378 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 1379 |
+
op2) {
|
| 1380 |
+
return operator<<(op2.to_ap_int_base());
|
| 1381 |
+
}
|
| 1382 |
+
|
| 1383 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1384 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1385 |
+
INLINE ap_fixed_base operator>>(
|
| 1386 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 1387 |
+
op2) {
|
| 1388 |
+
return operator>>(op2.to_ap_int_base());
|
| 1389 |
+
}
|
| 1390 |
+
|
| 1391 |
+
// Shift assign.
|
| 1392 |
+
// -------------------------------------------------------------------------
|
| 1393 |
+
|
| 1394 |
+
// left shift assign.
|
| 1395 |
+
INLINE ap_fixed_base& operator<<=(const int sh) {
|
| 1396 |
+
*this = operator<<(sh);
|
| 1397 |
+
return *this;
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
INLINE ap_fixed_base& operator<<=(const unsigned int sh) {
|
| 1401 |
+
*this = operator<<(sh);
|
| 1402 |
+
return *this;
|
| 1403 |
+
}
|
| 1404 |
+
|
| 1405 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1406 |
+
INLINE ap_fixed_base& operator<<=(const ap_int_base<_AP_W2, _AP_S2>& sh) {
|
| 1407 |
+
*this = operator<<(sh.to_int());
|
| 1408 |
+
return *this;
|
| 1409 |
+
}
|
| 1410 |
+
|
| 1411 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1412 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1413 |
+
INLINE ap_fixed_base& operator<<=(
|
| 1414 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 1415 |
+
sh) {
|
| 1416 |
+
*this = operator<<(sh.to_int());
|
| 1417 |
+
return *this;
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
// right shift assign.
|
| 1421 |
+
INLINE ap_fixed_base& operator>>=(const int sh) {
|
| 1422 |
+
*this = operator>>(sh);
|
| 1423 |
+
return *this;
|
| 1424 |
+
}
|
| 1425 |
+
|
| 1426 |
+
INLINE ap_fixed_base& operator>>=(const unsigned int sh) {
|
| 1427 |
+
*this = operator>>(sh);
|
| 1428 |
+
return *this;
|
| 1429 |
+
}
|
| 1430 |
+
|
| 1431 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1432 |
+
INLINE ap_fixed_base& operator>>=(const ap_int_base<_AP_W2, _AP_S2>& sh) {
|
| 1433 |
+
*this = operator>>(sh.to_int());
|
| 1434 |
+
return *this;
|
| 1435 |
+
}
|
| 1436 |
+
|
| 1437 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1438 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1439 |
+
INLINE ap_fixed_base& operator>>=(
|
| 1440 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 1441 |
+
sh) {
|
| 1442 |
+
*this = operator>>(sh.to_int());
|
| 1443 |
+
return *this;
|
| 1444 |
+
}
|
| 1445 |
+
|
| 1446 |
+
// Comparisons.
|
| 1447 |
+
// -------------------------------------------------------------------------
|
| 1448 |
+
#define OP_CMP_AF(Sym) \
|
| 1449 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2, \
|
| 1450 |
+
ap_o_mode _AP_O2, int _AP_N2> \
|
| 1451 |
+
INLINE bool operator Sym(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, \
|
| 1452 |
+
_AP_O2, _AP_N2>& op2) const { \
|
| 1453 |
+
enum { _AP_F = _AP_W - _AP_I, F2 = _AP_W2 - _AP_I2 }; \
|
| 1454 |
+
if (_AP_F == F2) \
|
| 1455 |
+
return Base::V Sym op2.V; \
|
| 1456 |
+
else if (_AP_F > F2) \
|
| 1457 |
+
return Base::V Sym ap_fixed_base<AP_MAX(_AP_W2 + _AP_F - F2, 1), _AP_I2, \
|
| 1458 |
+
_AP_S2, _AP_Q2, _AP_O2, _AP_N2>(op2).V; \
|
| 1459 |
+
else \
|
| 1460 |
+
return ap_fixed_base<AP_MAX(_AP_W + F2 - _AP_F + 1, 1), _AP_I + 1, \
|
| 1461 |
+
_AP_S, _AP_Q, _AP_O, _AP_N>(*this).V Sym op2.V; \
|
| 1462 |
+
return false; \
|
| 1463 |
+
}
|
| 1464 |
+
|
| 1465 |
+
OP_CMP_AF(>)
|
| 1466 |
+
OP_CMP_AF(<)
|
| 1467 |
+
OP_CMP_AF(>=)
|
| 1468 |
+
OP_CMP_AF(<=)
|
| 1469 |
+
OP_CMP_AF(==)
|
| 1470 |
+
OP_CMP_AF(!=)
|
| 1471 |
+
// FIXME: Move compare with double out of struct ap_fixed_base defination
|
| 1472 |
+
// and combine it with compare operator(double, ap_fixed_base)
|
| 1473 |
+
#define DOUBLE_CMP_AF(Sym) \
|
| 1474 |
+
INLINE bool operator Sym(double d) const { return to_double() Sym d; }
|
| 1475 |
+
|
| 1476 |
+
DOUBLE_CMP_AF(>)
|
| 1477 |
+
DOUBLE_CMP_AF(<)
|
| 1478 |
+
DOUBLE_CMP_AF(>=)
|
| 1479 |
+
DOUBLE_CMP_AF(<=)
|
| 1480 |
+
DOUBLE_CMP_AF(==)
|
| 1481 |
+
DOUBLE_CMP_AF(!=)
|
| 1482 |
+
|
| 1483 |
+
// Bit and Slice Select
|
| 1484 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator[](
|
| 1485 |
+
unsigned index) {
|
| 1486 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1487 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(this, index);
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1491 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator[](
|
| 1492 |
+
const ap_int_base<_AP_W2, _AP_S2>& index) {
|
| 1493 |
+
_AP_WARNING(index < 0, "Attempting to read bit with negative index");
|
| 1494 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1495 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(this,
|
| 1496 |
+
index.to_int());
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
+
INLINE bool operator[](unsigned index) const {
|
| 1500 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1501 |
+
return _AP_ROOT_op_get_bit(const_cast<ap_fixed_base*>(this)->V, index);
|
| 1502 |
+
}
|
| 1503 |
+
|
| 1504 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> bit(
|
| 1505 |
+
unsigned index) {
|
| 1506 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1507 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(this, index);
|
| 1508 |
+
}
|
| 1509 |
+
|
| 1510 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1511 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> bit(
|
| 1512 |
+
const ap_int_base<_AP_W2, _AP_S2>& index) {
|
| 1513 |
+
_AP_WARNING(index < 0, "Attempting to read bit with negative index");
|
| 1514 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1515 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(this,
|
| 1516 |
+
index.to_int());
|
| 1517 |
+
}
|
| 1518 |
+
|
| 1519 |
+
INLINE bool bit(unsigned index) const {
|
| 1520 |
+
_AP_WARNING(index >= _AP_W, "Attempting to read bit beyond MSB");
|
| 1521 |
+
return _AP_ROOT_op_get_bit(const_cast<ap_fixed_base*>(this)->V, index);
|
| 1522 |
+
}
|
| 1523 |
+
|
| 1524 |
+
template <int _AP_W2>
|
| 1525 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> get_bit(
|
| 1526 |
+
const ap_int_base<_AP_W2, true>& index) {
|
| 1527 |
+
_AP_WARNING(index < _AP_I - _AP_W,
|
| 1528 |
+
"Attempting to read bit with negative index");
|
| 1529 |
+
_AP_WARNING(index >= _AP_I, "Attempting to read bit beyond MSB");
|
| 1530 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(
|
| 1531 |
+
this, index.to_int() + _AP_W - _AP_I);
|
| 1532 |
+
}
|
| 1533 |
+
|
| 1534 |
+
INLINE bool get_bit(int index) const {
|
| 1535 |
+
_AP_WARNING(index >= _AP_I, "Attempting to read bit beyond MSB");
|
| 1536 |
+
_AP_WARNING(index < _AP_I - _AP_W, "Attempting to read bit beyond MSB");
|
| 1537 |
+
return _AP_ROOT_op_get_bit(const_cast<ap_fixed_base*>(this)->V,
|
| 1538 |
+
index + _AP_W - _AP_I);
|
| 1539 |
+
}
|
| 1540 |
+
#if 0
|
| 1541 |
+
INLINE af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> get_bit(
|
| 1542 |
+
int index) {
|
| 1543 |
+
_AP_WARNING(index < _AP_I - _AP_W,
|
| 1544 |
+
"Attempting to read bit with negative index");
|
| 1545 |
+
_AP_WARNING(index >= _AP_I, "Attempting to read bit beyond MSB");
|
| 1546 |
+
return af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(
|
| 1547 |
+
this, index + _AP_W - _AP_I);
|
| 1548 |
+
}
|
| 1549 |
+
#endif
|
| 1550 |
+
|
| 1551 |
+
template <int _AP_W2>
|
| 1552 |
+
INLINE bool get_bit(const ap_int_base<_AP_W2, true>& index) const {
|
| 1553 |
+
_AP_WARNING(index >= _AP_I, "Attempting to read bit beyond MSB");
|
| 1554 |
+
_AP_WARNING(index < _AP_I - _AP_W, "Attempting to read bit beyond MSB");
|
| 1555 |
+
return _AP_ROOT_op_get_bit(const_cast<ap_fixed_base*>(this)->V,
|
| 1556 |
+
index.to_int() + _AP_W - _AP_I);
|
| 1557 |
+
}
|
| 1558 |
+
|
| 1559 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range(int Hi,
|
| 1560 |
+
int Lo) {
|
| 1561 |
+
_AP_WARNING((Hi >= _AP_W) || (Lo >= _AP_W), "Out of bounds in range()");
|
| 1562 |
+
return af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(this, Hi, Lo);
|
| 1563 |
+
}
|
| 1564 |
+
|
| 1565 |
+
// This is a must to strip constness to produce reference type.
|
| 1566 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range(
|
| 1567 |
+
int Hi, int Lo) const {
|
| 1568 |
+
_AP_WARNING((Hi >= _AP_W) || (Lo >= _AP_W), "Out of bounds in range()");
|
| 1569 |
+
return af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(
|
| 1570 |
+
const_cast<ap_fixed_base*>(this), Hi, Lo);
|
| 1571 |
+
}
|
| 1572 |
+
|
| 1573 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 1574 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range(
|
| 1575 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 1576 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) {
|
| 1577 |
+
int Hi = HiIdx.to_int();
|
| 1578 |
+
int Lo = LoIdx.to_int();
|
| 1579 |
+
return this->range(Hi, Lo);
|
| 1580 |
+
}
|
| 1581 |
+
|
| 1582 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 1583 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range(
|
| 1584 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 1585 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) const {
|
| 1586 |
+
int Hi = HiIdx.to_int();
|
| 1587 |
+
int Lo = LoIdx.to_int();
|
| 1588 |
+
return this->range(Hi, Lo);
|
| 1589 |
+
}
|
| 1590 |
+
|
| 1591 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range() {
|
| 1592 |
+
return this->range(_AP_W - 1, 0);
|
| 1593 |
+
}
|
| 1594 |
+
|
| 1595 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> range() const {
|
| 1596 |
+
return this->range(_AP_W - 1, 0);
|
| 1597 |
+
}
|
| 1598 |
+
|
| 1599 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator()(
|
| 1600 |
+
int Hi, int Lo) {
|
| 1601 |
+
return this->range(Hi, Lo);
|
| 1602 |
+
}
|
| 1603 |
+
|
| 1604 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator()(
|
| 1605 |
+
int Hi, int Lo) const {
|
| 1606 |
+
return this->range(Hi, Lo);
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 1610 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator()(
|
| 1611 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 1612 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) {
|
| 1613 |
+
int Hi = HiIdx.to_int();
|
| 1614 |
+
int Lo = LoIdx.to_int();
|
| 1615 |
+
return this->range(Hi, Lo);
|
| 1616 |
+
}
|
| 1617 |
+
|
| 1618 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 1619 |
+
INLINE af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> operator()(
|
| 1620 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 1621 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) const {
|
| 1622 |
+
int Hi = HiIdx.to_int();
|
| 1623 |
+
int Lo = LoIdx.to_int();
|
| 1624 |
+
return this->range(Hi, Lo);
|
| 1625 |
+
}
|
| 1626 |
+
|
| 1627 |
+
INLINE bool is_zero() const { return Base::V == 0; }
|
| 1628 |
+
|
| 1629 |
+
INLINE bool is_neg() const {
|
| 1630 |
+
if (_AP_S && _AP_ROOT_op_get_bit(Base::V, _AP_W - 1)) return true;
|
| 1631 |
+
return false;
|
| 1632 |
+
}
|
| 1633 |
+
|
| 1634 |
+
INLINE int wl() const { return _AP_W; }
|
| 1635 |
+
|
| 1636 |
+
INLINE int iwl() const { return _AP_I; }
|
| 1637 |
+
|
| 1638 |
+
INLINE ap_q_mode q_mode() const { return _AP_Q; }
|
| 1639 |
+
|
| 1640 |
+
INLINE ap_o_mode o_mode() const { return _AP_O; }
|
| 1641 |
+
|
| 1642 |
+
INLINE int n_bits() const { return _AP_N; }
|
| 1643 |
+
|
| 1644 |
+
// print a string representation of this number in the given radix.
|
| 1645 |
+
// Radix support is 2, 8, 10, or 16.
|
| 1646 |
+
// The result will include a prefix indicating the radix, except for decimal,
|
| 1647 |
+
// where no prefix is needed. The default is to output a signed representation
|
| 1648 |
+
// of signed numbers, or an unsigned representation of unsigned numbers. For
|
| 1649 |
+
// non-decimal formats, this can be changed by the 'sign' argument.
|
| 1650 |
+
#ifndef __SYNTHESIS__
|
| 1651 |
+
std::string to_string(unsigned char radix = 2, bool sign = _AP_S) const {
|
| 1652 |
+
// XXX in autosim/autowrap.tcl "(${name}).to_string(2).c_str()" is used to
|
| 1653 |
+
// initialize sc_lv, which seems incapable of handling format "-0b".
|
| 1654 |
+
if (radix == 2) sign = false;
|
| 1655 |
+
|
| 1656 |
+
std::string str;
|
| 1657 |
+
str.clear();
|
| 1658 |
+
char step = 0;
|
| 1659 |
+
bool isNeg = sign && (Base::V < 0);
|
| 1660 |
+
|
| 1661 |
+
// Extend to take care of the -MAX case.
|
| 1662 |
+
ap_fixed_base<_AP_W + 1, _AP_I + 1> tmp(*this);
|
| 1663 |
+
if (isNeg) {
|
| 1664 |
+
tmp = -tmp;
|
| 1665 |
+
str += '-';
|
| 1666 |
+
}
|
| 1667 |
+
std::string prefix;
|
| 1668 |
+
switch (radix) {
|
| 1669 |
+
case 2:
|
| 1670 |
+
prefix = "0b";
|
| 1671 |
+
step = 1;
|
| 1672 |
+
break;
|
| 1673 |
+
case 8:
|
| 1674 |
+
prefix = "0o";
|
| 1675 |
+
step = 3;
|
| 1676 |
+
break;
|
| 1677 |
+
case 16:
|
| 1678 |
+
prefix = "0x";
|
| 1679 |
+
step = 4;
|
| 1680 |
+
break;
|
| 1681 |
+
default:
|
| 1682 |
+
break;
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
if (_AP_I > 0) {
|
| 1686 |
+
// Note we drop the quantization and rounding flags here. The
|
| 1687 |
+
// integer part is always in range, and the fractional part we
|
| 1688 |
+
// want to drop. Also, the number is always positive, because
|
| 1689 |
+
// of the absolute value above.
|
| 1690 |
+
ap_int_base<AP_MAX(_AP_I + 1, 1), false> int_part;
|
| 1691 |
+
// [1] [ I ] d [ W - I ]
|
| 1692 |
+
// | | |
|
| 1693 |
+
// | W-I 0
|
| 1694 |
+
// W
|
| 1695 |
+
int_part.V = _AP_ROOT_op_get_range(
|
| 1696 |
+
tmp.V, _AP_W - _AP_I, _AP_W);
|
| 1697 |
+
str += int_part.to_string(radix, false);
|
| 1698 |
+
} else {
|
| 1699 |
+
str += prefix;
|
| 1700 |
+
str += '0';
|
| 1701 |
+
}
|
| 1702 |
+
|
| 1703 |
+
ap_fixed_base<AP_MAX(_AP_W - _AP_I, 1), 0, false> frac_part = tmp;
|
| 1704 |
+
|
| 1705 |
+
if (radix == 10) {
|
| 1706 |
+
if (frac_part != 0) {
|
| 1707 |
+
str += ".";
|
| 1708 |
+
while (frac_part != 0) {
|
| 1709 |
+
char digit = (frac_part * radix).to_char();
|
| 1710 |
+
str += static_cast<char>(digit + '0');
|
| 1711 |
+
frac_part *= radix;
|
| 1712 |
+
}
|
| 1713 |
+
}
|
| 1714 |
+
} else {
|
| 1715 |
+
if (frac_part != 0) {
|
| 1716 |
+
str += ".";
|
| 1717 |
+
for (signed i = _AP_W - _AP_I - 1; i >= 0; i -= step) {
|
| 1718 |
+
char digit = frac_part.range(i, AP_MAX(0, i - step + 1)).to_char();
|
| 1719 |
+
// If we have a partial bit pattern at the end, then we need
|
| 1720 |
+
// to put it in the high-order bits of 'digit'.
|
| 1721 |
+
int offset = AP_MIN(0, i - step + 1);
|
| 1722 |
+
digit <<= -offset;
|
| 1723 |
+
str += digit < 10 ? static_cast<char>(digit + '0')
|
| 1724 |
+
: static_cast<char>(digit - 10 + 'a');
|
| 1725 |
+
}
|
| 1726 |
+
if (radix == 16)
|
| 1727 |
+
str += "p0"; // C99 Hex constants are required to have an exponent.
|
| 1728 |
+
}
|
| 1729 |
+
}
|
| 1730 |
+
return str;
|
| 1731 |
+
}
|
| 1732 |
+
#else
|
| 1733 |
+
// XXX HLS will delete this in synthesis
|
| 1734 |
+
INLINE char* to_string(unsigned char radix = 2, bool sign = _AP_S) const {
|
| 1735 |
+
return 0;
|
| 1736 |
+
}
|
| 1737 |
+
#endif
|
| 1738 |
+
}; // struct ap_fixed_base.
|
| 1739 |
+
|
| 1740 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1741 |
+
int _AP_N>
|
| 1742 |
+
INLINE void b_not(
|
| 1743 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1744 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) {
|
| 1745 |
+
ret.V = ~op.V;
|
| 1746 |
+
}
|
| 1747 |
+
|
| 1748 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1749 |
+
int _AP_N>
|
| 1750 |
+
INLINE void b_and(
|
| 1751 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1752 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op1,
|
| 1753 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 1754 |
+
ret.V = op1.V & op2.V;
|
| 1755 |
+
}
|
| 1756 |
+
|
| 1757 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1758 |
+
int _AP_N>
|
| 1759 |
+
INLINE void b_or(
|
| 1760 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1761 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op1,
|
| 1762 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 1763 |
+
ret.V = op1.V | op2.V;
|
| 1764 |
+
}
|
| 1765 |
+
|
| 1766 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1767 |
+
int _AP_N>
|
| 1768 |
+
INLINE void b_xor(
|
| 1769 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1770 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op1,
|
| 1771 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 1772 |
+
ret.V = op1.V ^ op2.V;
|
| 1773 |
+
}
|
| 1774 |
+
|
| 1775 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1776 |
+
int _AP_N, int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1777 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1778 |
+
INLINE void neg(
|
| 1779 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1780 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 1781 |
+
ap_fixed_base<_AP_W2 + !_AP_S2, _AP_I2 + !_AP_S2, true, _AP_Q2, _AP_O2,
|
| 1782 |
+
_AP_N2>
|
| 1783 |
+
t;
|
| 1784 |
+
t.V = -op.V;
|
| 1785 |
+
ret = t;
|
| 1786 |
+
}
|
| 1787 |
+
|
| 1788 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1789 |
+
int _AP_N, int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1790 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1791 |
+
INLINE void lshift(
|
| 1792 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1793 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op,
|
| 1794 |
+
int i) {
|
| 1795 |
+
enum {
|
| 1796 |
+
F2 = _AP_W2 - _AP_I2,
|
| 1797 |
+
_AP_I3 = AP_MAX(_AP_I, _AP_I2),
|
| 1798 |
+
_AP_W3 = _AP_I3 + F2,
|
| 1799 |
+
};
|
| 1800 |
+
// wide buffer
|
| 1801 |
+
ap_fixed_base<_AP_W3, _AP_I3, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> t;
|
| 1802 |
+
t.V = op.V;
|
| 1803 |
+
t.V <<= i; // FIXME overflow?
|
| 1804 |
+
// handle quantization and overflow
|
| 1805 |
+
ret = t;
|
| 1806 |
+
}
|
| 1807 |
+
|
| 1808 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 1809 |
+
int _AP_N, int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1810 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1811 |
+
INLINE void rshift(
|
| 1812 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ret,
|
| 1813 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op,
|
| 1814 |
+
int i) {
|
| 1815 |
+
enum {
|
| 1816 |
+
F = _AP_W - _AP_I,
|
| 1817 |
+
F2 = _AP_W2 - _AP_I2,
|
| 1818 |
+
F3 = AP_MAX(F, F2),
|
| 1819 |
+
_AP_W3 = _AP_I2 + F3,
|
| 1820 |
+
sh = F - F2,
|
| 1821 |
+
};
|
| 1822 |
+
// wide buffer
|
| 1823 |
+
ap_fixed_base<_AP_W3, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> t;
|
| 1824 |
+
t.V = op.V;
|
| 1825 |
+
if (sh >= 0)
|
| 1826 |
+
t.V <<= (int) sh;
|
| 1827 |
+
t.V >>= i;
|
| 1828 |
+
// handle quantization and overflow
|
| 1829 |
+
ret = t;
|
| 1830 |
+
}
|
| 1831 |
+
|
| 1832 |
+
//// FIXME
|
| 1833 |
+
//// These partial specialization ctors allow code like
|
| 1834 |
+
//// char c = 'a';
|
| 1835 |
+
//// ap_fixed_base<8, 8, true> x(c);
|
| 1836 |
+
//// but what bout ap_fixed_base<9, 9, true> y(c) ?
|
| 1837 |
+
//
|
| 1838 |
+
|
| 1839 |
+
#ifndef __SYNTHESIS__
|
| 1840 |
+
INLINE std::string scientificFormat(std::string& input) {
|
| 1841 |
+
if (input.length() == 0) return input;
|
| 1842 |
+
|
| 1843 |
+
size_t decPosition = input.find('.');
|
| 1844 |
+
if (decPosition == std::string::npos) decPosition = input.length();
|
| 1845 |
+
|
| 1846 |
+
size_t firstNonZeroPos = 0;
|
| 1847 |
+
for (; input[firstNonZeroPos] > '9' || input[firstNonZeroPos] < '1';
|
| 1848 |
+
firstNonZeroPos++)
|
| 1849 |
+
;
|
| 1850 |
+
|
| 1851 |
+
int exp;
|
| 1852 |
+
if (firstNonZeroPos > decPosition)
|
| 1853 |
+
exp = decPosition - firstNonZeroPos;
|
| 1854 |
+
else
|
| 1855 |
+
exp = decPosition - firstNonZeroPos - 1;
|
| 1856 |
+
std::string expString = "";
|
| 1857 |
+
if (exp == 0)
|
| 1858 |
+
;
|
| 1859 |
+
else if (exp < 0) {
|
| 1860 |
+
expString += "e-";
|
| 1861 |
+
exp = -exp;
|
| 1862 |
+
} else
|
| 1863 |
+
expString += "e+";
|
| 1864 |
+
|
| 1865 |
+
if (exp < 10 && exp > 0) {
|
| 1866 |
+
expString += '0';
|
| 1867 |
+
expString += (char)('0' + exp);
|
| 1868 |
+
} else if (exp != 0) {
|
| 1869 |
+
std::string tmp;
|
| 1870 |
+
|
| 1871 |
+
std::ostringstream oss;
|
| 1872 |
+
oss << exp;
|
| 1873 |
+
|
| 1874 |
+
tmp = oss.str();
|
| 1875 |
+
expString += tmp;
|
| 1876 |
+
}
|
| 1877 |
+
|
| 1878 |
+
int lastNonZeroPos = (int)(input.length() - 1);
|
| 1879 |
+
for (; lastNonZeroPos >= 0; --lastNonZeroPos)
|
| 1880 |
+
if (input[lastNonZeroPos] <= '9' && input[lastNonZeroPos] > '0') break;
|
| 1881 |
+
|
| 1882 |
+
std::string ans = "";
|
| 1883 |
+
ans += input[firstNonZeroPos];
|
| 1884 |
+
if (firstNonZeroPos != (size_t)lastNonZeroPos) {
|
| 1885 |
+
ans += '.';
|
| 1886 |
+
for (int i = firstNonZeroPos + 1; i <= lastNonZeroPos; i++)
|
| 1887 |
+
if (input[i] != '.') ans += input[i];
|
| 1888 |
+
}
|
| 1889 |
+
|
| 1890 |
+
ans += expString;
|
| 1891 |
+
return ans;
|
| 1892 |
+
}
|
| 1893 |
+
|
| 1894 |
+
INLINE std::string reduceToPrecision(std::string& input, int precision) {
|
| 1895 |
+
bool isZero = true;
|
| 1896 |
+
size_t inputLen = input.length();
|
| 1897 |
+
for (size_t i = 0; i < inputLen && isZero; i++)
|
| 1898 |
+
if (input[i] != '.' && input[i] != '0') isZero = false;
|
| 1899 |
+
if (isZero) return "0";
|
| 1900 |
+
|
| 1901 |
+
// Find the first valid number, skip '-'
|
| 1902 |
+
int FirstNonZeroPos = 0;
|
| 1903 |
+
int LastNonZeroPos = (int)inputLen - 1;
|
| 1904 |
+
int truncBitPosition = 0;
|
| 1905 |
+
size_t decPosition = input.find('.');
|
| 1906 |
+
for (; input[FirstNonZeroPos] < '1' || input[FirstNonZeroPos] > '9';
|
| 1907 |
+
FirstNonZeroPos++)
|
| 1908 |
+
;
|
| 1909 |
+
|
| 1910 |
+
for (; input[LastNonZeroPos] < '1' || input[LastNonZeroPos] > '9';
|
| 1911 |
+
LastNonZeroPos--)
|
| 1912 |
+
;
|
| 1913 |
+
|
| 1914 |
+
if (decPosition == std::string::npos) decPosition = inputLen;
|
| 1915 |
+
// Count the valid number, to decide whether we need to truncate
|
| 1916 |
+
if ((int)decPosition > LastNonZeroPos) {
|
| 1917 |
+
if (LastNonZeroPos - FirstNonZeroPos + 1 <= precision) return input;
|
| 1918 |
+
truncBitPosition = FirstNonZeroPos + precision;
|
| 1919 |
+
} else if ((int)decPosition < FirstNonZeroPos) { // This is pure decimal
|
| 1920 |
+
if (LastNonZeroPos - FirstNonZeroPos + 1 <= precision) {
|
| 1921 |
+
if (FirstNonZeroPos - decPosition - 1 < 4) {
|
| 1922 |
+
return input;
|
| 1923 |
+
} else {
|
| 1924 |
+
if (input[0] == '-') {
|
| 1925 |
+
std::string tmp = input.substr(1, inputLen - 1);
|
| 1926 |
+
return std::string("-") + scientificFormat(tmp);
|
| 1927 |
+
} else
|
| 1928 |
+
return scientificFormat(input);
|
| 1929 |
+
}
|
| 1930 |
+
}
|
| 1931 |
+
truncBitPosition = FirstNonZeroPos + precision;
|
| 1932 |
+
} else {
|
| 1933 |
+
if (LastNonZeroPos - FirstNonZeroPos <= precision) return input;
|
| 1934 |
+
truncBitPosition = FirstNonZeroPos + precision + 1;
|
| 1935 |
+
}
|
| 1936 |
+
|
| 1937 |
+
// duplicate the input string, we want to add "0" before the valid numbers
|
| 1938 |
+
// This is easy for quantization, since we may change 9999 to 10000
|
| 1939 |
+
std::string ans = "";
|
| 1940 |
+
std::string dupInput = "0";
|
| 1941 |
+
if (input[0] == '-') {
|
| 1942 |
+
ans += '-';
|
| 1943 |
+
dupInput += input.substr(1, inputLen - 1);
|
| 1944 |
+
} else {
|
| 1945 |
+
dupInput += input.substr(0, inputLen);
|
| 1946 |
+
++truncBitPosition;
|
| 1947 |
+
}
|
| 1948 |
+
|
| 1949 |
+
// Add 'carry' after truncation, if necessary
|
| 1950 |
+
bool carry = dupInput[truncBitPosition] > '4';
|
| 1951 |
+
for (int i = truncBitPosition - 1; i >= 0 && carry; i--) {
|
| 1952 |
+
if (dupInput[i] == '.') continue;
|
| 1953 |
+
if (dupInput[i] == '9')
|
| 1954 |
+
dupInput[i] = '0';
|
| 1955 |
+
else {
|
| 1956 |
+
++dupInput[i];
|
| 1957 |
+
carry = false;
|
| 1958 |
+
}
|
| 1959 |
+
}
|
| 1960 |
+
|
| 1961 |
+
// bits outside precision range should be set to 0
|
| 1962 |
+
if (dupInput[0] == '1')
|
| 1963 |
+
FirstNonZeroPos = 0;
|
| 1964 |
+
else {
|
| 1965 |
+
FirstNonZeroPos = 0;
|
| 1966 |
+
while (dupInput[FirstNonZeroPos] < '1' || dupInput[FirstNonZeroPos] > '9')
|
| 1967 |
+
++FirstNonZeroPos;
|
| 1968 |
+
}
|
| 1969 |
+
|
| 1970 |
+
unsigned it = FirstNonZeroPos;
|
| 1971 |
+
int NValidNumber = 0;
|
| 1972 |
+
while (it < dupInput.length()) {
|
| 1973 |
+
if (dupInput[it] == '.') {
|
| 1974 |
+
++it;
|
| 1975 |
+
continue;
|
| 1976 |
+
}
|
| 1977 |
+
++NValidNumber;
|
| 1978 |
+
if (NValidNumber > precision) dupInput[it] = '0';
|
| 1979 |
+
++it;
|
| 1980 |
+
}
|
| 1981 |
+
|
| 1982 |
+
// Here we wanted to adjust the truncate position and the value
|
| 1983 |
+
decPosition = dupInput.find('.');
|
| 1984 |
+
if (decPosition == std::string::npos) // When this is integer
|
| 1985 |
+
truncBitPosition = (int)dupInput.length();
|
| 1986 |
+
else
|
| 1987 |
+
for (truncBitPosition = (int)(dupInput.length() - 1); truncBitPosition >= 0;
|
| 1988 |
+
--truncBitPosition) {
|
| 1989 |
+
if (dupInput[truncBitPosition] == '.') break;
|
| 1990 |
+
if (dupInput[truncBitPosition] != '0') {
|
| 1991 |
+
truncBitPosition++;
|
| 1992 |
+
break;
|
| 1993 |
+
}
|
| 1994 |
+
}
|
| 1995 |
+
|
| 1996 |
+
if (dupInput[0] == '1')
|
| 1997 |
+
dupInput = dupInput.substr(0, truncBitPosition);
|
| 1998 |
+
else
|
| 1999 |
+
dupInput = dupInput.substr(1, truncBitPosition - 1);
|
| 2000 |
+
|
| 2001 |
+
decPosition = dupInput.find('.');
|
| 2002 |
+
if (decPosition != std::string::npos) {
|
| 2003 |
+
size_t it = 0;
|
| 2004 |
+
for (it = decPosition + 1; dupInput[it] == '0'; it++)
|
| 2005 |
+
;
|
| 2006 |
+
if (it - decPosition - 1 < 4) {
|
| 2007 |
+
ans += dupInput;
|
| 2008 |
+
return ans;
|
| 2009 |
+
} else {
|
| 2010 |
+
ans += scientificFormat(dupInput);
|
| 2011 |
+
return ans;
|
| 2012 |
+
}
|
| 2013 |
+
} else if ((int)(dupInput.length()) <= precision) {
|
| 2014 |
+
ans += dupInput;
|
| 2015 |
+
return ans;
|
| 2016 |
+
}
|
| 2017 |
+
|
| 2018 |
+
ans += scientificFormat(dupInput);
|
| 2019 |
+
return ans;
|
| 2020 |
+
}
|
| 2021 |
+
|
| 2022 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2023 |
+
int _AP_N>
|
| 2024 |
+
INLINE void print(
|
| 2025 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
| 2026 |
+
if (_AP_I > 0) {
|
| 2027 |
+
ap_int_base<_AP_I, _AP_S> p1;
|
| 2028 |
+
p1.V = x.V >> (_AP_W - _AP_I);
|
| 2029 |
+
print(p1.V); // print overlaod for .V should exit
|
| 2030 |
+
} else {
|
| 2031 |
+
printf("0");
|
| 2032 |
+
}
|
| 2033 |
+
printf(".");
|
| 2034 |
+
if (_AP_I < _AP_W) {
|
| 2035 |
+
ap_int_base<_AP_W - _AP_I, false> p2;
|
| 2036 |
+
p2.V = _AP_ROOT_op_get_range(x.V, 0, _AP_W - _AP_I);
|
| 2037 |
+
print(p2.V, false); // print overlaod for .V should exit
|
| 2038 |
+
}
|
| 2039 |
+
}
|
| 2040 |
+
#endif // ifndef __SYNTHESIS__
|
| 2041 |
+
|
| 2042 |
+
// XXX the following two functions have to exist in synthesis,
|
| 2043 |
+
// as some old HLS Video Library code uses the ostream overload,
|
| 2044 |
+
// although HLS will later delete I/O function call.
|
| 2045 |
+
|
| 2046 |
+
/// Output streaming
|
| 2047 |
+
//-----------------------------------------------------------------------------
|
| 2048 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 2049 |
+
#ifndef AP_AUTOCC
|
| 2050 |
+
#ifndef __SYNTHESIS__
|
| 2051 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2052 |
+
int _AP_N>
|
| 2053 |
+
INLINE std::ostream& operator<<(
|
| 2054 |
+
std::ostream& out,
|
| 2055 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
| 2056 |
+
// TODO support std::ios_base::fmtflags
|
| 2057 |
+
unsigned width = out.width();
|
| 2058 |
+
unsigned precision = out.precision();
|
| 2059 |
+
char fill = out.fill();
|
| 2060 |
+
std::string str = x.to_string(10, _AP_S);
|
| 2061 |
+
str = reduceToPrecision(str, precision);
|
| 2062 |
+
if (width > str.length()) {
|
| 2063 |
+
for (unsigned i = 0; i < width - str.length(); ++i)
|
| 2064 |
+
out << fill;
|
| 2065 |
+
}
|
| 2066 |
+
out << str;
|
| 2067 |
+
return out;
|
| 2068 |
+
}
|
| 2069 |
+
#endif // ifndef __SYNTHESIS__
|
| 2070 |
+
|
| 2071 |
+
/// Input streaming
|
| 2072 |
+
// -----------------------------------------------------------------------------
|
| 2073 |
+
#ifndef __SYNTHESIS__
|
| 2074 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2075 |
+
int _AP_N>
|
| 2076 |
+
INLINE std::istream& operator>>(
|
| 2077 |
+
std::istream& in,
|
| 2078 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
| 2079 |
+
double d;
|
| 2080 |
+
in >> d;
|
| 2081 |
+
x = ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>(d);
|
| 2082 |
+
return in;
|
| 2083 |
+
}
|
| 2084 |
+
#endif
|
| 2085 |
+
#endif // ifndef AP_AUTOCC
|
| 2086 |
+
|
| 2087 |
+
/// Operators mixing Integers with ap_fixed_base
|
| 2088 |
+
// -----------------------------------------------------------------------------
|
| 2089 |
+
#define AF_BIN_OP_WITH_INT_SF(BIN_OP, C_TYPE, _AP_W2, _AP_S2, RTYPE) \
|
| 2090 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2091 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2092 |
+
INLINE typename ap_fixed_base<_AP_W, _AP_I, _AP_S>::template RType< \
|
| 2093 |
+
_AP_W2, _AP_W2, _AP_S2>::RTYPE \
|
| 2094 |
+
operator BIN_OP( \
|
| 2095 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2096 |
+
C_TYPE i_op) { \
|
| 2097 |
+
return op.operator BIN_OP(ap_int_base<_AP_W2, _AP_S2>(i_op)); \
|
| 2098 |
+
}
|
| 2099 |
+
|
| 2100 |
+
#define AF_BIN_OP_WITH_INT(BIN_OP, C_TYPE, _AP_W2, _AP_S2, RTYPE) \
|
| 2101 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2102 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2103 |
+
INLINE typename ap_fixed_base<_AP_W, _AP_I, _AP_S>::template RType< \
|
| 2104 |
+
_AP_W2, _AP_W2, _AP_S2>::RTYPE \
|
| 2105 |
+
operator BIN_OP( \
|
| 2106 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2107 |
+
C_TYPE i_op) { \
|
| 2108 |
+
return op.operator BIN_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2109 |
+
} \
|
| 2110 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2111 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2112 |
+
INLINE typename ap_fixed_base<_AP_W, _AP_I, _AP_S>::template RType< \
|
| 2113 |
+
_AP_W2, _AP_W2, _AP_S2>::RTYPE \
|
| 2114 |
+
operator BIN_OP( \
|
| 2115 |
+
C_TYPE i_op, \
|
| 2116 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 2117 |
+
return ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op).operator BIN_OP(op); \
|
| 2118 |
+
}
|
| 2119 |
+
|
| 2120 |
+
#define AF_REL_OP_WITH_INT(REL_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 2121 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2122 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2123 |
+
INLINE bool operator REL_OP( \
|
| 2124 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2125 |
+
C_TYPE i_op) { \
|
| 2126 |
+
return op.operator REL_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2127 |
+
} \
|
| 2128 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2129 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2130 |
+
INLINE bool operator REL_OP( \
|
| 2131 |
+
C_TYPE i_op, \
|
| 2132 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 2133 |
+
return ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op).operator REL_OP(op); \
|
| 2134 |
+
}
|
| 2135 |
+
|
| 2136 |
+
#define AF_ASSIGN_OP_WITH_INT(ASSIGN_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 2137 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2138 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2139 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& \
|
| 2140 |
+
operator ASSIGN_OP( \
|
| 2141 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2142 |
+
C_TYPE i_op) { \
|
| 2143 |
+
return op.operator ASSIGN_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2144 |
+
}
|
| 2145 |
+
|
| 2146 |
+
#define AF_ASSIGN_OP_WITH_INT_SF(ASSIGN_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 2147 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2148 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 2149 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& \
|
| 2150 |
+
operator ASSIGN_OP( \
|
| 2151 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2152 |
+
C_TYPE i_op) { \
|
| 2153 |
+
return op.operator ASSIGN_OP(ap_int_base<_AP_W2, _AP_S2>(i_op)); \
|
| 2154 |
+
}
|
| 2155 |
+
|
| 2156 |
+
#define ALL_AF_OP_WITH_INT(C_TYPE, BITS, SIGN) \
|
| 2157 |
+
AF_BIN_OP_WITH_INT(+, C_TYPE, (BITS), (SIGN), plus) \
|
| 2158 |
+
AF_BIN_OP_WITH_INT(-, C_TYPE, (BITS), (SIGN), minus) \
|
| 2159 |
+
AF_BIN_OP_WITH_INT(*, C_TYPE, (BITS), (SIGN), mult) \
|
| 2160 |
+
AF_BIN_OP_WITH_INT(/, C_TYPE, (BITS), (SIGN), div) \
|
| 2161 |
+
AF_BIN_OP_WITH_INT(&, C_TYPE, (BITS), (SIGN), logic) \
|
| 2162 |
+
AF_BIN_OP_WITH_INT(|, C_TYPE, (BITS), (SIGN), logic) \
|
| 2163 |
+
AF_BIN_OP_WITH_INT(^, C_TYPE, (BITS), (SIGN), logic) \
|
| 2164 |
+
AF_BIN_OP_WITH_INT_SF(>>, C_TYPE, (BITS), (SIGN), lhs) \
|
| 2165 |
+
AF_BIN_OP_WITH_INT_SF(<<, C_TYPE, (BITS), (SIGN), lhs) \
|
| 2166 |
+
\
|
| 2167 |
+
AF_ASSIGN_OP_WITH_INT(+=, C_TYPE, (BITS), (SIGN)) \
|
| 2168 |
+
AF_ASSIGN_OP_WITH_INT(-=, C_TYPE, (BITS), (SIGN)) \
|
| 2169 |
+
AF_ASSIGN_OP_WITH_INT(*=, C_TYPE, (BITS), (SIGN)) \
|
| 2170 |
+
AF_ASSIGN_OP_WITH_INT(/=, C_TYPE, (BITS), (SIGN)) \
|
| 2171 |
+
AF_ASSIGN_OP_WITH_INT(&=, C_TYPE, (BITS), (SIGN)) \
|
| 2172 |
+
AF_ASSIGN_OP_WITH_INT(|=, C_TYPE, (BITS), (SIGN)) \
|
| 2173 |
+
AF_ASSIGN_OP_WITH_INT(^=, C_TYPE, (BITS), (SIGN)) \
|
| 2174 |
+
AF_ASSIGN_OP_WITH_INT_SF(>>=, C_TYPE, (BITS), (SIGN)) \
|
| 2175 |
+
AF_ASSIGN_OP_WITH_INT_SF(<<=, C_TYPE, (BITS), (SIGN)) \
|
| 2176 |
+
\
|
| 2177 |
+
AF_REL_OP_WITH_INT(>, C_TYPE, (BITS), (SIGN)) \
|
| 2178 |
+
AF_REL_OP_WITH_INT(<, C_TYPE, (BITS), (SIGN)) \
|
| 2179 |
+
AF_REL_OP_WITH_INT(>=, C_TYPE, (BITS), (SIGN)) \
|
| 2180 |
+
AF_REL_OP_WITH_INT(<=, C_TYPE, (BITS), (SIGN)) \
|
| 2181 |
+
AF_REL_OP_WITH_INT(==, C_TYPE, (BITS), (SIGN)) \
|
| 2182 |
+
AF_REL_OP_WITH_INT(!=, C_TYPE, (BITS), (SIGN))
|
| 2183 |
+
|
| 2184 |
+
ALL_AF_OP_WITH_INT(bool, 1, false)
|
| 2185 |
+
ALL_AF_OP_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 2186 |
+
ALL_AF_OP_WITH_INT(signed char, 8, true)
|
| 2187 |
+
ALL_AF_OP_WITH_INT(unsigned char, 8, false)
|
| 2188 |
+
ALL_AF_OP_WITH_INT(short, _AP_SIZE_short, true)
|
| 2189 |
+
ALL_AF_OP_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 2190 |
+
ALL_AF_OP_WITH_INT(int, _AP_SIZE_int, true)
|
| 2191 |
+
ALL_AF_OP_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 2192 |
+
ALL_AF_OP_WITH_INT(long, _AP_SIZE_long, true)
|
| 2193 |
+
ALL_AF_OP_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 2194 |
+
ALL_AF_OP_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 2195 |
+
ALL_AF_OP_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 2196 |
+
|
| 2197 |
+
#undef ALL_AF_OP_WITH_INT
|
| 2198 |
+
#undef AF_BIN_OP_WITH_INT
|
| 2199 |
+
#undef AF_BIN_OP_WITH_INT_SF
|
| 2200 |
+
#undef AF_ASSIGN_OP_WITH_INT
|
| 2201 |
+
#undef AF_ASSIGN_OP_WITH_INT_SF
|
| 2202 |
+
#undef AF_REL_OP_WITH_INT
|
| 2203 |
+
|
| 2204 |
+
/*
|
| 2205 |
+
* **********************************************************************
|
| 2206 |
+
* TODO
|
| 2207 |
+
* There is no operator defined with float/double/long double, so that
|
| 2208 |
+
* code like
|
| 2209 |
+
* ap_fixed<8,4> a = 1.5f;
|
| 2210 |
+
* a += 0.5f;
|
| 2211 |
+
* will fail in compilation.
|
| 2212 |
+
* Operator with warning about conversion might be wanted.
|
| 2213 |
+
* **********************************************************************
|
| 2214 |
+
*/
|
| 2215 |
+
|
| 2216 |
+
#define AF_BIN_OP_WITH_AP_INT(BIN_OP, RTYPE) \
|
| 2217 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2218 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2219 |
+
INLINE typename ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>::template RType< \
|
| 2220 |
+
_AP_W, _AP_I, _AP_S>::RTYPE \
|
| 2221 |
+
operator BIN_OP( \
|
| 2222 |
+
const ap_int_base<_AP_W2, _AP_S2>& i_op, \
|
| 2223 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 2224 |
+
return ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op).operator BIN_OP(op); \
|
| 2225 |
+
} \
|
| 2226 |
+
\
|
| 2227 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2228 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2229 |
+
INLINE typename ap_fixed_base<_AP_W, _AP_I, _AP_S>::template RType< \
|
| 2230 |
+
_AP_W2, _AP_W2, _AP_S2>::RTYPE \
|
| 2231 |
+
operator BIN_OP( \
|
| 2232 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2233 |
+
const ap_int_base<_AP_W2, _AP_S2>& i_op) { \
|
| 2234 |
+
return op.operator BIN_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2235 |
+
}
|
| 2236 |
+
|
| 2237 |
+
#define AF_REL_OP_WITH_AP_INT(REL_OP) \
|
| 2238 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2239 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2240 |
+
INLINE bool operator REL_OP( \
|
| 2241 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2242 |
+
const ap_int_base<_AP_W2, _AP_S2>& i_op) { \
|
| 2243 |
+
return op.operator REL_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2244 |
+
} \
|
| 2245 |
+
\
|
| 2246 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2247 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2248 |
+
INLINE bool operator REL_OP( \
|
| 2249 |
+
const ap_int_base<_AP_W2, _AP_S2>& i_op, \
|
| 2250 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 2251 |
+
return ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op).operator REL_OP(op); \
|
| 2252 |
+
}
|
| 2253 |
+
|
| 2254 |
+
#define AF_ASSIGN_OP_WITH_AP_INT(ASSIGN_OP) \
|
| 2255 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2256 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2257 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& \
|
| 2258 |
+
operator ASSIGN_OP( \
|
| 2259 |
+
ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 2260 |
+
const ap_int_base<_AP_W2, _AP_S2>& i_op) { \
|
| 2261 |
+
return op.operator ASSIGN_OP(ap_fixed_base<_AP_W2, _AP_W2, _AP_S2>(i_op)); \
|
| 2262 |
+
} \
|
| 2263 |
+
\
|
| 2264 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 2265 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 2266 |
+
INLINE ap_int_base<_AP_W2, _AP_S2>& operator ASSIGN_OP( \
|
| 2267 |
+
ap_int_base<_AP_W2, _AP_S2>& i_op, \
|
| 2268 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 2269 |
+
return i_op.operator ASSIGN_OP(op.to_ap_int_base()); \
|
| 2270 |
+
}
|
| 2271 |
+
|
| 2272 |
+
AF_BIN_OP_WITH_AP_INT(+, plus)
|
| 2273 |
+
AF_BIN_OP_WITH_AP_INT(-, minus)
|
| 2274 |
+
AF_BIN_OP_WITH_AP_INT(*, mult)
|
| 2275 |
+
AF_BIN_OP_WITH_AP_INT(/, div)
|
| 2276 |
+
AF_BIN_OP_WITH_AP_INT(&, logic)
|
| 2277 |
+
AF_BIN_OP_WITH_AP_INT(|, logic)
|
| 2278 |
+
AF_BIN_OP_WITH_AP_INT(^, logic)
|
| 2279 |
+
|
| 2280 |
+
#undef AF_BIN_OP_WITH_AP_INT
|
| 2281 |
+
|
| 2282 |
+
AF_ASSIGN_OP_WITH_AP_INT(+=)
|
| 2283 |
+
AF_ASSIGN_OP_WITH_AP_INT(-=)
|
| 2284 |
+
AF_ASSIGN_OP_WITH_AP_INT(*=)
|
| 2285 |
+
AF_ASSIGN_OP_WITH_AP_INT(/=)
|
| 2286 |
+
AF_ASSIGN_OP_WITH_AP_INT(&=)
|
| 2287 |
+
AF_ASSIGN_OP_WITH_AP_INT(|=)
|
| 2288 |
+
AF_ASSIGN_OP_WITH_AP_INT(^=)
|
| 2289 |
+
|
| 2290 |
+
#undef AF_ASSIGN_OP_WITH_AP_INT
|
| 2291 |
+
|
| 2292 |
+
AF_REL_OP_WITH_AP_INT(==)
|
| 2293 |
+
AF_REL_OP_WITH_AP_INT(!=)
|
| 2294 |
+
AF_REL_OP_WITH_AP_INT(>)
|
| 2295 |
+
AF_REL_OP_WITH_AP_INT(>=)
|
| 2296 |
+
AF_REL_OP_WITH_AP_INT(<)
|
| 2297 |
+
AF_REL_OP_WITH_AP_INT(<=)
|
| 2298 |
+
|
| 2299 |
+
#undef AF_REL_OP_WITH_AP_INT
|
| 2300 |
+
|
| 2301 |
+
// Relational Operators with double
|
| 2302 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2303 |
+
int _AP_N>
|
| 2304 |
+
INLINE bool operator==(
|
| 2305 |
+
double op1,
|
| 2306 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2307 |
+
return op2.operator==(op1);
|
| 2308 |
+
}
|
| 2309 |
+
|
| 2310 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2311 |
+
int _AP_N>
|
| 2312 |
+
INLINE bool operator!=(
|
| 2313 |
+
double op1,
|
| 2314 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2315 |
+
return op2.operator!=(op1);
|
| 2316 |
+
}
|
| 2317 |
+
|
| 2318 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2319 |
+
int _AP_N>
|
| 2320 |
+
INLINE bool operator>(
|
| 2321 |
+
double op1,
|
| 2322 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2323 |
+
return op2.operator<(op1);
|
| 2324 |
+
}
|
| 2325 |
+
|
| 2326 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2327 |
+
int _AP_N>
|
| 2328 |
+
INLINE bool operator>=(
|
| 2329 |
+
double op1,
|
| 2330 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2331 |
+
return op2.operator<=(op1);
|
| 2332 |
+
}
|
| 2333 |
+
|
| 2334 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2335 |
+
int _AP_N>
|
| 2336 |
+
INLINE bool operator<(
|
| 2337 |
+
double op1,
|
| 2338 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2339 |
+
return op2.operator>(op1);
|
| 2340 |
+
}
|
| 2341 |
+
|
| 2342 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 2343 |
+
int _AP_N>
|
| 2344 |
+
INLINE bool operator<=(
|
| 2345 |
+
double op1,
|
| 2346 |
+
const ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op2) {
|
| 2347 |
+
return op2.operator>=(op1);
|
| 2348 |
+
}
|
| 2349 |
+
|
| 2350 |
+
#endif // ifndef __cplusplus else
|
| 2351 |
+
|
| 2352 |
+
#endif // ifndef __AP_FIXED_BASE_H__ else
|
| 2353 |
+
|
| 2354 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_fixed_ref.h
ADDED
|
@@ -0,0 +1,718 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_FIXED_REF_H__
|
| 18 |
+
#define __AP_FIXED_REF_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_FIXED_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifndef __cplusplus
|
| 25 |
+
#error "C++ is required to include this header file"
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#ifndef __SYNTHESIS__
|
| 29 |
+
#include <iostream>
|
| 30 |
+
#endif
|
| 31 |
+
/// Proxy class, which allows bit selection to be used as both rvalue (for
|
| 32 |
+
/// reading) and lvalue (for writing)
|
| 33 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 34 |
+
int _AP_N>
|
| 35 |
+
struct af_bit_ref {
|
| 36 |
+
#ifdef _MSC_VER
|
| 37 |
+
#pragma warning(disable : 4521 4522)
|
| 38 |
+
#endif
|
| 39 |
+
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> ref_type;
|
| 40 |
+
ref_type& d_bv;
|
| 41 |
+
int d_index;
|
| 42 |
+
|
| 43 |
+
public:
|
| 44 |
+
INLINE af_bit_ref(
|
| 45 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ref)
|
| 46 |
+
: d_bv(ref.d_bv), d_index(ref.d_index) {
|
| 47 |
+
#ifndef __SYNTHESIS__
|
| 48 |
+
_AP_WARNING(d_index < 0, "Index of bit vector (%d) cannot be negative.",
|
| 49 |
+
d_index);
|
| 50 |
+
_AP_WARNING(d_index >= _AP_W, "Index of bit vector (%d) out of range (%d).",
|
| 51 |
+
d_index, _AP_W);
|
| 52 |
+
#endif
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
INLINE af_bit_ref(ref_type* bv, int index = 0) : d_bv(*bv), d_index(index) {}
|
| 56 |
+
|
| 57 |
+
INLINE af_bit_ref(const ref_type* bv, int index = 0)
|
| 58 |
+
: d_bv(*const_cast<ref_type*>(bv)), d_index(index) {}
|
| 59 |
+
|
| 60 |
+
/// convert operators.
|
| 61 |
+
INLINE operator bool() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 62 |
+
|
| 63 |
+
/// @name assign operators
|
| 64 |
+
// @{
|
| 65 |
+
INLINE af_bit_ref& operator=(bool val) {
|
| 66 |
+
d_bv.V = _AP_ROOT_op_set_bit(d_bv.V, d_index, val);
|
| 67 |
+
return *this;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// Be explicit to prevent it from being deleted, as field d_bv
|
| 71 |
+
// is of reference type.
|
| 72 |
+
INLINE af_bit_ref& operator=(const af_bit_ref& val) {
|
| 73 |
+
return operator=(bool(val));
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 77 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 78 |
+
INLINE af_bit_ref& operator=(
|
| 79 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 80 |
+
return operator=(bool(val));
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
template <int _AP_W2, bool _AP_S2>
|
| 84 |
+
INLINE af_bit_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
| 85 |
+
return operator=(bool(val));
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
template <int _AP_W2, bool _AP_S2>
|
| 89 |
+
INLINE af_bit_ref& operator=(const ap_int_base<_AP_W2, _AP_S2>& val) {
|
| 90 |
+
return operator=(val != 0);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
template <int _AP_W2, bool _AP_S2>
|
| 94 |
+
INLINE af_bit_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
| 95 |
+
return operator=(ap_int_base<_AP_W2, false>(val));
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 99 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 100 |
+
INLINE af_bit_ref& operator=(
|
| 101 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 102 |
+
return operator=(ap_int_base<_AP_W2, false>(val));
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 106 |
+
INLINE af_bit_ref& operator=(
|
| 107 |
+
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
| 108 |
+
return operator=(ap_int_base<_AP_W2 + _AP_W3, false>(val));
|
| 109 |
+
}
|
| 110 |
+
// @}
|
| 111 |
+
|
| 112 |
+
/// @name concatenate operators
|
| 113 |
+
// @{
|
| 114 |
+
template <int _AP_W2, int _AP_S2>
|
| 115 |
+
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 116 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &op) {
|
| 117 |
+
return ap_concat_ref<1, af_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
| 118 |
+
*this, op);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
template <int _AP_W2, int _AP_S2>
|
| 122 |
+
INLINE ap_concat_ref<1, af_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> > operator,(
|
| 123 |
+
const ap_bit_ref<_AP_W2, _AP_S2> &op) {
|
| 124 |
+
return ap_concat_ref<1, af_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(*this,
|
| 125 |
+
op);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
template <int _AP_W2, int _AP_S2>
|
| 129 |
+
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 130 |
+
operator,(const ap_range_ref<_AP_W2, _AP_S2> &op) {
|
| 131 |
+
return ap_concat_ref<1, af_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >(
|
| 132 |
+
*this, op);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 136 |
+
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2 + _AP_W3,
|
| 137 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 138 |
+
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &op) {
|
| 139 |
+
return ap_concat_ref<1, af_bit_ref, _AP_W2 + _AP_W3,
|
| 140 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(*this,
|
| 141 |
+
op);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 145 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 146 |
+
INLINE ap_concat_ref<
|
| 147 |
+
1, af_bit_ref, _AP_W2,
|
| 148 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 149 |
+
operator,(
|
| 150 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
| 151 |
+
return ap_concat_ref<
|
| 152 |
+
1, af_bit_ref, _AP_W2,
|
| 153 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(*this,
|
| 154 |
+
op);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 158 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 159 |
+
INLINE ap_concat_ref<1, af_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
| 160 |
+
_AP_Q2, _AP_O2, _AP_N2> >
|
| 161 |
+
operator,(
|
| 162 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
| 163 |
+
return ap_concat_ref<1, af_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
| 164 |
+
_AP_Q2, _AP_O2, _AP_N2> >(
|
| 165 |
+
*this,
|
| 166 |
+
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 167 |
+
op));
|
| 168 |
+
}
|
| 169 |
+
// @}
|
| 170 |
+
|
| 171 |
+
/// @name comparison
|
| 172 |
+
// @{
|
| 173 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 174 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 175 |
+
INLINE bool operator==(
|
| 176 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 177 |
+
return get() == op.get();
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 181 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 182 |
+
INLINE bool operator!=(
|
| 183 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 184 |
+
return get() != op.get();
|
| 185 |
+
}
|
| 186 |
+
// @}
|
| 187 |
+
|
| 188 |
+
INLINE bool operator~() const {
|
| 189 |
+
bool bit = _AP_ROOT_op_get_bit(d_bv.V, d_index);
|
| 190 |
+
return bit ? false : true;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
INLINE bool get() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 194 |
+
|
| 195 |
+
INLINE int length() const { return 1; }
|
| 196 |
+
|
| 197 |
+
#ifndef __SYNTHESIS__
|
| 198 |
+
std::string to_string() const { return get() ? "1" : "0"; }
|
| 199 |
+
#else
|
| 200 |
+
// XXX HLS will delete this in synthesis
|
| 201 |
+
INLINE char* to_string() const { return 0; }
|
| 202 |
+
#endif
|
| 203 |
+
}; // struct af_bit_ref
|
| 204 |
+
|
| 205 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 206 |
+
#ifndef AP_AUTOCC
|
| 207 |
+
#ifndef __SYNTHESIS__
|
| 208 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 209 |
+
int _AP_N>
|
| 210 |
+
INLINE std::ostream& operator<<(
|
| 211 |
+
std::ostream& os,
|
| 212 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
| 213 |
+
os << x.to_string();
|
| 214 |
+
return os;
|
| 215 |
+
}
|
| 216 |
+
#endif // ifndef __SYNTHESIS__
|
| 217 |
+
#endif // ifndef AP_AUTOCC
|
| 218 |
+
|
| 219 |
+
/// Range (slice) reference.
|
| 220 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 221 |
+
int _AP_N>
|
| 222 |
+
struct af_range_ref {
|
| 223 |
+
#ifdef _MSC_VER
|
| 224 |
+
#pragma warning(disable : 4521 4522)
|
| 225 |
+
#endif
|
| 226 |
+
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> ref_type;
|
| 227 |
+
ref_type& d_bv;
|
| 228 |
+
int l_index;
|
| 229 |
+
int h_index;
|
| 230 |
+
|
| 231 |
+
public:
|
| 232 |
+
/// copy ctor
|
| 233 |
+
INLINE af_range_ref(
|
| 234 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ref)
|
| 235 |
+
: d_bv(ref.d_bv), l_index(ref.l_index), h_index(ref.h_index) {}
|
| 236 |
+
|
| 237 |
+
/// ctor from ap_fixed_base, higher and lower bound.
|
| 238 |
+
/** if h is less than l, the bits selected will be returned in reverse order.
|
| 239 |
+
*/
|
| 240 |
+
INLINE af_range_ref(ref_type* bv, int h, int l)
|
| 241 |
+
: d_bv(*bv), l_index(l), h_index(h) {
|
| 242 |
+
#ifndef __SYNTHESIS__
|
| 243 |
+
_AP_WARNING(h < 0 || l < 0,
|
| 244 |
+
"Higher bound(%d) and lower(%d) bound cannot be negative.", h,
|
| 245 |
+
l);
|
| 246 |
+
_AP_WARNING(h >= _AP_W || l >= _AP_W,
|
| 247 |
+
"Higher bound(%d) or lower(%d) bound out of range.", h, l);
|
| 248 |
+
_AP_WARNING(h < l, "The bits selected will be returned in reverse order.");
|
| 249 |
+
#endif
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
INLINE af_range_ref(const ref_type* bv, int h, int l)
|
| 253 |
+
: d_bv(*const_cast<ref_type*>(bv)), l_index(l), h_index(h) {
|
| 254 |
+
#ifndef __SYNTHESIS__
|
| 255 |
+
_AP_WARNING(h < 0 || l < 0,
|
| 256 |
+
"Higher bound(%d) and lower(%d) bound cannot be negative.", h,
|
| 257 |
+
l);
|
| 258 |
+
_AP_WARNING(h >= _AP_W || l >= _AP_W,
|
| 259 |
+
"Higher bound(%d) or lower(%d) bound out of range.", h, l);
|
| 260 |
+
_AP_WARNING(h < l, "The bits selected will be returned in reverse order.");
|
| 261 |
+
#endif
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/// @name assign operators
|
| 265 |
+
// @{
|
| 266 |
+
|
| 267 |
+
#define ASSIGN_CTYPE_TO_AF_RANGE(DATA_TYPE) \
|
| 268 |
+
INLINE af_range_ref& operator=(const DATA_TYPE val) { \
|
| 269 |
+
ap_int_base<_AP_W, false> loc(val); \
|
| 270 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, loc.V); \
|
| 271 |
+
return *this; \
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
ASSIGN_CTYPE_TO_AF_RANGE(bool)
|
| 275 |
+
ASSIGN_CTYPE_TO_AF_RANGE(char)
|
| 276 |
+
ASSIGN_CTYPE_TO_AF_RANGE(signed char)
|
| 277 |
+
ASSIGN_CTYPE_TO_AF_RANGE(unsigned char)
|
| 278 |
+
ASSIGN_CTYPE_TO_AF_RANGE(short)
|
| 279 |
+
ASSIGN_CTYPE_TO_AF_RANGE(unsigned short)
|
| 280 |
+
ASSIGN_CTYPE_TO_AF_RANGE(int)
|
| 281 |
+
ASSIGN_CTYPE_TO_AF_RANGE(unsigned int)
|
| 282 |
+
ASSIGN_CTYPE_TO_AF_RANGE(long)
|
| 283 |
+
ASSIGN_CTYPE_TO_AF_RANGE(unsigned long)
|
| 284 |
+
ASSIGN_CTYPE_TO_AF_RANGE(ap_slong)
|
| 285 |
+
ASSIGN_CTYPE_TO_AF_RANGE(ap_ulong)
|
| 286 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 287 |
+
ASSIGN_CTYPE_TO_AF_RANGE(half)
|
| 288 |
+
#endif
|
| 289 |
+
ASSIGN_CTYPE_TO_AF_RANGE(float)
|
| 290 |
+
ASSIGN_CTYPE_TO_AF_RANGE(double)
|
| 291 |
+
#undef ASSIGN_CTYPE_TO_AF_RANGE
|
| 292 |
+
|
| 293 |
+
/// assgin using a string. XXX crucial for cosim.
|
| 294 |
+
INLINE af_range_ref& operator=(const char* val) {
|
| 295 |
+
const ap_int_base<_AP_W, false> tmp(val); // XXX figure out radix
|
| 296 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V);
|
| 297 |
+
return *this;
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
/// assign from ap_int_base.
|
| 301 |
+
// NOTE Base of other assgin operators.
|
| 302 |
+
template <int _AP_W3, bool _AP_S3>
|
| 303 |
+
INLINE af_range_ref& operator=(const ap_int_base<_AP_W3, _AP_S3>& val) {
|
| 304 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
| 305 |
+
return *this;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
/// assign from range reference to ap_int_base.
|
| 309 |
+
template <int _AP_W2, bool _AP_S2>
|
| 310 |
+
INLINE af_range_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
| 311 |
+
const ap_int_base<_AP_W2, false> tmp(val);
|
| 312 |
+
return operator=(tmp);
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
/// assign from bit reference to ap_int_base..
|
| 316 |
+
template <int _AP_W2, bool _AP_S2>
|
| 317 |
+
INLINE af_range_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
| 318 |
+
const ap_int_base<1, false> tmp((bool)val);
|
| 319 |
+
return operator=(tmp);
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
/// assgin from ap_fixed_base.
|
| 323 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 324 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 325 |
+
INLINE af_range_ref& operator=(
|
| 326 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 327 |
+
val) {
|
| 328 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
| 329 |
+
return *this;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
/// copy assgin.
|
| 333 |
+
// XXX This has to be explicit, otherwise it will be deleted, as d_bv is
|
| 334 |
+
// of reference type.
|
| 335 |
+
INLINE af_range_ref& operator=(const af_range_ref& val) {
|
| 336 |
+
ap_int_base<_AP_W, false> tmp(val);
|
| 337 |
+
return operator=(tmp);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
/// assign from range reference to ap_fixed_base.
|
| 341 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 342 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 343 |
+
INLINE af_range_ref& operator=(
|
| 344 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 345 |
+
ap_int_base<_AP_W2, false> tmp(val);
|
| 346 |
+
return operator=(tmp);
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
/// assign from bit reference to ap_fixed_base.
|
| 350 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 351 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 352 |
+
INLINE af_range_ref& operator=(
|
| 353 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 354 |
+
ap_int_base<1, false> tmp((bool)val);
|
| 355 |
+
return operator=(tmp);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
/// assign from compound reference.
|
| 359 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 360 |
+
INLINE af_range_ref& operator=(
|
| 361 |
+
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
| 362 |
+
const ap_int_base<_AP_W2 + _AP_W3, false> tmp(val);
|
| 363 |
+
return operator=(tmp);
|
| 364 |
+
}
|
| 365 |
+
// @}
|
| 366 |
+
|
| 367 |
+
/// @name comparison operators with ap_range_ref.
|
| 368 |
+
// @{
|
| 369 |
+
template <int _AP_W2, bool _AP_S2>
|
| 370 |
+
INLINE bool operator==(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 371 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 372 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 373 |
+
return lop == rop;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
template <int _AP_W2, bool _AP_S2>
|
| 377 |
+
INLINE bool operator!=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 378 |
+
return !(operator==(op2));
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
template <int _AP_W2, bool _AP_S2>
|
| 382 |
+
INLINE bool operator<(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 383 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 384 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 385 |
+
return lop < rop;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
template <int _AP_W2, bool _AP_S2>
|
| 389 |
+
INLINE bool operator>(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 390 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 391 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 392 |
+
return lop > rop;
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
template <int _AP_W2, bool _AP_S2>
|
| 396 |
+
INLINE bool operator<=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 397 |
+
return !(operator>(op2));
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
template <int _AP_W2, bool _AP_S2>
|
| 401 |
+
INLINE bool operator>=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 402 |
+
return !(operator<(op2));
|
| 403 |
+
}
|
| 404 |
+
// @}
|
| 405 |
+
|
| 406 |
+
/// @name comparison operators with af_range_ref.
|
| 407 |
+
// @{
|
| 408 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 409 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 410 |
+
INLINE bool operator==(
|
| 411 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 412 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 413 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 414 |
+
return lop == rop;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 418 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 419 |
+
INLINE bool operator!=(
|
| 420 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 421 |
+
return !(operator==(op2));
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 425 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 426 |
+
INLINE bool operator<(
|
| 427 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 428 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 429 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 430 |
+
return lop < rop;
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 434 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 435 |
+
INLINE bool operator>(
|
| 436 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 437 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 438 |
+
ap_int_base<_AP_W2, false> rop(op2);
|
| 439 |
+
return lop > rop;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 443 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 444 |
+
INLINE bool operator<=(
|
| 445 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 446 |
+
return !(operator>(op2));
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 450 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 451 |
+
INLINE bool operator>=(
|
| 452 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
| 453 |
+
return !(operator<(op2));
|
| 454 |
+
}
|
| 455 |
+
// @}
|
| 456 |
+
|
| 457 |
+
/// @name concatenate operators.
|
| 458 |
+
/// @{
|
| 459 |
+
/// concatenate with ap_int_base.
|
| 460 |
+
template <int _AP_W2, int _AP_S2>
|
| 461 |
+
INLINE
|
| 462 |
+
ap_concat_ref<_AP_W, af_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 463 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &op) {
|
| 464 |
+
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
| 465 |
+
ap_int_base<_AP_W2, _AP_S2> >(*this, op);
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
/// concatenate with ap_bit_ref.
|
| 469 |
+
template <int _AP_W2, int _AP_S2>
|
| 470 |
+
INLINE ap_concat_ref<_AP_W, af_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >
|
| 471 |
+
operator,(const ap_bit_ref<_AP_W2, _AP_S2> &op) {
|
| 472 |
+
return ap_concat_ref<_AP_W, af_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
| 473 |
+
*this, const_cast<ap_bit_ref<_AP_W2, _AP_S2>&>(op));
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
/// concatenate with ap_bit_ref.
|
| 477 |
+
template <int _AP_W2, int _AP_S2>
|
| 478 |
+
INLINE ap_concat_ref<_AP_W, af_range_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 479 |
+
operator,(const ap_range_ref<_AP_W2, _AP_S2> &op) {
|
| 480 |
+
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
| 481 |
+
ap_range_ref<_AP_W2, _AP_S2> >(
|
| 482 |
+
*this, const_cast<ap_range_ref<_AP_W2, _AP_S2>&>(op));
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
/// concatenate with ap_concat_ref.
|
| 486 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 487 |
+
INLINE ap_concat_ref<_AP_W, af_range_ref, _AP_W2 + _AP_W3,
|
| 488 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 489 |
+
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &op) {
|
| 490 |
+
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2 + _AP_W3,
|
| 491 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(
|
| 492 |
+
*this, const_cast<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>&>(op));
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
/// concatenate with another af_range_ref.
|
| 496 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 497 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 498 |
+
INLINE
|
| 499 |
+
ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
| 500 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 501 |
+
operator,(const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>
|
| 502 |
+
&op) {
|
| 503 |
+
return ap_concat_ref<
|
| 504 |
+
_AP_W, af_range_ref, _AP_W2,
|
| 505 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 506 |
+
*this,
|
| 507 |
+
const_cast<af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 508 |
+
op));
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
/// concatenate with another af_bit_ref.
|
| 512 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 513 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 514 |
+
INLINE
|
| 515 |
+
ap_concat_ref<_AP_W, af_range_ref, 1,
|
| 516 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 517 |
+
operator,(
|
| 518 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
| 519 |
+
return ap_concat_ref<
|
| 520 |
+
_AP_W, af_range_ref, 1,
|
| 521 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 522 |
+
*this,
|
| 523 |
+
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 524 |
+
op));
|
| 525 |
+
}
|
| 526 |
+
// @}
|
| 527 |
+
|
| 528 |
+
INLINE operator ap_ulong() const {
|
| 529 |
+
ap_int_base<_AP_W, false> ret;
|
| 530 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 531 |
+
return ret.to_uint64();
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
INLINE operator ap_int_base<_AP_W, false>() const {
|
| 535 |
+
ap_int_base<_AP_W, false> ret;
|
| 536 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 537 |
+
return ret;
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
INLINE ap_int_base<_AP_W, false> to_ap_int_base() const {
|
| 541 |
+
ap_int_base<_AP_W, false> ret;
|
| 542 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 543 |
+
return ret;
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
// used in ap_fixed_base::to_string()
|
| 547 |
+
INLINE char to_char() const {
|
| 548 |
+
return (char)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
INLINE int to_int() const {
|
| 552 |
+
return (int)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
INLINE unsigned to_uint() const {
|
| 556 |
+
return (unsigned)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
INLINE long to_long() const {
|
| 560 |
+
return (long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
INLINE unsigned long to_ulong() const {
|
| 564 |
+
return (unsigned long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
INLINE ap_slong to_int64() const {
|
| 568 |
+
return (ap_slong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
INLINE ap_ulong to_uint64() const {
|
| 572 |
+
return (ap_ulong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
INLINE ap_int_base<_AP_W, false> get() const {
|
| 576 |
+
ap_int_base<_AP_W, false> ret;
|
| 577 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 578 |
+
return ret;
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
template <int _AP_W2>
|
| 582 |
+
INLINE void set(const ap_int_base<_AP_W2, false>& val) {
|
| 583 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
INLINE int length() const {
|
| 587 |
+
return h_index >= l_index ? h_index - l_index + 1 : l_index - h_index + 1;
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
#ifndef __SYNTHESIS__
|
| 591 |
+
std::string to_string(signed char rd = 2) const {
|
| 592 |
+
ap_int_base<_AP_W, false> ret;
|
| 593 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 594 |
+
return ret.to_string(rd);
|
| 595 |
+
}
|
| 596 |
+
#else
|
| 597 |
+
// XXX HLS will delete this in synthesis
|
| 598 |
+
INLINE char* to_string(signed char rd = 2) const {
|
| 599 |
+
return 0;
|
| 600 |
+
}
|
| 601 |
+
#endif
|
| 602 |
+
}; // struct af_range_ref
|
| 603 |
+
|
| 604 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 605 |
+
#ifndef AP_AUTOCC
|
| 606 |
+
#ifndef __SYNTHESIS__
|
| 607 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
| 608 |
+
int _AP_N>
|
| 609 |
+
INLINE std::ostream& operator<<(
|
| 610 |
+
std::ostream& os,
|
| 611 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
| 612 |
+
os << x.to_string();
|
| 613 |
+
return os;
|
| 614 |
+
}
|
| 615 |
+
#endif
|
| 616 |
+
#endif // ifndef AP_AUTOCC
|
| 617 |
+
|
| 618 |
+
#define AF_REF_REL_OP_WITH_INT(REL_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 619 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 620 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 621 |
+
INLINE bool operator REL_OP( \
|
| 622 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 623 |
+
C_TYPE op2) { \
|
| 624 |
+
return ap_int_base<_AP_W, false>(op) \
|
| 625 |
+
REL_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 626 |
+
} \
|
| 627 |
+
\
|
| 628 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 629 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 630 |
+
INLINE bool operator REL_OP( \
|
| 631 |
+
C_TYPE op2, \
|
| 632 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 633 |
+
return ap_int_base<_AP_W2, _AP_S2>(op2) \
|
| 634 |
+
REL_OP ap_int_base<_AP_W, false>(op); \
|
| 635 |
+
} \
|
| 636 |
+
\
|
| 637 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 638 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 639 |
+
INLINE bool operator REL_OP( \
|
| 640 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 641 |
+
C_TYPE op2) { \
|
| 642 |
+
return bool(op) REL_OP op2; \
|
| 643 |
+
} \
|
| 644 |
+
\
|
| 645 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 646 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 647 |
+
INLINE bool operator REL_OP( \
|
| 648 |
+
C_TYPE op2, \
|
| 649 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 650 |
+
return op2 REL_OP bool(op); \
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
#define AF_REF_REL_OPS_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 654 |
+
AF_REF_REL_OP_WITH_INT(>, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 655 |
+
AF_REF_REL_OP_WITH_INT(<, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 656 |
+
AF_REF_REL_OP_WITH_INT(>=, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 657 |
+
AF_REF_REL_OP_WITH_INT(<=, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 658 |
+
AF_REF_REL_OP_WITH_INT(==, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 659 |
+
AF_REF_REL_OP_WITH_INT(!=, C_TYPE, (_AP_W2), (_AP_S2))
|
| 660 |
+
|
| 661 |
+
AF_REF_REL_OPS_WITH_INT(bool, 1, false)
|
| 662 |
+
AF_REF_REL_OPS_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 663 |
+
AF_REF_REL_OPS_WITH_INT(signed char, 8, true)
|
| 664 |
+
AF_REF_REL_OPS_WITH_INT(unsigned char, 8, false)
|
| 665 |
+
AF_REF_REL_OPS_WITH_INT(short, _AP_SIZE_short, true)
|
| 666 |
+
AF_REF_REL_OPS_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 667 |
+
AF_REF_REL_OPS_WITH_INT(int, _AP_SIZE_int, true)
|
| 668 |
+
AF_REF_REL_OPS_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 669 |
+
AF_REF_REL_OPS_WITH_INT(long, _AP_SIZE_long, true)
|
| 670 |
+
AF_REF_REL_OPS_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 671 |
+
AF_REF_REL_OPS_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 672 |
+
AF_REF_REL_OPS_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 673 |
+
|
| 674 |
+
#undef AF_REF_REL_OP_INT
|
| 675 |
+
#undef AF_REF_REL_OPS_WITH_INT
|
| 676 |
+
|
| 677 |
+
#define AF_REF_REL_OP_WITH_AP_INT(REL_OP) \
|
| 678 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 679 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 680 |
+
INLINE bool operator REL_OP( \
|
| 681 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 682 |
+
const ap_int_base<_AP_W2, _AP_S>& op2) { \
|
| 683 |
+
return ap_int_base<_AP_W, false>(op) REL_OP op2; \
|
| 684 |
+
} \
|
| 685 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 686 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 687 |
+
INLINE bool operator REL_OP( \
|
| 688 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2, \
|
| 689 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 690 |
+
return op2 REL_OP ap_int_base<_AP_W, false>(op); \
|
| 691 |
+
} \
|
| 692 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 693 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 694 |
+
INLINE bool operator REL_OP( \
|
| 695 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
| 696 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 697 |
+
return ap_int_base<1, false>(op) REL_OP op2; \
|
| 698 |
+
} \
|
| 699 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 700 |
+
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
| 701 |
+
INLINE bool operator REL_OP( \
|
| 702 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2, \
|
| 703 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
| 704 |
+
return op2 REL_OP ap_int_base<1, false>(op); \
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
AF_REF_REL_OP_WITH_AP_INT(>)
|
| 708 |
+
AF_REF_REL_OP_WITH_AP_INT(<)
|
| 709 |
+
AF_REF_REL_OP_WITH_AP_INT(>=)
|
| 710 |
+
AF_REF_REL_OP_WITH_AP_INT(<=)
|
| 711 |
+
AF_REF_REL_OP_WITH_AP_INT(==)
|
| 712 |
+
AF_REF_REL_OP_WITH_AP_INT(!=)
|
| 713 |
+
|
| 714 |
+
#endif // ifndef __cplusplus
|
| 715 |
+
|
| 716 |
+
#endif // ifndef __AP_FIXED_REF_H__
|
| 717 |
+
|
| 718 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_fixed_special.h
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_FIXED_SPECIAL_H__
|
| 18 |
+
#define __AP_FIXED_SPECIAL_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_FIXED_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifndef __SYNTHESIS__
|
| 25 |
+
#include <cstdio>
|
| 26 |
+
#include <cstdlib>
|
| 27 |
+
#endif
|
| 28 |
+
// FIXME AP_AUTOCC cannot handle many standard headers, so declare instead of
|
| 29 |
+
// include.
|
| 30 |
+
// #include <complex>
|
| 31 |
+
namespace std {
|
| 32 |
+
template<typename _Tp> class complex;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/*
|
| 36 |
+
TODO: Modernize the code using C++11/C++14
|
| 37 |
+
1. constexpr http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0415r0.html
|
| 38 |
+
2. move constructor
|
| 39 |
+
*/
|
| 40 |
+
|
| 41 |
+
namespace std {
|
| 42 |
+
/*
|
| 43 |
+
Specialize std::complex<ap_fixed> to zero initialization ap_fixed.
|
| 44 |
+
|
| 45 |
+
To reduce the area cost, ap_fixed is not zero initialized, just like basic
|
| 46 |
+
types float or double. However, libstdc++ provides specialization for float,
|
| 47 |
+
double and long double, initializing image part to 0 when not specified.
|
| 48 |
+
|
| 49 |
+
This has become a difficulty in switching legacy code from these C types to
|
| 50 |
+
ap_fixed. To ease the tranform of legacy code, we have to implement
|
| 51 |
+
specialization of std::complex<> for our type.
|
| 52 |
+
|
| 53 |
+
As ap_fixed is a template, it is impossible to specialize only the methods
|
| 54 |
+
that causes default initialization of value type in std::complex<>. An
|
| 55 |
+
explicit full specialization of the template class has to be done, covering
|
| 56 |
+
all the member functions and operators of std::complex<> as specified
|
| 57 |
+
in standard 26.2.4 and 26.2.5.
|
| 58 |
+
*/
|
| 59 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 60 |
+
class complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > {
|
| 61 |
+
public:
|
| 62 |
+
typedef ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> _Tp;
|
| 63 |
+
typedef _Tp value_type;
|
| 64 |
+
|
| 65 |
+
// 26.2.4/1
|
| 66 |
+
// Constructor without argument
|
| 67 |
+
// Default initialize, so that in dataflow, the variable is only written once.
|
| 68 |
+
complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
|
| 69 |
+
// Constructor with ap_fixed.
|
| 70 |
+
// Zero initialize image part when not specified, so that `C(1) == C(1,0)`
|
| 71 |
+
complex(const _Tp &__r, const _Tp &__i = _Tp(0))
|
| 72 |
+
: _M_real(__r), _M_imag(__i) {}
|
| 73 |
+
|
| 74 |
+
// Constructor with another complex number
|
| 75 |
+
template <typename _Up>
|
| 76 |
+
complex(const complex<_Up> &__z) : _M_real(__z.real()), _M_imag(__z.imag()) {}
|
| 77 |
+
|
| 78 |
+
#if __cplusplus >= 201103L
|
| 79 |
+
const _Tp& real() const { return _M_real; }
|
| 80 |
+
const _Tp& imag() const { return _M_imag; }
|
| 81 |
+
#else
|
| 82 |
+
_Tp& real() { return _M_real; }
|
| 83 |
+
const _Tp& real() const { return _M_real; }
|
| 84 |
+
_Tp& imag() { return _M_imag; }
|
| 85 |
+
const _Tp& imag() const { return _M_imag; }
|
| 86 |
+
#endif
|
| 87 |
+
|
| 88 |
+
void real(_Tp __val) { _M_real = __val; }
|
| 89 |
+
|
| 90 |
+
void imag(_Tp __val) { _M_imag = __val; }
|
| 91 |
+
|
| 92 |
+
// Assign this complex number with ap_fixed.
|
| 93 |
+
// Zero initialize image poarrt, so that `C c; c = 1; c == C(1,0);`
|
| 94 |
+
complex<_Tp> &operator=(const _Tp __t) {
|
| 95 |
+
_M_real = __t;
|
| 96 |
+
_M_imag = _Tp(0);
|
| 97 |
+
return *this;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// 26.2.5/1
|
| 101 |
+
// Add ap_fixed to this complex number.
|
| 102 |
+
complex<_Tp> &operator+=(const _Tp &__t) {
|
| 103 |
+
_M_real += __t;
|
| 104 |
+
return *this;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// 26.2.5/3
|
| 108 |
+
// Subtract ap_fixed from this complex number.
|
| 109 |
+
complex<_Tp> &operator-=(const _Tp &__t) {
|
| 110 |
+
_M_real -= __t;
|
| 111 |
+
return *this;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
// 26.2.5/5
|
| 115 |
+
// Multiply this complex number by ap_fixed.
|
| 116 |
+
complex<_Tp> &operator*=(const _Tp &__t) {
|
| 117 |
+
_M_real *= __t;
|
| 118 |
+
_M_imag *= __t;
|
| 119 |
+
return *this;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// 26.2.5/7
|
| 123 |
+
// Divide this complex number by ap_fixed.
|
| 124 |
+
complex<_Tp> &operator/=(const _Tp &__t) {
|
| 125 |
+
_M_real /= __t;
|
| 126 |
+
_M_imag /= __t;
|
| 127 |
+
return *this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// Assign complex number to this complex number.
|
| 131 |
+
template <typename _Up>
|
| 132 |
+
complex<_Tp> &operator=(const complex<_Up> &__z) {
|
| 133 |
+
_M_real = __z.real();
|
| 134 |
+
_M_imag = __z.imag();
|
| 135 |
+
return *this;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// 26.2.5/9
|
| 139 |
+
// Add complex number to this.
|
| 140 |
+
template <typename _Up>
|
| 141 |
+
complex<_Tp> &operator+=(const complex<_Up> &__z) {
|
| 142 |
+
_M_real += __z.real();
|
| 143 |
+
_M_imag += __z.imag();
|
| 144 |
+
return *this;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// 26.2.5/11
|
| 148 |
+
// Subtract complex number from this.
|
| 149 |
+
template <typename _Up>
|
| 150 |
+
complex<_Tp> &operator-=(const complex<_Up> &__z) {
|
| 151 |
+
_M_real -= __z.real();
|
| 152 |
+
_M_imag -= __z.imag();
|
| 153 |
+
return *this;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// 26.2.5/13
|
| 157 |
+
// Multiply this by complex number.
|
| 158 |
+
template <typename _Up>
|
| 159 |
+
complex<_Tp> &operator*=(const complex<_Up> &__z) {
|
| 160 |
+
const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
|
| 161 |
+
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
|
| 162 |
+
_M_real = __r;
|
| 163 |
+
return *this;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// 26.2.5/15
|
| 167 |
+
// Divide this by complex number.
|
| 168 |
+
template <typename _Up>
|
| 169 |
+
complex<_Tp> &operator/=(const complex<_Up> &__z) {
|
| 170 |
+
complex<_Tp> cj (__z.real(), -__z.imag());
|
| 171 |
+
complex<_Tp> a = (*this) * cj;
|
| 172 |
+
complex<_Tp> b = cj * __z;
|
| 173 |
+
_M_real = a.real() / b.real();
|
| 174 |
+
_M_imag = a.imag() / b.real();
|
| 175 |
+
return *this;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
private:
|
| 179 |
+
_Tp _M_real;
|
| 180 |
+
_Tp _M_imag;
|
| 181 |
+
|
| 182 |
+
}; // class complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> >
|
| 183 |
+
|
| 184 |
+
/*
|
| 185 |
+
Non-member operations
|
| 186 |
+
These operations are not required by standard in 26.2.6, but libstdc++
|
| 187 |
+
defines them for
|
| 188 |
+
float, double or long double's specialization.
|
| 189 |
+
*/
|
| 190 |
+
// Compare complex number with ap_fixed.
|
| 191 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 192 |
+
inline bool operator==(
|
| 193 |
+
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__x,
|
| 194 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__y) {
|
| 195 |
+
return __x.real() == __y &&
|
| 196 |
+
__x.imag() == 0;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Compare ap_fixed with complex number.
|
| 200 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 201 |
+
inline bool operator==(
|
| 202 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__x,
|
| 203 |
+
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__y) {
|
| 204 |
+
return __x == __y.real() &&
|
| 205 |
+
0 == __y.imag();
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// Compare complex number with ap_fixed.
|
| 209 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 210 |
+
inline bool operator!=(
|
| 211 |
+
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__x,
|
| 212 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__y) {
|
| 213 |
+
return __x.real() != __y ||
|
| 214 |
+
__x.imag() != 0;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// Compare ap_fixed with complex number.
|
| 218 |
+
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 219 |
+
inline bool operator!=(
|
| 220 |
+
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__x,
|
| 221 |
+
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__y) {
|
| 222 |
+
return __x != __y.real() ||
|
| 223 |
+
0 != __y.imag();
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
} // namespace std
|
| 227 |
+
|
| 228 |
+
#endif // ifndef __AP_FIXED_SPECIAL_H__
|
| 229 |
+
|
| 230 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_float.h
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
#include <cassert>
|
| 10 |
+
#include <cmath>
|
| 11 |
+
|
| 12 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 13 |
+
INLINE ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N>
|
| 14 |
+
abs(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> value) {
|
| 15 |
+
if (value > 0) {
|
| 16 |
+
return value;
|
| 17 |
+
} else {
|
| 18 |
+
return -value;
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 23 |
+
INLINE ap_uint<ceillog2(_AP_W)> msb_loc(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> value) {
|
| 24 |
+
auto buf = abs(value);
|
| 25 |
+
ap_uint<ceillog2(_AP_W)> msb = 0;
|
| 26 |
+
for (int i = 0; i < _AP_W; i++) {
|
| 27 |
+
#pragma HLS UNROLL
|
| 28 |
+
if (buf[i] && msb < i) {
|
| 29 |
+
msb = i;
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
return msb;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 36 |
+
INLINE auto rt_floorlog2(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> value)
|
| 37 |
+
-> ap_int_base<ceillog2(__AP_FLOAT_H_MAX(_AP_I - _AP_S, _AP_W - _AP_I + 1)) + (_AP_W - _AP_I > 0), (_AP_W - _AP_I > 0)> {
|
| 38 |
+
// Runtime floorlog2 for fixed point numbers
|
| 39 |
+
auto msb = msb_loc(value);
|
| 40 |
+
ap_int_base<6, 1> r = msb;
|
| 41 |
+
return r - (_AP_W - _AP_I);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 45 |
+
INLINE auto rt_ceillog2(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> value) -> decltype(rt_floorlog2(value)) {
|
| 46 |
+
// Runtime ceillog2 for fixed point numbers
|
| 47 |
+
auto msb = msb_loc(value);
|
| 48 |
+
ap_ufixed<_AP_W, _AP_I> buf;
|
| 49 |
+
if (value > 0) {
|
| 50 |
+
buf = value;
|
| 51 |
+
} else {
|
| 52 |
+
buf = -value;
|
| 53 |
+
}
|
| 54 |
+
bool is_pow2 = buf << (_AP_W - msb) == 0;
|
| 55 |
+
return msb + !is_pow2 - (_AP_W - _AP_I);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
template <int M, int E, int E0, int W, int I> INLINE bool cond_minimal_normal(ap_ufixed<W, I> abs_value) {
|
| 59 |
+
bool is_normal = true;
|
| 60 |
+
for (int i = 0; i < M + 1; ++i) {
|
| 61 |
+
#pragma HLS UNROLL
|
| 62 |
+
is_normal &= abs_value[W - I - (1 << (E - 1)) + E0 - i];
|
| 63 |
+
}
|
| 64 |
+
return is_normal;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
template <int M, int E, int E0 = 0> struct ap_float {
|
| 68 |
+
|
| 69 |
+
bool is_negative;
|
| 70 |
+
typedef ap_ufixed<M, 0, AP_RND_CONV, AP_SAT> mantissa_t;
|
| 71 |
+
typedef ap_fixed<E, E, AP_TRN, AP_SAT> exponent_t;
|
| 72 |
+
typedef ap_ufixed<M + 1, 1> opr_mantissa_t;
|
| 73 |
+
typedef ap_ufixed<M + 1, 1 + E0> opr_mantissa2_t;
|
| 74 |
+
mantissa_t mantissa;
|
| 75 |
+
exponent_t exponent;
|
| 76 |
+
INLINE ap_float() {}
|
| 77 |
+
INLINE ap_float(mantissa_t mantissa, exponent_t exponent) : mantissa(mantissa), exponent(exponent) {}
|
| 78 |
+
|
| 79 |
+
template <typename T> INLINE ap_float(T value) { *this = ap_fixed<32, 16>(value); }
|
| 80 |
+
|
| 81 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 82 |
+
INLINE int operator=(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> value) {
|
| 83 |
+
is_negative = value < 0;
|
| 84 |
+
ap_ufixed<M + 1, 1, AP_RND_CONV, AP_SAT> _mantissa;
|
| 85 |
+
ap_ufixed<_AP_W - _AP_S, _AP_I - _AP_S> abs_value = abs(value);
|
| 86 |
+
exponent = rt_floorlog2(abs_value) - E0; // E0 is the offset
|
| 87 |
+
|
| 88 |
+
// std::cout << "cond=" << (abs_value >> (-(1 << (E - 1)) + E0)).to_float() << std::endl;
|
| 89 |
+
if (exponent != -(1 << (E - 1))) {
|
| 90 |
+
// Normal
|
| 91 |
+
_mantissa = (abs_value >> (ap_int<E>(exponent) + E0)) - 1;
|
| 92 |
+
} else {
|
| 93 |
+
// Subnormal
|
| 94 |
+
_mantissa = (abs_value >> (ap_int<E>(exponent + 1) + E0));
|
| 95 |
+
}
|
| 96 |
+
if (_mantissa >= 1 && exponent != (1 << (E - 1)) - 1) {
|
| 97 |
+
exponent = exponent + 1;
|
| 98 |
+
_mantissa = 0;
|
| 99 |
+
}
|
| 100 |
+
mantissa = _mantissa;
|
| 101 |
+
|
| 102 |
+
return 0;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
INLINE ap_fixed<M + (1 << E) + 1, 1 + (1 << (E - 1)) + E0> to_ap_fixed() const {
|
| 106 |
+
|
| 107 |
+
ap_ufixed<M + (1 << E), (1 << (E - 1))> _result;
|
| 108 |
+
int shift = exponent;
|
| 109 |
+
if (exponent == -(1 << (E - 1))) {
|
| 110 |
+
shift += 1;
|
| 111 |
+
_result = mantissa;
|
| 112 |
+
} else {
|
| 113 |
+
_result = mantissa + 1;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
ap_ufixed<M + (1 << E), (1 << (E - 1)) + E0> result;
|
| 117 |
+
|
| 118 |
+
_result = _result << shift;
|
| 119 |
+
result.range() = _result.range();
|
| 120 |
+
if (is_negative)
|
| 121 |
+
return -result;
|
| 122 |
+
else
|
| 123 |
+
return result;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
INLINE double to_float() const { return to_ap_fixed().to_float(); }
|
| 127 |
+
INLINE operator float() const { return to_float(); }
|
| 128 |
+
INLINE operator double() const { return to_float(); }
|
| 129 |
+
|
| 130 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 131 |
+
auto operator*(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> other)
|
| 132 |
+
-> ap_fixed<M + (1 << E) - 1 + _AP_W + (!_AP_S), 1 + (1 << (E - 1)) - 1 + E0 + _AP_I + (!_AP_S)> {
|
| 133 |
+
|
| 134 |
+
int shift = exponent;
|
| 135 |
+
opr_mantissa_t mantissa;
|
| 136 |
+
if (exponent == -(1 << (E - 1))) {
|
| 137 |
+
shift += 1;
|
| 138 |
+
mantissa = this->mantissa;
|
| 139 |
+
} else {
|
| 140 |
+
mantissa = this->mantissa + 1;
|
| 141 |
+
}
|
| 142 |
+
opr_mantissa2_t mantissa2;
|
| 143 |
+
mantissa2.range() = mantissa.range();
|
| 144 |
+
|
| 145 |
+
constexpr int E_max = (1 << (E - 1)) - 1 + E0;
|
| 146 |
+
constexpr int E_min = -(1 << (E - 1)) + E0;
|
| 147 |
+
constexpr int I = 1 + E_max + _AP_I + (!_AP_S);
|
| 148 |
+
constexpr int W = M + 1 + _AP_W + E_max - E_min + 1 + (!_AP_S);
|
| 149 |
+
// std::cout << "W=" << W << std::endl;
|
| 150 |
+
// std::cout << "I=" << I << std::endl;
|
| 151 |
+
// std::cout << "E_max=" << E_max << std::endl;
|
| 152 |
+
// std::cout << "E_min=" << E_min << std::endl;
|
| 153 |
+
ap_fixed<W, I> result_fixed = mantissa2 * other;
|
| 154 |
+
|
| 155 |
+
if (is_negative) {
|
| 156 |
+
result_fixed = -result_fixed;
|
| 157 |
+
}
|
| 158 |
+
result_fixed <<= shift;
|
| 159 |
+
return result_fixed;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
template <int _M, int _E, int _E0> ap_float<_M, _E, _E0> operator*(ap_float<_M, _E, _E0> other) {
|
| 163 |
+
assert(0); // ap_float can only be multiplied by ap_fixed
|
| 164 |
+
}
|
| 165 |
+
};
|
| 166 |
+
|
| 167 |
+
template <int M, int E, int E0, int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
| 168 |
+
auto operator*(ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> a, ap_float<M, E, E0> b) -> decltype(b * a) {
|
| 169 |
+
return b * a;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
#ifndef __SYNTHESIS__
|
| 173 |
+
template <int M, int E, int E0> int operator>>(std::istringstream s, ap_float<M, E, E0> &b) {
|
| 174 |
+
std::string str;
|
| 175 |
+
s >> str;
|
| 176 |
+
b = std::stof(str);
|
| 177 |
+
return 0;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
template <int M, int E, int E0> std::ostream &operator<<(std::ostream &os, const ap_float<M, E, E0> &b) {
|
| 181 |
+
os << b.to_float();
|
| 182 |
+
return os;
|
| 183 |
+
}
|
| 184 |
+
#endif
|
| 185 |
+
|
| 186 |
+
#endif
|
firmware/ap_types/ap_int.h
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_INT_H__
|
| 18 |
+
#define __AP_INT_H__
|
| 19 |
+
|
| 20 |
+
#include <ap_common.h>
|
| 21 |
+
#include <ap_int_base.h>
|
| 22 |
+
#include <ap_int_ref.h>
|
| 23 |
+
|
| 24 |
+
//---------------------------------------------------------------
|
| 25 |
+
|
| 26 |
+
/// Sign Arbitrary Precision Type.
|
| 27 |
+
template <int _AP_W>
|
| 28 |
+
struct ap_int : ap_int_base<_AP_W, true> {
|
| 29 |
+
typedef ap_int_base<_AP_W, true> Base;
|
| 30 |
+
// Constructor
|
| 31 |
+
INLINE ap_int() : Base() {}
|
| 32 |
+
|
| 33 |
+
// Copy ctor
|
| 34 |
+
INLINE ap_int(const ap_int& op) { Base::V = op.V; }
|
| 35 |
+
|
| 36 |
+
template <int _AP_W2>
|
| 37 |
+
INLINE ap_int(const ap_int<_AP_W2>& op) {
|
| 38 |
+
Base::V = op.V;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
template <int _AP_W2>
|
| 42 |
+
INLINE ap_int(const volatile ap_int<_AP_W2>& op) {
|
| 43 |
+
Base::V = op.V;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
template <int _AP_W2>
|
| 47 |
+
INLINE ap_int(const ap_uint<_AP_W2>& op) {
|
| 48 |
+
Base::V = op.V;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
template <int _AP_W2>
|
| 52 |
+
INLINE ap_int(const volatile ap_uint<_AP_W2>& op) {
|
| 53 |
+
Base::V = op.V;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
template <int _AP_W2, bool _AP_S2>
|
| 57 |
+
INLINE ap_int(const ap_range_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
| 58 |
+
|
| 59 |
+
template <int _AP_W2, bool _AP_S2>
|
| 60 |
+
INLINE ap_int(const ap_bit_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
| 61 |
+
|
| 62 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 63 |
+
INLINE ap_int(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref)
|
| 64 |
+
: Base(ref) {}
|
| 65 |
+
|
| 66 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 67 |
+
int _AP_N2>
|
| 68 |
+
INLINE ap_int(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 69 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
| 70 |
+
|
| 71 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 72 |
+
int _AP_N2>
|
| 73 |
+
INLINE ap_int(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 74 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 78 |
+
int _AP_N2>
|
| 79 |
+
INLINE ap_int(
|
| 80 |
+
const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 81 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
| 82 |
+
|
| 83 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 84 |
+
int _AP_N2>
|
| 85 |
+
INLINE ap_int(
|
| 86 |
+
const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 87 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
template <int _AP_W2, bool _AP_S2>
|
| 91 |
+
INLINE ap_int(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 92 |
+
Base::V = op.V;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 96 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 97 |
+
INLINE ap_int(
|
| 98 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 99 |
+
: Base(op) {}
|
| 100 |
+
|
| 101 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 102 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 103 |
+
INLINE ap_int(
|
| 104 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 105 |
+
: Base(op) {}
|
| 106 |
+
|
| 107 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 108 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 109 |
+
INLINE ap_int(
|
| 110 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 111 |
+
: Base(op) {}
|
| 112 |
+
|
| 113 |
+
#define CTOR(TYPE) \
|
| 114 |
+
INLINE ap_int(TYPE val) { Base::V = val; }
|
| 115 |
+
CTOR(bool)
|
| 116 |
+
CTOR(char)
|
| 117 |
+
CTOR(signed char)
|
| 118 |
+
CTOR(unsigned char)
|
| 119 |
+
CTOR(short)
|
| 120 |
+
CTOR(unsigned short)
|
| 121 |
+
CTOR(int)
|
| 122 |
+
CTOR(unsigned int)
|
| 123 |
+
CTOR(long)
|
| 124 |
+
CTOR(unsigned long)
|
| 125 |
+
CTOR(ap_slong)
|
| 126 |
+
CTOR(ap_ulong)
|
| 127 |
+
#undef CTOR
|
| 128 |
+
ap_int(double val) : Base(val) {}
|
| 129 |
+
ap_int(float val) : Base(val) {}
|
| 130 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 131 |
+
ap_int(half val) : Base(val) {}
|
| 132 |
+
#endif
|
| 133 |
+
|
| 134 |
+
// ap_int_base will guess radix if radix is not provided.
|
| 135 |
+
INLINE ap_int(const char* s) : Base(s) {}
|
| 136 |
+
|
| 137 |
+
INLINE ap_int(const char* s, signed char rd) : Base(s, rd) {}
|
| 138 |
+
|
| 139 |
+
// Assignment
|
| 140 |
+
/* ctor will be used when right is not of proper type. */
|
| 141 |
+
|
| 142 |
+
INLINE ap_int& operator=(const ap_int<_AP_W>& op2) {
|
| 143 |
+
Base::V = op2.V;
|
| 144 |
+
return *this;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
/* cannot bind volatile reference to non-volatile type. */
|
| 148 |
+
INLINE ap_int& operator=(const volatile ap_int<_AP_W>& op2) {
|
| 149 |
+
Base::V = op2.V;
|
| 150 |
+
return *this;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/* cannot return volatile *this. */
|
| 154 |
+
INLINE void operator=(const ap_int<_AP_W>& op2) volatile { Base::V = op2.V; }
|
| 155 |
+
|
| 156 |
+
INLINE void operator=(const volatile ap_int<_AP_W>& op2) volatile {
|
| 157 |
+
Base::V = op2.V;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
}; // struct ap_int.
|
| 161 |
+
|
| 162 |
+
//---------------------------------------------------------------
|
| 163 |
+
|
| 164 |
+
/// Unsigned Arbitrary Precision Type.
|
| 165 |
+
template <int _AP_W>
|
| 166 |
+
struct ap_uint : ap_int_base<_AP_W, false> {
|
| 167 |
+
typedef ap_int_base<_AP_W, false> Base;
|
| 168 |
+
// Constructor
|
| 169 |
+
INLINE ap_uint() : Base() {}
|
| 170 |
+
|
| 171 |
+
// Copy ctor
|
| 172 |
+
INLINE ap_uint(const ap_uint& op) { Base::V = op.V; }
|
| 173 |
+
|
| 174 |
+
template <int _AP_W2>
|
| 175 |
+
INLINE ap_uint(const ap_uint<_AP_W2>& op) {
|
| 176 |
+
Base::V = op.V;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
template <int _AP_W2>
|
| 180 |
+
INLINE ap_uint(const ap_int<_AP_W2>& op) {
|
| 181 |
+
Base::V = op.V;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
template <int _AP_W2>
|
| 185 |
+
INLINE ap_uint(const volatile ap_uint<_AP_W2>& op) {
|
| 186 |
+
Base::V = op.V;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
template <int _AP_W2>
|
| 190 |
+
INLINE ap_uint(const volatile ap_int<_AP_W2>& op) {
|
| 191 |
+
Base::V = op.V;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
template <int _AP_W2, bool _AP_S2>
|
| 195 |
+
INLINE ap_uint(const ap_range_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
| 196 |
+
|
| 197 |
+
template <int _AP_W2, bool _AP_S2>
|
| 198 |
+
INLINE ap_uint(const ap_bit_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
| 199 |
+
|
| 200 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 201 |
+
INLINE ap_uint(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref)
|
| 202 |
+
: Base(ref) {}
|
| 203 |
+
|
| 204 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 205 |
+
int _AP_N2>
|
| 206 |
+
INLINE ap_uint(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 207 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
| 208 |
+
|
| 209 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 210 |
+
int _AP_N2>
|
| 211 |
+
INLINE ap_uint(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 212 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 216 |
+
int _AP_N2>
|
| 217 |
+
INLINE ap_uint(
|
| 218 |
+
const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 219 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
| 220 |
+
|
| 221 |
+
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
| 222 |
+
int _AP_N2>
|
| 223 |
+
INLINE ap_uint(
|
| 224 |
+
const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 225 |
+
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
template <int _AP_W2, bool _AP_S2>
|
| 229 |
+
INLINE ap_uint(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 230 |
+
Base::V = op.V;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 234 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 235 |
+
INLINE ap_uint(
|
| 236 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 237 |
+
: Base(op) {}
|
| 238 |
+
|
| 239 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 240 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 241 |
+
INLINE ap_uint(
|
| 242 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 243 |
+
: Base(op) {}
|
| 244 |
+
|
| 245 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 246 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 247 |
+
INLINE ap_uint(
|
| 248 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
| 249 |
+
: Base(op) {}
|
| 250 |
+
|
| 251 |
+
#define CTOR(TYPE) \
|
| 252 |
+
INLINE ap_uint(TYPE val) { Base::V = val; }
|
| 253 |
+
CTOR(bool)
|
| 254 |
+
CTOR(char)
|
| 255 |
+
CTOR(signed char)
|
| 256 |
+
CTOR(unsigned char)
|
| 257 |
+
CTOR(short)
|
| 258 |
+
CTOR(unsigned short)
|
| 259 |
+
CTOR(int)
|
| 260 |
+
CTOR(unsigned int)
|
| 261 |
+
CTOR(long)
|
| 262 |
+
CTOR(unsigned long)
|
| 263 |
+
CTOR(ap_slong)
|
| 264 |
+
CTOR(ap_ulong)
|
| 265 |
+
#undef CTOR
|
| 266 |
+
ap_uint(double val) : Base(val) {}
|
| 267 |
+
ap_uint(float val) : Base(val) {}
|
| 268 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 269 |
+
ap_uint(half val) : Base(val) {}
|
| 270 |
+
#endif
|
| 271 |
+
|
| 272 |
+
// ap_int_base will guess radix if radix is not provided.
|
| 273 |
+
INLINE ap_uint(const char* s) : Base(s) {}
|
| 274 |
+
|
| 275 |
+
INLINE ap_uint(const char* s, signed char rd) : Base(s, rd) {}
|
| 276 |
+
|
| 277 |
+
// Assignment
|
| 278 |
+
/* XXX ctor will be used when right is not of proper type. */
|
| 279 |
+
|
| 280 |
+
INLINE ap_uint& operator=(const ap_uint<_AP_W>& op2) {
|
| 281 |
+
Base::V = op2.V;
|
| 282 |
+
return *this;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
/* cannot bind volatile reference to non-volatile type. */
|
| 286 |
+
INLINE ap_uint& operator=(const volatile ap_uint<_AP_W>& op2) {
|
| 287 |
+
Base::V = op2.V;
|
| 288 |
+
return *this;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/* cannot return volatile *this. */
|
| 292 |
+
INLINE void operator=(const ap_uint<_AP_W>& op2) volatile { Base::V = op2.V; }
|
| 293 |
+
|
| 294 |
+
INLINE void operator=(const volatile ap_uint<_AP_W>& op2) volatile {
|
| 295 |
+
Base::V = op2.V;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
}; // struct ap_uint.
|
| 299 |
+
|
| 300 |
+
#define ap_bigint ap_int
|
| 301 |
+
#define ap_biguint ap_uint
|
| 302 |
+
|
| 303 |
+
#if !defined(__SYNTHESIS__) && (defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED))
|
| 304 |
+
// XXX sc_trace overload for ap_fixed is already included in
|
| 305 |
+
// "ap_sysc/ap_sc_extras.h", so do not define in synthesis.
|
| 306 |
+
template <int _AP_W>
|
| 307 |
+
INLINE void sc_trace(sc_core::sc_trace_file* tf, const ap_int<_AP_W>& op,
|
| 308 |
+
const std::string& name) {
|
| 309 |
+
if (tf) tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
template <int _AP_W>
|
| 313 |
+
INLINE void sc_trace(sc_core::sc_trace_file* tf, const ap_uint<_AP_W>& op,
|
| 314 |
+
const std::string& name) {
|
| 315 |
+
if (tf) tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
| 316 |
+
}
|
| 317 |
+
#endif // System C sim
|
| 318 |
+
|
| 319 |
+
#include <ap_int_special.h>
|
| 320 |
+
|
| 321 |
+
#endif // ifndef __AP_INT_H__ else
|
| 322 |
+
|
| 323 |
+
// FIXME user should include ap_fixed.h when using ap_fixed.
|
| 324 |
+
// to avoid circular inclusion, must check whether this is required by
|
| 325 |
+
// ap_fixed.h
|
| 326 |
+
#ifndef __AP_FIXED_H__
|
| 327 |
+
#include <ap_fixed.h>
|
| 328 |
+
#endif
|
| 329 |
+
|
| 330 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_int_base.h
ADDED
|
@@ -0,0 +1,1885 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_INT_BASE_H__
|
| 18 |
+
#define __AP_INT_BASE_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_INT_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifndef __cplusplus
|
| 25 |
+
#error "C++ is required to include this header file"
|
| 26 |
+
#else
|
| 27 |
+
|
| 28 |
+
#include <ap_common.h>
|
| 29 |
+
#ifndef __SYNTHESIS__
|
| 30 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 31 |
+
#include <hls_half.h>
|
| 32 |
+
#endif
|
| 33 |
+
#include <iostream>
|
| 34 |
+
#include <string.h>
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
/* ----------------------------------------------------------------
|
| 38 |
+
* ap_int_base: AutoPilot integer/Arbitrary precision integer.
|
| 39 |
+
* ----------------------------------------------------------------
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
/* helper trait. Selecting the smallest C type that can hold the value,
|
| 43 |
+
* return 64 bit C type if not possible.
|
| 44 |
+
*/
|
| 45 |
+
template <int _AP_N, bool _AP_S>
|
| 46 |
+
struct retval;
|
| 47 |
+
|
| 48 |
+
// at least 64 bit
|
| 49 |
+
template <int _AP_N>
|
| 50 |
+
struct retval<_AP_N, true> {
|
| 51 |
+
typedef ap_slong Type;
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
template <int _AP_N>
|
| 55 |
+
struct retval<_AP_N, false> {
|
| 56 |
+
typedef ap_ulong Type;
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
// at least 8 bit
|
| 60 |
+
template <>
|
| 61 |
+
struct retval<1, true> {
|
| 62 |
+
typedef signed char Type;
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
template <>
|
| 66 |
+
struct retval<1, false> {
|
| 67 |
+
typedef unsigned char Type;
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
// at least 16 bit
|
| 71 |
+
template <>
|
| 72 |
+
struct retval<2, true> {
|
| 73 |
+
typedef short Type;
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
template <>
|
| 77 |
+
struct retval<2, false> {
|
| 78 |
+
typedef unsigned short Type;
|
| 79 |
+
};
|
| 80 |
+
|
| 81 |
+
// at least 32 bit
|
| 82 |
+
template <>
|
| 83 |
+
struct retval<3, true> {
|
| 84 |
+
typedef long Type;
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
template <>
|
| 88 |
+
struct retval<3, false> {
|
| 89 |
+
typedef unsigned long Type;
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
+
template <>
|
| 93 |
+
struct retval<4, true> {
|
| 94 |
+
typedef long Type;
|
| 95 |
+
};
|
| 96 |
+
|
| 97 |
+
template <>
|
| 98 |
+
struct retval<4, false> {
|
| 99 |
+
typedef unsigned long Type;
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
// trait for letting base class to return derived class.
|
| 103 |
+
// Notice that derived class template is incomplete, and we cannot use
|
| 104 |
+
// the member of the derived class.
|
| 105 |
+
template <int _AP_W2, bool _AP_S2>
|
| 106 |
+
struct _ap_int_factory;
|
| 107 |
+
template <int _AP_W2>
|
| 108 |
+
struct _ap_int_factory<_AP_W2,true> { typedef ap_int<_AP_W2> type; };
|
| 109 |
+
template <int _AP_W2>
|
| 110 |
+
struct _ap_int_factory<_AP_W2,false> { typedef ap_uint<_AP_W2> type; };
|
| 111 |
+
|
| 112 |
+
template <int _AP_W, bool _AP_S>
|
| 113 |
+
struct ap_int_base : public _AP_ROOT_TYPE<_AP_W, _AP_S> {
|
| 114 |
+
public:
|
| 115 |
+
typedef _AP_ROOT_TYPE<_AP_W, _AP_S> Base;
|
| 116 |
+
|
| 117 |
+
/* ap_int_base<_AP_W, _AP_S, true>
|
| 118 |
+
* typedef typename retval<(_AP_W + 7) / 8, _AP_S>::Type RetType;
|
| 119 |
+
*
|
| 120 |
+
* ap_int_base<_AP_W, _AP_S, false>
|
| 121 |
+
* typedef typename retval<8, _AP_S>::Type RetType;
|
| 122 |
+
*/
|
| 123 |
+
typedef typename retval<AP_MAX((_AP_W + 7) / 8, 8), _AP_S>::Type RetType;
|
| 124 |
+
|
| 125 |
+
static const int width = _AP_W;
|
| 126 |
+
|
| 127 |
+
template <int _AP_W2, bool _AP_S2>
|
| 128 |
+
struct RType {
|
| 129 |
+
enum {
|
| 130 |
+
mult_w = _AP_W + _AP_W2,
|
| 131 |
+
mult_s = _AP_S || _AP_S2,
|
| 132 |
+
plus_w =
|
| 133 |
+
AP_MAX(_AP_W + (_AP_S2 && !_AP_S), _AP_W2 + (_AP_S && !_AP_S2)) + 1,
|
| 134 |
+
plus_s = _AP_S || _AP_S2,
|
| 135 |
+
minus_w =
|
| 136 |
+
AP_MAX(_AP_W + (_AP_S2 && !_AP_S), _AP_W2 + (_AP_S && !_AP_S2)) + 1,
|
| 137 |
+
minus_s = true,
|
| 138 |
+
div_w = _AP_W + _AP_S2,
|
| 139 |
+
div_s = _AP_S || _AP_S2,
|
| 140 |
+
mod_w = AP_MIN(_AP_W, _AP_W2 + (!_AP_S2 && _AP_S)),
|
| 141 |
+
mod_s = _AP_S,
|
| 142 |
+
logic_w = AP_MAX(_AP_W + (_AP_S2 && !_AP_S), _AP_W2 + (_AP_S && !_AP_S2)),
|
| 143 |
+
logic_s = _AP_S || _AP_S2
|
| 144 |
+
};
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
typedef ap_int_base<mult_w, mult_s> mult_base;
|
| 148 |
+
typedef ap_int_base<plus_w, plus_s> plus_base;
|
| 149 |
+
typedef ap_int_base<minus_w, minus_s> minus_base;
|
| 150 |
+
typedef ap_int_base<logic_w, logic_s> logic_base;
|
| 151 |
+
typedef ap_int_base<div_w, div_s> div_base;
|
| 152 |
+
typedef ap_int_base<mod_w, mod_s> mod_base;
|
| 153 |
+
typedef ap_int_base<_AP_W, _AP_S> arg1_base;
|
| 154 |
+
|
| 155 |
+
typedef typename _ap_int_factory<mult_w, mult_s>::type mult;
|
| 156 |
+
typedef typename _ap_int_factory<plus_w, plus_s>::type plus;
|
| 157 |
+
typedef typename _ap_int_factory<minus_w, minus_s>::type minus;
|
| 158 |
+
typedef typename _ap_int_factory<logic_w, logic_s>::type logic;
|
| 159 |
+
typedef typename _ap_int_factory<div_w, div_s>::type div;
|
| 160 |
+
typedef typename _ap_int_factory<mod_w, mod_s>::type mod;
|
| 161 |
+
typedef typename _ap_int_factory<_AP_W, _AP_S>::type arg1;
|
| 162 |
+
typedef bool reduce;
|
| 163 |
+
};
|
| 164 |
+
|
| 165 |
+
/* Constructors.
|
| 166 |
+
* ----------------------------------------------------------------
|
| 167 |
+
*/
|
| 168 |
+
/// default ctor
|
| 169 |
+
INLINE ap_int_base() {
|
| 170 |
+
/*
|
| 171 |
+
#ifdef __SC_COMPATIBLE__
|
| 172 |
+
Base::V = 0;
|
| 173 |
+
#endif
|
| 174 |
+
*/
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/// copy ctor
|
| 178 |
+
template <int _AP_W2, bool _AP_S2>
|
| 179 |
+
INLINE ap_int_base(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 180 |
+
Base::V = op.V;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
/// volatile copy ctor
|
| 184 |
+
template <int _AP_W2, bool _AP_S2>
|
| 185 |
+
INLINE ap_int_base(const volatile ap_int_base<_AP_W2, _AP_S2>& op) {
|
| 186 |
+
Base::V = op.V;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
// XXX C++11 feature.
|
| 190 |
+
// The explicit specifier specifies that a constructor or conversion function
|
| 191 |
+
// (since C++11) doesn't allow implicit conversions or copy-initialization.
|
| 192 |
+
// ap_int_base<W,S> x = 1;
|
| 193 |
+
// ap_int_base<W,S> foo() { return 1; }
|
| 194 |
+
// but allows
|
| 195 |
+
// ap_int_base<W,S> x(1);
|
| 196 |
+
// ap_int_base<W,S> y {1};
|
| 197 |
+
|
| 198 |
+
/// from all c types.
|
| 199 |
+
#define CTOR_FROM_INT(Type, Size, Signed) \
|
| 200 |
+
INLINE ap_int_base(const Type op) { Base::V = op; }
|
| 201 |
+
|
| 202 |
+
CTOR_FROM_INT(bool, 1, false)
|
| 203 |
+
CTOR_FROM_INT(char, 8, CHAR_IS_SIGNED)
|
| 204 |
+
CTOR_FROM_INT(signed char, 8, true)
|
| 205 |
+
CTOR_FROM_INT(unsigned char, 8, false)
|
| 206 |
+
CTOR_FROM_INT(short, _AP_SIZE_short, true)
|
| 207 |
+
CTOR_FROM_INT(unsigned short, _AP_SIZE_short, false)
|
| 208 |
+
CTOR_FROM_INT(int, _AP_SIZE_int, true)
|
| 209 |
+
CTOR_FROM_INT(unsigned int, _AP_SIZE_int, false)
|
| 210 |
+
CTOR_FROM_INT(long, _AP_SIZE_long, true)
|
| 211 |
+
CTOR_FROM_INT(unsigned long, _AP_SIZE_long, false)
|
| 212 |
+
CTOR_FROM_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 213 |
+
CTOR_FROM_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 214 |
+
#undef CTOR_FROM_INT
|
| 215 |
+
|
| 216 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 217 |
+
/// ctor from half.
|
| 218 |
+
// TODO optimize
|
| 219 |
+
INLINE ap_int_base(half op) {
|
| 220 |
+
ap_int_base<_AP_W, _AP_S> t((float)op);
|
| 221 |
+
Base::V = t.V;
|
| 222 |
+
}
|
| 223 |
+
#endif
|
| 224 |
+
|
| 225 |
+
/// ctor from float.
|
| 226 |
+
INLINE ap_int_base(float op) {
|
| 227 |
+
const int BITS = FLOAT_MAN + FLOAT_EXP + 1;
|
| 228 |
+
ap_int_base<BITS, false> reg;
|
| 229 |
+
reg.V = floatToRawBits(op);
|
| 230 |
+
bool is_neg = _AP_ROOT_op_get_bit(reg.V, BITS - 1);
|
| 231 |
+
|
| 232 |
+
ap_int_base<FLOAT_EXP + 1, true> exp = 0;
|
| 233 |
+
exp.V = _AP_ROOT_op_get_range(reg.V, FLOAT_MAN, BITS - 2);
|
| 234 |
+
exp = exp - FLOAT_BIAS;
|
| 235 |
+
|
| 236 |
+
ap_int_base<FLOAT_MAN + 2, true> man;
|
| 237 |
+
man.V = _AP_ROOT_op_get_range(reg.V, 0, FLOAT_MAN - 1);
|
| 238 |
+
// check for NaN
|
| 239 |
+
_AP_WARNING(exp == ((unsigned char)(FLOAT_BIAS + 1)) && man.V != 0,
|
| 240 |
+
"assign NaN to ap integer value");
|
| 241 |
+
// set leading 1.
|
| 242 |
+
man.V = _AP_ROOT_op_set_bit(man.V, FLOAT_MAN, 1);
|
| 243 |
+
//if (is_neg) man = -man;
|
| 244 |
+
|
| 245 |
+
if ((reg.V & 0x7ffffffful) == 0) {
|
| 246 |
+
Base::V = 0;
|
| 247 |
+
} else {
|
| 248 |
+
int sh_amt = FLOAT_MAN - exp.V;
|
| 249 |
+
if (sh_amt == 0) {
|
| 250 |
+
Base::V = man.V;
|
| 251 |
+
} else if (sh_amt > 0) {
|
| 252 |
+
if (sh_amt < FLOAT_MAN + 2) {
|
| 253 |
+
Base::V = man.V >> sh_amt;
|
| 254 |
+
} else {
|
| 255 |
+
if (is_neg)
|
| 256 |
+
Base::V = -1;
|
| 257 |
+
else
|
| 258 |
+
Base::V = 0;
|
| 259 |
+
}
|
| 260 |
+
} else {
|
| 261 |
+
sh_amt = -sh_amt;
|
| 262 |
+
if (sh_amt < _AP_W) {
|
| 263 |
+
Base::V = man.V;
|
| 264 |
+
Base::V <<= sh_amt;
|
| 265 |
+
} else {
|
| 266 |
+
Base::V = 0;
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
if (is_neg) *this = -(*this);
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/// ctor from double.
|
| 274 |
+
INLINE ap_int_base(double op) {
|
| 275 |
+
const int BITS = DOUBLE_MAN + DOUBLE_EXP + 1;
|
| 276 |
+
ap_int_base<BITS, false> reg;
|
| 277 |
+
reg.V = doubleToRawBits(op);
|
| 278 |
+
bool is_neg = _AP_ROOT_op_get_bit(reg.V, BITS - 1);
|
| 279 |
+
|
| 280 |
+
ap_int_base<DOUBLE_EXP + 1, true> exp = 0;
|
| 281 |
+
exp.V = _AP_ROOT_op_get_range(reg.V, DOUBLE_MAN, BITS - 2);
|
| 282 |
+
exp = exp - DOUBLE_BIAS;
|
| 283 |
+
|
| 284 |
+
ap_int_base<DOUBLE_MAN + 2, true> man;
|
| 285 |
+
man.V = _AP_ROOT_op_get_range(reg.V, 0, DOUBLE_MAN - 1);
|
| 286 |
+
// check for NaN
|
| 287 |
+
_AP_WARNING(exp == ((unsigned char)(DOUBLE_BIAS + 1)) && man.V != 0,
|
| 288 |
+
"assign NaN to ap integer value");
|
| 289 |
+
// set leading 1.
|
| 290 |
+
man.V = _AP_ROOT_op_set_bit(man.V, DOUBLE_MAN, 1);
|
| 291 |
+
//if (is_neg) man = -man;
|
| 292 |
+
|
| 293 |
+
if ((reg.V & 0x7fffffffffffffffull) == 0) {
|
| 294 |
+
Base::V = 0;
|
| 295 |
+
} else {
|
| 296 |
+
int sh_amt = DOUBLE_MAN - exp.V;
|
| 297 |
+
if (sh_amt == 0) {
|
| 298 |
+
Base::V = man.V;
|
| 299 |
+
} else if (sh_amt > 0) {
|
| 300 |
+
if (sh_amt < DOUBLE_MAN + 2) {
|
| 301 |
+
Base::V = man.V >> sh_amt;
|
| 302 |
+
} else {
|
| 303 |
+
if (is_neg)
|
| 304 |
+
Base::V = -1;
|
| 305 |
+
else
|
| 306 |
+
Base::V = 0;
|
| 307 |
+
}
|
| 308 |
+
} else {
|
| 309 |
+
sh_amt = -sh_amt;
|
| 310 |
+
if (sh_amt < _AP_W) {
|
| 311 |
+
Base::V = man.V;
|
| 312 |
+
Base::V <<= sh_amt;
|
| 313 |
+
} else {
|
| 314 |
+
Base::V = 0;
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
if (is_neg) *this = -(*this);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
/// from higer rank type.
|
| 322 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 323 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 324 |
+
INLINE ap_int_base(
|
| 325 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 326 |
+
Base::V = op.to_ap_int_base().V;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
template <int _AP_W2, bool _AP_S2>
|
| 330 |
+
INLINE ap_int_base(const ap_range_ref<_AP_W2, _AP_S2>& ref) {
|
| 331 |
+
Base::V = (ref.get()).V;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
template <int _AP_W2, bool _AP_S2>
|
| 335 |
+
INLINE ap_int_base(const ap_bit_ref<_AP_W2, _AP_S2>& ref) {
|
| 336 |
+
Base::V = ref.operator bool();
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 340 |
+
INLINE ap_int_base(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref) {
|
| 341 |
+
const ap_int_base<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>::_AP_WR,
|
| 342 |
+
false>
|
| 343 |
+
tmp = ref.get();
|
| 344 |
+
Base::V = tmp.V;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
/* radix has default value in set */
|
| 348 |
+
|
| 349 |
+
#ifndef __SYNTHESIS__
|
| 350 |
+
INLINE ap_int_base(const char* s, signed char rd = 0) {
|
| 351 |
+
if (rd == 0)
|
| 352 |
+
rd = guess_radix(s);
|
| 353 |
+
unsigned int length = strlen(s);
|
| 354 |
+
Base::V.fromString(s, length, rd);
|
| 355 |
+
}
|
| 356 |
+
#else
|
| 357 |
+
// XXX __builtin_bit_from_string(...) requires const C string and radix.
|
| 358 |
+
INLINE ap_int_base(const char* s) {
|
| 359 |
+
typeof(Base::V) t;
|
| 360 |
+
_ssdm_string2bits((void*)(&t), (const char*)(s), 10, _AP_W, _AP_S,
|
| 361 |
+
AP_TRN, AP_WRAP, 0, _AP_C99);
|
| 362 |
+
Base::V = t;
|
| 363 |
+
}
|
| 364 |
+
INLINE ap_int_base(const char* s, signed char rd) {
|
| 365 |
+
typeof(Base::V) t;
|
| 366 |
+
_ssdm_string2bits((void*)(&t), (const char*)(s), rd, _AP_W, _AP_S,
|
| 367 |
+
AP_TRN, AP_WRAP, 0, _AP_C99);
|
| 368 |
+
Base::V = t;
|
| 369 |
+
}
|
| 370 |
+
#endif
|
| 371 |
+
|
| 372 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 373 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 374 |
+
INLINE ap_int_base(
|
| 375 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 376 |
+
Base::V = (val.get()).V;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 380 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 381 |
+
INLINE ap_int_base(
|
| 382 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 383 |
+
Base::V = val.operator bool();
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
INLINE ap_int_base read() volatile {
|
| 387 |
+
/*AP_DEBUG(printf("call read %d\n", Base::V););*/
|
| 388 |
+
ap_int_base ret;
|
| 389 |
+
ret.V = Base::V;
|
| 390 |
+
return ret;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
INLINE void write(const ap_int_base<_AP_W, _AP_S>& op2) volatile {
|
| 394 |
+
/*AP_DEBUG(printf("call write %d\n", op2.V););*/
|
| 395 |
+
Base::V = op2.V;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
/* Another form of "write".*/
|
| 399 |
+
template <int _AP_W2, bool _AP_S2>
|
| 400 |
+
INLINE void operator=(
|
| 401 |
+
const volatile ap_int_base<_AP_W2, _AP_S2>& op2) volatile {
|
| 402 |
+
Base::V = op2.V;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
INLINE void operator=(
|
| 406 |
+
const volatile ap_int_base<_AP_W, _AP_S>& op2) volatile {
|
| 407 |
+
Base::V = op2.V;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
template <int _AP_W2, bool _AP_S2>
|
| 411 |
+
INLINE void operator=(const ap_int_base<_AP_W2, _AP_S2>& op2) volatile {
|
| 412 |
+
Base::V = op2.V;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
INLINE void operator=(const ap_int_base<_AP_W, _AP_S>& op2) volatile {
|
| 416 |
+
Base::V = op2.V;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
template <int _AP_W2, bool _AP_S2>
|
| 420 |
+
INLINE ap_int_base& operator=(
|
| 421 |
+
const volatile ap_int_base<_AP_W2, _AP_S2>& op2) {
|
| 422 |
+
Base::V = op2.V;
|
| 423 |
+
return *this;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
template <int _AP_W2, bool _AP_S2>
|
| 427 |
+
INLINE ap_int_base& operator=(const ap_int_base<_AP_W2, _AP_S2>& op2) {
|
| 428 |
+
Base::V = op2.V;
|
| 429 |
+
return *this;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
INLINE ap_int_base& operator=(const volatile ap_int_base<_AP_W, _AP_S>& op2) {
|
| 433 |
+
Base::V = op2.V;
|
| 434 |
+
return *this;
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
INLINE ap_int_base& operator=(const ap_int_base<_AP_W, _AP_S>& op2) {
|
| 438 |
+
Base::V = op2.V;
|
| 439 |
+
return *this;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
#define ASSIGN_OP_FROM_INT(Type, Size, Signed) \
|
| 444 |
+
INLINE ap_int_base& operator=(Type op) { \
|
| 445 |
+
Base::V = op; \
|
| 446 |
+
return *this; \
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
ASSIGN_OP_FROM_INT(bool, 1, false)
|
| 450 |
+
ASSIGN_OP_FROM_INT(char, 8, CHAR_IS_SIGNED)
|
| 451 |
+
ASSIGN_OP_FROM_INT(signed char, 8, true)
|
| 452 |
+
ASSIGN_OP_FROM_INT(unsigned char, 8, false)
|
| 453 |
+
ASSIGN_OP_FROM_INT(short, _AP_SIZE_short, true)
|
| 454 |
+
ASSIGN_OP_FROM_INT(unsigned short, _AP_SIZE_short, false)
|
| 455 |
+
ASSIGN_OP_FROM_INT(int, _AP_SIZE_int, true)
|
| 456 |
+
ASSIGN_OP_FROM_INT(unsigned int, _AP_SIZE_int, false)
|
| 457 |
+
ASSIGN_OP_FROM_INT(long, _AP_SIZE_long, true)
|
| 458 |
+
ASSIGN_OP_FROM_INT(unsigned long, _AP_SIZE_long, false)
|
| 459 |
+
ASSIGN_OP_FROM_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 460 |
+
ASSIGN_OP_FROM_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 461 |
+
|
| 462 |
+
#undef ASSIGN_OP_FROM_INT
|
| 463 |
+
|
| 464 |
+
template <int _AP_W2, bool _AP_S2>
|
| 465 |
+
INLINE ap_int_base& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& op2) {
|
| 466 |
+
Base::V = (bool)op2;
|
| 467 |
+
return *this;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
template <int _AP_W2, bool _AP_S2>
|
| 471 |
+
INLINE ap_int_base& operator=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 472 |
+
Base::V = (ap_int_base<_AP_W2, false>(op2)).V;
|
| 473 |
+
return *this;
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 477 |
+
INLINE ap_int_base& operator=(
|
| 478 |
+
const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op2) {
|
| 479 |
+
Base::V = op2.get().V;
|
| 480 |
+
return *this;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 484 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 485 |
+
INLINE ap_int_base& operator=(
|
| 486 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 487 |
+
Base::V = op.to_ap_int_base().V;
|
| 488 |
+
return *this;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 492 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 493 |
+
INLINE ap_int_base& operator=(
|
| 494 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 495 |
+
Base::V = (bool)op;
|
| 496 |
+
return *this;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 500 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 501 |
+
INLINE ap_int_base& operator=(
|
| 502 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
| 503 |
+
Base::V = ((const ap_int_base<_AP_W2, false>)(op)).V;
|
| 504 |
+
return *this;
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
// FIXME: UG902 has clearly required user to use to_int() to convert to built-in
|
| 508 |
+
// types, but this implicit conversion is relied on in hls_cordic.h and hls_rsr.h.
|
| 509 |
+
// For example:
|
| 510 |
+
// int d_exp = fps_x.exp - fps_y.exp;
|
| 511 |
+
INLINE operator RetType() const { return (RetType)(Base::V); }
|
| 512 |
+
|
| 513 |
+
/* Explicit conversions to C types.
|
| 514 |
+
* ----------------------------------------------------------------
|
| 515 |
+
*/
|
| 516 |
+
INLINE bool to_bool() const { return (bool)(Base::V); }
|
| 517 |
+
INLINE char to_char() const { return (char)(Base::V); }
|
| 518 |
+
INLINE signed char to_schar() const { return (signed char)(Base::V); }
|
| 519 |
+
INLINE unsigned char to_uchar() const { return (unsigned char)(Base::V); }
|
| 520 |
+
INLINE short to_short() const { return (short)(Base::V); }
|
| 521 |
+
INLINE unsigned short to_ushort() const { return (unsigned short)(Base::V); }
|
| 522 |
+
INLINE int to_int() const { return (int)(Base::V); }
|
| 523 |
+
INLINE unsigned to_uint() const { return (unsigned)(Base::V); }
|
| 524 |
+
INLINE long to_long() const { return (long)(Base::V); }
|
| 525 |
+
INLINE unsigned long to_ulong() const { return (unsigned long)(Base::V); }
|
| 526 |
+
INLINE ap_slong to_int64() const { return (ap_slong)(Base::V); }
|
| 527 |
+
INLINE ap_ulong to_uint64() const { return (ap_ulong)(Base::V); }
|
| 528 |
+
INLINE float to_float() const { return (float)(Base::V); }
|
| 529 |
+
INLINE double to_double() const { return (double)(Base::V); }
|
| 530 |
+
|
| 531 |
+
// TODO decide if user-defined conversion should be provided.
|
| 532 |
+
#if 0
|
| 533 |
+
INLINE operator char() const { return (char)(Base::V); }
|
| 534 |
+
INLINE operator signed char() const { return (signed char)(Base::V); }
|
| 535 |
+
INLINE operator unsigned char() const { return (unsigned char)(Base::V); }
|
| 536 |
+
INLINE operator short() const { return (short)(Base::V); }
|
| 537 |
+
INLINE operator unsigned short() const { return (unsigned short)(Base::V); }
|
| 538 |
+
INLINE operator int() const { return (int)(Base::V); }
|
| 539 |
+
INLINE operator unsigned int () const { return (unsigned)(Base::V); }
|
| 540 |
+
INLINE operator long () const { return (long)(Base::V); }
|
| 541 |
+
INLINE operator unsigned long () const { return (unsigned long)(Base::V); }
|
| 542 |
+
INLINE operator ap_slong () { return (ap_slong)(Base::V); }
|
| 543 |
+
INLINE operator ap_ulong () { return (ap_ulong)(Base::V); }
|
| 544 |
+
#endif
|
| 545 |
+
|
| 546 |
+
/* Helper methods.
|
| 547 |
+
----------------------------------------------------------------
|
| 548 |
+
*/
|
| 549 |
+
/* we cannot call a non-volatile function on a volatile instance.
|
| 550 |
+
* but calling a volatile function is ok.
|
| 551 |
+
* XXX deleted non-volatile version.
|
| 552 |
+
*/
|
| 553 |
+
INLINE int length() const volatile { return _AP_W; }
|
| 554 |
+
|
| 555 |
+
/*Return true if the value of ap_int_base instance is zero*/
|
| 556 |
+
INLINE bool iszero() const { return Base::V == 0; }
|
| 557 |
+
|
| 558 |
+
/*Return true if the value of ap_int_base instance is zero*/
|
| 559 |
+
INLINE bool is_zero() const { return Base::V == 0; }
|
| 560 |
+
|
| 561 |
+
/* x < 0 */
|
| 562 |
+
INLINE bool sign() const {
|
| 563 |
+
if (_AP_S &&
|
| 564 |
+
_AP_ROOT_op_get_bit(Base::V, _AP_W - 1))
|
| 565 |
+
return true;
|
| 566 |
+
else
|
| 567 |
+
return false;
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
/* x[i] = 0 */
|
| 571 |
+
INLINE void clear(int i) {
|
| 572 |
+
AP_ASSERT(i >= 0 && i < _AP_W, "position out of range");
|
| 573 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, 0);
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
/* x[i] = !x[i]*/
|
| 577 |
+
INLINE void invert(int i) {
|
| 578 |
+
AP_ASSERT(i >= 0 && i < _AP_W, "position out of range");
|
| 579 |
+
bool val = _AP_ROOT_op_get_bit(Base::V, i);
|
| 580 |
+
if (val)
|
| 581 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, 0);
|
| 582 |
+
else
|
| 583 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, 1);
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
INLINE bool test(int i) const {
|
| 587 |
+
AP_ASSERT(i >= 0 && i < _AP_W, "position out of range");
|
| 588 |
+
return _AP_ROOT_op_get_bit(Base::V, i);
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
// Get self. For ap_concat_ref expansion.
|
| 592 |
+
INLINE ap_int_base& get() { return *this; }
|
| 593 |
+
|
| 594 |
+
// Set the ith bit into 1
|
| 595 |
+
INLINE void set(int i) {
|
| 596 |
+
AP_ASSERT(i >= 0 && i < _AP_W, "position out of range");
|
| 597 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, 1);
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
// Set the ith bit into v
|
| 601 |
+
INLINE void set(int i, bool v) {
|
| 602 |
+
AP_ASSERT(i >= 0 && i < _AP_W, "position out of range");
|
| 603 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, v);
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// This is used for sc_lv and sc_bv, which is implemented by sc_uint
|
| 607 |
+
// Rotate an ap_int_base object n places to the left
|
| 608 |
+
INLINE ap_int_base& lrotate(int n) {
|
| 609 |
+
AP_ASSERT(n >= 0 && n < _AP_W, "shift value out of range");
|
| 610 |
+
// TODO unify this.
|
| 611 |
+
#ifdef __SYNTHESIS__
|
| 612 |
+
typeof(Base::V) l_p = Base::V << n;
|
| 613 |
+
typeof(Base::V) r_p = Base::V >> (_AP_W - n);
|
| 614 |
+
Base::V = l_p | r_p;
|
| 615 |
+
#else
|
| 616 |
+
Base::V.lrotate(n);
|
| 617 |
+
#endif
|
| 618 |
+
return *this;
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
// This is used for sc_lv and sc_bv, which is implemented by sc_uint
|
| 622 |
+
// Rotate an ap_int_base object n places to the right
|
| 623 |
+
INLINE ap_int_base& rrotate(int n) {
|
| 624 |
+
AP_ASSERT(n >= 0 && n < _AP_W, "shift value out of range");
|
| 625 |
+
// TODO unify this.
|
| 626 |
+
#ifdef __SYNTHESIS__
|
| 627 |
+
typeof(Base::V) l_p = Base::V << (_AP_W - n);
|
| 628 |
+
typeof(Base::V) r_p = Base::V >> n;
|
| 629 |
+
Base::V = l_p | r_p;
|
| 630 |
+
#else
|
| 631 |
+
Base::V.rrotate(n);
|
| 632 |
+
#endif
|
| 633 |
+
return *this;
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
// Reverse the contents of ap_int_base instance.
|
| 637 |
+
// I.e. LSB becomes MSB and vise versa.
|
| 638 |
+
INLINE ap_int_base& reverse() {
|
| 639 |
+
Base::V = _AP_ROOT_op_get_range(Base::V, _AP_W - 1, 0);
|
| 640 |
+
return *this;
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
// Set the ith bit into v
|
| 644 |
+
INLINE void set_bit(int i, bool v) {
|
| 645 |
+
Base::V = _AP_ROOT_op_set_bit(Base::V, i, v);
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
// Get the value of ith bit
|
| 649 |
+
INLINE bool get_bit(int i) const {
|
| 650 |
+
return (bool)_AP_ROOT_op_get_bit(Base::V, i);
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
// complements every bit
|
| 654 |
+
INLINE void b_not() { Base::V = ~Base::V; }
|
| 655 |
+
|
| 656 |
+
#define OP_ASSIGN_AP(Sym) \
|
| 657 |
+
template <int _AP_W2, bool _AP_S2> \
|
| 658 |
+
INLINE ap_int_base& operator Sym(const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 659 |
+
Base::V Sym op2.V; \
|
| 660 |
+
return *this; \
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
/* Arithmetic assign.
|
| 664 |
+
* ----------------------------------------------------------------
|
| 665 |
+
*/
|
| 666 |
+
OP_ASSIGN_AP(*=)
|
| 667 |
+
OP_ASSIGN_AP(+=)
|
| 668 |
+
OP_ASSIGN_AP(-=)
|
| 669 |
+
OP_ASSIGN_AP(/=)
|
| 670 |
+
OP_ASSIGN_AP(%=)
|
| 671 |
+
#undef OP_ASSIGN_AP
|
| 672 |
+
|
| 673 |
+
/* Bitwise assign: and, or, xor.
|
| 674 |
+
* ----------------------------------------------------------------
|
| 675 |
+
*/
|
| 676 |
+
#define OP_ASSIGN_AP_CHK(Sym) \
|
| 677 |
+
template <int _AP_W2, bool _AP_S2> \
|
| 678 |
+
INLINE ap_int_base& operator Sym(const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 679 |
+
_AP_WARNING((_AP_W != _AP_W2), \
|
| 680 |
+
"Bitsize mismatch for ap_[u]int" #Sym "ap_[u]int."); \
|
| 681 |
+
Base::V Sym op2.V; \
|
| 682 |
+
return *this; \
|
| 683 |
+
}
|
| 684 |
+
OP_ASSIGN_AP_CHK(&=)
|
| 685 |
+
OP_ASSIGN_AP_CHK(|=)
|
| 686 |
+
OP_ASSIGN_AP_CHK(^=)
|
| 687 |
+
#undef OP_ASSIGN_AP_CHK
|
| 688 |
+
|
| 689 |
+
/* Prefix increment, decrement.
|
| 690 |
+
* ----------------------------------------------------------------
|
| 691 |
+
*/
|
| 692 |
+
INLINE ap_int_base& operator++() {
|
| 693 |
+
operator+=((ap_int_base<1, false>)1);
|
| 694 |
+
return *this;
|
| 695 |
+
}
|
| 696 |
+
INLINE ap_int_base& operator--() {
|
| 697 |
+
operator-=((ap_int_base<1, false>)1);
|
| 698 |
+
return *this;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
/* Postfix increment, decrement
|
| 702 |
+
* ----------------------------------------------------------------
|
| 703 |
+
*/
|
| 704 |
+
INLINE const typename RType<_AP_W,_AP_S>::arg1 operator++(int) {
|
| 705 |
+
ap_int_base t = *this;
|
| 706 |
+
operator+=((ap_int_base<1, false>)1);
|
| 707 |
+
return t;
|
| 708 |
+
}
|
| 709 |
+
INLINE const typename RType<_AP_W,_AP_S>::arg1 operator--(int) {
|
| 710 |
+
ap_int_base t = *this;
|
| 711 |
+
operator-=((ap_int_base<1, false>)1);
|
| 712 |
+
return t;
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
/* Unary arithmetic.
|
| 716 |
+
* ----------------------------------------------------------------
|
| 717 |
+
*/
|
| 718 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator+() const { return *this; }
|
| 719 |
+
|
| 720 |
+
// TODO used to be W>64 only... need check.
|
| 721 |
+
INLINE typename RType<1, false>::minus operator-() const {
|
| 722 |
+
return ap_int_base<1, false>(0) - *this;
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
/* Not (!)
|
| 726 |
+
* ----------------------------------------------------------------
|
| 727 |
+
*/
|
| 728 |
+
INLINE bool operator!() const { return Base::V == 0; }
|
| 729 |
+
|
| 730 |
+
/* Bitwise (arithmetic) unary: complement
|
| 731 |
+
----------------------------------------------------------------
|
| 732 |
+
*/
|
| 733 |
+
// XXX different from Mentor's ac_int!
|
| 734 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator~() const {
|
| 735 |
+
ap_int_base<_AP_W, _AP_S> r;
|
| 736 |
+
r.V = ~Base::V;
|
| 737 |
+
return r;
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
/* Shift (result constrained by left operand).
|
| 741 |
+
* ----------------------------------------------------------------
|
| 742 |
+
*/
|
| 743 |
+
template <int _AP_W2>
|
| 744 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator<<(const ap_int_base<_AP_W2, true>& op2) const {
|
| 745 |
+
bool isNeg = _AP_ROOT_op_get_bit(op2.V, _AP_W2 - 1);
|
| 746 |
+
ap_int_base<_AP_W2, false> sh = op2;
|
| 747 |
+
if (isNeg) {
|
| 748 |
+
sh = -op2;
|
| 749 |
+
return operator>>(sh);
|
| 750 |
+
} else
|
| 751 |
+
return operator<<(sh);
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
template <int _AP_W2>
|
| 755 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator<<(const ap_int_base<_AP_W2, false>& op2) const {
|
| 756 |
+
ap_int_base r;
|
| 757 |
+
r.V = Base::V << op2.to_uint();
|
| 758 |
+
return r;
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
template <int _AP_W2>
|
| 762 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator>>(const ap_int_base<_AP_W2, true>& op2) const {
|
| 763 |
+
bool isNeg = _AP_ROOT_op_get_bit(op2.V, _AP_W2 - 1);
|
| 764 |
+
ap_int_base<_AP_W2, false> sh = op2;
|
| 765 |
+
if (isNeg) {
|
| 766 |
+
sh = -op2;
|
| 767 |
+
return operator<<(sh);
|
| 768 |
+
}
|
| 769 |
+
return operator>>(sh);
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
template <int _AP_W2>
|
| 773 |
+
INLINE typename RType<_AP_W,_AP_S>::arg1 operator>>(const ap_int_base<_AP_W2, false>& op2) const {
|
| 774 |
+
ap_int_base r;
|
| 775 |
+
r.V = Base::V >> op2.to_uint();
|
| 776 |
+
return r;
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
// FIXME we standalone operator>> for ap_int_base and ap_range_ref.
|
| 780 |
+
#if 0
|
| 781 |
+
template <int _AP_W2, bool _AP_S2>
|
| 782 |
+
INLINE ap_int_base operator<<(const ap_range_ref<_AP_W2, _AP_S2>& op2) const {
|
| 783 |
+
return *this << (op2.operator ap_int_base<_AP_W2, false>());
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
template <int _AP_W2, bool _AP_S2>
|
| 787 |
+
INLINE ap_int_base operator>>(const ap_range_ref<_AP_W2, _AP_S2>& op2) const {
|
| 788 |
+
return *this >> (op2.operator ap_int_base<_AP_W2, false>());
|
| 789 |
+
}
|
| 790 |
+
#endif
|
| 791 |
+
|
| 792 |
+
/* Shift assign
|
| 793 |
+
* ----------------------------------------------------------------
|
| 794 |
+
*/
|
| 795 |
+
template <int _AP_W2>
|
| 796 |
+
INLINE ap_int_base& operator<<=(const ap_int_base<_AP_W2, true>& op2) {
|
| 797 |
+
bool isNeg = _AP_ROOT_op_get_bit(op2.V, _AP_W2 - 1);
|
| 798 |
+
ap_int_base<_AP_W2, false> sh = op2;
|
| 799 |
+
if (isNeg) {
|
| 800 |
+
sh = -op2;
|
| 801 |
+
return operator>>=(sh);
|
| 802 |
+
} else
|
| 803 |
+
return operator<<=(sh);
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
template <int _AP_W2>
|
| 807 |
+
INLINE ap_int_base& operator<<=(const ap_int_base<_AP_W2, false>& op2) {
|
| 808 |
+
Base::V <<= op2.to_uint();
|
| 809 |
+
return *this;
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
template <int _AP_W2>
|
| 813 |
+
INLINE ap_int_base& operator>>=(const ap_int_base<_AP_W2, true>& op2) {
|
| 814 |
+
bool isNeg = _AP_ROOT_op_get_bit(op2.V, _AP_W2 - 1);
|
| 815 |
+
ap_int_base<_AP_W2, false> sh = op2;
|
| 816 |
+
if (isNeg) {
|
| 817 |
+
sh = -op2;
|
| 818 |
+
return operator<<=(sh);
|
| 819 |
+
}
|
| 820 |
+
return operator>>=(sh);
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
template <int _AP_W2>
|
| 824 |
+
INLINE ap_int_base& operator>>=(const ap_int_base<_AP_W2, false>& op2) {
|
| 825 |
+
Base::V >>= op2.to_uint();
|
| 826 |
+
return *this;
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
// FIXME we standalone operator>> for ap_int_base and ap_range_ref.
|
| 830 |
+
#if 0
|
| 831 |
+
template <int _AP_W2, bool _AP_S2>
|
| 832 |
+
INLINE ap_int_base& operator<<=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 833 |
+
return *this <<= (op2.operator ap_int_base<_AP_W2, false>());
|
| 834 |
+
}
|
| 835 |
+
template <int _AP_W2, bool _AP_S2>
|
| 836 |
+
INLINE ap_int_base& operator>>=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 837 |
+
return *this >>= (op2.operator ap_int_base<_AP_W2, false>());
|
| 838 |
+
}
|
| 839 |
+
#endif
|
| 840 |
+
|
| 841 |
+
/* Equality and Relational.
|
| 842 |
+
* ----------------------------------------------------------------
|
| 843 |
+
*/
|
| 844 |
+
template <int _AP_W2, bool _AP_S2>
|
| 845 |
+
INLINE bool operator==(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 846 |
+
return Base::V == op2.V;
|
| 847 |
+
}
|
| 848 |
+
template <int _AP_W2, bool _AP_S2>
|
| 849 |
+
INLINE bool operator!=(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 850 |
+
return !(Base::V == op2.V);
|
| 851 |
+
}
|
| 852 |
+
template <int _AP_W2, bool _AP_S2>
|
| 853 |
+
INLINE bool operator<(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 854 |
+
return Base::V < op2.V;
|
| 855 |
+
}
|
| 856 |
+
template <int _AP_W2, bool _AP_S2>
|
| 857 |
+
INLINE bool operator>=(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 858 |
+
return Base::V >= op2.V;
|
| 859 |
+
}
|
| 860 |
+
template <int _AP_W2, bool _AP_S2>
|
| 861 |
+
INLINE bool operator>(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 862 |
+
return Base::V > op2.V;
|
| 863 |
+
}
|
| 864 |
+
template <int _AP_W2, bool _AP_S2>
|
| 865 |
+
INLINE bool operator<=(const ap_int_base<_AP_W2, _AP_S2>& op2) const {
|
| 866 |
+
return Base::V <= op2.V;
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
/* Bit and Part Select
|
| 870 |
+
* ----------------------------------------------------------------
|
| 871 |
+
*/
|
| 872 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range(int Hi, int Lo) {
|
| 873 |
+
_AP_ERROR(Hi >= _AP_W, "Hi(%d)out of bound(%d) in range()", Hi, _AP_W);
|
| 874 |
+
_AP_ERROR(Lo >= _AP_W, "Lo(%d)out of bound(%d) in range()", Lo, _AP_W);
|
| 875 |
+
return ap_range_ref<_AP_W, _AP_S>(this, Hi, Lo);
|
| 876 |
+
}
|
| 877 |
+
|
| 878 |
+
// This is a must to strip constness to produce reference type.
|
| 879 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range(int Hi, int Lo) const {
|
| 880 |
+
_AP_ERROR(Hi >= _AP_W, "Hi(%d)out of bound(%d) in range()", Hi, _AP_W);
|
| 881 |
+
_AP_ERROR(Lo >= _AP_W, "Lo(%d)out of bound(%d) in range()", Lo, _AP_W);
|
| 882 |
+
return ap_range_ref<_AP_W, _AP_S>(const_cast<ap_int_base*>(this), Hi, Lo);
|
| 883 |
+
}
|
| 884 |
+
|
| 885 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 886 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range(
|
| 887 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 888 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) {
|
| 889 |
+
int Hi = HiIdx.to_int();
|
| 890 |
+
int Lo = LoIdx.to_int();
|
| 891 |
+
return this->range(Hi, Lo);
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 895 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range(
|
| 896 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 897 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) const {
|
| 898 |
+
int Hi = HiIdx.to_int();
|
| 899 |
+
int Lo = LoIdx.to_int();
|
| 900 |
+
return this->range(Hi, Lo);
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range() {
|
| 904 |
+
return this->range(_AP_W - 1, 0);
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
INLINE ap_range_ref<_AP_W, _AP_S> range() const {
|
| 908 |
+
return this->range(_AP_W - 1, 0);
|
| 909 |
+
}
|
| 910 |
+
|
| 911 |
+
INLINE ap_range_ref<_AP_W, _AP_S> operator()(int Hi, int Lo) {
|
| 912 |
+
return this->range(Hi, Lo);
|
| 913 |
+
}
|
| 914 |
+
|
| 915 |
+
INLINE ap_range_ref<_AP_W, _AP_S> operator()(int Hi, int Lo) const {
|
| 916 |
+
return this->range(Hi, Lo);
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 920 |
+
INLINE ap_range_ref<_AP_W, _AP_S> operator()(
|
| 921 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 922 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) {
|
| 923 |
+
int Hi = HiIdx.to_int();
|
| 924 |
+
int Lo = LoIdx.to_int();
|
| 925 |
+
return this->range(Hi, Lo);
|
| 926 |
+
}
|
| 927 |
+
|
| 928 |
+
template <int _AP_W2, bool _AP_S2, int _AP_W3, bool _AP_S3>
|
| 929 |
+
INLINE ap_range_ref<_AP_W, _AP_S> operator()(
|
| 930 |
+
const ap_int_base<_AP_W2, _AP_S2>& HiIdx,
|
| 931 |
+
const ap_int_base<_AP_W3, _AP_S3>& LoIdx) const {
|
| 932 |
+
int Hi = HiIdx.to_int();
|
| 933 |
+
int Lo = LoIdx.to_int();
|
| 934 |
+
return this->range(Hi, Lo);
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
#if 0
|
| 938 |
+
template<int Hi, int Lo>
|
| 939 |
+
INLINE ap_int_base<Hi-Lo+1, false> slice() const {
|
| 940 |
+
AP_ASSERT(Hi >= Lo && Hi < _AP_W && Lo < _AP_W, "Out of bounds in slice()");
|
| 941 |
+
ap_int_base<Hi-Lo+1, false> tmp ;
|
| 942 |
+
tmp.V = _AP_ROOT_op_get_range(Base::V, Lo, Hi);
|
| 943 |
+
return tmp;
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
INLINE ap_bit_ref<_AP_W,_AP_S> operator [] ( unsigned int uindex) {
|
| 947 |
+
AP_ASSERT(uindex < _AP_W, "Attempting to read bit beyond MSB");
|
| 948 |
+
ap_bit_ref<_AP_W,_AP_S> bvh( this, uindex );
|
| 949 |
+
return bvh;
|
| 950 |
+
}
|
| 951 |
+
#endif
|
| 952 |
+
|
| 953 |
+
INLINE ap_bit_ref<_AP_W, _AP_S> operator[](int index) {
|
| 954 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 955 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 956 |
+
ap_bit_ref<_AP_W, _AP_S> bvh(this, index);
|
| 957 |
+
return bvh;
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
template <int _AP_W2, bool _AP_S2>
|
| 961 |
+
INLINE ap_bit_ref<_AP_W, _AP_S> operator[](
|
| 962 |
+
const ap_int_base<_AP_W2, _AP_S2>& index) {
|
| 963 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 964 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 965 |
+
ap_bit_ref<_AP_W, _AP_S> bvh(this, index.to_int());
|
| 966 |
+
return bvh;
|
| 967 |
+
}
|
| 968 |
+
|
| 969 |
+
INLINE bool operator[](int index) const {
|
| 970 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 971 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 972 |
+
ap_bit_ref<_AP_W, _AP_S> br(this, index);
|
| 973 |
+
return br.to_bool();
|
| 974 |
+
}
|
| 975 |
+
template <int _AP_W2, bool _AP_S2>
|
| 976 |
+
INLINE bool operator[](const ap_int_base<_AP_W2, _AP_S2>& index) const {
|
| 977 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 978 |
+
ap_bit_ref<_AP_W, _AP_S> br(this, index.to_int());
|
| 979 |
+
return br.to_bool();
|
| 980 |
+
}
|
| 981 |
+
|
| 982 |
+
INLINE ap_bit_ref<_AP_W, _AP_S> bit(int index) {
|
| 983 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 984 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 985 |
+
ap_bit_ref<_AP_W, _AP_S> bvh(this, index);
|
| 986 |
+
return bvh;
|
| 987 |
+
}
|
| 988 |
+
template <int _AP_W2, bool _AP_S2>
|
| 989 |
+
INLINE ap_bit_ref<_AP_W, _AP_S> bit(
|
| 990 |
+
const ap_int_base<_AP_W2, _AP_S2>& index) {
|
| 991 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 992 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 993 |
+
ap_bit_ref<_AP_W, _AP_S> bvh(this, index.to_int());
|
| 994 |
+
return bvh;
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
INLINE bool bit(int index) const {
|
| 998 |
+
AP_ASSERT(index >= 0, "Attempting to read bit with negative index");
|
| 999 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 1000 |
+
ap_bit_ref<_AP_W, _AP_S> br(this, index);
|
| 1001 |
+
return br.to_bool();
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1005 |
+
INLINE bool bit(const ap_int_base<_AP_W2, _AP_S2>& index) const {
|
| 1006 |
+
return bit(index.to_int());
|
| 1007 |
+
}
|
| 1008 |
+
|
| 1009 |
+
#if 0
|
| 1010 |
+
template<typename _AP_T>
|
| 1011 |
+
INLINE bool operator[](_AP_T index) const {
|
| 1012 |
+
AP_ASSERT(index < _AP_W, "Attempting to read bit beyond MSB");
|
| 1013 |
+
ap_bit_ref<_AP_W,_AP_S> br = operator[](index);
|
| 1014 |
+
return br.to_bool();
|
| 1015 |
+
}
|
| 1016 |
+
#endif
|
| 1017 |
+
|
| 1018 |
+
// Count the number of zeros from the most significant bit
|
| 1019 |
+
// to the first one bit.
|
| 1020 |
+
INLINE int countLeadingZeros() {
|
| 1021 |
+
#ifdef __SYNTHESIS__
|
| 1022 |
+
if (_AP_W <= 32) {
|
| 1023 |
+
ap_int_base<32, false> t(-1UL), x;
|
| 1024 |
+
x.V = _AP_ROOT_op_get_range(this->V, _AP_W - 1, 0); // reverse
|
| 1025 |
+
t.V = _AP_ROOT_op_set_range(t.V, 0, _AP_W - 1, x.V);
|
| 1026 |
+
return __builtin_ctz(t.V); // count trailing zeros.
|
| 1027 |
+
} else if (_AP_W <= 64) {
|
| 1028 |
+
ap_int_base<64, false> t(-1ULL);
|
| 1029 |
+
ap_int_base<64, false> x;
|
| 1030 |
+
x.V = _AP_ROOT_op_get_range(this->V, _AP_W - 1, 0); // reverse
|
| 1031 |
+
t.V = _AP_ROOT_op_set_range(t.V, 0, _AP_W - 1, x.V);
|
| 1032 |
+
return __builtin_ctzll(t.V); // count trailing zeros.
|
| 1033 |
+
} else {
|
| 1034 |
+
enum { __N = (_AP_W + 63) / 64 };
|
| 1035 |
+
int NZeros = 0;
|
| 1036 |
+
int i = 0;
|
| 1037 |
+
bool hitNonZero = false;
|
| 1038 |
+
for (i = 0; i < __N - 1; ++i) {
|
| 1039 |
+
ap_int_base<64, false> t;
|
| 1040 |
+
t.V = _AP_ROOT_op_get_range(this->V, _AP_W - i * 64 - 64, _AP_W - i * 64 - 1);
|
| 1041 |
+
NZeros += hitNonZero ? 0 : __builtin_clzll(t.V); // count leading zeros.
|
| 1042 |
+
hitNonZero |= (t.V != 0);
|
| 1043 |
+
}
|
| 1044 |
+
if (!hitNonZero) {
|
| 1045 |
+
ap_int_base<64, false> t(-1ULL);
|
| 1046 |
+
enum { REST = (_AP_W - 1) % 64 };
|
| 1047 |
+
ap_int_base<64, false> x;
|
| 1048 |
+
x.V = _AP_ROOT_op_get_range(this->V, 0, REST);
|
| 1049 |
+
t.V = _AP_ROOT_op_set_range(t.V, 63 - REST, 63, x.V);
|
| 1050 |
+
NZeros += __builtin_clzll(t.V);
|
| 1051 |
+
}
|
| 1052 |
+
return NZeros;
|
| 1053 |
+
}
|
| 1054 |
+
#else
|
| 1055 |
+
return (Base::V).countLeadingZeros();
|
| 1056 |
+
#endif
|
| 1057 |
+
} // countLeadingZeros
|
| 1058 |
+
|
| 1059 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1060 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1061 |
+
concat(const ap_int_base<_AP_W2, _AP_S2>& a2) const {
|
| 1062 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1063 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 1064 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1065 |
+
const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 1066 |
+
}
|
| 1067 |
+
|
| 1068 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1069 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1070 |
+
concat(ap_int_base<_AP_W2, _AP_S2>& a2) {
|
| 1071 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1072 |
+
ap_int_base<_AP_W2, _AP_S2> >(*this, a2);
|
| 1073 |
+
}
|
| 1074 |
+
|
| 1075 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1076 |
+
INLINE
|
| 1077 |
+
ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 1078 |
+
operator,(const ap_range_ref<_AP_W2, _AP_S2> &a2) const {
|
| 1079 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1080 |
+
ap_range_ref<_AP_W2, _AP_S2> >(
|
| 1081 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1082 |
+
const_cast<ap_range_ref<_AP_W2, _AP_S2>&>(a2));
|
| 1083 |
+
}
|
| 1084 |
+
|
| 1085 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1086 |
+
INLINE
|
| 1087 |
+
ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 1088 |
+
operator,(ap_range_ref<_AP_W2, _AP_S2> &a2) {
|
| 1089 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1090 |
+
ap_range_ref<_AP_W2, _AP_S2> >(*this, a2);
|
| 1091 |
+
}
|
| 1092 |
+
|
| 1093 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1094 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1095 |
+
operator,(const ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 1096 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1097 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 1098 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 1099 |
+
}
|
| 1100 |
+
|
| 1101 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1102 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1103 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &a2) const {
|
| 1104 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1105 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 1106 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this), a2);
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1110 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1111 |
+
operator,(const ap_int_base<_AP_W2, _AP_S2> &a2) const {
|
| 1112 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1113 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 1114 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1115 |
+
const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 1116 |
+
}
|
| 1117 |
+
|
| 1118 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1119 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 1120 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 1121 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2,
|
| 1122 |
+
ap_int_base<_AP_W2, _AP_S2> >(*this, a2);
|
| 1123 |
+
}
|
| 1124 |
+
|
| 1125 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1126 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, 1, ap_bit_ref<_AP_W2, _AP_S2> >
|
| 1127 |
+
operator,(const ap_bit_ref<_AP_W2, _AP_S2> &a2) const {
|
| 1128 |
+
return ap_concat_ref<_AP_W, ap_int_base, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
| 1129 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1130 |
+
const_cast<ap_bit_ref<_AP_W2, _AP_S2>&>(a2));
|
| 1131 |
+
}
|
| 1132 |
+
|
| 1133 |
+
template <int _AP_W2, bool _AP_S2>
|
| 1134 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, 1, ap_bit_ref<_AP_W2, _AP_S2> >
|
| 1135 |
+
operator,(ap_bit_ref<_AP_W2, _AP_S2> &a2) {
|
| 1136 |
+
return ap_concat_ref<_AP_W, ap_int_base, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
| 1137 |
+
*this, a2);
|
| 1138 |
+
}
|
| 1139 |
+
|
| 1140 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 1141 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2 + _AP_W3,
|
| 1142 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 1143 |
+
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &a2) {
|
| 1144 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2 + _AP_W3,
|
| 1145 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(
|
| 1146 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1147 |
+
const_cast<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>&>(a2));
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 1151 |
+
INLINE ap_concat_ref<_AP_W, ap_int_base, _AP_W2 + _AP_W3,
|
| 1152 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 1153 |
+
operator,(ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &a2) {
|
| 1154 |
+
return ap_concat_ref<_AP_W, ap_int_base, _AP_W2 + _AP_W3,
|
| 1155 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(*this,
|
| 1156 |
+
a2);
|
| 1157 |
+
}
|
| 1158 |
+
|
| 1159 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1160 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1161 |
+
INLINE ap_concat_ref<
|
| 1162 |
+
_AP_W, ap_int_base, _AP_W2,
|
| 1163 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 1164 |
+
operator,(const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>
|
| 1165 |
+
&a2) const {
|
| 1166 |
+
return ap_concat_ref<
|
| 1167 |
+
_AP_W, ap_int_base, _AP_W2,
|
| 1168 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 1169 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1170 |
+
const_cast<
|
| 1171 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(a2));
|
| 1172 |
+
}
|
| 1173 |
+
|
| 1174 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1175 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1176 |
+
INLINE ap_concat_ref<
|
| 1177 |
+
_AP_W, ap_int_base, _AP_W2,
|
| 1178 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 1179 |
+
operator,(af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &a2) {
|
| 1180 |
+
return ap_concat_ref<
|
| 1181 |
+
_AP_W, ap_int_base, _AP_W2,
|
| 1182 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(*this,
|
| 1183 |
+
a2);
|
| 1184 |
+
}
|
| 1185 |
+
|
| 1186 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1187 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1188 |
+
INLINE
|
| 1189 |
+
ap_concat_ref<_AP_W, ap_int_base, 1,
|
| 1190 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 1191 |
+
operator,(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>
|
| 1192 |
+
&a2) const {
|
| 1193 |
+
return ap_concat_ref<
|
| 1194 |
+
_AP_W, ap_int_base, 1,
|
| 1195 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 1196 |
+
const_cast<ap_int_base<_AP_W, _AP_S>&>(*this),
|
| 1197 |
+
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 1198 |
+
a2));
|
| 1199 |
+
}
|
| 1200 |
+
|
| 1201 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 1202 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 1203 |
+
INLINE
|
| 1204 |
+
ap_concat_ref<_AP_W, ap_int_base, 1,
|
| 1205 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 1206 |
+
operator,(
|
| 1207 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &a2) {
|
| 1208 |
+
return ap_concat_ref<
|
| 1209 |
+
_AP_W, ap_int_base, 1,
|
| 1210 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(*this, a2);
|
| 1211 |
+
}
|
| 1212 |
+
|
| 1213 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 1214 |
+
INLINE ap_int_base<AP_MAX(_AP_W2 + _AP_W3, _AP_W), _AP_S> operator&(
|
| 1215 |
+
const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& a2) {
|
| 1216 |
+
return *this & a2.get();
|
| 1217 |
+
}
|
| 1218 |
+
|
| 1219 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 1220 |
+
INLINE ap_int_base<AP_MAX(_AP_W2 + _AP_W3, _AP_W), _AP_S> operator|(
|
| 1221 |
+
const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& a2) {
|
| 1222 |
+
return *this | a2.get();
|
| 1223 |
+
}
|
| 1224 |
+
|
| 1225 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 1226 |
+
INLINE ap_int_base<AP_MAX(_AP_W2 + _AP_W3, _AP_W), _AP_S> operator^(
|
| 1227 |
+
const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& a2) {
|
| 1228 |
+
return *this ^ a2.get();
|
| 1229 |
+
}
|
| 1230 |
+
|
| 1231 |
+
template <int _AP_W3>
|
| 1232 |
+
INLINE void set(const ap_int_base<_AP_W3, false>& val) {
|
| 1233 |
+
Base::V = val.V;
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
/* Reduce operations.
|
| 1237 |
+
* ----------------------------------------------------------------
|
| 1238 |
+
*/
|
| 1239 |
+
// XXX non-const version deleted.
|
| 1240 |
+
INLINE bool and_reduce() const { return _AP_ROOT_op_reduce(and, Base::V); }
|
| 1241 |
+
INLINE bool nand_reduce() const { return _AP_ROOT_op_reduce(nand, Base::V); }
|
| 1242 |
+
INLINE bool or_reduce() const { return _AP_ROOT_op_reduce(or, Base::V); }
|
| 1243 |
+
INLINE bool nor_reduce() const { return !(_AP_ROOT_op_reduce(or, Base::V)); }
|
| 1244 |
+
INLINE bool xor_reduce() const { return _AP_ROOT_op_reduce (xor, Base::V); }
|
| 1245 |
+
INLINE bool xnor_reduce() const {
|
| 1246 |
+
return !(_AP_ROOT_op_reduce (xor, Base::V));
|
| 1247 |
+
}
|
| 1248 |
+
|
| 1249 |
+
/* Output as a string.
|
| 1250 |
+
* ----------------------------------------------------------------
|
| 1251 |
+
*/
|
| 1252 |
+
#ifndef __SYNTHESIS__
|
| 1253 |
+
std::string to_string(signed char rd = 2, bool sign = _AP_S) const {
|
| 1254 |
+
// XXX in autosim/autowrap.tcl "(${name}).to_string(2).c_str()" is used to
|
| 1255 |
+
// initialize sc_lv, which seems incapable of handling format "-0b".
|
| 1256 |
+
if (rd == 2) sign = false;
|
| 1257 |
+
return (Base::V).to_string(rd, sign);
|
| 1258 |
+
}
|
| 1259 |
+
#else
|
| 1260 |
+
INLINE char* to_string(signed char rd = 2, bool sign = _AP_S) const {
|
| 1261 |
+
return 0;
|
| 1262 |
+
}
|
| 1263 |
+
#endif
|
| 1264 |
+
}; // struct ap_int_base
|
| 1265 |
+
|
| 1266 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 1267 |
+
#ifndef AP_AUTOCC
|
| 1268 |
+
#ifndef __SYNTHESIS__
|
| 1269 |
+
template <int _AP_W, bool _AP_S>
|
| 1270 |
+
INLINE std::ostream& operator<<(std::ostream& os,
|
| 1271 |
+
const ap_int_base<_AP_W, _AP_S>& x) {
|
| 1272 |
+
std::ios_base::fmtflags ff = std::cout.flags();
|
| 1273 |
+
if (ff & std::cout.hex) {
|
| 1274 |
+
os << x.to_string(16); // don't print sign
|
| 1275 |
+
} else if (ff & std::cout.oct) {
|
| 1276 |
+
os << x.to_string(8); // don't print sign
|
| 1277 |
+
} else {
|
| 1278 |
+
os << x.to_string(10);
|
| 1279 |
+
}
|
| 1280 |
+
return os;
|
| 1281 |
+
}
|
| 1282 |
+
#endif // ifndef __SYNTHESIS__
|
| 1283 |
+
|
| 1284 |
+
#ifndef __SYNTHESIS__
|
| 1285 |
+
template <int _AP_W, bool _AP_S>
|
| 1286 |
+
INLINE std::istream& operator>>(std::istream& in,
|
| 1287 |
+
ap_int_base<_AP_W, _AP_S>& op) {
|
| 1288 |
+
std::string str;
|
| 1289 |
+
in >> str;
|
| 1290 |
+
const std::ios_base::fmtflags basefield = in.flags() & std::ios_base::basefield;
|
| 1291 |
+
unsigned radix = (basefield == std::ios_base::dec) ? 0 : (
|
| 1292 |
+
(basefield == std::ios_base::oct) ? 8 : (
|
| 1293 |
+
(basefield == std::ios_base::hex) ? 16 : 0));
|
| 1294 |
+
op = ap_int_base<_AP_W, _AP_S>(str.c_str(), radix);
|
| 1295 |
+
return in;
|
| 1296 |
+
}
|
| 1297 |
+
#endif // ifndef __SYNTHESIS__
|
| 1298 |
+
#endif // ifndef AP_AUTOCC
|
| 1299 |
+
|
| 1300 |
+
/* Operators with another ap_int_base.
|
| 1301 |
+
* ----------------------------------------------------------------
|
| 1302 |
+
*/
|
| 1303 |
+
#define OP_BIN_AP(Sym, Rty) \
|
| 1304 |
+
template <int _AP_W, bool _AP_S, int _AP_W2, bool _AP_S2> \
|
| 1305 |
+
INLINE \
|
| 1306 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W2, _AP_S2>::Rty \
|
| 1307 |
+
operator Sym(const ap_int_base<_AP_W, _AP_S>& op, \
|
| 1308 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1309 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType< \
|
| 1310 |
+
_AP_W2, _AP_S2>::Rty##_base lhs(op); \
|
| 1311 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType< \
|
| 1312 |
+
_AP_W2, _AP_S2>::Rty##_base rhs(op2); \
|
| 1313 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType< \
|
| 1314 |
+
_AP_W2, _AP_S2>::Rty##_base ret; \
|
| 1315 |
+
ret.V = lhs.V Sym rhs.V; \
|
| 1316 |
+
return ret; \
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
OP_BIN_AP(*, mult)
|
| 1320 |
+
OP_BIN_AP(+, plus)
|
| 1321 |
+
OP_BIN_AP(-, minus)
|
| 1322 |
+
OP_BIN_AP(&, logic)
|
| 1323 |
+
OP_BIN_AP(|, logic)
|
| 1324 |
+
OP_BIN_AP(^, logic)
|
| 1325 |
+
|
| 1326 |
+
#define OP_BIN_AP2(Sym, Rty) \
|
| 1327 |
+
template <int _AP_W, bool _AP_S, int _AP_W2, bool _AP_S2> \
|
| 1328 |
+
INLINE \
|
| 1329 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W2, _AP_S2>::Rty \
|
| 1330 |
+
operator Sym(const ap_int_base<_AP_W, _AP_S>& op, \
|
| 1331 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1332 |
+
typename ap_int_base<_AP_W, _AP_S>::template RType< \
|
| 1333 |
+
_AP_W2, _AP_S2>::Rty##_base ret; \
|
| 1334 |
+
ret.V = op.V Sym op2.V; \
|
| 1335 |
+
return ret; \
|
| 1336 |
+
}
|
| 1337 |
+
|
| 1338 |
+
OP_BIN_AP2(/, div)
|
| 1339 |
+
OP_BIN_AP2(%, mod)
|
| 1340 |
+
|
| 1341 |
+
// shift operators are defined inside class.
|
| 1342 |
+
// compound assignment operators are defined inside class.
|
| 1343 |
+
|
| 1344 |
+
/* Operators with a pointer type.
|
| 1345 |
+
* ----------------------------------------------------------------
|
| 1346 |
+
* char a[100];
|
| 1347 |
+
* char* ptr = a;
|
| 1348 |
+
* ap_int<2> n = 3;
|
| 1349 |
+
* char* ptr2 = ptr + n*2;
|
| 1350 |
+
* avoid ambiguous errors.
|
| 1351 |
+
*/
|
| 1352 |
+
#define OP_BIN_WITH_PTR(BIN_OP) \
|
| 1353 |
+
template <typename PTR_TYPE, int _AP_W, bool _AP_S> \
|
| 1354 |
+
INLINE PTR_TYPE* operator BIN_OP(PTR_TYPE* i_op, \
|
| 1355 |
+
const ap_int_base<_AP_W, _AP_S>& op) { \
|
| 1356 |
+
ap_slong op2 = op.to_int64(); /* Not all implementation */ \
|
| 1357 |
+
return i_op BIN_OP op2; \
|
| 1358 |
+
} \
|
| 1359 |
+
template <typename PTR_TYPE, int _AP_W, bool _AP_S> \
|
| 1360 |
+
INLINE PTR_TYPE* operator BIN_OP(const ap_int_base<_AP_W, _AP_S>& op, \
|
| 1361 |
+
PTR_TYPE* i_op) { \
|
| 1362 |
+
ap_slong op2 = op.to_int64(); /* Not all implementation */ \
|
| 1363 |
+
return op2 BIN_OP i_op; \
|
| 1364 |
+
}
|
| 1365 |
+
|
| 1366 |
+
OP_BIN_WITH_PTR(+)
|
| 1367 |
+
OP_BIN_WITH_PTR(-)
|
| 1368 |
+
|
| 1369 |
+
/* Operators with a native floating point types.
|
| 1370 |
+
* ----------------------------------------------------------------
|
| 1371 |
+
*/
|
| 1372 |
+
// float OP ap_int
|
| 1373 |
+
// when ap_int<wa>'s width > 64, then trunc ap_int<w> to ap_int<64>
|
| 1374 |
+
#define OP_BIN_WITH_FLOAT(BIN_OP, C_TYPE) \
|
| 1375 |
+
template <int _AP_W, bool _AP_S> \
|
| 1376 |
+
INLINE C_TYPE operator BIN_OP(C_TYPE i_op, \
|
| 1377 |
+
const ap_int_base<_AP_W, _AP_S>& op) { \
|
| 1378 |
+
typename ap_int_base<_AP_W, _AP_S>::RetType op2 = op; \
|
| 1379 |
+
return i_op BIN_OP op2; \
|
| 1380 |
+
} \
|
| 1381 |
+
template <int _AP_W, bool _AP_S> \
|
| 1382 |
+
INLINE C_TYPE operator BIN_OP(const ap_int_base<_AP_W, _AP_S>& op, \
|
| 1383 |
+
C_TYPE i_op) { \
|
| 1384 |
+
typename ap_int_base<_AP_W, _AP_S>::RetType op2 = op; \
|
| 1385 |
+
return op2 BIN_OP i_op; \
|
| 1386 |
+
}
|
| 1387 |
+
|
| 1388 |
+
#define ALL_OP_WITH_FLOAT(C_TYPE) \
|
| 1389 |
+
OP_BIN_WITH_FLOAT(*, C_TYPE) \
|
| 1390 |
+
OP_BIN_WITH_FLOAT(/, C_TYPE) \
|
| 1391 |
+
OP_BIN_WITH_FLOAT(+, C_TYPE) \
|
| 1392 |
+
OP_BIN_WITH_FLOAT(-, C_TYPE)
|
| 1393 |
+
|
| 1394 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 1395 |
+
ALL_OP_WITH_FLOAT(half)
|
| 1396 |
+
#endif
|
| 1397 |
+
ALL_OP_WITH_FLOAT(float)
|
| 1398 |
+
ALL_OP_WITH_FLOAT(double)
|
| 1399 |
+
|
| 1400 |
+
// TODO no shift?
|
| 1401 |
+
|
| 1402 |
+
/* Operators with a native integral types.
|
| 1403 |
+
* ----------------------------------------------------------------
|
| 1404 |
+
*/
|
| 1405 |
+
// arithmetic and bitwise operators.
|
| 1406 |
+
#define OP_BIN_WITH_INT(BIN_OP, C_TYPE, _AP_W2, _AP_S2, RTYPE) \
|
| 1407 |
+
template <int _AP_W, bool _AP_S> \
|
| 1408 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W2, \
|
| 1409 |
+
_AP_S2>::RTYPE \
|
| 1410 |
+
operator BIN_OP(C_TYPE i_op, const ap_int_base<_AP_W, _AP_S>& op) { \
|
| 1411 |
+
return ap_int_base<_AP_W2, _AP_S2>(i_op) BIN_OP(op); \
|
| 1412 |
+
} \
|
| 1413 |
+
template <int _AP_W, bool _AP_S> \
|
| 1414 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W2, \
|
| 1415 |
+
_AP_S2>::RTYPE \
|
| 1416 |
+
operator BIN_OP(const ap_int_base<_AP_W, _AP_S>& op, C_TYPE i_op) { \
|
| 1417 |
+
return op BIN_OP ap_int_base<_AP_W2, _AP_S2>(i_op); \
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
#define ALL_OP_BIN_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 1421 |
+
OP_BIN_WITH_INT(*, C_TYPE, _AP_W2, _AP_S2, mult) \
|
| 1422 |
+
OP_BIN_WITH_INT(+, C_TYPE, _AP_W2, _AP_S2, plus) \
|
| 1423 |
+
OP_BIN_WITH_INT(-, C_TYPE, _AP_W2, _AP_S2, minus) \
|
| 1424 |
+
OP_BIN_WITH_INT(/, C_TYPE, _AP_W2, _AP_S2, div) \
|
| 1425 |
+
OP_BIN_WITH_INT(%, C_TYPE, _AP_W2, _AP_S2, mod) \
|
| 1426 |
+
OP_BIN_WITH_INT(&, C_TYPE, _AP_W2, _AP_S2, logic) \
|
| 1427 |
+
OP_BIN_WITH_INT(|, C_TYPE, _AP_W2, _AP_S2, logic) \
|
| 1428 |
+
OP_BIN_WITH_INT(^, C_TYPE, _AP_W2, _AP_S2, logic)
|
| 1429 |
+
|
| 1430 |
+
ALL_OP_BIN_WITH_INT(bool, 1, false)
|
| 1431 |
+
ALL_OP_BIN_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 1432 |
+
ALL_OP_BIN_WITH_INT(signed char, 8, true)
|
| 1433 |
+
ALL_OP_BIN_WITH_INT(unsigned char, 8, false)
|
| 1434 |
+
ALL_OP_BIN_WITH_INT(short, _AP_SIZE_short, true)
|
| 1435 |
+
ALL_OP_BIN_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 1436 |
+
ALL_OP_BIN_WITH_INT(int, _AP_SIZE_int, true)
|
| 1437 |
+
ALL_OP_BIN_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 1438 |
+
ALL_OP_BIN_WITH_INT(long, _AP_SIZE_long, true)
|
| 1439 |
+
ALL_OP_BIN_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 1440 |
+
ALL_OP_BIN_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1441 |
+
ALL_OP_BIN_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1442 |
+
|
| 1443 |
+
#undef OP_BIN_WITH_INT
|
| 1444 |
+
#undef ALL_OP_BIN_WITH_INT
|
| 1445 |
+
|
| 1446 |
+
// shift operators.
|
| 1447 |
+
#define ALL_OP_SHIFT_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 1448 |
+
template <int _AP_W, bool _AP_S> \
|
| 1449 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W,_AP_S>::arg1 operator<<( \
|
| 1450 |
+
const ap_int_base<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1451 |
+
ap_int_base<_AP_W, _AP_S> r; \
|
| 1452 |
+
if (_AP_S2) \
|
| 1453 |
+
r.V = op2 >= 0 ? (op.V << op2) : (op.V >> (-op2)); \
|
| 1454 |
+
else \
|
| 1455 |
+
r.V = op.V << op2; \
|
| 1456 |
+
return r; \
|
| 1457 |
+
} \
|
| 1458 |
+
template <int _AP_W, bool _AP_S> \
|
| 1459 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W,_AP_S>::arg1 operator>>( \
|
| 1460 |
+
const ap_int_base<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1461 |
+
ap_int_base<_AP_W, _AP_S> r; \
|
| 1462 |
+
if (_AP_S2) \
|
| 1463 |
+
r.V = op2 >= 0 ? (op.V >> op2) : (op.V << (-op2)); \
|
| 1464 |
+
else \
|
| 1465 |
+
r.V = op.V >> op2; \
|
| 1466 |
+
return r; \
|
| 1467 |
+
}
|
| 1468 |
+
|
| 1469 |
+
ALL_OP_SHIFT_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 1470 |
+
ALL_OP_SHIFT_WITH_INT(signed char, 8, true)
|
| 1471 |
+
ALL_OP_SHIFT_WITH_INT(short, _AP_SIZE_short, true)
|
| 1472 |
+
ALL_OP_SHIFT_WITH_INT(int, _AP_SIZE_int, true)
|
| 1473 |
+
ALL_OP_SHIFT_WITH_INT(long, _AP_SIZE_long, true)
|
| 1474 |
+
ALL_OP_SHIFT_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1475 |
+
|
| 1476 |
+
#undef ALL_OP_SHIFT_WITH_INT
|
| 1477 |
+
|
| 1478 |
+
#define ALL_OP_SHIFT_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 1479 |
+
template <int _AP_W, bool _AP_S> \
|
| 1480 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W,_AP_S>::arg1 operator<<( \
|
| 1481 |
+
const ap_int_base<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1482 |
+
ap_int_base<_AP_W, _AP_S> r; \
|
| 1483 |
+
r.V = op.V << op2; \
|
| 1484 |
+
return r; \
|
| 1485 |
+
} \
|
| 1486 |
+
template <int _AP_W, bool _AP_S> \
|
| 1487 |
+
INLINE typename ap_int_base<_AP_W, _AP_S>::template RType<_AP_W,_AP_S>::arg1 operator>>( \
|
| 1488 |
+
const ap_int_base<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1489 |
+
ap_int_base<_AP_W, _AP_S> r; \
|
| 1490 |
+
r.V = op.V >> op2; \
|
| 1491 |
+
return r; \
|
| 1492 |
+
}
|
| 1493 |
+
ALL_OP_SHIFT_WITH_INT(bool, 1, false)
|
| 1494 |
+
ALL_OP_SHIFT_WITH_INT(unsigned char, 8, false)
|
| 1495 |
+
ALL_OP_SHIFT_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 1496 |
+
ALL_OP_SHIFT_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 1497 |
+
ALL_OP_SHIFT_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 1498 |
+
ALL_OP_SHIFT_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1499 |
+
|
| 1500 |
+
#undef ALL_OP_SHIFT_WITH_INT
|
| 1501 |
+
|
| 1502 |
+
// compound assign operators.
|
| 1503 |
+
#define OP_ASSIGN_WITH_INT(ASSIGN_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 1504 |
+
template <int _AP_W, bool _AP_S> \
|
| 1505 |
+
INLINE ap_int_base<_AP_W, _AP_S>& operator ASSIGN_OP( \
|
| 1506 |
+
ap_int_base<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1507 |
+
return op ASSIGN_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 1508 |
+
}
|
| 1509 |
+
|
| 1510 |
+
// TODO int a; ap_int<16> b; a += b;
|
| 1511 |
+
|
| 1512 |
+
#define ALL_OP_ASSIGN_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 1513 |
+
OP_ASSIGN_WITH_INT(+=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1514 |
+
OP_ASSIGN_WITH_INT(-=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1515 |
+
OP_ASSIGN_WITH_INT(*=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1516 |
+
OP_ASSIGN_WITH_INT(/=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1517 |
+
OP_ASSIGN_WITH_INT(%=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1518 |
+
OP_ASSIGN_WITH_INT(&=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1519 |
+
OP_ASSIGN_WITH_INT(|=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1520 |
+
OP_ASSIGN_WITH_INT(^=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1521 |
+
OP_ASSIGN_WITH_INT(>>=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1522 |
+
OP_ASSIGN_WITH_INT(<<=, C_TYPE, _AP_W2, _AP_S2)
|
| 1523 |
+
|
| 1524 |
+
ALL_OP_ASSIGN_WITH_INT(bool, 1, false)
|
| 1525 |
+
ALL_OP_ASSIGN_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 1526 |
+
ALL_OP_ASSIGN_WITH_INT(signed char, 8, true)
|
| 1527 |
+
ALL_OP_ASSIGN_WITH_INT(unsigned char, 8, false)
|
| 1528 |
+
ALL_OP_ASSIGN_WITH_INT(short, _AP_SIZE_short, true)
|
| 1529 |
+
ALL_OP_ASSIGN_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 1530 |
+
ALL_OP_ASSIGN_WITH_INT(int, _AP_SIZE_int, true)
|
| 1531 |
+
ALL_OP_ASSIGN_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 1532 |
+
ALL_OP_ASSIGN_WITH_INT(long, _AP_SIZE_long, true)
|
| 1533 |
+
ALL_OP_ASSIGN_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 1534 |
+
ALL_OP_ASSIGN_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1535 |
+
ALL_OP_ASSIGN_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1536 |
+
|
| 1537 |
+
#undef OP_ASSIGN_WITH_INT
|
| 1538 |
+
#undef ALL_OP_ASSIGN_WITH_INT
|
| 1539 |
+
|
| 1540 |
+
// equality and relational operators.
|
| 1541 |
+
#define OP_REL_WITH_INT(REL_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 1542 |
+
template <int _AP_W, bool _AP_S> \
|
| 1543 |
+
INLINE bool operator REL_OP(C_TYPE i_op, \
|
| 1544 |
+
const ap_int_base<_AP_W, _AP_S>& op) { \
|
| 1545 |
+
return ap_int_base<_AP_W2, _AP_S2>(i_op) REL_OP op; \
|
| 1546 |
+
} \
|
| 1547 |
+
template <int _AP_W, bool _AP_S> \
|
| 1548 |
+
INLINE bool operator REL_OP(const ap_int_base<_AP_W, _AP_S>& op, \
|
| 1549 |
+
C_TYPE op2) { \
|
| 1550 |
+
return op REL_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 1551 |
+
}
|
| 1552 |
+
|
| 1553 |
+
#define ALL_OP_REL_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
| 1554 |
+
OP_REL_WITH_INT(>, C_TYPE, _AP_W2, _AP_S2) \
|
| 1555 |
+
OP_REL_WITH_INT(<, C_TYPE, _AP_W2, _AP_S2) \
|
| 1556 |
+
OP_REL_WITH_INT(>=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1557 |
+
OP_REL_WITH_INT(<=, C_TYPE, _AP_W2, _AP_S2) \
|
| 1558 |
+
OP_REL_WITH_INT(==, C_TYPE, _AP_W2, _AP_S2) \
|
| 1559 |
+
OP_REL_WITH_INT(!=, C_TYPE, _AP_W2, _AP_S2)
|
| 1560 |
+
|
| 1561 |
+
ALL_OP_REL_WITH_INT(bool, 1, false)
|
| 1562 |
+
ALL_OP_REL_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 1563 |
+
ALL_OP_REL_WITH_INT(signed char, 8, true)
|
| 1564 |
+
ALL_OP_REL_WITH_INT(unsigned char, 8, false)
|
| 1565 |
+
ALL_OP_REL_WITH_INT(short, _AP_SIZE_short, true)
|
| 1566 |
+
ALL_OP_REL_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 1567 |
+
ALL_OP_REL_WITH_INT(int, _AP_SIZE_int, true)
|
| 1568 |
+
ALL_OP_REL_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 1569 |
+
ALL_OP_REL_WITH_INT(long, _AP_SIZE_long, true)
|
| 1570 |
+
ALL_OP_REL_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 1571 |
+
ALL_OP_REL_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1572 |
+
ALL_OP_REL_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1573 |
+
|
| 1574 |
+
#undef OP_REL_WITH_INT
|
| 1575 |
+
#undef ALL_OP_BIN_WITH_INT
|
| 1576 |
+
|
| 1577 |
+
#define OP_REL_WITH_DOUBLE_OR_FLOAT(Sym) \
|
| 1578 |
+
template <int _AP_W, bool _AP_S> \
|
| 1579 |
+
INLINE bool operator Sym(const ap_int_base<_AP_W, _AP_S>& op1, \
|
| 1580 |
+
double op2) { \
|
| 1581 |
+
return op1.to_double() Sym op2 ; \
|
| 1582 |
+
} \
|
| 1583 |
+
template <int _AP_W, bool _AP_S> \
|
| 1584 |
+
INLINE bool operator Sym(double op1, \
|
| 1585 |
+
const ap_int_base<_AP_W, _AP_S>& op2) { \
|
| 1586 |
+
return op1 Sym op2.to_double() ; \
|
| 1587 |
+
} \
|
| 1588 |
+
template <int _AP_W, bool _AP_S> \
|
| 1589 |
+
INLINE bool operator Sym(const ap_int_base<_AP_W, _AP_S>& op1, \
|
| 1590 |
+
float op2) { \
|
| 1591 |
+
return op1.to_double() Sym op2 ; \
|
| 1592 |
+
} \
|
| 1593 |
+
template <int _AP_W, bool _AP_S> \
|
| 1594 |
+
INLINE bool operator Sym(float op1, \
|
| 1595 |
+
const ap_int_base<_AP_W, _AP_S>& op2) { \
|
| 1596 |
+
return op1 Sym op2.to_double() ; \
|
| 1597 |
+
}
|
| 1598 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(>)
|
| 1599 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(<)
|
| 1600 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(>=)
|
| 1601 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(<=)
|
| 1602 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(==)
|
| 1603 |
+
OP_REL_WITH_DOUBLE_OR_FLOAT(!=)
|
| 1604 |
+
|
| 1605 |
+
#undef OP_REL_WITH_DOUBLE_OR_FLOAT
|
| 1606 |
+
|
| 1607 |
+
|
| 1608 |
+
/* Operators with ap_bit_ref.
|
| 1609 |
+
* ------------------------------------------------------------
|
| 1610 |
+
*/
|
| 1611 |
+
// arithmetic, bitwise and shift operators.
|
| 1612 |
+
#define OP_BIN_WITH_RANGE(BIN_OP, RTYPE) \
|
| 1613 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1614 |
+
INLINE typename ap_int_base<_AP_W1, _AP_S1>::template RType<_AP_W2, \
|
| 1615 |
+
_AP_S2>::RTYPE \
|
| 1616 |
+
operator BIN_OP(const ap_range_ref<_AP_W1, _AP_S1>& op1, \
|
| 1617 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1618 |
+
return ap_int_base<_AP_W1, false>(op1) BIN_OP op2; \
|
| 1619 |
+
} \
|
| 1620 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1621 |
+
INLINE typename ap_int_base<_AP_W1, _AP_S1>::template RType<_AP_W2, \
|
| 1622 |
+
_AP_S2>::RTYPE \
|
| 1623 |
+
operator BIN_OP(const ap_int_base<_AP_W1, _AP_S1>& op1, \
|
| 1624 |
+
const ap_range_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1625 |
+
return op1 BIN_OP ap_int_base<_AP_W2, false>(op2); \
|
| 1626 |
+
}
|
| 1627 |
+
|
| 1628 |
+
OP_BIN_WITH_RANGE(+, plus)
|
| 1629 |
+
OP_BIN_WITH_RANGE(-, minus)
|
| 1630 |
+
OP_BIN_WITH_RANGE(*, mult)
|
| 1631 |
+
OP_BIN_WITH_RANGE(/, div)
|
| 1632 |
+
OP_BIN_WITH_RANGE(%, mod)
|
| 1633 |
+
OP_BIN_WITH_RANGE(&, logic)
|
| 1634 |
+
OP_BIN_WITH_RANGE(|, logic)
|
| 1635 |
+
OP_BIN_WITH_RANGE(^, logic)
|
| 1636 |
+
OP_BIN_WITH_RANGE(>>, arg1)
|
| 1637 |
+
OP_BIN_WITH_RANGE(<<, arg1)
|
| 1638 |
+
|
| 1639 |
+
#undef OP_BIN_WITH_RANGE
|
| 1640 |
+
|
| 1641 |
+
// compound assignment operators.
|
| 1642 |
+
#define OP_ASSIGN_WITH_RANGE(ASSIGN_OP) \
|
| 1643 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1644 |
+
INLINE ap_int_base<_AP_W1, _AP_S1>& operator ASSIGN_OP( \
|
| 1645 |
+
ap_int_base<_AP_W1, _AP_S1>& op1, ap_range_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1646 |
+
return op1 ASSIGN_OP ap_int_base<_AP_W2, false>(op2); \
|
| 1647 |
+
} \
|
| 1648 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1649 |
+
INLINE ap_range_ref<_AP_W1, _AP_S1>& operator ASSIGN_OP( \
|
| 1650 |
+
ap_range_ref<_AP_W1, _AP_S1>& op1, ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1651 |
+
ap_int_base<_AP_W1, false> tmp(op1); \
|
| 1652 |
+
tmp ASSIGN_OP op2; \
|
| 1653 |
+
op1 = tmp; \
|
| 1654 |
+
return op1; \
|
| 1655 |
+
}
|
| 1656 |
+
|
| 1657 |
+
OP_ASSIGN_WITH_RANGE(+=)
|
| 1658 |
+
OP_ASSIGN_WITH_RANGE(-=)
|
| 1659 |
+
OP_ASSIGN_WITH_RANGE(*=)
|
| 1660 |
+
OP_ASSIGN_WITH_RANGE(/=)
|
| 1661 |
+
OP_ASSIGN_WITH_RANGE(%=)
|
| 1662 |
+
OP_ASSIGN_WITH_RANGE(&=)
|
| 1663 |
+
OP_ASSIGN_WITH_RANGE(|=)
|
| 1664 |
+
OP_ASSIGN_WITH_RANGE(^=)
|
| 1665 |
+
OP_ASSIGN_WITH_RANGE(>>=)
|
| 1666 |
+
OP_ASSIGN_WITH_RANGE(<<=)
|
| 1667 |
+
|
| 1668 |
+
#undef OP_ASSIGN_WITH_RANGE
|
| 1669 |
+
|
| 1670 |
+
// equality and relational operators
|
| 1671 |
+
#define OP_REL_WITH_RANGE(REL_OP) \
|
| 1672 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1673 |
+
INLINE bool operator REL_OP(const ap_range_ref<_AP_W1, _AP_S1>& op1, \
|
| 1674 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1675 |
+
return ap_int_base<_AP_W1, false>(op1).operator REL_OP(op2); \
|
| 1676 |
+
} \
|
| 1677 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1678 |
+
INLINE bool operator REL_OP(const ap_int_base<_AP_W1, _AP_S1>& op1, \
|
| 1679 |
+
const ap_range_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1680 |
+
return op1.operator REL_OP(op2.operator ap_int_base<_AP_W2, false>()); \
|
| 1681 |
+
}
|
| 1682 |
+
|
| 1683 |
+
OP_REL_WITH_RANGE(==)
|
| 1684 |
+
OP_REL_WITH_RANGE(!=)
|
| 1685 |
+
OP_REL_WITH_RANGE(>)
|
| 1686 |
+
OP_REL_WITH_RANGE(>=)
|
| 1687 |
+
OP_REL_WITH_RANGE(<)
|
| 1688 |
+
OP_REL_WITH_RANGE(<=)
|
| 1689 |
+
|
| 1690 |
+
#undef OP_REL_WITH_RANGE
|
| 1691 |
+
|
| 1692 |
+
/* Operators with ap_bit_ref.
|
| 1693 |
+
* ------------------------------------------------------------
|
| 1694 |
+
*/
|
| 1695 |
+
// arithmetic, bitwise and shift operators.
|
| 1696 |
+
#define OP_BIN_WITH_BIT(BIN_OP, RTYPE) \
|
| 1697 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1698 |
+
INLINE typename ap_int_base<_AP_W1, _AP_S1>::template RType<1, false>::RTYPE \
|
| 1699 |
+
operator BIN_OP(const ap_int_base<_AP_W1, _AP_S1>& op1, \
|
| 1700 |
+
const ap_bit_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1701 |
+
return op1 BIN_OP ap_int_base<1, false>(op2); \
|
| 1702 |
+
} \
|
| 1703 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1704 |
+
INLINE typename ap_int_base<1, false>::template RType<_AP_W2, _AP_S2>::RTYPE \
|
| 1705 |
+
operator BIN_OP(const ap_bit_ref<_AP_W1, _AP_S1>& op1, \
|
| 1706 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1707 |
+
return ap_int_base<1, false>(op1) BIN_OP op2; \
|
| 1708 |
+
}
|
| 1709 |
+
|
| 1710 |
+
OP_BIN_WITH_BIT(+, plus)
|
| 1711 |
+
OP_BIN_WITH_BIT(-, minus)
|
| 1712 |
+
OP_BIN_WITH_BIT(*, mult)
|
| 1713 |
+
OP_BIN_WITH_BIT(/, div)
|
| 1714 |
+
OP_BIN_WITH_BIT(%, mod)
|
| 1715 |
+
OP_BIN_WITH_BIT(&, logic)
|
| 1716 |
+
OP_BIN_WITH_BIT(|, logic)
|
| 1717 |
+
OP_BIN_WITH_BIT(^, logic)
|
| 1718 |
+
OP_BIN_WITH_BIT(>>, arg1)
|
| 1719 |
+
OP_BIN_WITH_BIT(<<, arg1)
|
| 1720 |
+
|
| 1721 |
+
#undef OP_BIN_WITH_BIT
|
| 1722 |
+
|
| 1723 |
+
// compound assignment operators.
|
| 1724 |
+
#define OP_ASSIGN_WITH_BIT(ASSIGN_OP) \
|
| 1725 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1726 |
+
INLINE ap_int_base<_AP_W1, _AP_S1>& operator ASSIGN_OP( \
|
| 1727 |
+
ap_int_base<_AP_W1, _AP_S1>& op1, ap_bit_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1728 |
+
return op1 ASSIGN_OP ap_int_base<1, false>(op2); \
|
| 1729 |
+
} \
|
| 1730 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1731 |
+
INLINE ap_bit_ref<_AP_W1, _AP_S1>& operator ASSIGN_OP( \
|
| 1732 |
+
ap_bit_ref<_AP_W1, _AP_S1>& op1, ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1733 |
+
ap_int_base<1, false> tmp(op1); \
|
| 1734 |
+
tmp ASSIGN_OP op2; \
|
| 1735 |
+
op1 = tmp; \
|
| 1736 |
+
return op1; \
|
| 1737 |
+
}
|
| 1738 |
+
|
| 1739 |
+
OP_ASSIGN_WITH_BIT(+=)
|
| 1740 |
+
OP_ASSIGN_WITH_BIT(-=)
|
| 1741 |
+
OP_ASSIGN_WITH_BIT(*=)
|
| 1742 |
+
OP_ASSIGN_WITH_BIT(/=)
|
| 1743 |
+
OP_ASSIGN_WITH_BIT(%=)
|
| 1744 |
+
OP_ASSIGN_WITH_BIT(&=)
|
| 1745 |
+
OP_ASSIGN_WITH_BIT(|=)
|
| 1746 |
+
OP_ASSIGN_WITH_BIT(^=)
|
| 1747 |
+
OP_ASSIGN_WITH_BIT(>>=)
|
| 1748 |
+
OP_ASSIGN_WITH_BIT(<<=)
|
| 1749 |
+
|
| 1750 |
+
#undef OP_ASSIGN_WITH_BIT
|
| 1751 |
+
|
| 1752 |
+
// equality and relational operators.
|
| 1753 |
+
#define OP_REL_WITH_BIT(REL_OP) \
|
| 1754 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1755 |
+
INLINE bool operator REL_OP(const ap_int_base<_AP_W1, _AP_S1>& op1, \
|
| 1756 |
+
const ap_bit_ref<_AP_W2, _AP_S2>& op2) { \
|
| 1757 |
+
return op1 REL_OP ap_int_base<1, false>(op2); \
|
| 1758 |
+
} \
|
| 1759 |
+
template <int _AP_W1, bool _AP_S1, int _AP_W2, bool _AP_S2> \
|
| 1760 |
+
INLINE bool operator REL_OP(const ap_bit_ref<_AP_W1, _AP_S1>& op1, \
|
| 1761 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
| 1762 |
+
return ap_int_base<1, false>(op1) REL_OP op2; \
|
| 1763 |
+
}
|
| 1764 |
+
|
| 1765 |
+
OP_REL_WITH_BIT(==)
|
| 1766 |
+
OP_REL_WITH_BIT(!=)
|
| 1767 |
+
OP_REL_WITH_BIT(>)
|
| 1768 |
+
OP_REL_WITH_BIT(>=)
|
| 1769 |
+
OP_REL_WITH_BIT(<)
|
| 1770 |
+
OP_REL_WITH_BIT(<=)
|
| 1771 |
+
|
| 1772 |
+
#undef OP_REL_WITH_BIT
|
| 1773 |
+
|
| 1774 |
+
|
| 1775 |
+
/* Operators with ap_concat_ref.
|
| 1776 |
+
* ------------------------------------------------------------
|
| 1777 |
+
*/
|
| 1778 |
+
// arithmetic, bitwise and shift operators.
|
| 1779 |
+
// bitwise operators are defined in struct.
|
| 1780 |
+
// TODO specify whether to define arithmetic and bitwise operators.
|
| 1781 |
+
#if 0
|
| 1782 |
+
#define OP_BIN_WITH_CONCAT(BIN_OP, RTYPE) \
|
| 1783 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1784 |
+
int _AP_W3, bool _AP_S3> \
|
| 1785 |
+
INLINE typename ap_int_base<_AP_W3, _AP_S3>::template RType<_AP_W1 + _AP_W2, \
|
| 1786 |
+
false>::RTYPE \
|
| 1787 |
+
operator BIN_OP(const ap_int_base<_AP_W3, _AP_S3>& op1, \
|
| 1788 |
+
const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op2) { \
|
| 1789 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1790 |
+
return op1 BIN_OP op2.get(); \
|
| 1791 |
+
} \
|
| 1792 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1793 |
+
int _AP_W3, bool _AP_S3> \
|
| 1794 |
+
INLINE typename ap_int_base<_AP_W1 + _AP_W2, \
|
| 1795 |
+
false>::template RType<_AP_W3, _AP_S3>::RTYPE \
|
| 1796 |
+
operator BIN_OP(const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op1, \
|
| 1797 |
+
const ap_int_base<_AP_W3, _AP_S3>& op2) { \
|
| 1798 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1799 |
+
return op1.get() BIN_OP op2; \
|
| 1800 |
+
}
|
| 1801 |
+
|
| 1802 |
+
OP_BIN_WITH_CONCAT(+, plus)
|
| 1803 |
+
OP_BIN_WITH_CONCAT(-, minus)
|
| 1804 |
+
OP_BIN_WITH_CONCAT(*, mult)
|
| 1805 |
+
OP_BIN_WITH_CONCAT(/, div)
|
| 1806 |
+
OP_BIN_WITH_CONCAT(%, mod)
|
| 1807 |
+
OP_BIN_WITH_CONCAT(&, logic)
|
| 1808 |
+
OP_BIN_WITH_CONCAT(|, logic)
|
| 1809 |
+
OP_BIN_WITH_CONCAT(^, logic)
|
| 1810 |
+
OP_BIN_WITH_CONCAT(>>, arg1)
|
| 1811 |
+
OP_BIN_WITH_CONCAT(<<, arg1)
|
| 1812 |
+
|
| 1813 |
+
#undef OP_BIN_WITH_CONCAT
|
| 1814 |
+
|
| 1815 |
+
// compound assignment operators.
|
| 1816 |
+
#define OP_ASSIGN_WITH_CONCAT(ASSIGN_OP) \
|
| 1817 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1818 |
+
int _AP_W3, bool _AP_S3> \
|
| 1819 |
+
INLINE typename ap_int_base<_AP_W3, _AP_S3>::template RType<_AP_W1 + _AP_W2, \
|
| 1820 |
+
false>::RTYPE \
|
| 1821 |
+
operator ASSIGN_OP( \
|
| 1822 |
+
const ap_int_base<_AP_W3, _AP_S3>& op1, \
|
| 1823 |
+
const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op2) { \
|
| 1824 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1825 |
+
return op1 ASSIGN_OP op2.get(); \
|
| 1826 |
+
} \
|
| 1827 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1828 |
+
int _AP_W3, bool _AP_S3> \
|
| 1829 |
+
INLINE typename ap_int_base<_AP_W1 + _AP_W2, \
|
| 1830 |
+
false>::template RType<_AP_W3, _AP_S3>::RTYPE \
|
| 1831 |
+
operator ASSIGN_OP(const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op1, \
|
| 1832 |
+
const ap_int_base<_AP_W3, _AP_S3>& op2) { \
|
| 1833 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1834 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmp = op1.get(); \
|
| 1835 |
+
tmp ASSIGN_OP op2; \
|
| 1836 |
+
op1 = tmp; \
|
| 1837 |
+
return op1; \
|
| 1838 |
+
}
|
| 1839 |
+
|
| 1840 |
+
OP_ASSIGN_WITH_CONCAT(+=)
|
| 1841 |
+
OP_ASSIGN_WITH_CONCAT(-=)
|
| 1842 |
+
OP_ASSIGN_WITH_CONCAT(*=)
|
| 1843 |
+
OP_ASSIGN_WITH_CONCAT(/=)
|
| 1844 |
+
OP_ASSIGN_WITH_CONCAT(%=)
|
| 1845 |
+
OP_ASSIGN_WITH_CONCAT(&=)
|
| 1846 |
+
OP_ASSIGN_WITH_CONCAT(|=)
|
| 1847 |
+
OP_ASSIGN_WITH_CONCAT(^=)
|
| 1848 |
+
OP_ASSIGN_WITH_CONCAT(>>=)
|
| 1849 |
+
OP_ASSIGN_WITH_CONCAT(<<=)
|
| 1850 |
+
|
| 1851 |
+
#undef OP_ASSIGN_WITH_CONCAT
|
| 1852 |
+
#endif
|
| 1853 |
+
|
| 1854 |
+
// equality and relational operators.
|
| 1855 |
+
#define OP_REL_WITH_CONCAT(REL_OP) \
|
| 1856 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1857 |
+
int _AP_W3, bool _AP_S3> \
|
| 1858 |
+
INLINE bool operator REL_OP( \
|
| 1859 |
+
const ap_int_base<_AP_W3, _AP_S3>& op1, \
|
| 1860 |
+
const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op2) { \
|
| 1861 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1862 |
+
return op1 REL_OP op2.get(); \
|
| 1863 |
+
} \
|
| 1864 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2, \
|
| 1865 |
+
int _AP_W3, bool _AP_S3> \
|
| 1866 |
+
INLINE bool operator REL_OP( \
|
| 1867 |
+
const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& op1, \
|
| 1868 |
+
const ap_int_base<_AP_W3, _AP_S3>& op2) { \
|
| 1869 |
+
/* convert ap_concat_ref to ap_int_base */ \
|
| 1870 |
+
return op1.get() REL_OP op2; \
|
| 1871 |
+
}
|
| 1872 |
+
|
| 1873 |
+
OP_REL_WITH_CONCAT(==)
|
| 1874 |
+
OP_REL_WITH_CONCAT(!=)
|
| 1875 |
+
OP_REL_WITH_CONCAT(>)
|
| 1876 |
+
OP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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_INT_REF_H__
|
| 18 |
+
#define __AP_INT_REF_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_INT_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifndef __cplusplus
|
| 25 |
+
#error "C++ is required to include this header file"
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
|
| 29 |
+
#ifndef __SYNTHESIS__
|
| 30 |
+
#include <iostream>
|
| 31 |
+
#endif
|
| 32 |
+
|
| 33 |
+
/* Concatination reference.
|
| 34 |
+
----------------------------------------------------------------
|
| 35 |
+
*/
|
| 36 |
+
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2>
|
| 37 |
+
struct ap_concat_ref {
|
| 38 |
+
enum {
|
| 39 |
+
_AP_WR = _AP_W1 + _AP_W2,
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
_AP_T1& mbv1;
|
| 43 |
+
_AP_T2& mbv2;
|
| 44 |
+
|
| 45 |
+
INLINE ap_concat_ref(const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& ref)
|
| 46 |
+
: mbv1(ref.mbv1), mbv2(ref.mbv2) {}
|
| 47 |
+
|
| 48 |
+
INLINE ap_concat_ref(_AP_T1& bv1, _AP_T2& bv2) : mbv1(bv1), mbv2(bv2) {}
|
| 49 |
+
|
| 50 |
+
template <int _AP_W3, bool _AP_S3>
|
| 51 |
+
INLINE ap_concat_ref& operator=(const ap_int_base<_AP_W3, _AP_S3>& val) {
|
| 52 |
+
ap_int_base<_AP_W1 + _AP_W2, false> vval(val);
|
| 53 |
+
int W_ref1 = mbv1.length();
|
| 54 |
+
int W_ref2 = mbv2.length();
|
| 55 |
+
ap_int_base<_AP_W1, false> Part1;
|
| 56 |
+
Part1.V = _AP_ROOT_op_get_range(vval.V, W_ref2, W_ref1 + W_ref2 - 1);
|
| 57 |
+
mbv1.set(Part1);
|
| 58 |
+
ap_int_base<_AP_W2, false> Part2;
|
| 59 |
+
Part2.V = _AP_ROOT_op_get_range(vval.V, 0, W_ref2 - 1);
|
| 60 |
+
mbv2.set(Part2);
|
| 61 |
+
return *this;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
// assign op from hls supported C integral types.
|
| 65 |
+
// FIXME disabled to support legacy code directly assign from sc_signal<T>
|
| 66 |
+
//template <typename T>
|
| 67 |
+
//INLINE typename _ap_type::enable_if<_ap_type::is_integral<T>::value,
|
| 68 |
+
// ap_concat_ref&>::type
|
| 69 |
+
//operator=(T val) {
|
| 70 |
+
// ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val);
|
| 71 |
+
// return operator=(tmpVal);
|
| 72 |
+
//}
|
| 73 |
+
#define ASSIGN_WITH_CTYPE(_Tp) \
|
| 74 |
+
INLINE ap_concat_ref& operator=(_Tp val) { \
|
| 75 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val); \
|
| 76 |
+
return operator=(tmpVal); \
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
ASSIGN_WITH_CTYPE(bool)
|
| 80 |
+
ASSIGN_WITH_CTYPE(char)
|
| 81 |
+
ASSIGN_WITH_CTYPE(signed char)
|
| 82 |
+
ASSIGN_WITH_CTYPE(unsigned char)
|
| 83 |
+
ASSIGN_WITH_CTYPE(short)
|
| 84 |
+
ASSIGN_WITH_CTYPE(unsigned short)
|
| 85 |
+
ASSIGN_WITH_CTYPE(int)
|
| 86 |
+
ASSIGN_WITH_CTYPE(unsigned int)
|
| 87 |
+
ASSIGN_WITH_CTYPE(long)
|
| 88 |
+
ASSIGN_WITH_CTYPE(unsigned long)
|
| 89 |
+
ASSIGN_WITH_CTYPE(ap_slong)
|
| 90 |
+
ASSIGN_WITH_CTYPE(ap_ulong)
|
| 91 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 92 |
+
ASSIGN_WITH_CTYPE(half)
|
| 93 |
+
#endif
|
| 94 |
+
ASSIGN_WITH_CTYPE(float)
|
| 95 |
+
ASSIGN_WITH_CTYPE(double)
|
| 96 |
+
|
| 97 |
+
#undef ASSIGN_WITH_CTYPE
|
| 98 |
+
|
| 99 |
+
// Be explicit to prevent it from being deleted, as field d_bv
|
| 100 |
+
// is of reference type.
|
| 101 |
+
INLINE ap_concat_ref& operator=(
|
| 102 |
+
const ap_concat_ref<_AP_W1, _AP_T1, _AP_W2, _AP_T2>& val) {
|
| 103 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val);
|
| 104 |
+
return operator=(tmpVal);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
template <int _AP_W3, typename _AP_T3, int _AP_W4, typename _AP_T4>
|
| 108 |
+
INLINE ap_concat_ref& operator=(
|
| 109 |
+
const ap_concat_ref<_AP_W3, _AP_T3, _AP_W4, _AP_T4>& val) {
|
| 110 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val);
|
| 111 |
+
return operator=(tmpVal);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
template <int _AP_W3, bool _AP_S3>
|
| 115 |
+
INLINE ap_concat_ref& operator=(const ap_bit_ref<_AP_W3, _AP_S3>& val) {
|
| 116 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val);
|
| 117 |
+
return operator=(tmpVal);
|
| 118 |
+
}
|
| 119 |
+
template <int _AP_W3, bool _AP_S3>
|
| 120 |
+
INLINE ap_concat_ref& operator=(const ap_range_ref<_AP_W3, _AP_S3>& val) {
|
| 121 |
+
ap_int_base<_AP_W1 + _AP_W2, false> tmpVal(val);
|
| 122 |
+
return operator=(tmpVal);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
template <int _AP_W3, int _AP_I3, bool _AP_S3, ap_q_mode _AP_Q3,
|
| 126 |
+
ap_o_mode _AP_O3, int _AP_N3>
|
| 127 |
+
INLINE ap_concat_ref& operator=(
|
| 128 |
+
const af_range_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>& val) {
|
| 129 |
+
return operator=((const ap_int_base<_AP_W3, false>)(val));
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
template <int _AP_W3, int _AP_I3, bool _AP_S3, ap_q_mode _AP_Q3,
|
| 133 |
+
ap_o_mode _AP_O3, int _AP_N3>
|
| 134 |
+
INLINE ap_concat_ref& operator=(
|
| 135 |
+
const ap_fixed_base<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>&
|
| 136 |
+
val) {
|
| 137 |
+
return operator=(val.to_ap_int_base());
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
template <int _AP_W3, int _AP_I3, bool _AP_S3, ap_q_mode _AP_Q3,
|
| 141 |
+
ap_o_mode _AP_O3, int _AP_N3>
|
| 142 |
+
INLINE ap_concat_ref& operator=(
|
| 143 |
+
const af_bit_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>& val) {
|
| 144 |
+
return operator=((ap_ulong)(bool)(val));
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
INLINE operator ap_int_base<_AP_WR, false>() const { return get(); }
|
| 148 |
+
|
| 149 |
+
INLINE operator ap_ulong() const { return get().to_uint64(); }
|
| 150 |
+
|
| 151 |
+
template <int _AP_W3, bool _AP_S3>
|
| 152 |
+
INLINE ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 153 |
+
ap_range_ref<_AP_W3, _AP_S3> >
|
| 154 |
+
operator,(const ap_range_ref<_AP_W3, _AP_S3> &a2) {
|
| 155 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 156 |
+
ap_range_ref<_AP_W3, _AP_S3> >(
|
| 157 |
+
*this, const_cast<ap_range_ref<_AP_W3, _AP_S3>&>(a2));
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
template <int _AP_W3, bool _AP_S3>
|
| 161 |
+
INLINE
|
| 162 |
+
ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3, ap_int_base<_AP_W3, _AP_S3> >
|
| 163 |
+
operator,(ap_int_base<_AP_W3, _AP_S3> &a2) {
|
| 164 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 165 |
+
ap_int_base<_AP_W3, _AP_S3> >(*this, a2);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
template <int _AP_W3, bool _AP_S3>
|
| 169 |
+
INLINE
|
| 170 |
+
ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3, ap_int_base<_AP_W3, _AP_S3> >
|
| 171 |
+
operator,(volatile ap_int_base<_AP_W3, _AP_S3> &a2) {
|
| 172 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 173 |
+
ap_int_base<_AP_W3, _AP_S3> >(
|
| 174 |
+
*this, const_cast<ap_int_base<_AP_W3, _AP_S3>&>(a2));
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
template <int _AP_W3, bool _AP_S3>
|
| 178 |
+
INLINE
|
| 179 |
+
ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3, ap_int_base<_AP_W3, _AP_S3> >
|
| 180 |
+
operator,(const ap_int_base<_AP_W3, _AP_S3> &a2) {
|
| 181 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 182 |
+
ap_int_base<_AP_W3, _AP_S3> >(
|
| 183 |
+
*this, const_cast<ap_int_base<_AP_W3, _AP_S3>&>(a2));
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
template <int _AP_W3, bool _AP_S3>
|
| 187 |
+
INLINE
|
| 188 |
+
ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3, ap_int_base<_AP_W3, _AP_S3> >
|
| 189 |
+
operator,(const volatile ap_int_base<_AP_W3, _AP_S3> &a2) {
|
| 190 |
+
// FIXME op's life does not seem long enough
|
| 191 |
+
ap_int_base<_AP_W3, _AP_S3> op(a2);
|
| 192 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3,
|
| 193 |
+
ap_int_base<_AP_W3, _AP_S3> >(
|
| 194 |
+
*this, const_cast<ap_int_base<_AP_W3, _AP_S3>&>(op));
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
template <int _AP_W3, bool _AP_S3>
|
| 198 |
+
INLINE ap_concat_ref<_AP_WR, ap_concat_ref, 1, ap_bit_ref<_AP_W3, _AP_S3> >
|
| 199 |
+
operator,(const ap_bit_ref<_AP_W3, _AP_S3> &a2) {
|
| 200 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, 1, ap_bit_ref<_AP_W3, _AP_S3> >(
|
| 201 |
+
*this, const_cast<ap_bit_ref<_AP_W3, _AP_S3>&>(a2));
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
template <int _AP_W3, typename _AP_T3, int _AP_W4, typename _AP_T4>
|
| 205 |
+
INLINE ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3 + _AP_W4,
|
| 206 |
+
ap_concat_ref<_AP_W3, _AP_T3, _AP_W4, _AP_T4> >
|
| 207 |
+
operator,(const ap_concat_ref<_AP_W3, _AP_T3, _AP_W4, _AP_T4> &a2) {
|
| 208 |
+
return ap_concat_ref<_AP_WR, ap_concat_ref, _AP_W3 + _AP_W4,
|
| 209 |
+
ap_concat_ref<_AP_W3, _AP_T3, _AP_W4, _AP_T4> >(
|
| 210 |
+
*this, const_cast<ap_concat_ref<_AP_W3, _AP_T3, _AP_W4, _AP_T4>&>(a2));
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
template <int _AP_W3, int _AP_I3, bool _AP_S3, ap_q_mode _AP_Q3,
|
| 214 |
+
ap_o_mode _AP_O3, int _AP_N3>
|
| 215 |
+
INLINE ap_concat_ref<
|
| 216 |
+
_AP_WR, ap_concat_ref, _AP_W3,
|
| 217 |
+
af_range_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3> >
|
| 218 |
+
operator,(
|
| 219 |
+
const af_range_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3> &a2) {
|
| 220 |
+
return ap_concat_ref<
|
| 221 |
+
_AP_WR, ap_concat_ref, _AP_W3,
|
| 222 |
+
af_range_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3> >(
|
| 223 |
+
*this,
|
| 224 |
+
const_cast<
|
| 225 |
+
af_range_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>&>(a2));
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
template <int _AP_W3, int _AP_I3, bool _AP_S3, ap_q_mode _AP_Q3,
|
| 229 |
+
ap_o_mode _AP_O3, int _AP_N3>
|
| 230 |
+
INLINE
|
| 231 |
+
ap_concat_ref<_AP_WR, ap_concat_ref, 1,
|
| 232 |
+
af_bit_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3> >
|
| 233 |
+
operator,(const af_bit_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>
|
| 234 |
+
&a2) {
|
| 235 |
+
return ap_concat_ref<
|
| 236 |
+
_AP_WR, ap_concat_ref, 1,
|
| 237 |
+
af_bit_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3> >(
|
| 238 |
+
*this,
|
| 239 |
+
const_cast<af_bit_ref<_AP_W3, _AP_I3, _AP_S3, _AP_Q3, _AP_O3, _AP_N3>&>(
|
| 240 |
+
a2));
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
template <int _AP_W3, bool _AP_S3>
|
| 244 |
+
INLINE ap_int_base<AP_MAX(_AP_WR, _AP_W3), _AP_S3> operator&(
|
| 245 |
+
const ap_int_base<_AP_W3, _AP_S3>& a2) {
|
| 246 |
+
return get() & a2;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
template <int _AP_W3, bool _AP_S3>
|
| 250 |
+
INLINE ap_int_base<AP_MAX(_AP_WR, _AP_W3), _AP_S3> operator|(
|
| 251 |
+
const ap_int_base<_AP_W3, _AP_S3>& a2) {
|
| 252 |
+
return get() | a2;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
template <int _AP_W3, bool _AP_S3>
|
| 256 |
+
INLINE ap_int_base<AP_MAX(_AP_WR, _AP_W3), _AP_S3> operator^(
|
| 257 |
+
const ap_int_base<_AP_W3, _AP_S3>& a2) {
|
| 258 |
+
return get() ^ a2;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
#if 0
|
| 262 |
+
template<int Hi, int Lo>
|
| 263 |
+
INLINE ap_int_base<Hi-Lo+1, false> slice() {
|
| 264 |
+
ap_int_base<_AP_WR, false> bv = get();
|
| 265 |
+
return bv.slice<Hi,Lo>();
|
| 266 |
+
}
|
| 267 |
+
#endif
|
| 268 |
+
|
| 269 |
+
INLINE ap_int_base<_AP_WR, false> get() const {
|
| 270 |
+
ap_int_base<_AP_WR, false> tmpVal(0);
|
| 271 |
+
int W_ref1 = mbv1.length();
|
| 272 |
+
int W_ref2 = mbv2.length();
|
| 273 |
+
ap_int_base<_AP_W2, false> v2(mbv2);
|
| 274 |
+
ap_int_base<_AP_W1, false> v1(mbv1);
|
| 275 |
+
tmpVal.V = _AP_ROOT_op_set_range(tmpVal.V, 0, W_ref2 - 1, v2.V);
|
| 276 |
+
tmpVal.V =
|
| 277 |
+
_AP_ROOT_op_set_range(tmpVal.V, W_ref2, W_ref1 + W_ref2 - 1, v1.V);
|
| 278 |
+
return tmpVal;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
template <int _AP_W3>
|
| 282 |
+
INLINE void set(const ap_int_base<_AP_W3, false>& val) {
|
| 283 |
+
ap_int_base<_AP_W1 + _AP_W2, false> vval(val);
|
| 284 |
+
int W_ref1 = mbv1.length();
|
| 285 |
+
int W_ref2 = mbv2.length();
|
| 286 |
+
ap_int_base<_AP_W1, false> tmpVal1;
|
| 287 |
+
tmpVal1.V = _AP_ROOT_op_get_range(vval.V, W_ref2, W_ref1 + W_ref2 - 1);
|
| 288 |
+
mbv1.set(tmpVal1);
|
| 289 |
+
ap_int_base<_AP_W2, false> tmpVal2;
|
| 290 |
+
tmpVal2.V = _AP_ROOT_op_get_range(vval.V, 0, W_ref2 - 1);
|
| 291 |
+
mbv2.set(tmpVal2);
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
INLINE int length() const { return mbv1.length() + mbv2.length(); }
|
| 295 |
+
}; // struct ap_concat_ref
|
| 296 |
+
|
| 297 |
+
/* Range (slice) reference.
|
| 298 |
+
----------------------------------------------------------------
|
| 299 |
+
*/
|
| 300 |
+
template <int _AP_W, bool _AP_S>
|
| 301 |
+
struct ap_range_ref {
|
| 302 |
+
// struct ssdm_int or its sim model.
|
| 303 |
+
// TODO make it possible to reference to ap_fixed_base/ap_fixed/ap_ufixed
|
| 304 |
+
// and then we can retire af_range_ref.
|
| 305 |
+
typedef ap_int_base<_AP_W, _AP_S> ref_type;
|
| 306 |
+
ref_type& d_bv;
|
| 307 |
+
int l_index;
|
| 308 |
+
int h_index;
|
| 309 |
+
|
| 310 |
+
public:
|
| 311 |
+
INLINE ap_range_ref(const ap_range_ref<_AP_W, _AP_S>& ref)
|
| 312 |
+
: d_bv(ref.d_bv), l_index(ref.l_index), h_index(ref.h_index) {}
|
| 313 |
+
|
| 314 |
+
INLINE ap_range_ref(ref_type* bv, int h, int l)
|
| 315 |
+
: d_bv(*bv), l_index(l), h_index(h) {}
|
| 316 |
+
|
| 317 |
+
INLINE ap_range_ref(const ref_type* bv, int h, int l)
|
| 318 |
+
: d_bv(*const_cast<ref_type*>(bv)), l_index(l), h_index(h) {}
|
| 319 |
+
|
| 320 |
+
INLINE operator ap_int_base<_AP_W, false>() const {
|
| 321 |
+
ap_int_base<_AP_W, false> ret;
|
| 322 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 323 |
+
return ret;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
INLINE operator ap_ulong() const { return to_uint64(); }
|
| 327 |
+
|
| 328 |
+
/// @name assign operators
|
| 329 |
+
// @{
|
| 330 |
+
|
| 331 |
+
// FIXME disabled to work-around lagacy code assigning from sc_signal<T>,
|
| 332 |
+
// which dependes on implicit type conversion.
|
| 333 |
+
//
|
| 334 |
+
// /// assign from hls supported C integral types.
|
| 335 |
+
// template <typename T>
|
| 336 |
+
// INLINE typename _ap_type::enable_if<_ap_type::is_integral<T>::value,
|
| 337 |
+
// ap_range_ref&>::type
|
| 338 |
+
// operator=(T val) {
|
| 339 |
+
// ap_int_base<_AP_W, false> tmp(val);
|
| 340 |
+
// d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V);
|
| 341 |
+
// return *this;
|
| 342 |
+
// }
|
| 343 |
+
#define ASSIGN_WITH_CTYPE(_Tp) \
|
| 344 |
+
INLINE ap_range_ref& operator=(_Tp val) { \
|
| 345 |
+
ap_int_base<_AP_W, false> tmp(val); \
|
| 346 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V); \
|
| 347 |
+
return *this; \
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
ASSIGN_WITH_CTYPE(bool)
|
| 351 |
+
ASSIGN_WITH_CTYPE(char)
|
| 352 |
+
ASSIGN_WITH_CTYPE(signed char)
|
| 353 |
+
ASSIGN_WITH_CTYPE(unsigned char)
|
| 354 |
+
ASSIGN_WITH_CTYPE(short)
|
| 355 |
+
ASSIGN_WITH_CTYPE(unsigned short)
|
| 356 |
+
ASSIGN_WITH_CTYPE(int)
|
| 357 |
+
ASSIGN_WITH_CTYPE(unsigned int)
|
| 358 |
+
ASSIGN_WITH_CTYPE(long)
|
| 359 |
+
ASSIGN_WITH_CTYPE(unsigned long)
|
| 360 |
+
ASSIGN_WITH_CTYPE(ap_slong)
|
| 361 |
+
ASSIGN_WITH_CTYPE(ap_ulong)
|
| 362 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 363 |
+
ASSIGN_WITH_CTYPE(half)
|
| 364 |
+
#endif
|
| 365 |
+
ASSIGN_WITH_CTYPE(float)
|
| 366 |
+
ASSIGN_WITH_CTYPE(double)
|
| 367 |
+
|
| 368 |
+
#undef ASSIGN_WITH_CTYPE
|
| 369 |
+
|
| 370 |
+
/// assign using string. XXX crucial for cosim.
|
| 371 |
+
INLINE ap_range_ref& operator=(const char* val) {
|
| 372 |
+
const ap_int_base<_AP_W, false> tmp(val); // XXX figure out radix
|
| 373 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V);
|
| 374 |
+
return *this;
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
/// assign from ap_int_base.
|
| 378 |
+
template <int _AP_W2, bool _AP_S2>
|
| 379 |
+
INLINE ap_range_ref& operator=(const ap_int_base<_AP_W2, _AP_S2>& val) {
|
| 380 |
+
ap_int_base<_AP_W, false> tmp(val);
|
| 381 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V);
|
| 382 |
+
return *this;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
/// copy assign operator
|
| 386 |
+
// XXX Be explicit to prevent it from being deleted, as field d_bv
|
| 387 |
+
// is of reference type.
|
| 388 |
+
INLINE ap_range_ref& operator=(const ap_range_ref& val) {
|
| 389 |
+
return operator=((const ap_int_base<_AP_W, false>)val);
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
/// assign from range reference to ap_int_base.
|
| 393 |
+
template <int _AP_W2, bool _AP_S2>
|
| 394 |
+
INLINE ap_range_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
| 395 |
+
return operator=((const ap_int_base<_AP_W2, false>)val);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
/// assign from bit reference to ap_int_base.
|
| 399 |
+
template <int _AP_W2, bool _AP_S2>
|
| 400 |
+
INLINE ap_range_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
| 401 |
+
return operator=((ap_ulong)(bool)(val));
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
/// assign from ap_fixed_base.
|
| 405 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 406 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 407 |
+
INLINE ap_range_ref& operator=(
|
| 408 |
+
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
| 409 |
+
val) {
|
| 410 |
+
return operator=(val.to_ap_int_base());
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
/// assign from range reference to ap_fixed_base.
|
| 414 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 415 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 416 |
+
INLINE ap_range_ref& operator=(
|
| 417 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 418 |
+
return operator=((const ap_int_base<_AP_W2, false>)val);
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
/// assign from bit reference to ap_fixed_base.
|
| 422 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 423 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 424 |
+
INLINE ap_range_ref& operator=(
|
| 425 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 426 |
+
return operator=((ap_ulong)(bool)(val));
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/// assign from compound reference.
|
| 430 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 431 |
+
INLINE ap_range_ref& operator=(
|
| 432 |
+
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
| 433 |
+
return operator=((const ap_int_base<_AP_W2 + _AP_W3, false>)(val));
|
| 434 |
+
}
|
| 435 |
+
// @}
|
| 436 |
+
|
| 437 |
+
template <int _AP_W2, bool _AP_S2>
|
| 438 |
+
INLINE
|
| 439 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 440 |
+
operator,(const ap_range_ref<_AP_W2, _AP_S2> &a2) {
|
| 441 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2,
|
| 442 |
+
ap_range_ref<_AP_W2, _AP_S2> >(
|
| 443 |
+
*this, const_cast<ap_range_ref<_AP_W2, _AP_S2>&>(a2));
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
template <int _AP_W2, bool _AP_S2>
|
| 447 |
+
INLINE
|
| 448 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 449 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 450 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2,
|
| 451 |
+
ap_int_base<_AP_W2, _AP_S2> >(*this, a2);
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
INLINE
|
| 455 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W, ap_int_base<_AP_W, _AP_S> >
|
| 456 |
+
operator,(ap_int_base<_AP_W, _AP_S>& a2) {
|
| 457 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W,
|
| 458 |
+
ap_int_base<_AP_W, _AP_S> >(*this, a2);
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
template <int _AP_W2, bool _AP_S2>
|
| 462 |
+
INLINE
|
| 463 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 464 |
+
operator,(volatile ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 465 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2,
|
| 466 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 467 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
template <int _AP_W2, bool _AP_S2>
|
| 471 |
+
INLINE
|
| 472 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 473 |
+
operator,(const ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 474 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2,
|
| 475 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 476 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
template <int _AP_W2, bool _AP_S2>
|
| 480 |
+
INLINE
|
| 481 |
+
ap_concat_ref<_AP_W, ap_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 482 |
+
operator,(const volatile ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 483 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2,
|
| 484 |
+
ap_int_base<_AP_W2, _AP_S2> >(
|
| 485 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
template <int _AP_W2, bool _AP_S2>
|
| 489 |
+
INLINE ap_concat_ref<_AP_W, ap_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >
|
| 490 |
+
operator,(const ap_bit_ref<_AP_W2, _AP_S2> &a2) {
|
| 491 |
+
return ap_concat_ref<_AP_W, ap_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
| 492 |
+
*this, const_cast<ap_bit_ref<_AP_W2, _AP_S2>&>(a2));
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 496 |
+
INLINE ap_concat_ref<_AP_W, ap_range_ref, _AP_W2 + _AP_W3,
|
| 497 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 498 |
+
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &a2) {
|
| 499 |
+
return ap_concat_ref<_AP_W, ap_range_ref, _AP_W2 + _AP_W3,
|
| 500 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(
|
| 501 |
+
*this, const_cast<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>&>(a2));
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 505 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 506 |
+
INLINE ap_concat_ref<
|
| 507 |
+
_AP_W, ap_range_ref, _AP_W2,
|
| 508 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 509 |
+
operator,(
|
| 510 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> a2) {
|
| 511 |
+
return ap_concat_ref<
|
| 512 |
+
_AP_W, ap_range_ref, _AP_W2,
|
| 513 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 514 |
+
*this,
|
| 515 |
+
const_cast<
|
| 516 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(a2));
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 520 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 521 |
+
INLINE
|
| 522 |
+
ap_concat_ref<_AP_W, ap_range_ref, 1,
|
| 523 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 524 |
+
operator,(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>
|
| 525 |
+
&a2) {
|
| 526 |
+
return ap_concat_ref<
|
| 527 |
+
_AP_W, ap_range_ref, 1,
|
| 528 |
+
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 529 |
+
*this,
|
| 530 |
+
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 531 |
+
a2));
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
template <int _AP_W2, bool _AP_S2>
|
| 535 |
+
INLINE bool operator==(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 536 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 537 |
+
ap_int_base<_AP_W2, false> hop(op2);
|
| 538 |
+
return lop == hop;
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
template <int _AP_W2, bool _AP_S2>
|
| 542 |
+
INLINE bool operator!=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 543 |
+
return !(operator==(op2));
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
template <int _AP_W2, bool _AP_S2>
|
| 547 |
+
INLINE bool operator<(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 548 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 549 |
+
ap_int_base<_AP_W2, false> hop(op2);
|
| 550 |
+
return lop < hop;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
template <int _AP_W2, bool _AP_S2>
|
| 554 |
+
INLINE bool operator<=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 555 |
+
ap_int_base<_AP_W, false> lop(*this);
|
| 556 |
+
ap_int_base<_AP_W2, false> hop(op2);
|
| 557 |
+
return lop <= hop;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
template <int _AP_W2, bool _AP_S2>
|
| 561 |
+
INLINE bool operator>(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 562 |
+
return !(operator<=(op2));
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
template <int _AP_W2, bool _AP_S2>
|
| 566 |
+
INLINE bool operator>=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 567 |
+
return !(operator<(op2));
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
template <int _AP_W2, bool _AP_S2>
|
| 571 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator|=(
|
| 572 |
+
const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 573 |
+
(this->d_bv).V |= (op2.d_bv).V;
|
| 574 |
+
return *this;
|
| 575 |
+
};
|
| 576 |
+
|
| 577 |
+
template <int _AP_W2, bool _AP_S2>
|
| 578 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator|=(
|
| 579 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) {
|
| 580 |
+
(this->d_bv).V |= op2.V;
|
| 581 |
+
return *this;
|
| 582 |
+
};
|
| 583 |
+
|
| 584 |
+
template <int _AP_W2, bool _AP_S2>
|
| 585 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator&=(
|
| 586 |
+
const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 587 |
+
(this->d_bv).V &= (op2.d_bv).V;
|
| 588 |
+
return *this;
|
| 589 |
+
};
|
| 590 |
+
|
| 591 |
+
template <int _AP_W2, bool _AP_S2>
|
| 592 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator&=(
|
| 593 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) {
|
| 594 |
+
(this->d_bv).V &= op2.V;
|
| 595 |
+
return *this;
|
| 596 |
+
};
|
| 597 |
+
|
| 598 |
+
template <int _AP_W2, bool _AP_S2>
|
| 599 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator^=(
|
| 600 |
+
const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
| 601 |
+
(this->d_bv).V ^= (op2.d_bv).V;
|
| 602 |
+
return *this;
|
| 603 |
+
};
|
| 604 |
+
|
| 605 |
+
template <int _AP_W2, bool _AP_S2>
|
| 606 |
+
INLINE ap_range_ref<_AP_W, _AP_S>& operator^=(
|
| 607 |
+
const ap_int_base<_AP_W2, _AP_S2>& op2) {
|
| 608 |
+
(this->d_bv).V ^= op2.V;
|
| 609 |
+
return *this;
|
| 610 |
+
};
|
| 611 |
+
|
| 612 |
+
INLINE ap_int_base<_AP_W, false> get() const {
|
| 613 |
+
ap_int_base<_AP_W, false> ret;
|
| 614 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 615 |
+
return ret;
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
template <int _AP_W2>
|
| 619 |
+
INLINE void set(const ap_int_base<_AP_W2, false>& val) {
|
| 620 |
+
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
INLINE int length() const {
|
| 624 |
+
return h_index >= l_index ? h_index - l_index + 1 : l_index - h_index + 1;
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
INLINE int to_int() const {
|
| 628 |
+
return (int)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
INLINE unsigned to_uint() const {
|
| 632 |
+
return (unsigned)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
INLINE long to_long() const {
|
| 636 |
+
return (long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
INLINE unsigned long to_ulong() const {
|
| 640 |
+
return (unsigned long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
INLINE ap_slong to_int64() const {
|
| 644 |
+
return (ap_slong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
INLINE ap_ulong to_uint64() const {
|
| 648 |
+
return (ap_ulong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
INLINE bool and_reduce() const {
|
| 652 |
+
bool ret = true;
|
| 653 |
+
bool reverse = l_index > h_index;
|
| 654 |
+
unsigned low = reverse ? h_index : l_index;
|
| 655 |
+
unsigned high = reverse ? l_index : h_index;
|
| 656 |
+
for (unsigned i = low; i != high; ++i) {
|
| 657 |
+
#ifdef __SYNTHESIS__
|
| 658 |
+
#pragma HLS unroll
|
| 659 |
+
#endif
|
| 660 |
+
ret &= _AP_ROOT_op_get_bit(d_bv.V, i);
|
| 661 |
+
}
|
| 662 |
+
return ret;
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
INLINE bool or_reduce() const {
|
| 666 |
+
bool ret = false;
|
| 667 |
+
bool reverse = l_index > h_index;
|
| 668 |
+
unsigned low = reverse ? h_index : l_index;
|
| 669 |
+
unsigned high = reverse ? l_index : h_index;
|
| 670 |
+
for (unsigned i = low; i != high; ++i) {
|
| 671 |
+
#ifdef __SYNTHESIS__
|
| 672 |
+
#pragma HLS unroll
|
| 673 |
+
#endif
|
| 674 |
+
ret |= _AP_ROOT_op_get_bit(d_bv.V, i);
|
| 675 |
+
}
|
| 676 |
+
return ret;
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
INLINE bool xor_reduce() const {
|
| 680 |
+
bool ret = false;
|
| 681 |
+
bool reverse = l_index > h_index;
|
| 682 |
+
unsigned low = reverse ? h_index : l_index;
|
| 683 |
+
unsigned high = reverse ? l_index : h_index;
|
| 684 |
+
for (unsigned i = low; i != high; ++i) {
|
| 685 |
+
#ifdef __SYNTHESIS__
|
| 686 |
+
#pragma HLS unroll
|
| 687 |
+
#endif
|
| 688 |
+
ret ^= _AP_ROOT_op_get_bit(d_bv.V, i);
|
| 689 |
+
}
|
| 690 |
+
return ret;
|
| 691 |
+
}
|
| 692 |
+
#ifndef __SYNTHESIS__
|
| 693 |
+
std::string to_string(signed char radix = 2) const {
|
| 694 |
+
ap_int_base<_AP_W, false> ret;
|
| 695 |
+
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
| 696 |
+
return ret.to_string(radix);
|
| 697 |
+
}
|
| 698 |
+
#else
|
| 699 |
+
// XXX HLS will delete this in synthesis
|
| 700 |
+
INLINE char* to_string(signed char radix = 2) const {
|
| 701 |
+
return 0;
|
| 702 |
+
}
|
| 703 |
+
#endif
|
| 704 |
+
}; // struct ap_range_ref
|
| 705 |
+
|
| 706 |
+
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
| 707 |
+
#ifndef AP_AUTOCC
|
| 708 |
+
#ifndef __SYNTHESIS__
|
| 709 |
+
template <int _AP_W, bool _AP_S>
|
| 710 |
+
INLINE std::ostream& operator<<(std::ostream& os,
|
| 711 |
+
const ap_range_ref<_AP_W, _AP_S>& x) {
|
| 712 |
+
std::ios_base::fmtflags ff = std::cout.flags();
|
| 713 |
+
if (ff & std::cout.hex) {
|
| 714 |
+
os << x.to_string(16); // don't print sign
|
| 715 |
+
} else if (ff & std::cout.oct) {
|
| 716 |
+
os << x.to_string(8); // don't print sign
|
| 717 |
+
} else {
|
| 718 |
+
os << x.to_string(10);
|
| 719 |
+
}
|
| 720 |
+
return os;
|
| 721 |
+
}
|
| 722 |
+
#endif // ifndef __SYNTHESIS__
|
| 723 |
+
|
| 724 |
+
#ifndef __SYNTHESIS__
|
| 725 |
+
template <int _AP_W, bool _AP_S>
|
| 726 |
+
INLINE std::istream& operator>>(std::istream& in,
|
| 727 |
+
ap_range_ref<_AP_W, _AP_S>& op) {
|
| 728 |
+
std::string str;
|
| 729 |
+
in >> str;
|
| 730 |
+
op = ap_int_base<_AP_W, _AP_S>(str.c_str());
|
| 731 |
+
return in;
|
| 732 |
+
}
|
| 733 |
+
#endif // ifndef __SYNTHESIS__
|
| 734 |
+
#endif // ifndef AP_AUTOCC
|
| 735 |
+
|
| 736 |
+
/* Bit reference.
|
| 737 |
+
----------------------------------------------------------------
|
| 738 |
+
*/
|
| 739 |
+
template <int _AP_W, bool _AP_S>
|
| 740 |
+
struct ap_bit_ref {
|
| 741 |
+
// struct ssdm_int or its sim model.
|
| 742 |
+
// TODO make it possible to reference to ap_fixed_base/ap_fixed/ap_ufixed
|
| 743 |
+
// and then we can retire af_bit_ref.
|
| 744 |
+
typedef ap_int_base<_AP_W, _AP_S> ref_type;
|
| 745 |
+
ref_type& d_bv;
|
| 746 |
+
int d_index;
|
| 747 |
+
|
| 748 |
+
public:
|
| 749 |
+
// copy ctor
|
| 750 |
+
INLINE ap_bit_ref(const ap_bit_ref<_AP_W, _AP_S>& ref)
|
| 751 |
+
: d_bv(ref.d_bv), d_index(ref.d_index) {}
|
| 752 |
+
|
| 753 |
+
INLINE ap_bit_ref(ref_type* bv, int index = 0) : d_bv(*bv), d_index(index) {}
|
| 754 |
+
|
| 755 |
+
INLINE ap_bit_ref(const ref_type* bv, int index = 0)
|
| 756 |
+
: d_bv(*const_cast<ref_type*>(bv)), d_index(index) {}
|
| 757 |
+
|
| 758 |
+
INLINE operator bool() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 759 |
+
INLINE bool to_bool() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 760 |
+
|
| 761 |
+
// assign op from hls supported C integral types.
|
| 762 |
+
// FIXME disabled to support sc_signal<bool>.
|
| 763 |
+
// NOTE this used to be unsigned long long.
|
| 764 |
+
//template <typename T>
|
| 765 |
+
//INLINE typename _ap_type::enable_if<_ap_type::is_integral<T>::value,
|
| 766 |
+
// ap_bit_ref&>::type
|
| 767 |
+
//operator=(T val) {
|
| 768 |
+
// d_bv.V = _AP_ROOT_op_set_bit(d_bv.V, d_index, val);
|
| 769 |
+
// return *this;
|
| 770 |
+
//}
|
| 771 |
+
#define ASSIGN_WITH_CTYPE(_Tp) \
|
| 772 |
+
INLINE ap_bit_ref& operator=(_Tp val) { \
|
| 773 |
+
d_bv.V = _AP_ROOT_op_set_bit(d_bv.V, d_index, val); \
|
| 774 |
+
return *this; \
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
ASSIGN_WITH_CTYPE(bool)
|
| 778 |
+
ASSIGN_WITH_CTYPE(char)
|
| 779 |
+
ASSIGN_WITH_CTYPE(signed char)
|
| 780 |
+
ASSIGN_WITH_CTYPE(unsigned char)
|
| 781 |
+
ASSIGN_WITH_CTYPE(short)
|
| 782 |
+
ASSIGN_WITH_CTYPE(unsigned short)
|
| 783 |
+
ASSIGN_WITH_CTYPE(int)
|
| 784 |
+
ASSIGN_WITH_CTYPE(unsigned int)
|
| 785 |
+
ASSIGN_WITH_CTYPE(long)
|
| 786 |
+
ASSIGN_WITH_CTYPE(unsigned long)
|
| 787 |
+
ASSIGN_WITH_CTYPE(ap_slong)
|
| 788 |
+
ASSIGN_WITH_CTYPE(ap_ulong)
|
| 789 |
+
|
| 790 |
+
#undef ASSIGN_WITH_CTYPE
|
| 791 |
+
|
| 792 |
+
#define ASSIGN_WITH_CTYPE_FP(_Tp) \
|
| 793 |
+
INLINE ap_bit_ref& operator=(_Tp val) { \
|
| 794 |
+
bool tmp_val = val; \
|
| 795 |
+
d_bv.V = _AP_ROOT_op_set_bit(d_bv.V, d_index,tmp_val); \
|
| 796 |
+
return *this; \
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
#if _AP_ENABLE_HALF_ == 1
|
| 800 |
+
ASSIGN_WITH_CTYPE_FP(half)
|
| 801 |
+
#endif
|
| 802 |
+
ASSIGN_WITH_CTYPE_FP(float)
|
| 803 |
+
ASSIGN_WITH_CTYPE_FP(double)
|
| 804 |
+
|
| 805 |
+
#undef ASSIGN_WITH_CTYPE_FP
|
| 806 |
+
|
| 807 |
+
|
| 808 |
+
template <int _AP_W2, bool _AP_S2>
|
| 809 |
+
INLINE ap_bit_ref& operator=(const ap_int_base<_AP_W2, _AP_S2>& val) {
|
| 810 |
+
return operator=((ap_ulong)(val.V != 0));
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
template <int _AP_W2, bool _AP_S2>
|
| 814 |
+
INLINE ap_bit_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
| 815 |
+
return operator=((ap_int_base<_AP_W2, false>)val);
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
// Be explicit to prevent it from being deleted, as field d_bv
|
| 819 |
+
// is of reference type.
|
| 820 |
+
INLINE ap_bit_ref& operator=(const ap_bit_ref& val) {
|
| 821 |
+
return operator=((ap_ulong)(bool)val);
|
| 822 |
+
}
|
| 823 |
+
|
| 824 |
+
template <int _AP_W2, bool _AP_S2>
|
| 825 |
+
INLINE ap_bit_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
| 826 |
+
return operator=((ap_ulong)(bool)val);
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 830 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 831 |
+
INLINE ap_bit_ref& operator=(
|
| 832 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 833 |
+
return operator=((const ap_int_base<_AP_W2, false>)val);
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 837 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 838 |
+
INLINE ap_bit_ref& operator=(
|
| 839 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
| 840 |
+
return operator=((ap_ulong)(bool)val);
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 844 |
+
INLINE ap_bit_ref& operator=(
|
| 845 |
+
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
| 846 |
+
return operator=((const ap_int_base<_AP_W2 + _AP_W3, false>)val);
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
template <int _AP_W2, bool _AP_S2>
|
| 850 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 851 |
+
operator,(ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 852 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
| 853 |
+
*this, a2);
|
| 854 |
+
}
|
| 855 |
+
|
| 856 |
+
template <int _AP_W2, bool _AP_S2>
|
| 857 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 858 |
+
operator,(volatile ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 859 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
| 860 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(a2));
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
template <int _AP_W2, bool _AP_S2>
|
| 864 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 865 |
+
operator,(const ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 866 |
+
ap_int_base<_AP_W2, _AP_S2> op(a2);
|
| 867 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
| 868 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(op));
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
template <int _AP_W2, bool _AP_S2>
|
| 872 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
| 873 |
+
operator,(const volatile ap_int_base<_AP_W2, _AP_S2> &a2) {
|
| 874 |
+
ap_int_base<_AP_W2, _AP_S2> op(a2);
|
| 875 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
| 876 |
+
*this, const_cast<ap_int_base<_AP_W2, _AP_S2>&>(op));
|
| 877 |
+
}
|
| 878 |
+
|
| 879 |
+
template <int _AP_W2, bool _AP_S2>
|
| 880 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
| 881 |
+
operator,(const ap_range_ref<_AP_W2, _AP_S2> &a2) {
|
| 882 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >(
|
| 883 |
+
*this, const_cast<ap_range_ref<_AP_W2, _AP_S2>&>(a2));
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
template <int _AP_W2, bool _AP_S2>
|
| 887 |
+
INLINE ap_concat_ref<1, ap_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> > operator,(
|
| 888 |
+
const ap_bit_ref<_AP_W2, _AP_S2> &a2) {
|
| 889 |
+
return ap_concat_ref<1, ap_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
| 890 |
+
*this, const_cast<ap_bit_ref<_AP_W2, _AP_S2>&>(a2));
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
| 894 |
+
INLINE ap_concat_ref<1, ap_bit_ref, _AP_W2 + _AP_W3,
|
| 895 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
| 896 |
+
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &a2) {
|
| 897 |
+
return ap_concat_ref<1, ap_bit_ref, _AP_W2 + _AP_W3,
|
| 898 |
+
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(
|
| 899 |
+
*this, const_cast<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>&>(a2));
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 903 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 904 |
+
INLINE ap_concat_ref<
|
| 905 |
+
1, ap_bit_ref, _AP_W2,
|
| 906 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
| 907 |
+
operator,(
|
| 908 |
+
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &a2) {
|
| 909 |
+
return ap_concat_ref<
|
| 910 |
+
1, ap_bit_ref, _AP_W2,
|
| 911 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
| 912 |
+
*this,
|
| 913 |
+
const_cast<
|
| 914 |
+
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(a2));
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
| 918 |
+
ap_o_mode _AP_O2, int _AP_N2>
|
| 919 |
+
INLINE ap_concat_ref<1, ap_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
| 920 |
+
_AP_Q2, _AP_O2, _AP_N2> >
|
| 921 |
+
operator,(
|
| 922 |
+
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &a2) {
|
| 923 |
+
return ap_concat_ref<1, ap_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
| 924 |
+
_AP_Q2, _AP_O2, _AP_N2> >(
|
| 925 |
+
*this,
|
| 926 |
+
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
| 927 |
+
a2));
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
template <int _AP_W2, bool _AP_S2>
|
| 931 |
+
INLINE bool operator==(const ap_bit_ref<_AP_W2, _AP_S2>& op) {
|
| 932 |
+
return get() == op.get();
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
template <int _AP_W2, bool _AP_S2>
|
| 936 |
+
INLINE bool operator!=(const ap_bit_ref<_AP_W2, _AP_S2>& op) {
|
| 937 |
+
return get() != op.get();
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
INLINE bool get() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 941 |
+
|
| 942 |
+
INLINE bool get() { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
| 943 |
+
|
| 944 |
+
template <int _AP_W3>
|
| 945 |
+
INLINE void set(const ap_int_base<_AP_W3, false>& val) {
|
| 946 |
+
operator=(val);
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
INLINE bool operator~() const {
|
| 950 |
+
bool bit = _AP_ROOT_op_get_bit(d_bv.V, d_index);
|
| 951 |
+
return bit ? false : true;
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
INLINE int length() const { return 1; }
|
| 955 |
+
|
| 956 |
+
#ifndef __SYNTHESIS__
|
| 957 |
+
std::string to_string() const { return get() ? "1" : "0"; }
|
| 958 |
+
#else
|
| 959 |
+
// XXX HLS will delete this in synthesis
|
| 960 |
+
INLINE char* to_string() const { return 0; }
|
| 961 |
+
#endif
|
| 962 |
+
}; // struct ap_bit_ref
|
| 963 |
+
|
| 964 |
+
/* ap_range_ref with int.
|
| 965 |
+
* ------------------------------------------------------------
|
| 966 |
+
*/
|
| 967 |
+
// equality and relational operators.
|
| 968 |
+
#define REF_REL_OP_WITH_INT(REL_OP, C_TYPE, _AP_W2, _AP_S2) \
|
| 969 |
+
template <int _AP_W, bool _AP_S> \
|
| 970 |
+
INLINE bool operator REL_OP(const ap_range_ref<_AP_W, _AP_S>& op, \
|
| 971 |
+
C_TYPE op2) { \
|
| 972 |
+
return ap_int_base<_AP_W, false>(op) \
|
| 973 |
+
REL_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 974 |
+
} \
|
| 975 |
+
template <int _AP_W, bool _AP_S> \
|
| 976 |
+
INLINE bool operator REL_OP(const ap_bit_ref<_AP_W, _AP_S>& op, \
|
| 977 |
+
C_TYPE op2) { \
|
| 978 |
+
return bool(op) REL_OP op2; \
|
| 979 |
+
} \
|
| 980 |
+
template <int _AP_W, bool _AP_S> \
|
| 981 |
+
INLINE bool operator REL_OP(C_TYPE op2, \
|
| 982 |
+
const ap_bit_ref<_AP_W, _AP_S>& op) { \
|
| 983 |
+
return op2 REL_OP bool(op); \
|
| 984 |
+
} \
|
| 985 |
+
template <int _AP_W, typename _AP_T, int _AP_W1, typename _AP_T1> \
|
| 986 |
+
INLINE bool operator REL_OP( \
|
| 987 |
+
const ap_concat_ref<_AP_W, _AP_T, _AP_W1, _AP_T1>& op, C_TYPE op2) { \
|
| 988 |
+
return ap_int_base<_AP_W + _AP_W1, false>(op) \
|
| 989 |
+
REL_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 990 |
+
}
|
| 991 |
+
|
| 992 |
+
// Make the line shorter than 5000 chars
|
| 993 |
+
#define REF_REL_WITH_INT_1(C_TYPE, _AP_WI, _AP_SI) \
|
| 994 |
+
REF_REL_OP_WITH_INT(>, C_TYPE, _AP_WI, _AP_SI) \
|
| 995 |
+
REF_REL_OP_WITH_INT(<, C_TYPE, _AP_WI, _AP_SI) \
|
| 996 |
+
REF_REL_OP_WITH_INT(>=, C_TYPE, _AP_WI, _AP_SI) \
|
| 997 |
+
REF_REL_OP_WITH_INT(<=, C_TYPE, _AP_WI, _AP_SI)
|
| 998 |
+
|
| 999 |
+
REF_REL_WITH_INT_1(bool, 1, false)
|
| 1000 |
+
REF_REL_WITH_INT_1(char, 8, CHAR_IS_SIGNED)
|
| 1001 |
+
REF_REL_WITH_INT_1(signed char, 8, true)
|
| 1002 |
+
REF_REL_WITH_INT_1(unsigned char, 8, false)
|
| 1003 |
+
REF_REL_WITH_INT_1(short, _AP_SIZE_short, true)
|
| 1004 |
+
REF_REL_WITH_INT_1(unsigned short, _AP_SIZE_short, false)
|
| 1005 |
+
REF_REL_WITH_INT_1(int, _AP_SIZE_int, true)
|
| 1006 |
+
REF_REL_WITH_INT_1(unsigned int, _AP_SIZE_int, false)
|
| 1007 |
+
REF_REL_WITH_INT_1(long, _AP_SIZE_long, true)
|
| 1008 |
+
REF_REL_WITH_INT_1(unsigned long, _AP_SIZE_long, false)
|
| 1009 |
+
REF_REL_WITH_INT_1(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1010 |
+
REF_REL_WITH_INT_1(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1011 |
+
|
| 1012 |
+
// Make the line shorter than 5000 chars
|
| 1013 |
+
#define REF_REL_WITH_INT_2(C_TYPE, _AP_WI, _AP_SI) \
|
| 1014 |
+
REF_REL_OP_WITH_INT(==, C_TYPE, _AP_WI, _AP_SI) \
|
| 1015 |
+
REF_REL_OP_WITH_INT(!=, C_TYPE, _AP_WI, _AP_SI)
|
| 1016 |
+
|
| 1017 |
+
REF_REL_WITH_INT_2(bool, 1, false)
|
| 1018 |
+
REF_REL_WITH_INT_2(char, 8, CHAR_IS_SIGNED)
|
| 1019 |
+
REF_REL_WITH_INT_2(signed char, 8, true)
|
| 1020 |
+
REF_REL_WITH_INT_2(unsigned char, 8, false)
|
| 1021 |
+
REF_REL_WITH_INT_2(short, _AP_SIZE_short, true)
|
| 1022 |
+
REF_REL_WITH_INT_2(unsigned short, _AP_SIZE_short, false)
|
| 1023 |
+
REF_REL_WITH_INT_2(int, _AP_SIZE_int, true)
|
| 1024 |
+
REF_REL_WITH_INT_2(unsigned int, _AP_SIZE_int, false)
|
| 1025 |
+
REF_REL_WITH_INT_2(long, _AP_SIZE_long, true)
|
| 1026 |
+
REF_REL_WITH_INT_2(unsigned long, _AP_SIZE_long, false)
|
| 1027 |
+
REF_REL_WITH_INT_2(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1028 |
+
REF_REL_WITH_INT_2(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1029 |
+
|
| 1030 |
+
#undef REF_REL_OP_WITH_INT
|
| 1031 |
+
#undef REF_REL_WITH_INT_1
|
| 1032 |
+
#undef REF_REL_WITH_INT_2
|
| 1033 |
+
|
| 1034 |
+
#define REF_BIN_OP_WITH_INT(BIN_OP, RTYPE, C_TYPE, _AP_W2, _AP_S2) \
|
| 1035 |
+
template <int _AP_W, bool _AP_S> \
|
| 1036 |
+
INLINE typename ap_int_base<_AP_W, false>::template RType<_AP_W2, \
|
| 1037 |
+
_AP_S2>::RTYPE \
|
| 1038 |
+
operator BIN_OP(const ap_range_ref<_AP_W, _AP_S>& op, C_TYPE op2) { \
|
| 1039 |
+
return ap_int_base<_AP_W, false>(op) \
|
| 1040 |
+
BIN_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
| 1041 |
+
} \
|
| 1042 |
+
template <int _AP_W, bool _AP_S> \
|
| 1043 |
+
INLINE typename ap_int_base<_AP_W2, _AP_S2>::template RType<_AP_W, \
|
| 1044 |
+
false>::RTYPE \
|
| 1045 |
+
operator BIN_OP(C_TYPE op2, const ap_range_ref<_AP_W, _AP_S>& op) { \
|
| 1046 |
+
return ap_int_base<_AP_W2, _AP_S2>(op2) \
|
| 1047 |
+
BIN_OP ap_int_base<_AP_W, false>(op); \
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
// arithmetic operators.
|
| 1051 |
+
#define REF_BIN_OP_WITH_INT_ARITH(C_TYPE, _AP_W2, _AP_S2) \
|
| 1052 |
+
REF_BIN_OP_WITH_INT(+, plus, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1053 |
+
REF_BIN_OP_WITH_INT(-, minus, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1054 |
+
REF_BIN_OP_WITH_INT(*, mult, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1055 |
+
REF_BIN_OP_WITH_INT(/, div, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1056 |
+
REF_BIN_OP_WITH_INT(%, mod, C_TYPE, (_AP_W2), (_AP_S2))
|
| 1057 |
+
|
| 1058 |
+
REF_BIN_OP_WITH_INT_ARITH(bool, 1, false)
|
| 1059 |
+
REF_BIN_OP_WITH_INT_ARITH(char, 8, CHAR_IS_SIGNED)
|
| 1060 |
+
REF_BIN_OP_WITH_INT_ARITH(signed char, 8, true)
|
| 1061 |
+
REF_BIN_OP_WITH_INT_ARITH(unsigned char, 8, false)
|
| 1062 |
+
REF_BIN_OP_WITH_INT_ARITH(short, _AP_SIZE_short, true)
|
| 1063 |
+
REF_BIN_OP_WITH_INT_ARITH(unsigned short, _AP_SIZE_short, false)
|
| 1064 |
+
REF_BIN_OP_WITH_INT_ARITH(int, _AP_SIZE_int, true)
|
| 1065 |
+
REF_BIN_OP_WITH_INT_ARITH(unsigned int, _AP_SIZE_int, false)
|
| 1066 |
+
REF_BIN_OP_WITH_INT_ARITH(long, _AP_SIZE_long, true)
|
| 1067 |
+
REF_BIN_OP_WITH_INT_ARITH(unsigned long, _AP_SIZE_long, false)
|
| 1068 |
+
REF_BIN_OP_WITH_INT_ARITH(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1069 |
+
REF_BIN_OP_WITH_INT_ARITH(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1070 |
+
|
| 1071 |
+
#undef REF_BIN_OP_WITH_INT_ARITH
|
| 1072 |
+
|
| 1073 |
+
// bitwise and shift operators
|
| 1074 |
+
#define REF_BIN_OP_WITH_INT_BITS(C_TYPE, _AP_W2, _AP_S2) \
|
| 1075 |
+
REF_BIN_OP_WITH_INT(&, logic, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1076 |
+
REF_BIN_OP_WITH_INT(|, logic, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1077 |
+
REF_BIN_OP_WITH_INT(^, logic, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1078 |
+
REF_BIN_OP_WITH_INT(>>, arg1, C_TYPE, (_AP_W2), (_AP_S2)) \
|
| 1079 |
+
REF_BIN_OP_WITH_INT(<<, arg1, C_TYPE, (_AP_W2), (_AP_S2))
|
| 1080 |
+
|
| 1081 |
+
REF_BIN_OP_WITH_INT_BITS(bool, 1, false)
|
| 1082 |
+
REF_BIN_OP_WITH_INT_BITS(char, 8, CHAR_IS_SIGNED)
|
| 1083 |
+
REF_BIN_OP_WITH_INT_BITS(signed char, 8, true)
|
| 1084 |
+
REF_BIN_OP_WITH_INT_BITS(unsigned char, 8, false)
|
| 1085 |
+
REF_BIN_OP_WITH_INT_BITS(short, _AP_SIZE_short, true)
|
| 1086 |
+
REF_BIN_OP_WITH_INT_BITS(unsigned short, _AP_SIZE_short, false)
|
| 1087 |
+
REF_BIN_OP_WITH_INT_BITS(int, _AP_SIZE_int, true)
|
| 1088 |
+
REF_BIN_OP_WITH_INT_BITS(unsigned int, _AP_SIZE_int, false)
|
| 1089 |
+
REF_BIN_OP_WITH_INT_BITS(long, _AP_SIZE_long, true)
|
| 1090 |
+
REF_BIN_OP_WITH_INT_BITS(unsigned long, _AP_SIZE_long, false)
|
| 1091 |
+
REF_BIN_OP_WITH_INT_BITS(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1092 |
+
REF_BIN_OP_WITH_INT_BITS(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1093 |
+
|
| 1094 |
+
#undef REF_BIN_OP_WITH_INT_BITS
|
| 1095 |
+
|
| 1096 |
+
/* ap_range_ref with ap_range_ref
|
| 1097 |
+
* ------------------------------------------------------------
|
| 1098 |
+
*/
|
| 1099 |
+
#define REF_BIN_OP(BIN_OP, RTYPE) \
|
| 1100 |
+
template <int _AP_W, bool _AP_S, int _AP_W2, bool _AP_S2> \
|
| 1101 |
+
INLINE \
|
| 1102 |
+
typename ap_int_base<_AP_W, false>::template RType<_AP_W2, false>::RTYPE \
|
| 1103 |
+
operator BIN_OP(const ap_range_ref<_AP_W, _AP_S>& lhs, \
|
| 1104 |
+
const ap_range_ref<_AP_W2, _AP_S2>& rhs) { \
|
| 1105 |
+
return (lhs.operator ap_int_base<_AP_W, false>())BIN_OP( \
|
| 1106 |
+
rhs.operator ap_int_base<_AP_W2, false>()); \
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
REF_BIN_OP(+, plus)
|
| 1110 |
+
REF_BIN_OP(-, minus)
|
| 1111 |
+
REF_BIN_OP(*, mult)
|
| 1112 |
+
REF_BIN_OP(/, div)
|
| 1113 |
+
REF_BIN_OP(%, mod)
|
| 1114 |
+
REF_BIN_OP(&, logic)
|
| 1115 |
+
REF_BIN_OP(|, logic)
|
| 1116 |
+
REF_BIN_OP(^, logic)
|
| 1117 |
+
REF_BIN_OP(>>, arg1)
|
| 1118 |
+
REF_BIN_OP(<<, arg1)
|
| 1119 |
+
|
| 1120 |
+
/* ap_concat_ref with ap_concat_ref.
|
| 1121 |
+
* ------------------------------------------------------------
|
| 1122 |
+
*/
|
| 1123 |
+
|
| 1124 |
+
//************************************************************************
|
| 1125 |
+
// Implement
|
| 1126 |
+
// ap_int_base<M+N> = ap_concat_ref<M> OP ap_concat_ref<N>
|
| 1127 |
+
// for operators +, -, *, /, %, >>, <<, &, |, ^
|
| 1128 |
+
// Without these operators the operands are converted to int64 and
|
| 1129 |
+
// larger results lose informations (higher order bits).
|
| 1130 |
+
//
|
| 1131 |
+
// operand OP
|
| 1132 |
+
// / |
|
| 1133 |
+
// left-concat right-concat
|
| 1134 |
+
// / | / |
|
| 1135 |
+
// <LW1,LT1> <LW2,LT2> <RW1,RT1> <RW2,RT2>
|
| 1136 |
+
//
|
| 1137 |
+
// _AP_LW1, _AP_LT1 (width and type of left-concat's left side)
|
| 1138 |
+
// _AP_LW2, _AP_LT2 (width and type of left-concat's right side)
|
| 1139 |
+
// Similarly for RHS of operand OP: _AP_RW1, AP_RW2, _AP_RT1, _AP_RT2
|
| 1140 |
+
//
|
| 1141 |
+
// In Verilog 2001 result of concatenation is always unsigned even
|
| 1142 |
+
// when both sides are signed.
|
| 1143 |
+
//************************************************************************
|
| 1144 |
+
|
| 1145 |
+
#undef SYN_CONCAT_REF_BIN_OP
|
| 1146 |
+
|
| 1147 |
+
#define SYN_CONCAT_REF_BIN_OP(BIN_OP, RTYPE) \
|
| 1148 |
+
template <int _AP_LW1, typename _AP_LT1, int _AP_LW2, typename _AP_LT2, \
|
| 1149 |
+
int _AP_RW1, typename _AP_RT1, int _AP_RW2, typename _AP_RT2> \
|
| 1150 |
+
INLINE typename ap_int_base<_AP_LW1 + _AP_LW2, false>::template RType< \
|
| 1151 |
+
_AP_RW1 + _AP_RW2, false>::RTYPE \
|
| 1152 |
+
operator BIN_OP( \
|
| 1153 |
+
const ap_concat_ref<_AP_LW1, _AP_LT1, _AP_LW2, _AP_LT2>& lhs, \
|
| 1154 |
+
const ap_concat_ref<_AP_RW1, _AP_RT1, _AP_RW2, _AP_RT2>& rhs) { \
|
| 1155 |
+
return lhs.get() BIN_OP rhs.get(); \
|
| 1156 |
+
}
|
| 1157 |
+
|
| 1158 |
+
SYN_CONCAT_REF_BIN_OP(+, plus)
|
| 1159 |
+
SYN_CONCAT_REF_BIN_OP(-, minus)
|
| 1160 |
+
SYN_CONCAT_REF_BIN_OP(*, mult)
|
| 1161 |
+
SYN_CONCAT_REF_BIN_OP(/, div)
|
| 1162 |
+
SYN_CONCAT_REF_BIN_OP(%, mod)
|
| 1163 |
+
SYN_CONCAT_REF_BIN_OP(&, logic)
|
| 1164 |
+
SYN_CONCAT_REF_BIN_OP(|, logic)
|
| 1165 |
+
SYN_CONCAT_REF_BIN_OP(^, logic)
|
| 1166 |
+
SYN_CONCAT_REF_BIN_OP(>>, arg1)
|
| 1167 |
+
SYN_CONCAT_REF_BIN_OP(<<, arg1)
|
| 1168 |
+
|
| 1169 |
+
#undef SYN_CONCAT_REF_BIN_OP
|
| 1170 |
+
|
| 1171 |
+
#define CONCAT_OP_WITH_INT(C_TYPE, _AP_WI, _AP_SI) \
|
| 1172 |
+
template <int _AP_W, bool _AP_S> \
|
| 1173 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1174 |
+
const ap_int_base<_AP_W, _AP_S> &op1, C_TYPE op2) { \
|
| 1175 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op2); \
|
| 1176 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op1); \
|
| 1177 |
+
ret <<= _AP_WI; \
|
| 1178 |
+
if (_AP_SI) { \
|
| 1179 |
+
val <<= _AP_W; \
|
| 1180 |
+
val >>= _AP_W; \
|
| 1181 |
+
} \
|
| 1182 |
+
ret |= val; \
|
| 1183 |
+
return ret; \
|
| 1184 |
+
} \
|
| 1185 |
+
template <int _AP_W, bool _AP_S> \
|
| 1186 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1187 |
+
C_TYPE op1, const ap_int_base<_AP_W, _AP_S> &op2) { \
|
| 1188 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op1); \
|
| 1189 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op2); \
|
| 1190 |
+
if (_AP_S) { \
|
| 1191 |
+
ret <<= _AP_WI; \
|
| 1192 |
+
ret >>= _AP_WI; \
|
| 1193 |
+
} \
|
| 1194 |
+
ret |= val << _AP_W; \
|
| 1195 |
+
return ret; \
|
| 1196 |
+
} \
|
| 1197 |
+
template <int _AP_W, bool _AP_S> \
|
| 1198 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1199 |
+
const ap_range_ref<_AP_W, _AP_S> &op1, C_TYPE op2) { \
|
| 1200 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op2); \
|
| 1201 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op1); \
|
| 1202 |
+
ret <<= _AP_WI; \
|
| 1203 |
+
if (_AP_SI) { \
|
| 1204 |
+
val <<= _AP_W; \
|
| 1205 |
+
val >>= _AP_W; \
|
| 1206 |
+
} \
|
| 1207 |
+
ret |= val; \
|
| 1208 |
+
return ret; \
|
| 1209 |
+
} \
|
| 1210 |
+
template <int _AP_W, bool _AP_S> \
|
| 1211 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1212 |
+
C_TYPE op1, const ap_range_ref<_AP_W, _AP_S> &op2) { \
|
| 1213 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op1); \
|
| 1214 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op2); \
|
| 1215 |
+
int len = op2.length(); \
|
| 1216 |
+
val <<= len; \
|
| 1217 |
+
ret |= val; \
|
| 1218 |
+
return ret; \
|
| 1219 |
+
} \
|
| 1220 |
+
template <int _AP_W, bool _AP_S> \
|
| 1221 |
+
INLINE ap_int_base<_AP_WI + 1, false> operator,( \
|
| 1222 |
+
const ap_bit_ref<_AP_W, _AP_S> &op1, C_TYPE op2) { \
|
| 1223 |
+
ap_int_base<_AP_WI + 1, false> val(op2); \
|
| 1224 |
+
val[_AP_WI] = op1; \
|
| 1225 |
+
return val; \
|
| 1226 |
+
} \
|
| 1227 |
+
template <int _AP_W, bool _AP_S> \
|
| 1228 |
+
INLINE ap_int_base<_AP_WI + 1, false> operator,( \
|
| 1229 |
+
C_TYPE op1, const ap_bit_ref<_AP_W, _AP_S> &op2) { \
|
| 1230 |
+
ap_int_base<_AP_WI + 1, false> val(op1); \
|
| 1231 |
+
val <<= 1; \
|
| 1232 |
+
val[0] = op2; \
|
| 1233 |
+
return val; \
|
| 1234 |
+
} \
|
| 1235 |
+
template <int _AP_W, typename _AP_T, int _AP_W2, typename _AP_T2> \
|
| 1236 |
+
INLINE ap_int_base<_AP_W + _AP_W2 + _AP_WI, false> operator,( \
|
| 1237 |
+
const ap_concat_ref<_AP_W, _AP_T, _AP_W2, _AP_T2> &op1, C_TYPE op2) { \
|
| 1238 |
+
ap_int_base<_AP_WI + _AP_W + _AP_W2, _AP_SI> val(op2); \
|
| 1239 |
+
ap_int_base<_AP_WI + _AP_W + _AP_W2, _AP_SI> ret(op1); \
|
| 1240 |
+
if (_AP_SI) { \
|
| 1241 |
+
val <<= _AP_W + _AP_W2; \
|
| 1242 |
+
val >>= _AP_W + _AP_W2; \
|
| 1243 |
+
} \
|
| 1244 |
+
ret <<= _AP_WI; \
|
| 1245 |
+
ret |= val; \
|
| 1246 |
+
return ret; \
|
| 1247 |
+
} \
|
| 1248 |
+
template <int _AP_W, typename _AP_T, int _AP_W2, typename _AP_T2> \
|
| 1249 |
+
INLINE ap_int_base<_AP_W + _AP_W2 + _AP_WI, false> operator,( \
|
| 1250 |
+
C_TYPE op1, const ap_concat_ref<_AP_W, _AP_T, _AP_W2, _AP_T2> &op2) { \
|
| 1251 |
+
ap_int_base<_AP_WI + _AP_W + _AP_W2, _AP_SI> val(op1); \
|
| 1252 |
+
ap_int_base<_AP_WI + _AP_W + _AP_W2, _AP_SI> ret(op2); \
|
| 1253 |
+
int len = op2.length(); \
|
| 1254 |
+
val <<= len; \
|
| 1255 |
+
ret |= val; \
|
| 1256 |
+
return ret; \
|
| 1257 |
+
} \
|
| 1258 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 1259 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 1260 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1261 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> &op1, \
|
| 1262 |
+
C_TYPE op2) { \
|
| 1263 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op2); \
|
| 1264 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op1); \
|
| 1265 |
+
if (_AP_SI) { \
|
| 1266 |
+
val <<= _AP_W; \
|
| 1267 |
+
val >>= _AP_W; \
|
| 1268 |
+
} \
|
| 1269 |
+
ret <<= _AP_WI; \
|
| 1270 |
+
ret |= val; \
|
| 1271 |
+
return ret; \
|
| 1272 |
+
} \
|
| 1273 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 1274 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 1275 |
+
INLINE ap_int_base<_AP_W + _AP_WI, false> operator,( \
|
| 1276 |
+
C_TYPE op1, \
|
| 1277 |
+
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> &op2) { \
|
| 1278 |
+
ap_int_base<_AP_WI + _AP_W, false> val(op1); \
|
| 1279 |
+
ap_int_base<_AP_WI + _AP_W, false> ret(op2); \
|
| 1280 |
+
int len = op2.length(); \
|
| 1281 |
+
val <<= len; \
|
| 1282 |
+
ret |= val; \
|
| 1283 |
+
return ret; \
|
| 1284 |
+
} \
|
| 1285 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 1286 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 1287 |
+
INLINE ap_int_base<1 + _AP_WI, false> operator,( \
|
| 1288 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> &op1, \
|
| 1289 |
+
C_TYPE op2) { \
|
| 1290 |
+
ap_int_base<_AP_WI + 1, _AP_SI> val(op2); \
|
| 1291 |
+
val[_AP_WI] = op1; \
|
| 1292 |
+
return val; \
|
| 1293 |
+
} \
|
| 1294 |
+
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
| 1295 |
+
ap_o_mode _AP_O, int _AP_N> \
|
| 1296 |
+
INLINE ap_int_base<1 + _AP_WI, false> operator,( \
|
| 1297 |
+
C_TYPE op1, \
|
| 1298 |
+
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> &op2) { \
|
| 1299 |
+
ap_int_base<_AP_WI + 1, _AP_SI> val(op1); \
|
| 1300 |
+
val <<= 1; \
|
| 1301 |
+
val[0] = op2; \
|
| 1302 |
+
return val; \
|
| 1303 |
+
}
|
| 1304 |
+
|
| 1305 |
+
CONCAT_OP_WITH_INT(bool, 1, false)
|
| 1306 |
+
CONCAT_OP_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
| 1307 |
+
CONCAT_OP_WITH_INT(signed char, 8, true)
|
| 1308 |
+
CONCAT_OP_WITH_INT(unsigned char, 8, false)
|
| 1309 |
+
CONCAT_OP_WITH_INT(short, _AP_SIZE_short, true)
|
| 1310 |
+
CONCAT_OP_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
| 1311 |
+
CONCAT_OP_WITH_INT(int, _AP_SIZE_int, true)
|
| 1312 |
+
CONCAT_OP_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
| 1313 |
+
CONCAT_OP_WITH_INT(long, _AP_SIZE_long, true)
|
| 1314 |
+
CONCAT_OP_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
| 1315 |
+
CONCAT_OP_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
| 1316 |
+
CONCAT_OP_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
| 1317 |
+
|
| 1318 |
+
#undef CONCAT_OP_WITH_INT
|
| 1319 |
+
|
| 1320 |
+
#define CONCAT_SHIFT_WITH_INT(C_TYPE, OP) \
|
| 1321 |
+
template <int _AP_W, typename _AP_T, int _AP_W1, typename _AP_T1> \
|
| 1322 |
+
INLINE ap_uint<_AP_W + _AP_W1> operator OP( \
|
| 1323 |
+
const ap_concat_ref<_AP_W, _AP_T, _AP_W1, _AP_T1> lhs, C_TYPE rhs) { \
|
| 1324 |
+
return ap_uint<_AP_W + _AP_W1>(lhs).get() OP int(rhs); \
|
| 1325 |
+
}
|
| 1326 |
+
|
| 1327 |
+
// FIXME int(rhs) may loose precision.
|
| 1328 |
+
|
| 1329 |
+
CONCAT_SHIFT_WITH_INT(int, <<)
|
| 1330 |
+
CONCAT_SHIFT_WITH_INT(unsigned int, <<)
|
| 1331 |
+
CONCAT_SHIFT_WITH_INT(long, <<)
|
| 1332 |
+
CONCAT_SHIFT_WITH_INT(unsigned long, <<)
|
| 1333 |
+
CONCAT_SHIFT_WITH_INT(ap_slong, <<)
|
| 1334 |
+
CONCAT_SHIFT_WITH_INT(ap_ulong, <<)
|
| 1335 |
+
|
| 1336 |
+
CONCAT_SHIFT_WITH_INT(int, >>)
|
| 1337 |
+
CONCAT_SHIFT_WITH_INT(unsigned int, >>)
|
| 1338 |
+
CONCAT_SHIFT_WITH_INT(long, >>)
|
| 1339 |
+
CONCAT_SHIFT_WITH_INT(unsigned long, >>)
|
| 1340 |
+
CONCAT_SHIFT_WITH_INT(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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2019 Xilinx, Inc.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#ifndef __AP_INT_SPECIAL_H__
|
| 18 |
+
#define __AP_INT_SPECIAL_H__
|
| 19 |
+
|
| 20 |
+
#ifndef __AP_INT_H__
|
| 21 |
+
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifndef __SYNTHESIS__
|
| 25 |
+
#include <cstdio>
|
| 26 |
+
#include <cstdlib>
|
| 27 |
+
#endif
|
| 28 |
+
// FIXME AP_AUTOCC cannot handle many standard headers, so declare instead of
|
| 29 |
+
// include.
|
| 30 |
+
// #include <complex>
|
| 31 |
+
namespace std {
|
| 32 |
+
template<typename _Tp> class complex;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/*
|
| 36 |
+
TODO: Modernize the code using C++11/C++14
|
| 37 |
+
1. constexpr http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0415r0.html
|
| 38 |
+
2. move constructor
|
| 39 |
+
*/
|
| 40 |
+
|
| 41 |
+
namespace std {
|
| 42 |
+
/*
|
| 43 |
+
Specialize std::complex<ap_int> to zero initialization ap_int.
|
| 44 |
+
|
| 45 |
+
To reduce the area cost, ap_int is not zero initialized, just like basic
|
| 46 |
+
types float or double. However, libstdc++ provides specialization for float,
|
| 47 |
+
double and long double, initializing image part to 0 when not specified.
|
| 48 |
+
|
| 49 |
+
This has become a difficulty in switching legacy code from these C types to
|
| 50 |
+
ap_int. To ease the tranform of legacy code, we have to implement
|
| 51 |
+
specialization of std::complex<> for our type.
|
| 52 |
+
|
| 53 |
+
As ap_int is a template, it is impossible to specialize only the methods
|
| 54 |
+
that causes default initialization of value type in std::complex<>. An
|
| 55 |
+
explicit full specialization of the template class has to be done, covering
|
| 56 |
+
all the member functions and operators of std::complex<> as specified
|
| 57 |
+
in standard 26.2.4 and 26.2.5.
|
| 58 |
+
*/
|
| 59 |
+
template <int _AP_W>
|
| 60 |
+
class complex<ap_int<_AP_W> > {
|
| 61 |
+
public:
|
| 62 |
+
typedef ap_int<_AP_W> _Tp;
|
| 63 |
+
typedef _Tp value_type;
|
| 64 |
+
|
| 65 |
+
// 26.2.4/1
|
| 66 |
+
// Constructor without argument
|
| 67 |
+
// Default initialize, so that in dataflow, the variable is only written once.
|
| 68 |
+
complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
|
| 69 |
+
// Constructor with ap_int.
|
| 70 |
+
// Zero initialize image part when not specified, so that `C(1) == C(1,0)`
|
| 71 |
+
complex(const _Tp &__r, const _Tp &__i = _Tp(0))
|
| 72 |
+
: _M_real(__r), _M_imag(__i) {}
|
| 73 |
+
|
| 74 |
+
// Constructor with another complex number
|
| 75 |
+
template <typename _Up>
|
| 76 |
+
complex(const complex<_Up> &__z) : _M_real(__z.real()), _M_imag(__z.imag()) {}
|
| 77 |
+
|
| 78 |
+
#if __cplusplus >= 201103L
|
| 79 |
+
const _Tp& real() const { return _M_real; }
|
| 80 |
+
const _Tp& imag() const { return _M_imag; }
|
| 81 |
+
#else
|
| 82 |
+
_Tp& real() { return _M_real; }
|
| 83 |
+
const _Tp& real() const { return _M_real; }
|
| 84 |
+
_Tp& imag() { return _M_imag; }
|
| 85 |
+
const _Tp& imag() const { return _M_imag; }
|
| 86 |
+
#endif
|
| 87 |
+
|
| 88 |
+
void real(_Tp __val) { _M_real = __val; }
|
| 89 |
+
|
| 90 |
+
void imag(_Tp __val) { _M_imag = __val; }
|
| 91 |
+
|
| 92 |
+
// Assign this complex number with ap_int.
|
| 93 |
+
// Zero initialize image poarrt, so that `C c; c = 1; c == C(1,0);`
|
| 94 |
+
complex<_Tp> &operator=(const _Tp __t) {
|
| 95 |
+
_M_real = __t;
|
| 96 |
+
_M_imag = _Tp(0);
|
| 97 |
+
return *this;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// 26.2.5/1
|
| 101 |
+
// Add ap_int to this complex number.
|
| 102 |
+
complex<_Tp> &operator+=(const _Tp &__t) {
|
| 103 |
+
_M_real += __t;
|
| 104 |
+
return *this;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// 26.2.5/3
|
| 108 |
+
// Subtract ap_int from this complex number.
|
| 109 |
+
complex<_Tp> &operator-=(const _Tp &__t) {
|
| 110 |
+
_M_real -= __t;
|
| 111 |
+
return *this;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
// 26.2.5/5
|
| 115 |
+
// Multiply this complex number by ap_int.
|
| 116 |
+
complex<_Tp> &operator*=(const _Tp &__t) {
|
| 117 |
+
_M_real *= __t;
|
| 118 |
+
_M_imag *= __t;
|
| 119 |
+
return *this;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// 26.2.5/7
|
| 123 |
+
// Divide this complex number by ap_int.
|
| 124 |
+
complex<_Tp> &operator/=(const _Tp &__t) {
|
| 125 |
+
_M_real /= __t;
|
| 126 |
+
_M_imag /= __t;
|
| 127 |
+
return *this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// Assign complex number to this complex number.
|
| 131 |
+
template <typename _Up>
|
| 132 |
+
complex<_Tp> &operator=(const complex<_Up> &__z) {
|
| 133 |
+
_M_real = __z.real();
|
| 134 |
+
_M_imag = __z.imag();
|
| 135 |
+
return *this;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// 26.2.5/9
|
| 139 |
+
// Add complex number to this.
|
| 140 |
+
template <typename _Up>
|
| 141 |
+
complex<_Tp> &operator+=(const complex<_Up> &__z) {
|
| 142 |
+
_M_real += __z.real();
|
| 143 |
+
_M_imag += __z.imag();
|
| 144 |
+
return *this;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// 26.2.5/11
|
| 148 |
+
// Subtract complex number from this.
|
| 149 |
+
template <typename _Up>
|
| 150 |
+
complex<_Tp> &operator-=(const complex<_Up> &__z) {
|
| 151 |
+
_M_real -= __z.real();
|
| 152 |
+
_M_imag -= __z.imag();
|
| 153 |
+
return *this;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// 26.2.5/13
|
| 157 |
+
// Multiply this by complex number.
|
| 158 |
+
template <typename _Up>
|
| 159 |
+
complex<_Tp> &operator*=(const complex<_Up> &__z) {
|
| 160 |
+
const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
|
| 161 |
+
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
|
| 162 |
+
_M_real = __r;
|
| 163 |
+
return *this;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// 26.2.5/15
|
| 167 |
+
// Divide this by complex number.
|
| 168 |
+
template <typename _Up>
|
| 169 |
+
complex<_Tp> &operator/=(const complex<_Up> &__z) {
|
| 170 |
+
complex<_Tp> cj (__z.real(), -__z.imag());
|
| 171 |
+
complex<_Tp> a = (*this) * cj;
|
| 172 |
+
complex<_Tp> b = cj * __z;
|
| 173 |
+
_M_real = a.real() / b.real();
|
| 174 |
+
_M_imag = a.imag() / b.real();
|
| 175 |
+
return *this;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
private:
|
| 179 |
+
_Tp _M_real;
|
| 180 |
+
_Tp _M_imag;
|
| 181 |
+
|
| 182 |
+
}; // class complex<ap_int<_AP_W> >
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
/*
|
| 186 |
+
Non-member operations
|
| 187 |
+
These operations are not required by standard in 26.2.6, but libstdc++
|
| 188 |
+
defines them for
|
| 189 |
+
float, double or long double's specialization.
|
| 190 |
+
*/
|
| 191 |
+
// Compare complex number with ap_int.
|
| 192 |
+
template <int _AP_W>
|
| 193 |
+
inline bool operator==(const complex<ap_int<_AP_W> > &__x, const ap_int<_AP_W> &__y) {
|
| 194 |
+
return __x.real() == __y &&
|
| 195 |
+
__x.imag() == 0;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
// Compare ap_int with complex number.
|
| 199 |
+
template <int _AP_W>
|
| 200 |
+
inline bool operator==(const ap_int<_AP_W> &__x, const complex<ap_int<_AP_W> > &__y) {
|
| 201 |
+
return __x == __y.real() &&
|
| 202 |
+
0 == __y.imag();
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
// Compare complex number with ap_int.
|
| 206 |
+
template <int _AP_W>
|
| 207 |
+
inline bool operator!=(const complex<ap_int<_AP_W> > &__x, const ap_int<_AP_W> &__y) {
|
| 208 |
+
return __x.real() != __y ||
|
| 209 |
+
__x.imag() != 0;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
// Compare ap_int with complex number.
|
| 213 |
+
template <int _AP_W>
|
| 214 |
+
inline bool operator!=(const ap_int<_AP_W> &__x, const complex<ap_int<_AP_W> > &__y) {
|
| 215 |
+
return __x != __y.real() ||
|
| 216 |
+
0 != __y.imag();
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
} // namespace std
|
| 220 |
+
|
| 221 |
+
#endif // ifndef __AP_INT_SPECIAL_H__
|
| 222 |
+
|
| 223 |
+
// -*- cpp -*-
|
firmware/ap_types/ap_shift_reg.h
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
#- (c) Copyright 2011-2019 Xilinx, Inc. All rights reserved.
|
| 3 |
+
#-
|
| 4 |
+
#- This file contains confidential and proprietary information
|
| 5 |
+
#- of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
#- international copyright and other intellectual property
|
| 7 |
+
#- laws.
|
| 8 |
+
#-
|
| 9 |
+
#- DISCLAIMER
|
| 10 |
+
#- This disclaimer is not a license and does not grant any
|
| 11 |
+
#- rights to the materials distributed herewith. Except as
|
| 12 |
+
#- otherwise provided in a valid license issued to you by
|
| 13 |
+
#- Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
#- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
#- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
#- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
#- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
#- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
#- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
#- including negligence, or under any other theory of
|
| 21 |
+
#- liability) for any loss or damage of any kind or nature
|
| 22 |
+
#- related to, arising under or in connection with these
|
| 23 |
+
#- materials, including for any direct, or any indirect,
|
| 24 |
+
#- special, incidental, or consequential loss or damage
|
| 25 |
+
#- (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
#- loss or damage suffered as a result of any action brought
|
| 27 |
+
#- by a third party) even if such damage or loss was
|
| 28 |
+
#- reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
#- possibility of the same.
|
| 30 |
+
#-
|
| 31 |
+
#- CRITICAL APPLICATIONS
|
| 32 |
+
#- Xilinx products are not designed or intended to be fail-
|
| 33 |
+
#- safe, or for use in any application requiring fail-safe
|
| 34 |
+
#- performance, such as life-support or safety devices or
|
| 35 |
+
#- systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
#- applications related to the deployment of airbags, or any
|
| 37 |
+
#- other applications that could lead to death, personal
|
| 38 |
+
#- injury, or severe property or environmental damage
|
| 39 |
+
#- (individually and collectively, "Critical
|
| 40 |
+
#- Applications"). Customer assumes the sole risk and
|
| 41 |
+
#- liability of any use of Xilinx products in Critical
|
| 42 |
+
#- Applications, subject only to applicable laws and
|
| 43 |
+
#- regulations governing limitations on product liability.
|
| 44 |
+
#-
|
| 45 |
+
#- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
#- PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
#- ************************************************************************
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 51 |
+
you may not use this file except in compliance with the License.
|
| 52 |
+
You may obtain a copy of the License at
|
| 53 |
+
|
| 54 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 55 |
+
|
| 56 |
+
Unless required by applicable law or agreed to in writing, software
|
| 57 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 58 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 59 |
+
See the License for the specific language governing permissions and
|
| 60 |
+
limitations under the License.
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
#ifndef __SIM_AP_SHIFT_REG_H__
|
| 64 |
+
#define __SIM_AP_SHIFT_REG_H__
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
/*
|
| 68 |
+
* This file contains a C++ model of shift register.
|
| 69 |
+
* It defines C level simulation model.
|
| 70 |
+
*/
|
| 71 |
+
#ifndef __cplusplus
|
| 72 |
+
#error C++ is required to include this header file
|
| 73 |
+
#else
|
| 74 |
+
|
| 75 |
+
#include <cassert>
|
| 76 |
+
|
| 77 |
+
//////////////////////////////////////////////
|
| 78 |
+
// C level simulation model for ap_shift_reg
|
| 79 |
+
//////////////////////////////////////////////
|
| 80 |
+
template<typename __SHIFT_T__, unsigned int __SHIFT_DEPTH__ = 32>
|
| 81 |
+
class ap_shift_reg
|
| 82 |
+
{
|
| 83 |
+
public:
|
| 84 |
+
/// Constructors
|
| 85 |
+
ap_shift_reg() { }
|
| 86 |
+
ap_shift_reg(const char* name) { }
|
| 87 |
+
/// Destructor
|
| 88 |
+
virtual ~ap_shift_reg() { }
|
| 89 |
+
|
| 90 |
+
private:
|
| 91 |
+
/// Make copy constructor and assignment operator private
|
| 92 |
+
ap_shift_reg(const ap_shift_reg< __SHIFT_T__, __SHIFT_DEPTH__ >& shreg)
|
| 93 |
+
{
|
| 94 |
+
for (unsigned i = 0; i < __SHIFT_DEPTH__; ++i)
|
| 95 |
+
Array[i] = shreg.Array[i];
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
ap_shift_reg& operator = (const ap_shift_reg< __SHIFT_T__,
|
| 99 |
+
__SHIFT_DEPTH__ >& shreg)
|
| 100 |
+
{
|
| 101 |
+
for (unsigned i = 0; i < __SHIFT_DEPTH__; ++i)
|
| 102 |
+
Array[i] = shreg.Array[i];
|
| 103 |
+
return *this;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
public:
|
| 107 |
+
// Shift the queue, push to back and read from a given address.
|
| 108 |
+
__SHIFT_T__ shift(__SHIFT_T__ DataIn,
|
| 109 |
+
unsigned int Addr = __SHIFT_DEPTH__ - 1, bool Enable = true)
|
| 110 |
+
{
|
| 111 |
+
assert(Addr < __SHIFT_DEPTH__ &&
|
| 112 |
+
"Out-of-bound shift is found in ap_shift_reg.");
|
| 113 |
+
__SHIFT_T__ ret = Array[Addr];
|
| 114 |
+
if (Enable) {
|
| 115 |
+
for (unsigned int i = __SHIFT_DEPTH__ - 1; i > 0; --i)
|
| 116 |
+
Array[i] = Array[i-1];
|
| 117 |
+
Array[0] = DataIn;
|
| 118 |
+
}
|
| 119 |
+
return ret;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// Read from a given address.
|
| 123 |
+
__SHIFT_T__ read(unsigned int Addr = __SHIFT_DEPTH__ - 1) const
|
| 124 |
+
{
|
| 125 |
+
assert(Addr < __SHIFT_DEPTH__ &&
|
| 126 |
+
"Out-of-bound read is found in ap_shift_reg.");
|
| 127 |
+
return Array[Addr];
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
protected:
|
| 131 |
+
__SHIFT_T__ Array[__SHIFT_DEPTH__];
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
#endif //__cplusplus
|
| 135 |
+
|
| 136 |
+
#endif //__SIM_AP_SHIFT_REG_H__
|
| 137 |
+
|
| 138 |
+
|
firmware/ap_types/etc/ap_private.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
firmware/ap_types/hls_math.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef X_HLS_MATH_H
|
| 2 |
+
#define X_HLS_MATH_H
|
| 3 |
+
|
| 4 |
+
#include <cmath>
|
| 5 |
+
#include "ap_fixed.h"
|
| 6 |
+
|
| 7 |
+
namespace hls {
|
| 8 |
+
|
| 9 |
+
template<class T>
|
| 10 |
+
static T exp(const T x) {
|
| 11 |
+
return (T) std::exp(x.to_double());
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
template <typename T> T sin(T x) { return (T) std::sin(x.to_double()); };
|
| 15 |
+
|
| 16 |
+
template <typename T> T cos(T x) { return (T) std::cos(x.to_double()); };
|
| 17 |
+
|
| 18 |
+
template <typename T> T asin(T x) { return (T) std::asin(x.to_double()); };
|
| 19 |
+
|
| 20 |
+
template <typename T> T acos(T x) { return (T) std::acos(x.to_double()); };
|
| 21 |
+
|
| 22 |
+
template <typename T> T atan(T x) { return (T) std::atan(x.to_double()); };
|
| 23 |
+
|
| 24 |
+
template <typename T> T atan2(T x, T y) { return (T) hls::atan2(x.to_double(), y.to_double()); };
|
| 25 |
+
|
| 26 |
+
}
|
| 27 |
+
#endif
|
firmware/ap_types/hls_stream.h
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 5 |
+
#- of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
#- international copyright and other intellectual property
|
| 7 |
+
#- laws.
|
| 8 |
+
#-
|
| 9 |
+
#- DISCLAIMER
|
| 10 |
+
#- This disclaimer is not a license and does not grant any
|
| 11 |
+
#- rights to the materials distributed herewith. Except as
|
| 12 |
+
#- otherwise provided in a valid license issued to you by
|
| 13 |
+
#- Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
#- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
#- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
#- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
#- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
#- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
#- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
#- including negligence, or under any other theory of
|
| 21 |
+
#- liability) for any loss or damage of any kind or nature
|
| 22 |
+
#- related to, arising under or in connection with these
|
| 23 |
+
#- materials, including for any direct, or any indirect,
|
| 24 |
+
#- special, incidental, or consequential loss or damage
|
| 25 |
+
#- (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
#- loss or damage suffered as a result of any action brought
|
| 27 |
+
#- by a third party) even if such damage or loss was
|
| 28 |
+
#- reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
#- possibility of the same.
|
| 30 |
+
#-
|
| 31 |
+
#- CRITICAL APPLICATIONS
|
| 32 |
+
#- Xilinx products are not designed or intended to be fail-
|
| 33 |
+
#- safe, or for use in any application requiring fail-safe
|
| 34 |
+
#- performance, such as life-support or safety devices or
|
| 35 |
+
#- systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
#- applications related to the deployment of airbags, or any
|
| 37 |
+
#- other applications that could lead to death, personal
|
| 38 |
+
#- injury, or severe property or environmental damage
|
| 39 |
+
#- (individually and collectively, "Critical
|
| 40 |
+
#- Applications"). Customer assumes the sole risk and
|
| 41 |
+
#- liability of any use of Xilinx products in Critical
|
| 42 |
+
#- Applications, subject only to applicable laws and
|
| 43 |
+
#- regulations governing limitations on product liability.
|
| 44 |
+
#-
|
| 45 |
+
#- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
#- PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
#- ************************************************************************
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 51 |
+
you may not use this file except in compliance with the License.
|
| 52 |
+
You may obtain a copy of the License at
|
| 53 |
+
|
| 54 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 55 |
+
|
| 56 |
+
Unless required by applicable law or agreed to in writing, software
|
| 57 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 58 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 59 |
+
See the License for the specific language governing permissions and
|
| 60 |
+
limitations under the License.
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
#ifndef X_HLS_STREAM_SIM_H
|
| 64 |
+
#define X_HLS_STREAM_SIM_H
|
| 65 |
+
|
| 66 |
+
/*
|
| 67 |
+
* This file contains a C++ model of hls::stream.
|
| 68 |
+
* It defines C simulation model.
|
| 69 |
+
*/
|
| 70 |
+
#ifndef __cplusplus
|
| 71 |
+
|
| 72 |
+
#error C++ is required to include this header file
|
| 73 |
+
|
| 74 |
+
#else
|
| 75 |
+
|
| 76 |
+
//////////////////////////////////////////////
|
| 77 |
+
// C level simulation models for hls::stream
|
| 78 |
+
//////////////////////////////////////////////
|
| 79 |
+
#include <queue>
|
| 80 |
+
#include <iostream>
|
| 81 |
+
#include <typeinfo>
|
| 82 |
+
#include <string>
|
| 83 |
+
#include <sstream>
|
| 84 |
+
|
| 85 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 86 |
+
#include <mutex>
|
| 87 |
+
#include <condition_variable>
|
| 88 |
+
#endif
|
| 89 |
+
|
| 90 |
+
#ifndef _MSC_VER
|
| 91 |
+
#include <cxxabi.h>
|
| 92 |
+
#include <stdlib.h>
|
| 93 |
+
#endif
|
| 94 |
+
|
| 95 |
+
namespace hls {
|
| 96 |
+
|
| 97 |
+
template<typename __STREAM_T__>
|
| 98 |
+
class stream
|
| 99 |
+
{
|
| 100 |
+
protected:
|
| 101 |
+
std::string _name;
|
| 102 |
+
std::deque<__STREAM_T__> _data; // container for the elements
|
| 103 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 104 |
+
std::mutex _mutex;
|
| 105 |
+
std::condition_variable _condition_var;
|
| 106 |
+
#endif
|
| 107 |
+
|
| 108 |
+
public:
|
| 109 |
+
/// Constructors
|
| 110 |
+
// Keep consistent with the synthesis model's constructors
|
| 111 |
+
stream() {
|
| 112 |
+
static unsigned _counter = 1;
|
| 113 |
+
std::stringstream ss;
|
| 114 |
+
#ifndef _MSC_VER
|
| 115 |
+
char* _demangle_name = abi::__cxa_demangle(typeid(*this).name(), 0, 0, 0);
|
| 116 |
+
if (_demangle_name) {
|
| 117 |
+
_name = _demangle_name;
|
| 118 |
+
free(_demangle_name);
|
| 119 |
+
}
|
| 120 |
+
else {
|
| 121 |
+
_name = "hls_stream";
|
| 122 |
+
}
|
| 123 |
+
#else
|
| 124 |
+
_name = typeid(*this).name();
|
| 125 |
+
#endif
|
| 126 |
+
|
| 127 |
+
ss << _counter++;
|
| 128 |
+
_name += "." + ss.str();
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
stream(const std::string name) {
|
| 132 |
+
// default constructor,
|
| 133 |
+
// capacity set to predefined maximum
|
| 134 |
+
_name = name;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/// Make copy constructor and assignment operator private
|
| 138 |
+
private:
|
| 139 |
+
stream(const stream< __STREAM_T__ >& chn):
|
| 140 |
+
_name(chn._name), _data(chn._data) {
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
stream& operator = (const stream< __STREAM_T__ >& chn) {
|
| 144 |
+
_name = chn._name;
|
| 145 |
+
_data = chn._data;
|
| 146 |
+
return *this;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
public:
|
| 150 |
+
/// Overload >> and << operators to implement read() and write()
|
| 151 |
+
void operator >> (__STREAM_T__& rdata) {
|
| 152 |
+
read(rdata);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
void operator << (const __STREAM_T__& wdata) {
|
| 156 |
+
write(wdata);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
public:
|
| 161 |
+
/// Destructor
|
| 162 |
+
/// Check status of the queue
|
| 163 |
+
virtual ~stream() {
|
| 164 |
+
if (!_data.empty())
|
| 165 |
+
{
|
| 166 |
+
std::cout << "WARNING: Hls::stream '"
|
| 167 |
+
<< _name
|
| 168 |
+
<< "' contains leftover data,"
|
| 169 |
+
<< " which may result in RTL simulation hanging."
|
| 170 |
+
<< std::endl;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/// Status of the queue
|
| 175 |
+
bool empty() {
|
| 176 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 177 |
+
std::lock_guard<std::mutex> lg(_mutex);
|
| 178 |
+
#endif
|
| 179 |
+
return _data.empty();
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
bool full() const { return false; }
|
| 183 |
+
|
| 184 |
+
/// Blocking read
|
| 185 |
+
void read(__STREAM_T__& head) {
|
| 186 |
+
head = read();
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 190 |
+
__STREAM_T__ read() {
|
| 191 |
+
std::unique_lock<std::mutex> ul(_mutex);
|
| 192 |
+
while (_data.empty()) {
|
| 193 |
+
_condition_var.wait(ul);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
__STREAM_T__ elem;
|
| 197 |
+
elem = _data.front();
|
| 198 |
+
_data.pop_front();
|
| 199 |
+
return elem;
|
| 200 |
+
}
|
| 201 |
+
#else
|
| 202 |
+
__STREAM_T__ read() {
|
| 203 |
+
__STREAM_T__ elem;
|
| 204 |
+
if (_data.empty()) {
|
| 205 |
+
std::cout << "WARNING: Hls::stream '"
|
| 206 |
+
<< _name
|
| 207 |
+
<< "' is read while empty,"
|
| 208 |
+
<< " which may result in RTL simulation hanging."
|
| 209 |
+
<< std::endl;
|
| 210 |
+
elem = __STREAM_T__();
|
| 211 |
+
} else {
|
| 212 |
+
elem = _data.front();
|
| 213 |
+
_data.pop_front();
|
| 214 |
+
}
|
| 215 |
+
return elem;
|
| 216 |
+
}
|
| 217 |
+
#endif
|
| 218 |
+
|
| 219 |
+
/// Blocking write
|
| 220 |
+
void write(const __STREAM_T__& tail) {
|
| 221 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 222 |
+
std::unique_lock<std::mutex> ul(_mutex);
|
| 223 |
+
#endif
|
| 224 |
+
_data.push_back(tail);
|
| 225 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 226 |
+
_condition_var.notify_one();
|
| 227 |
+
#endif
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
/// Nonblocking read
|
| 231 |
+
bool read_nb(__STREAM_T__& head) {
|
| 232 |
+
#ifdef HLS_STREAM_THREAD_SAFE
|
| 233 |
+
std::lock_guard<std::mutex> lg(_mutex);
|
| 234 |
+
#endif
|
| 235 |
+
bool is_empty = _data.empty();
|
| 236 |
+
if (is_empty) {
|
| 237 |
+
head = __STREAM_T__();
|
| 238 |
+
} else {
|
| 239 |
+
__STREAM_T__ elem(_data.front());
|
| 240 |
+
_data.pop_front();
|
| 241 |
+
head = elem;
|
| 242 |
+
}
|
| 243 |
+
return !is_empty;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/// Nonblocking write
|
| 247 |
+
bool write_nb(const __STREAM_T__& tail) {
|
| 248 |
+
bool is_full = full();
|
| 249 |
+
write(tail);
|
| 250 |
+
return !is_full;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
/// Fifo size
|
| 254 |
+
size_t size() {
|
| 255 |
+
return _data.size();
|
| 256 |
+
}
|
| 257 |
+
};
|
| 258 |
+
|
| 259 |
+
} // namespace hls
|
| 260 |
+
|
| 261 |
+
#endif // __cplusplus
|
| 262 |
+
#endif // X_HLS_STREAM_SIM_H
|
| 263 |
+
|
firmware/ap_types/utils/x_hls_utils.h
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef X_HLS_UTILS_H
|
| 2 |
+
#define X_HLS_UTILS_H
|
| 3 |
+
#include "ap_fixed.h"
|
| 4 |
+
#include <limits>
|
| 5 |
+
|
| 6 |
+
namespace hls {
|
| 7 |
+
|
| 8 |
+
template<typename T>
|
| 9 |
+
class numeric_limits {
|
| 10 |
+
public:
|
| 11 |
+
static T max() { return std::numeric_limits<T>::max(); }
|
| 12 |
+
static T min() { return std::numeric_limits<T>::min(); }
|
| 13 |
+
static T epsilon() { return std::numeric_limits<T>::epsilon(); }
|
| 14 |
+
};
|
| 15 |
+
|
| 16 |
+
template <int W, int I, ap_q_mode Q, ap_o_mode O>
|
| 17 |
+
class numeric_limits<ap_fixed<W,I,Q,O> > {
|
| 18 |
+
public:
|
| 19 |
+
static ap_fixed<W,I,Q,O> max() {
|
| 20 |
+
ap_int<W> m = ::hls::numeric_limits<ap_int<W> >::max();
|
| 21 |
+
ap_fixed<W,I,Q,O> x;
|
| 22 |
+
x(W-1,0) = m(W-1,0);
|
| 23 |
+
return x;
|
| 24 |
+
}
|
| 25 |
+
static ap_fixed<W,I,Q,O> min() {
|
| 26 |
+
ap_int<W> m = ::hls::numeric_limits<ap_int<W> >::min();
|
| 27 |
+
ap_fixed<W,I,Q,O> x;
|
| 28 |
+
x(W-1,0) = m(W-1,0);
|
| 29 |
+
return x;
|
| 30 |
+
}
|
| 31 |
+
static ap_fixed<W,I,Q,O> epsilon() {
|
| 32 |
+
ap_fixed<W,I,Q,O> x = 0;
|
| 33 |
+
x[0] = 1;
|
| 34 |
+
return x;
|
| 35 |
+
}
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
template <int W, int I, ap_q_mode Q, ap_o_mode O>
|
| 39 |
+
class numeric_limits<ap_ufixed<W,I,Q,O> > {
|
| 40 |
+
public:
|
| 41 |
+
static ap_ufixed<W,I,Q,O> max() {
|
| 42 |
+
ap_uint<W> m = ::hls::numeric_limits<ap_uint<W> >::max();
|
| 43 |
+
ap_ufixed<W,I,Q,O> x;
|
| 44 |
+
x(W-1,0) = m(W-1,0);
|
| 45 |
+
return x;
|
| 46 |
+
}
|
| 47 |
+
static ap_ufixed<W,I,Q,O> min() { return 0; }
|
| 48 |
+
static ap_ufixed<W,I,Q,O> epsilon() {
|
| 49 |
+
ap_ufixed<W,I,Q,O> x = 0;
|
| 50 |
+
x[0] = 1;
|
| 51 |
+
return x;
|
| 52 |
+
}
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
template <int W>
|
| 56 |
+
class numeric_limits<ap_int<W> > {
|
| 57 |
+
public:
|
| 58 |
+
static ap_int<W> max() { ap_int<W> m = min(); return ~m; }
|
| 59 |
+
static ap_int<W> min() { ap_int<W> m = 0; m[W-1] = 1; return m; }
|
| 60 |
+
static ap_int<W> epsilon() {
|
| 61 |
+
ap_int<W> x = 0;
|
| 62 |
+
x[0] = 1;
|
| 63 |
+
return x;
|
| 64 |
+
}
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
template <int W>
|
| 68 |
+
class numeric_limits<ap_uint<W> > {
|
| 69 |
+
public:
|
| 70 |
+
static ap_uint<W> max() { ap_uint<W> zero = 0; return ~zero; }
|
| 71 |
+
static ap_uint<W> min() { return 0; }
|
| 72 |
+
static ap_uint<W> epsilon() {
|
| 73 |
+
ap_uint<W> x = 0;
|
| 74 |
+
x[0] = 1;
|
| 75 |
+
return x;
|
| 76 |
+
}
|
| 77 |
+
};
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
#endif
|
firmware/nnet_utils/nnet_code_gen.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_INSTR_GEN_H_
|
| 2 |
+
#define NNET_INSTR_GEN_H_
|
| 3 |
+
|
| 4 |
+
#include "nnet_conv1d_latency.h"
|
| 5 |
+
#include "nnet_helpers.h"
|
| 6 |
+
|
| 7 |
+
#include "hls_stream.h"
|
| 8 |
+
#include "nnet_common.h"
|
| 9 |
+
#include "nnet_function_stubs.h"
|
| 10 |
+
#include "nnet_mult.h"
|
| 11 |
+
|
| 12 |
+
namespace nnet {
|
| 13 |
+
|
| 14 |
+
template <class data_T, class res_T, typename CONFIG_T> class PointwiseConv1D {
|
| 15 |
+
public:
|
| 16 |
+
static void pointwise_conv(data_T data[CONFIG_T::in_width * CONFIG_T::n_chan],
|
| 17 |
+
res_T res[CONFIG_T::out_width * CONFIG_T::n_filt],
|
| 18 |
+
typename CONFIG_T::weight_t weights[CONFIG_T::n_chan * CONFIG_T::n_filt],
|
| 19 |
+
typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
|
| 20 |
+
// To be implemented in subclasses
|
| 21 |
+
}
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
+
// hls4ml insert code
|
| 25 |
+
|
| 26 |
+
} // namespace nnet
|
| 27 |
+
|
| 28 |
+
#endif
|
firmware/nnet_utils/nnet_conv1d_stream.h
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_CONV1D_STREAM_H_
|
| 2 |
+
#define NNET_CONV1D_STREAM_H_
|
| 3 |
+
|
| 4 |
+
#include "hls_stream.h"
|
| 5 |
+
#include "nnet_common.h"
|
| 6 |
+
#include "nnet_conv_stream.h"
|
| 7 |
+
#include <cassert>
|
| 8 |
+
|
| 9 |
+
namespace nnet {
|
| 10 |
+
|
| 11 |
+
template <class data_T, class res_T, typename CONFIG_T>
|
| 12 |
+
void conv_1d_cl(hls::stream<data_T> &data, hls::stream<res_T> &res,
|
| 13 |
+
typename CONFIG_T::weight_t weights[CONFIG_T::filt_width * CONFIG_T::n_chan * CONFIG_T::n_filt],
|
| 14 |
+
typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
|
| 15 |
+
assert(CONFIG_T::implementation == conv_implementation::linebuffer &&
|
| 16 |
+
"Only \"linebuffer\" implementation is supported in Vitis HLS.");
|
| 17 |
+
|
| 18 |
+
assert(CONFIG_T::pad_left == 0 && CONFIG_T::pad_right == 0);
|
| 19 |
+
|
| 20 |
+
if (CONFIG_T::strategy == nnet::latency || CONFIG_T::strategy == nnet::distributed_arithmetic) {
|
| 21 |
+
ReadInputWidth:
|
| 22 |
+
for (unsigned i_iw = 0; i_iw < CONFIG_T::in_width; i_iw++) {
|
| 23 |
+
#pragma HLS PIPELINE II=CONFIG_T::reuse_factor
|
| 24 |
+
compute_output_buffer_1d<data_T, res_T, CONFIG_T>(data.read(), res, weights, biases);
|
| 25 |
+
}
|
| 26 |
+
} else if (CONFIG_T::strategy == nnet::resource || CONFIG_T::strategy == nnet::resource_unrolled) {
|
| 27 |
+
ReadInputWidthSerial:
|
| 28 |
+
for (unsigned i_iw = 0; i_iw < CONFIG_T::in_width; i_iw++) {
|
| 29 |
+
compute_output_buffer_1d<data_T, res_T, CONFIG_T>(data.read(), res, weights, biases);
|
| 30 |
+
}
|
| 31 |
+
} else {
|
| 32 |
+
assert(false && "Unsupported strategy for conv_1d_cl");
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
} // namespace nnet
|
| 37 |
+
#endif
|
firmware/nnet_utils/nnet_conv2d_latency.h
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_CONV2D_LATENCY_H_
|
| 2 |
+
#define NNET_CONV2D_LATENCY_H_
|
| 3 |
+
|
| 4 |
+
#include "nnet_common.h"
|
| 5 |
+
#include "nnet_mult.h"
|
| 6 |
+
#include <cstdlib>
|
| 7 |
+
|
| 8 |
+
namespace nnet {
|
| 9 |
+
|
| 10 |
+
template <class data_T, class res_T, typename CONFIG_T>
|
| 11 |
+
void conv_2d_latency_cl(
|
| 12 |
+
data_T data[CONFIG_T::in_height * CONFIG_T::in_width * CONFIG_T::n_chan],
|
| 13 |
+
res_T res[CONFIG_T::out_height * CONFIG_T::out_width * CONFIG_T::n_filt],
|
| 14 |
+
typename CONFIG_T::weight_t weights[CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan * CONFIG_T::n_filt],
|
| 15 |
+
typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
|
| 16 |
+
constexpr unsigned mult_n_in = CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan;
|
| 17 |
+
constexpr unsigned mult_n_out = CONFIG_T::n_filt;
|
| 18 |
+
|
| 19 |
+
data_T data_buf[CONFIG_T::n_pixels][mult_n_in];
|
| 20 |
+
#pragma HLS ARRAY_PARTITION variable=data_buf complete dim=0
|
| 21 |
+
|
| 22 |
+
typename CONFIG_T::accum_t mult[mult_n_in * mult_n_out];
|
| 23 |
+
#pragma HLS ARRAY_PARTITION variable=mult complete
|
| 24 |
+
|
| 25 |
+
typename CONFIG_T::accum_t acc[mult_n_out];
|
| 26 |
+
#pragma HLS ARRAY_PARTITION variable=acc complete
|
| 27 |
+
|
| 28 |
+
#pragma HLS ARRAY_PARTITION variable=weights complete
|
| 29 |
+
#pragma HLS ARRAY_PARTITION variable=biases complete
|
| 30 |
+
|
| 31 |
+
// Limit multipliers to control parallelization
|
| 32 |
+
#pragma HLS ALLOCATION operation instances=mul limit=CONFIG_T::mult_config::multiplier_limit
|
| 33 |
+
|
| 34 |
+
PartitionLoop:
|
| 35 |
+
for (int i_part = 0; i_part < CONFIG_T::n_partitions; i_part++) {
|
| 36 |
+
#pragma HLS PIPELINE II=CONFIG_T::reuse_factor rewind
|
| 37 |
+
|
| 38 |
+
CONFIG_T::template fill_buffer<data_T, CONFIG_T>::fill_buffer(data, data_buf, i_part);
|
| 39 |
+
|
| 40 |
+
PixelLoop:
|
| 41 |
+
for (unsigned i_pxl = 0; i_pxl < CONFIG_T::n_pixels; i_pxl++) {
|
| 42 |
+
#pragma HLS UNROLL
|
| 43 |
+
|
| 44 |
+
data_T cache;
|
| 45 |
+
|
| 46 |
+
// Do the matrix-multiply
|
| 47 |
+
Product1:
|
| 48 |
+
for (int i_in = 0; i_in < mult_n_in; i_in++) {
|
| 49 |
+
#pragma HLS UNROLL
|
| 50 |
+
cache = data_buf[i_pxl][i_in];
|
| 51 |
+
Product2:
|
| 52 |
+
for (int i_out = 0; i_out < mult_n_out; i_out++) {
|
| 53 |
+
#pragma HLS UNROLL
|
| 54 |
+
mult[i_in * mult_n_out + i_out] =
|
| 55 |
+
CONFIG_T::mult_config::template product<data_T, typename CONFIG_T::mult_config::weight_t>::product(
|
| 56 |
+
cache, weights[i_in * mult_n_out + i_out]);
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// Initialize accumulator with input biases
|
| 61 |
+
ResetAccum:
|
| 62 |
+
for (int i_acc = 0; i_acc < mult_n_out; i_acc++) {
|
| 63 |
+
#pragma HLS UNROLL
|
| 64 |
+
acc[i_acc] = (typename CONFIG_T::accum_t)biases[i_acc];
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// Accumulate multiplication result
|
| 68 |
+
Accum1:
|
| 69 |
+
for (int i_in = 0; i_in < mult_n_in; i_in++) {
|
| 70 |
+
#pragma HLS UNROLL
|
| 71 |
+
Accum2:
|
| 72 |
+
for (int i_out = 0; i_out < mult_n_out; i_out++) {
|
| 73 |
+
#pragma HLS UNROLL
|
| 74 |
+
acc[i_out] += mult[i_in * mult_n_out + i_out];
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// Cast to "res_t" type
|
| 79 |
+
Result:
|
| 80 |
+
for (int i_res = 0; i_res < mult_n_out; i_res++) {
|
| 81 |
+
#pragma HLS UNROLL
|
| 82 |
+
res[i_part * CONFIG_T::n_pixels * mult_n_out + i_pxl * mult_n_out + i_res] =
|
| 83 |
+
cast<data_T, res_T, typename CONFIG_T::mult_config>(acc[i_res]);
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
} // namespace nnet
|
| 90 |
+
#endif
|
firmware/nnet_utils/nnet_conv2d_resource.h
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_CONV2D_RESOURCE_H_
|
| 2 |
+
#define NNET_CONV2D_RESOURCE_H_
|
| 3 |
+
|
| 4 |
+
#include "nnet_common.h"
|
| 5 |
+
#include "nnet_dense.h"
|
| 6 |
+
|
| 7 |
+
namespace nnet {
|
| 8 |
+
|
| 9 |
+
template <class data_T, class res_T, typename CONFIG_T>
|
| 10 |
+
void conv_2d_resource_cl(
|
| 11 |
+
data_T data[CONFIG_T::in_height * CONFIG_T::in_width * CONFIG_T::n_chan],
|
| 12 |
+
res_T res[CONFIG_T::out_height * CONFIG_T::out_width * CONFIG_T::n_filt],
|
| 13 |
+
typename CONFIG_T::weight_t weights[CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan * CONFIG_T::n_filt],
|
| 14 |
+
typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
|
| 15 |
+
constexpr unsigned mult_n_in = CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan;
|
| 16 |
+
constexpr unsigned mult_n_out = CONFIG_T::n_filt;
|
| 17 |
+
constexpr unsigned block_factor = DIV_ROUNDUP(mult_n_in * mult_n_out, CONFIG_T::reuse_factor);
|
| 18 |
+
|
| 19 |
+
constexpr unsigned multiplier_limit = DIV_ROUNDUP(mult_n_in * mult_n_out, CONFIG_T::reuse_factor);
|
| 20 |
+
constexpr unsigned multscale = multiplier_limit / mult_n_out;
|
| 21 |
+
|
| 22 |
+
assert((multiplier_limit % mult_n_out == 0 || CONFIG_T::reuse_factor >= mult_n_in) &&
|
| 23 |
+
"The current Reuse Factor is not allowed");
|
| 24 |
+
assert((multiplier_limit == block_factor) &&
|
| 25 |
+
"This function is correct only for RF <= FILT_HEIGHT * FILT_WIDTH * N_CHAN");
|
| 26 |
+
|
| 27 |
+
// Treating weights as 2d is required to make sure Vitis doesn't use urem cores to calculate indices.
|
| 28 |
+
// Also, we don't apply ARRAY_RESHAPE pragma as Vitis figures this out on its own.
|
| 29 |
+
typename CONFIG_T::weight_t(*weights_2d)[CONFIG_T::reuse_factor] =
|
| 30 |
+
(typename CONFIG_T::weight_t(*)[CONFIG_T::reuse_factor])weights;
|
| 31 |
+
|
| 32 |
+
data_T data_buf[CONFIG_T::n_pixels][mult_n_in];
|
| 33 |
+
#pragma HLS ARRAY_PARTITION variable=data_buf complete dim=0
|
| 34 |
+
|
| 35 |
+
#pragma HLS ARRAY_PARTITION variable=biases complete
|
| 36 |
+
|
| 37 |
+
typename CONFIG_T::accum_t acc[CONFIG_T::n_pixels][mult_n_out];
|
| 38 |
+
#pragma HLS ARRAY_PARTITION variable=acc complete dim=0
|
| 39 |
+
|
| 40 |
+
PartitionLoop:
|
| 41 |
+
for (unsigned i_part = 0; i_part < CONFIG_T::n_partitions; i_part++) {
|
| 42 |
+
//#pragma HLS UNROLL // We don't want this loop unrolled
|
| 43 |
+
|
| 44 |
+
CONFIG_T::template fill_buffer<data_T, CONFIG_T>::fill_buffer(data, data_buf, i_part);
|
| 45 |
+
|
| 46 |
+
PixelInitAccumLoop:
|
| 47 |
+
for (unsigned i_pxl = 0; i_pxl < CONFIG_T::n_pixels; i_pxl++) {
|
| 48 |
+
#pragma HLS UNROLL
|
| 49 |
+
|
| 50 |
+
InitAccumLoop:
|
| 51 |
+
for (unsigned i_acc = 0; i_acc < mult_n_out; i_acc++) {
|
| 52 |
+
#pragma HLS UNROLL
|
| 53 |
+
acc[i_pxl][i_acc] = (typename CONFIG_T::accum_t)biases[i_acc];
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
ReuseLoop:
|
| 58 |
+
for (unsigned i_rf = 0; i_rf < CONFIG_T::reuse_factor; i_rf++) {
|
| 59 |
+
#pragma HLS PIPELINE II=1 rewind
|
| 60 |
+
|
| 61 |
+
unsigned i_in = i_rf;
|
| 62 |
+
unsigned i_out = 0;
|
| 63 |
+
unsigned i_acc = 0;
|
| 64 |
+
|
| 65 |
+
MultLoop:
|
| 66 |
+
for (unsigned i_blk = 0; i_blk < block_factor; i_blk++) {
|
| 67 |
+
#pragma HLS UNROLL
|
| 68 |
+
|
| 69 |
+
PixelMultLoop:
|
| 70 |
+
for (unsigned i_pxl = 0; i_pxl < CONFIG_T::n_pixels; i_pxl++) {
|
| 71 |
+
#pragma HLS UNROLL
|
| 72 |
+
|
| 73 |
+
acc[i_pxl][i_out] += static_cast<typename CONFIG_T::accum_t>(
|
| 74 |
+
CONFIG_T::mult_config::template product<data_T, typename CONFIG_T::mult_config::weight_t>::product(
|
| 75 |
+
data_buf[i_pxl][i_in], weights_2d[i_blk][i_rf]));
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// Increment i_in
|
| 79 |
+
i_in += CONFIG_T::reuse_factor;
|
| 80 |
+
if (i_in >= mult_n_in) {
|
| 81 |
+
i_in = i_rf;
|
| 82 |
+
}
|
| 83 |
+
// Increment i_out
|
| 84 |
+
if (i_acc + 1 >= multscale) {
|
| 85 |
+
i_acc = 0;
|
| 86 |
+
i_out++;
|
| 87 |
+
} else {
|
| 88 |
+
i_acc++;
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
PixelResultLoop:
|
| 94 |
+
for (unsigned i_pxl = 0; i_pxl < CONFIG_T::n_pixels; i_pxl++) {
|
| 95 |
+
#pragma HLS UNROLL
|
| 96 |
+
// Cast to "res_t" type
|
| 97 |
+
ResultLoop:
|
| 98 |
+
for (unsigned i_res = 0; i_res < mult_n_out; i_res++) {
|
| 99 |
+
#pragma HLS UNROLL
|
| 100 |
+
res[i_part * CONFIG_T::n_pixels * mult_n_out + i_pxl * mult_n_out + i_res] =
|
| 101 |
+
cast<data_T, res_T, typename CONFIG_T::mult_config>(acc[i_pxl][i_res]);
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
} // namespace nnet
|
| 108 |
+
#endif
|
firmware/nnet_utils/nnet_embed_stream.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_EMBED_STREAM_H_
|
| 2 |
+
#define NNET_EMBED_STREAM_H_
|
| 3 |
+
|
| 4 |
+
#include "hls_stream.h"
|
| 5 |
+
#include "nnet_common.h"
|
| 6 |
+
#include "nnet_helpers.h"
|
| 7 |
+
|
| 8 |
+
namespace nnet {
|
| 9 |
+
|
| 10 |
+
template <class data_T, class res_T, typename CONFIG_T>
|
| 11 |
+
void embedding(hls::stream<data_T> &data, hls::stream<res_T> &res,
|
| 12 |
+
typename CONFIG_T::embeddings_t embeddings[CONFIG_T::vocab_size * CONFIG_T::n_out]) {
|
| 13 |
+
data_T in_data = data.read();
|
| 14 |
+
|
| 15 |
+
InputSequence:
|
| 16 |
+
for (int j = 0; j < data_T::size; j++) {
|
| 17 |
+
#pragma HLS PIPELINE II=CONFIG_T::reuse_factor
|
| 18 |
+
|
| 19 |
+
res_T res_pack;
|
| 20 |
+
PRAGMA_DATA_PACK(res_pack)
|
| 21 |
+
|
| 22 |
+
DenseEmbedding:
|
| 23 |
+
for (int i = 0; i < CONFIG_T::n_out; i++) {
|
| 24 |
+
#pragma HLS UNROLL
|
| 25 |
+
res_pack[i] = embeddings[in_data[j] * CONFIG_T::n_out + i];
|
| 26 |
+
}
|
| 27 |
+
res.write(res_pack);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
} // namespace nnet
|
| 32 |
+
|
| 33 |
+
#endif
|
firmware/nnet_utils/nnet_helpers.h
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_HELPERS_H
|
| 2 |
+
#define NNET_HELPERS_H
|
| 3 |
+
|
| 4 |
+
#include "hls_stream.h"
|
| 5 |
+
#include <algorithm>
|
| 6 |
+
#include <fstream>
|
| 7 |
+
#include <iostream>
|
| 8 |
+
#include <map>
|
| 9 |
+
#include <math.h>
|
| 10 |
+
#include <stdio.h>
|
| 11 |
+
#include <stdlib.h>
|
| 12 |
+
#include <vector>
|
| 13 |
+
|
| 14 |
+
namespace nnet {
|
| 15 |
+
|
| 16 |
+
#ifndef __SYNTHESIS__
|
| 17 |
+
|
| 18 |
+
#ifndef WEIGHTS_DIR
|
| 19 |
+
#define WEIGHTS_DIR "weights"
|
| 20 |
+
#endif
|
| 21 |
+
|
| 22 |
+
template <class T, size_t SIZE> void load_weights_from_txt(T *w, const char *fname) {
|
| 23 |
+
|
| 24 |
+
std::string full_path = std::string(WEIGHTS_DIR) + "/" + std::string(fname);
|
| 25 |
+
std::ifstream infile(full_path.c_str(), std::ios::binary);
|
| 26 |
+
|
| 27 |
+
if (infile.fail()) {
|
| 28 |
+
std::cerr << "ERROR: file " << std::string(full_path) << " does not exist" << std::endl;
|
| 29 |
+
exit(1);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
std::string line;
|
| 33 |
+
if (std::getline(infile, line)) {
|
| 34 |
+
std::istringstream iss(line);
|
| 35 |
+
std::string token;
|
| 36 |
+
|
| 37 |
+
size_t i = 0;
|
| 38 |
+
while (std::getline(iss, token, ',')) {
|
| 39 |
+
std::istringstream(token) >> w[i];
|
| 40 |
+
i++;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
if (SIZE != i) {
|
| 44 |
+
std::cerr << "ERROR: Expected " << SIZE << " values";
|
| 45 |
+
std::cerr << " but read only " << i << " values" << std::endl;
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
template <class T, size_t SIZE> void load_compressed_weights_from_txt(T *w, const char *fname) {
|
| 51 |
+
|
| 52 |
+
std::string full_path = std::string(WEIGHTS_DIR) + "/" + std::string(fname);
|
| 53 |
+
std::ifstream infile(full_path.c_str(), std::ios::binary);
|
| 54 |
+
|
| 55 |
+
if (infile.fail()) {
|
| 56 |
+
std::cerr << "ERROR: file " << std::string(fname) << " does not exist" << std::endl;
|
| 57 |
+
exit(1);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
std::string line;
|
| 61 |
+
if (std::getline(infile, line)) {
|
| 62 |
+
std::istringstream iss(line);
|
| 63 |
+
std::string token;
|
| 64 |
+
std::string extra_chars = "} ";
|
| 65 |
+
|
| 66 |
+
size_t i = 0;
|
| 67 |
+
while (std::getline(iss, token, '{')) {
|
| 68 |
+
if (token.length() == 0) {
|
| 69 |
+
continue;
|
| 70 |
+
}
|
| 71 |
+
for (char c : extra_chars) {
|
| 72 |
+
token.erase(std::remove(token.begin(), token.end(), c), token.end());
|
| 73 |
+
}
|
| 74 |
+
if (token.back() == ',') {
|
| 75 |
+
token.erase(token.end() - 1);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
std::replace(token.begin(), token.end(), ',', ' ');
|
| 79 |
+
std::istringstream structss(token);
|
| 80 |
+
|
| 81 |
+
if (!(structss >> w[i].row_index >> w[i].col_index >> w[i].weight)) {
|
| 82 |
+
std::cerr << "ERROR: Unable to parse file " << std::string(fname);
|
| 83 |
+
exit(1);
|
| 84 |
+
}
|
| 85 |
+
i++;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
if (SIZE != i) {
|
| 89 |
+
std::cerr << "ERROR: Expected " << SIZE << " values";
|
| 90 |
+
std::cerr << " but read only " << i << " values" << std::endl;
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
template <class T, size_t SIZE> void load_exponent_weights_from_txt(T *w, const char *fname) {
|
| 96 |
+
|
| 97 |
+
std::string full_path = std::string(WEIGHTS_DIR) + "/" + std::string(fname);
|
| 98 |
+
std::ifstream infile(full_path.c_str(), std::ios::binary);
|
| 99 |
+
|
| 100 |
+
if (infile.fail()) {
|
| 101 |
+
std::cerr << "ERROR: file " << std::string(fname) << " does not exist" << std::endl;
|
| 102 |
+
exit(1);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
std::string line;
|
| 106 |
+
if (std::getline(infile, line)) {
|
| 107 |
+
std::istringstream iss(line);
|
| 108 |
+
std::string token;
|
| 109 |
+
std::string extra_chars = "} ";
|
| 110 |
+
|
| 111 |
+
size_t i = 0;
|
| 112 |
+
while (std::getline(iss, token, '{')) {
|
| 113 |
+
if (token.length() == 0) {
|
| 114 |
+
continue;
|
| 115 |
+
}
|
| 116 |
+
for (char c : extra_chars) {
|
| 117 |
+
token.erase(std::remove(token.begin(), token.end(), c), token.end());
|
| 118 |
+
}
|
| 119 |
+
if (token.back() == ',') {
|
| 120 |
+
token.erase(token.end() - 1);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
std::replace(token.begin(), token.end(), ',', ' ');
|
| 124 |
+
std::istringstream structss(token);
|
| 125 |
+
|
| 126 |
+
if (!(structss >> w[i].sign >> w[i].weight)) {
|
| 127 |
+
std::cerr << "ERROR: Unable to parse file " << std::string(fname);
|
| 128 |
+
exit(1);
|
| 129 |
+
}
|
| 130 |
+
i++;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
if (SIZE != i) {
|
| 134 |
+
std::cerr << "ERROR: Expected " << SIZE << " values";
|
| 135 |
+
std::cerr << " but read only " << i << " values" << std::endl;
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
template <class srcType, class dstType, size_t SIZE> void convert_data(srcType *src, dstType *dst) {
|
| 140 |
+
for (size_t i = 0; i < SIZE; i++) {
|
| 141 |
+
dst[i] = dstType(src[i]);
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
template <class srcType, class dstType, size_t SIZE> void convert_data(srcType *src, hls::stream<dstType> &dst) {
|
| 146 |
+
for (size_t i = 0; i < SIZE / dstType::size; i++) {
|
| 147 |
+
dstType ctype;
|
| 148 |
+
for (size_t j = 0; j < dstType::size; j++) {
|
| 149 |
+
ctype[j] = typename dstType::value_type(src[i * dstType::size + j]);
|
| 150 |
+
}
|
| 151 |
+
dst.write(ctype);
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
template <class srcType, class dstType, size_t SIZE> void convert_data(hls::stream<srcType> &src, dstType *dst) {
|
| 156 |
+
for (size_t i = 0; i < SIZE / srcType::size; i++) {
|
| 157 |
+
srcType ctype = src.read();
|
| 158 |
+
for (size_t j = 0; j < srcType::size; j++) {
|
| 159 |
+
dst[i * srcType::size + j] = dstType(ctype[j]);
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
extern bool trace_enabled;
|
| 165 |
+
extern std::map<std::string, void *> *trace_outputs;
|
| 166 |
+
extern size_t trace_type_size;
|
| 167 |
+
|
| 168 |
+
template <class data_T, class save_T> void save_output_array(data_T *data, save_T *ptr, size_t layer_size) {
|
| 169 |
+
for (int i = 0; i < layer_size; i++) {
|
| 170 |
+
ptr[i] = save_T(data[i]);
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
template <class data_T, class save_T> void save_output_array(hls::stream<data_T> &data, save_T *ptr, size_t layer_size) {
|
| 175 |
+
for (size_t i = 0; i < layer_size / data_T::size; i++) {
|
| 176 |
+
data_T ctype = data.read();
|
| 177 |
+
for (size_t j = 0; j < data_T::size; j++) {
|
| 178 |
+
ptr[i * data_T::size + j] = save_T(ctype[j]);
|
| 179 |
+
}
|
| 180 |
+
data.write(ctype);
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
// We don't want to include save_T in this function because it will be inserted into myproject.cpp
|
| 185 |
+
// so a workaround with element size is used
|
| 186 |
+
template <class data_T> void save_layer_output(data_T *data, const char *layer_name, size_t layer_size) {
|
| 187 |
+
if (!trace_enabled)
|
| 188 |
+
return;
|
| 189 |
+
|
| 190 |
+
if (trace_outputs) {
|
| 191 |
+
if (trace_outputs->count(layer_name) > 0) {
|
| 192 |
+
if (trace_type_size == 4) {
|
| 193 |
+
save_output_array<data_T, float>(data, (float *)(*trace_outputs)[layer_name], layer_size);
|
| 194 |
+
} else if (trace_type_size == 8) {
|
| 195 |
+
save_output_array<data_T, double>(data, (double *)(*trace_outputs)[layer_name], layer_size);
|
| 196 |
+
} else {
|
| 197 |
+
std::cout << "Unknown trace type!" << std::endl;
|
| 198 |
+
}
|
| 199 |
+
} else {
|
| 200 |
+
std::cout << "Layer name: " << layer_name << " not found in debug storage!" << std::endl;
|
| 201 |
+
}
|
| 202 |
+
} else {
|
| 203 |
+
std::ostringstream filename;
|
| 204 |
+
filename << "./tb_data/" << layer_name << "_output.log"; // TODO if run as a shared lib, path should be ../tb_data
|
| 205 |
+
std::fstream out;
|
| 206 |
+
out.open(filename.str(), std::ios::app);
|
| 207 |
+
assert(out.is_open());
|
| 208 |
+
for (int i = 0; i < layer_size; i++) {
|
| 209 |
+
out << float(data[i]) << " "; // We don't care about precision in text files
|
| 210 |
+
}
|
| 211 |
+
out << std::endl;
|
| 212 |
+
out.close();
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
template <class data_T> void save_layer_output(hls::stream<data_T> &data, const char *layer_name, size_t layer_size) {
|
| 217 |
+
if (!trace_enabled)
|
| 218 |
+
return;
|
| 219 |
+
|
| 220 |
+
if (trace_outputs) {
|
| 221 |
+
if (trace_outputs->count(layer_name) > 0) {
|
| 222 |
+
if (trace_type_size == 4) {
|
| 223 |
+
save_output_array<data_T, float>(data, (float *)(*trace_outputs)[layer_name], layer_size);
|
| 224 |
+
} else if (trace_type_size == 8) {
|
| 225 |
+
save_output_array<data_T, double>(data, (double *)(*trace_outputs)[layer_name], layer_size);
|
| 226 |
+
} else {
|
| 227 |
+
std::cout << "Unknown trace type!" << std::endl;
|
| 228 |
+
}
|
| 229 |
+
} else {
|
| 230 |
+
std::cout << "Layer name: " << layer_name << " not found in debug storage!" << std::endl;
|
| 231 |
+
}
|
| 232 |
+
} else {
|
| 233 |
+
std::ostringstream filename;
|
| 234 |
+
filename << "./tb_data/" << layer_name << "_output.log"; // TODO if run as a shared lib, path should be ../tb_data
|
| 235 |
+
std::fstream out;
|
| 236 |
+
out.open(filename.str(), std::ios::app);
|
| 237 |
+
assert(out.is_open());
|
| 238 |
+
for (size_t i = 0; i < layer_size / data_T::size; i++) {
|
| 239 |
+
data_T ctype = data.read();
|
| 240 |
+
for (size_t j = 0; j < data_T::size; j++) {
|
| 241 |
+
out << float(ctype[j]) << " "; // We don't care about precision in text files
|
| 242 |
+
}
|
| 243 |
+
data.write(ctype);
|
| 244 |
+
}
|
| 245 |
+
out << std::endl;
|
| 246 |
+
out.close();
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
#endif
|
| 251 |
+
|
| 252 |
+
template <class src_T, class dst_T, size_t OFFSET, size_t SIZE> void copy_data(std::vector<src_T> src, dst_T dst[SIZE]) {
|
| 253 |
+
typename std::vector<src_T>::const_iterator in_begin = src.cbegin() + OFFSET;
|
| 254 |
+
typename std::vector<src_T>::const_iterator in_end = in_begin + SIZE;
|
| 255 |
+
std::copy(in_begin, in_end, dst);
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
template <class src_T, class dst_T, size_t OFFSET, size_t SIZE>
|
| 259 |
+
void copy_data(std::vector<src_T> src, hls::stream<dst_T> &dst) {
|
| 260 |
+
typename std::vector<src_T>::const_iterator in_begin = src.cbegin() + OFFSET;
|
| 261 |
+
typename std::vector<src_T>::const_iterator in_end = in_begin + SIZE;
|
| 262 |
+
|
| 263 |
+
size_t i_pack = 0;
|
| 264 |
+
dst_T dst_pack;
|
| 265 |
+
for (typename std::vector<src_T>::const_iterator i = in_begin; i != in_end; ++i) {
|
| 266 |
+
dst_pack[i_pack++] = typename dst_T::value_type(*i);
|
| 267 |
+
if (i_pack == dst_T::size) {
|
| 268 |
+
i_pack = 0;
|
| 269 |
+
dst.write(dst_pack);
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
template <class src_T, class dst_T, size_t OFFSET, size_t SIZE> void copy_data_axi(std::vector<src_T> src, dst_T dst[SIZE]) {
|
| 275 |
+
for (auto i = 0; i < SIZE; i++)
|
| 276 |
+
if (i == SIZE - 1) {
|
| 277 |
+
dst[i].data = src[i];
|
| 278 |
+
dst[i].last = 1;
|
| 279 |
+
} else {
|
| 280 |
+
dst[i].data = src[i];
|
| 281 |
+
dst[i].last = 0;
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
template <class res_T, size_t SIZE> void print_result(res_T result[SIZE], std::ostream &out, bool keep = false) {
|
| 286 |
+
for (int i = 0; i < SIZE; i++) {
|
| 287 |
+
out << result[i] << " ";
|
| 288 |
+
}
|
| 289 |
+
out << std::endl;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
template <class res_T, size_t SIZE> void print_result(hls::stream<res_T> &result, std::ostream &out, bool keep = false) {
|
| 293 |
+
for (int i = 0; i < SIZE / res_T::size; i++) {
|
| 294 |
+
res_T res_pack = result.read();
|
| 295 |
+
for (int j = 0; j < res_T::size; j++) {
|
| 296 |
+
out << res_pack[j] << " ";
|
| 297 |
+
}
|
| 298 |
+
if (keep)
|
| 299 |
+
result.write(res_pack);
|
| 300 |
+
}
|
| 301 |
+
out << std::endl;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
template <class data_T, size_t SIZE> void fill_zero(data_T data[SIZE]) { std::fill_n(data, SIZE, 0.); }
|
| 305 |
+
|
| 306 |
+
template <class data_T, size_t SIZE> void fill_zero(hls::stream<data_T> &data) {
|
| 307 |
+
for (int i = 0; i < SIZE / data_T::size; i++) {
|
| 308 |
+
data_T data_pack;
|
| 309 |
+
for (int j = 0; j < data_T::size; j++) {
|
| 310 |
+
data_pack[j] = 0.;
|
| 311 |
+
}
|
| 312 |
+
data.write(data_pack);
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
template <class dataType, unsigned int nrows> int read_file_1D(const char *filename, dataType data[nrows]) {
|
| 317 |
+
FILE *fp;
|
| 318 |
+
fp = fopen(filename, "r");
|
| 319 |
+
if (fp == 0) {
|
| 320 |
+
return -1;
|
| 321 |
+
}
|
| 322 |
+
// Read data from file
|
| 323 |
+
float newval;
|
| 324 |
+
for (int ii = 0; ii < nrows; ii++) {
|
| 325 |
+
if (fscanf(fp, "%f\n", &newval) != 0) {
|
| 326 |
+
data[ii] = newval;
|
| 327 |
+
} else {
|
| 328 |
+
return -2;
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
fclose(fp);
|
| 332 |
+
return 0;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
template <class dataType, unsigned int nrows, unsigned int ncols>
|
| 336 |
+
int read_file_2D(const char *filename, dataType data[nrows][ncols]) {
|
| 337 |
+
FILE *fp;
|
| 338 |
+
fp = fopen(filename, "r");
|
| 339 |
+
if (fp == 0) {
|
| 340 |
+
return -1;
|
| 341 |
+
}
|
| 342 |
+
// Read data from file
|
| 343 |
+
float newval;
|
| 344 |
+
for (int ii = 0; ii < nrows; ii++) {
|
| 345 |
+
for (int jj = 0; jj < ncols; jj++) {
|
| 346 |
+
if (fscanf(fp, "%f\n", &newval) != 0) {
|
| 347 |
+
data[ii][jj] = newval;
|
| 348 |
+
} else {
|
| 349 |
+
return -2;
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
fclose(fp);
|
| 354 |
+
return 0;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
template <class in_T, class out_T, int N_IN> void change_type(hls::stream<in_T> &in, hls::stream<out_T> &out) {
|
| 358 |
+
in_T datareg;
|
| 359 |
+
hls::stream<out_T> input_trunc;
|
| 360 |
+
for (int ii = 0; ii < N_IN; ii++) {
|
| 361 |
+
out << (out_T)in.read();
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
template <class data_T, int N_IN> void hls_stream_debug(hls::stream<data_T> &data, hls::stream<data_T> &res) {
|
| 366 |
+
data_T datareg;
|
| 367 |
+
for (int ii = 0; ii < N_IN; ii++) {
|
| 368 |
+
datareg = data.read();
|
| 369 |
+
std::cout << "[" << ii << "]: " << datareg << std::endl;
|
| 370 |
+
res << datareg;
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
constexpr int ceillog2(int x) { return (x <= 2) ? 1 : 1 + ceillog2((x + 1) / 2); }
|
| 375 |
+
|
| 376 |
+
constexpr int floorlog2(int x) { return (x < 2) ? 0 : 1 + floorlog2(x / 2); }
|
| 377 |
+
|
| 378 |
+
constexpr int pow2(int x) { return x == 0 ? 1 : 2 * pow2(x - 1); }
|
| 379 |
+
|
| 380 |
+
} // namespace nnet
|
| 381 |
+
|
| 382 |
+
#endif
|
firmware/nnet_utils/nnet_sepconv2d.h
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_SEPARABLE_CONV2D_H_
|
| 2 |
+
#define NNET_SEPARABLE_CONV2D_H_
|
| 3 |
+
|
| 4 |
+
#include "nnet_common.h"
|
| 5 |
+
#include "nnet_conv2d.h"
|
| 6 |
+
#include "nnet_sepconv2d_latency.h"
|
| 7 |
+
//#include "nnet_sepconv2d_resource.h"
|
| 8 |
+
#include <cstdlib>
|
| 9 |
+
|
| 10 |
+
namespace nnet {
|
| 11 |
+
|
| 12 |
+
template <class data_T, class res_T, typename CONFIG_T>
|
| 13 |
+
void depthwise_conv_2d_cl(
|
| 14 |
+
data_T data[CONFIG_T::in_height * CONFIG_T::in_width * CONFIG_T::n_chan],
|
| 15 |
+
res_T res[CONFIG_T::out_height * CONFIG_T::out_width * CONFIG_T::n_filt],
|
| 16 |
+
typename CONFIG_T::weight_t weights[CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan],
|
| 17 |
+
typename CONFIG_T::bias_t biases[CONFIG_T::n_chan]) {
|
| 18 |
+
#pragma HLS INLINE recursive
|
| 19 |
+
if (CONFIG_T::strategy == nnet::latency || CONFIG_T::strategy == nnet::distributed_arithmetic) {
|
| 20 |
+
depthwise_conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
|
| 21 |
+
} else {
|
| 22 |
+
assert("Resource strategy for DepthwiseConv2D is not supported." && false);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
template <class data_T, class dw_res_T, class res_T, typename CONFIG_T>
|
| 27 |
+
void separable_conv_2d_cl(data_T data[CONFIG_T::depthwise_config::in_height * CONFIG_T::depthwise_config::in_width *
|
| 28 |
+
CONFIG_T::depthwise_config::n_chan],
|
| 29 |
+
res_T res[CONFIG_T::pointwise_config::out_height * CONFIG_T::pointwise_config::out_width *
|
| 30 |
+
CONFIG_T::pointwise_config::n_filt],
|
| 31 |
+
typename CONFIG_T::depthwise_config::weight_t
|
| 32 |
+
depthwise_weights[CONFIG_T::depthwise_config::filt_height *
|
| 33 |
+
CONFIG_T::depthwise_config::filt_width * CONFIG_T::depthwise_config::n_chan],
|
| 34 |
+
typename CONFIG_T::pointwise_config::weight_t
|
| 35 |
+
pointwise_weights[CONFIG_T::pointwise_config::n_chan * CONFIG_T::pointwise_config::n_filt],
|
| 36 |
+
typename CONFIG_T::depthwise_config::bias_t depthwise_biases[CONFIG_T::depthwise_config::n_chan],
|
| 37 |
+
typename CONFIG_T::pointwise_config::bias_t pointwise_biases[CONFIG_T::pointwise_config::n_filt]) {
|
| 38 |
+
#pragma HLS INLINE recursive
|
| 39 |
+
|
| 40 |
+
dw_res_T depthwise_res[CONFIG_T::depthwise_config::out_height * CONFIG_T::depthwise_config::out_width *
|
| 41 |
+
CONFIG_T::depthwise_config::n_filt];
|
| 42 |
+
|
| 43 |
+
depthwise_conv_2d_cl<data_T, dw_res_T, typename CONFIG_T::depthwise_config>(data, depthwise_res, depthwise_weights,
|
| 44 |
+
depthwise_biases);
|
| 45 |
+
pointwise_conv_2d_cl<dw_res_T, res_T, typename CONFIG_T::pointwise_config>(depthwise_res, res, pointwise_weights,
|
| 46 |
+
pointwise_biases);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
} // namespace nnet
|
| 50 |
+
|
| 51 |
+
#endif
|
firmware/nnet_utils/nnet_transpose.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_PERMUTE_H_
|
| 2 |
+
#define NNET_PERMUTE_H_
|
| 3 |
+
|
| 4 |
+
namespace nnet {
|
| 5 |
+
|
| 6 |
+
struct transpose_config {
|
| 7 |
+
static const unsigned dims;
|
| 8 |
+
static const unsigned N;
|
| 9 |
+
// vivado/vitis hls can't index constexpr array for some reason
|
| 10 |
+
// and vivado hls don't like template recursion either (vitis is fine)
|
| 11 |
+
// thus this appears to be the only workaround (or overkill it with codegen)
|
| 12 |
+
static const unsigned *const from_shape;
|
| 13 |
+
static const unsigned *const to_shape;
|
| 14 |
+
static const unsigned *const perm;
|
| 15 |
+
static const unsigned *const perm_strides;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
template <typename CONFIG_T> unsigned transfer_idx(int index) {
|
| 19 |
+
// Given output idx in c-order flat array, return input idx
|
| 20 |
+
int idx = 0;
|
| 21 |
+
for (int i = CONFIG_T::dims - 1; i >= 0; i--) {
|
| 22 |
+
idx += (index % CONFIG_T::to_shape[i]) * CONFIG_T::perm_strides[i];
|
| 23 |
+
index /= CONFIG_T::to_shape[i];
|
| 24 |
+
}
|
| 25 |
+
return idx;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
template <typename data_T, typename res_T, typename CONFIG_T>
|
| 29 |
+
void transpose(const data_T data[CONFIG_T::N], res_T res[CONFIG_T::N]) {
|
| 30 |
+
for (int i = 0; i < CONFIG_T::N; i++) {
|
| 31 |
+
#pragma HLS UNROLL
|
| 32 |
+
int idx = transfer_idx<CONFIG_T>(i);
|
| 33 |
+
res[i] = data[idx];
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
} // namespace nnet
|
| 38 |
+
|
| 39 |
+
#endif
|
firmware/nnet_utils/nnet_types.h
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NNET_TYPES_H_
|
| 2 |
+
#define NNET_TYPES_H_
|
| 3 |
+
|
| 4 |
+
#include <assert.h>
|
| 5 |
+
#include <cstddef>
|
| 6 |
+
#include <cstdio>
|
| 7 |
+
|
| 8 |
+
namespace nnet {
|
| 9 |
+
|
| 10 |
+
// Fixed-size array
|
| 11 |
+
template <typename T, unsigned N> struct array {
|
| 12 |
+
typedef T value_type;
|
| 13 |
+
static const unsigned size = N;
|
| 14 |
+
|
| 15 |
+
T data[N];
|
| 16 |
+
|
| 17 |
+
T &operator[](size_t pos) { return data[pos]; }
|
| 18 |
+
|
| 19 |
+
const T &operator[](size_t pos) const { return data[pos]; }
|
| 20 |
+
|
| 21 |
+
array &operator=(const array &other) {
|
| 22 |
+
if (&other == this)
|
| 23 |
+
return *this;
|
| 24 |
+
|
| 25 |
+
assert(N == other.size && "Array sizes must match.");
|
| 26 |
+
|
| 27 |
+
for (unsigned i = 0; i < N; i++) {
|
| 28 |
+
#pragma HLS UNROLL
|
| 29 |
+
data[i] = other[i];
|
| 30 |
+
}
|
| 31 |
+
return *this;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
bool operator==(const array &other) const {
|
| 35 |
+
if (N != other.size) {
|
| 36 |
+
return false;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
for (unsigned i = 0; i < N; i++) {
|
| 40 |
+
if (data[i] != other[i]) {
|
| 41 |
+
return false;
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return true;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
bool operator!=(const array &other) const { return !(*this == other); }
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
// Generic lookup-table implementation, for use in approximations of math functions
|
| 52 |
+
template <typename T, unsigned N, T (*func)(T)> class lookup_table {
|
| 53 |
+
public:
|
| 54 |
+
lookup_table(T from, T to) : range_start(from), range_end(to), base_div(ap_uint<16>(N) / T(to - from)) {
|
| 55 |
+
T step = (range_end - range_start) / ap_uint<16>(N);
|
| 56 |
+
for (size_t i = 0; i < N; i++) {
|
| 57 |
+
T num = range_start + ap_uint<16>(i) * step;
|
| 58 |
+
T sample = func(num);
|
| 59 |
+
samples[i] = sample;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
T operator()(T n) const {
|
| 64 |
+
int index = (n - range_start) * base_div;
|
| 65 |
+
if (index < 0)
|
| 66 |
+
index = 0;
|
| 67 |
+
else if (index > N - 1)
|
| 68 |
+
index = N - 1;
|
| 69 |
+
return samples[index];
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
private:
|
| 73 |
+
T samples[N];
|
| 74 |
+
const T range_start, range_end;
|
| 75 |
+
ap_fixed<20, 16> base_div;
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
} // namespace nnet
|
| 79 |
+
|
| 80 |
+
#endif
|
logs/hls_run_tcl.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_137509.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_17873.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_181235.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_184335.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_185829.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_20622.backup.log
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
INFO: [vitis-run 82-31] Launching vitis_hls: vitis_hls -nolog -run tcl -f /home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl -work_dir /home/ubuntu/lithobench/hls4ml_mini_unet
|
| 2 |
+
|
| 3 |
+
****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2024.1 (64-bit)
|
| 4 |
+
**** SW Build 5069499 on May 21 2024
|
| 5 |
+
**** IP Build 5075265 on Wed May 22 21:45:21 MDT 2024
|
| 6 |
+
**** SharedData Build 5076995 on Wed May 22 18:29:18 MDT 2024
|
| 7 |
+
**** Start of session at: Mon Mar 30 15:20:26 2026
|
| 8 |
+
** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
|
| 9 |
+
** Copyright 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
| 10 |
+
|
| 11 |
+
source /opt/Xilinx/Vitis_HLS/2024.1/scripts/vitis_hls/hls.tcl -notrace
|
| 12 |
+
INFO: [HLS 200-10] For user 'ubuntu' on host 'ip-172-31-42-252.ec2.internal' (Linux_x86_64 version 5.15.0-1084-aws) on Mon Mar 30 15:20:28 UTC 2026
|
| 13 |
+
INFO: [HLS 200-10] On os Ubuntu 20.04.6 LTS
|
| 14 |
+
INFO: [HLS 200-10] In directory '/home/ubuntu/lithobench/hls4ml_mini_unet'
|
| 15 |
+
Sourcing Tcl script '/home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl'
|
| 16 |
+
INFO: [HLS 200-1510] Running: open_project myproject_prj
|
| 17 |
+
INFO: [HLS 200-10] Opening project '/home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj'.
|
| 18 |
+
INFO: [HLS 200-1510] Running: set_top myproject
|
| 19 |
+
INFO: [HLS 200-1510] Running: add_files firmware/myproject.cpp -cflags -std=c++0x
|
| 20 |
+
INFO: [HLS 200-10] Adding design file 'firmware/myproject.cpp' to the project
|
| 21 |
+
INFO: [HLS 200-1510] Running: add_files -tb myproject_test.cpp -cflags -std=c++0x
|
| 22 |
+
INFO: [HLS 200-10] Adding test bench file 'myproject_test.cpp' to the project
|
| 23 |
+
INFO: [HLS 200-1510] Running: add_files -tb firmware/weights
|
| 24 |
+
INFO: [HLS 200-10] Adding test bench file 'firmware/weights' to the project
|
| 25 |
+
INFO: [HLS 200-1510] Running: add_files -tb tb_data
|
| 26 |
+
INFO: [HLS 200-10] Adding test bench file 'tb_data' to the project
|
| 27 |
+
INFO: [HLS 200-1510] Running: open_solution solution1
|
| 28 |
+
INFO: [HLS 200-10] Opening solution '/home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1'.
|
| 29 |
+
INFO: [SYN 201-201] Setting up clock 'default' with a period of 5ns.
|
| 30 |
+
INFO: [SYN 201-201] Setting up clock 'default' with an uncertainty of 1.35ns.
|
| 31 |
+
INFO: [HLS 200-1611] Setting target device to 'xcvu47p-fsvh2892-2L-e'
|
| 32 |
+
INFO: [HLS 200-1505] Using flow_target 'vivado'
|
| 33 |
+
Resolution: For help on HLS 200-1505 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=200-1505.html
|
| 34 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -name_max_length=80
|
| 35 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 36 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -complex-mul-dsp=0
|
| 37 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 38 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -unsafe_math_optimizations=0
|
| 39 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 40 |
+
INFO: [HLS 200-1464] Running solution command: config_schedule -enable_dsp_full_reg=0
|
| 41 |
+
INFO: [HLS 200-1464] Running solution command: config_array_partition -complete_threshold=4096
|
| 42 |
+
INFO: [XFORM 203-102] Size-based automatic array partition enabled: cut-off elements per dimension is 4096.
|
| 43 |
+
INFO: [HLS 200-1510] Running: config_array_partition -maximum_size 4096
|
| 44 |
+
ERROR: [HLS 200-101] config_array_partition: Unknown option '-maximum_size'.
|
| 45 |
+
ERROR: [HLS 200-101] config_array_partition: Unknown option '4096'.
|
| 46 |
+
SYNTAX
|
| 47 |
+
config_array_partition [OPTIONS]
|
| 48 |
+
-auto_partition_threshold <uint:*4*> *** DEPRECATED***
|
| 49 |
+
-auto_promotion_threshold <uint:*64*> *** DEPRECATED***
|
| 50 |
+
-complete_threshold <uint:*4*>
|
| 51 |
+
-throughput_driven <off|auto|aggressive|*on*>
|
| 52 |
+
|
| 53 |
+
SEE ALSO
|
| 54 |
+
INI: syn.array_partition.complete_threshold syn.array_partition.throughput_driven
|
| 55 |
+
docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1399-vitis-hls&resourceid=vyw1583260160301.html
|
| 56 |
+
|
| 57 |
+
INFO: [HLS 200-1510] Running: config_compile -name_max_length 80
|
| 58 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 59 |
+
INFO: [HLS 200-1510] Running: set_part xcvu47p-fsvh2892-2L-e
|
| 60 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 61 |
+
INFO: [HLS 200-1510] Running: config_schedule -enable_dsp_full_reg=false
|
| 62 |
+
INFO: [HLS 200-1510] Running: create_clock -period 5 -name default
|
| 63 |
+
INFO: [HLS 200-1510] Running: set_clock_uncertainty 27% default
|
| 64 |
+
***** C/RTL SYNTHESIS *****
|
| 65 |
+
INFO: [HLS 200-1510] Running: csynth_design
|
| 66 |
+
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0.07 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.08 seconds; current allocated memory: 276.859 MB.
|
| 67 |
+
INFO: [HLS 200-10] Analyzing design file 'firmware/myproject.cpp' ...
|
| 68 |
+
WARNING: [HLS 207-5570] unexpected pragma argument 'softmax', expects function/operation (firmware/nnet_utils/nnet_activation.h:402:36)
|
| 69 |
+
WARNING: [HLS 207-5538] 'Resource pragma' is deprecated, use 'bind_op/bind_storage pragma' instead (firmware/nnet_utils/nnet_dense_resource.h:33:9)
|
| 70 |
+
WARNING: [HLS 207-5538] 'Resource pragma' is deprecated, use 'bind_op/bind_storage pragma' instead (firmware/nnet_utils/nnet_dense_resource.h:107:9)
|
| 71 |
+
WARNING: [HLS 207-5538] 'Resource pragma' is deprecated, use 'bind_op/bind_storage pragma' instead (firmware/nnet_utils/nnet_dense_resource.h:189:9)
|
| 72 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:242:85)
|
| 73 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 74 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:242:89)
|
| 75 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 76 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:248:85)
|
| 77 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 78 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:248:89)
|
| 79 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 80 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:258:85)
|
| 81 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 82 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:258:89)
|
| 83 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 84 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:264:85)
|
| 85 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 86 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:264:89)
|
| 87 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 88 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:274:87)
|
| 89 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 90 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:274:92)
|
| 91 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 92 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:280:87)
|
| 93 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 94 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:280:92)
|
| 95 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 96 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:290:87)
|
| 97 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 98 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:290:92)
|
| 99 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 100 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:296:87)
|
| 101 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 102 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:296:92)
|
| 103 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 104 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:306:89)
|
| 105 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 106 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:306:94)
|
| 107 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 108 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:312:89)
|
| 109 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 110 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:312:94)
|
| 111 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 112 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:322:89)
|
| 113 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 114 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:322:94)
|
| 115 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 116 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:328:89)
|
| 117 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 118 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:328:94)
|
| 119 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 120 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:338:89)
|
| 121 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 122 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:338:94)
|
| 123 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 124 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:344:89)
|
| 125 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 126 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:344:94)
|
| 127 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 128 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:348:100)
|
| 129 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 130 |
+
WARNING: [HLS 214-113] Either use an argument of the function or declare the variable inside the dataflow loop body (firmware/myproject.cpp:348:105)
|
| 131 |
+
Resolution: For help on HLS 214-113 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=214-113.html
|
| 132 |
+
WARNING: [HLS 200-471] Dataflow form checks found 30 issue(s) in file firmware/myproject.cpp
|
| 133 |
+
Resolution: For help on HLS 200-471 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=200-471.html
|
| 134 |
+
WARNING: [HLS 207-5292] unused parameter 'keep' (firmware/nnet_utils/nnet_helpers.h:285:99)
|
| 135 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_function_stubs.h:14:36)
|
| 136 |
+
WARNING: [HLS 207-5292] unused parameter 'buffer' (firmware/nnet_utils/nnet_function_stubs.h:15:36)
|
| 137 |
+
WARNING: [HLS 207-5292] unused parameter 'partition' (firmware/nnet_utils/nnet_function_stubs.h:16:44)
|
| 138 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_function_stubs.h:24:24)
|
| 139 |
+
WARNING: [HLS 207-5292] unused parameter 'buffer' (firmware/nnet_utils/nnet_function_stubs.h:25:24)
|
| 140 |
+
WARNING: [HLS 207-5292] unused parameter 'partition' (firmware/nnet_utils/nnet_function_stubs.h:26:32)
|
| 141 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_function_stubs.h:33:30)
|
| 142 |
+
WARNING: [HLS 207-5292] unused parameter 'res' (firmware/nnet_utils/nnet_function_stubs.h:33:58)
|
| 143 |
+
WARNING: [HLS 207-5292] unused parameter 'weights' (firmware/nnet_utils/nnet_function_stubs.h:34:51)
|
| 144 |
+
WARNING: [HLS 207-5292] unused parameter 'biases' (firmware/nnet_utils/nnet_function_stubs.h:35:49)
|
| 145 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_function_stubs.h:42:30)
|
| 146 |
+
WARNING: [HLS 207-5292] unused parameter 'res' (firmware/nnet_utils/nnet_function_stubs.h:42:58)
|
| 147 |
+
WARNING: [HLS 207-5292] unused parameter 'weights' (firmware/nnet_utils/nnet_function_stubs.h:43:51)
|
| 148 |
+
WARNING: [HLS 207-5292] unused parameter 'biases' (firmware/nnet_utils/nnet_function_stubs.h:44:49)
|
| 149 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_function_stubs.h:51:29)
|
| 150 |
+
WARNING: [HLS 207-5292] unused parameter 'res' (firmware/nnet_utils/nnet_function_stubs.h:51:80)
|
| 151 |
+
WARNING: [HLS 207-5292] unused parameter 'weights' (firmware/nnet_utils/nnet_function_stubs.h:52:50)
|
| 152 |
+
WARNING: [HLS 207-5292] unused parameter 'biases' (firmware/nnet_utils/nnet_function_stubs.h:53:48)
|
| 153 |
+
WARNING: [HLS 207-5292] unused parameter 'data' (firmware/nnet_utils/nnet_code_gen.h:16:39)
|
| 154 |
+
WARNING: [HLS 207-5292] unused parameter 'res' (firmware/nnet_utils/nnet_code_gen.h:17:38)
|
| 155 |
+
WARNING: [HLS 207-5292] unused parameter 'weights' (firmware/nnet_utils/nnet_code_gen.h:18:60)
|
| 156 |
+
WARNING: [HLS 207-5292] unused parameter 'biases' (firmware/nnet_utils/nnet_code_gen.h:19:58)
|
| 157 |
+
WARNING: [HLS 207-5584] there are more than one pragma inline in the function scope, ignore the pragma (/opt/Xilinx/Vitis_HLS/2024.1/common/technology/autopilot/ap_shift_reg.h:47:9)
|
| 158 |
+
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 36.43 seconds. CPU system time: 2.15 seconds. Elapsed time: 38.64 seconds; current allocated memory: 287.945 MB.
|
| 159 |
+
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
|
| 160 |
+
INFO: [HLS 200-1995] There were 28,390 instructions in the design after the 'Compile/Link' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 161 |
+
WARNING: [HLS 200-1995] There were 282,347 instructions in the design after the 'Unroll/Inline' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 162 |
+
WARNING: [HLS 200-1995] There were 127,448 instructions in the design after the 'Unroll/Inline (step 2)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 163 |
+
WARNING: [HLS 200-1995] There were 102,013 instructions in the design after the 'Unroll/Inline (step 3)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 164 |
+
INFO: [HLS 200-1995] There were 53,117 instructions in the design after the 'Unroll/Inline (step 4)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 165 |
+
INFO: [HLS 200-1995] There were 69,335 instructions in the design after the 'Array/Struct' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 166 |
+
INFO: [HLS 200-1995] There were 50,968 instructions in the design after the 'Array/Struct (step 2)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 167 |
+
INFO: [HLS 200-1995] There were 51,867 instructions in the design after the 'Array/Struct (step 3)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 168 |
+
WARNING: [HLS 200-1995] There were 106,651 instructions in the design after the 'Array/Struct (step 4)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 169 |
+
INFO: [HLS 200-1995] There were 97,860 instructions in the design after the 'Array/Struct (step 5)' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
| 170 |
+
INFO: [HLS 200-1995] There were 99,568 instructions in the design after the 'Performance' phase of compilation. See the Design Size Report for more details: /home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1/syn/report/csynth_design_size.rpt
|
logs/hls_run_tcl_21278.backup.log
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
INFO: [vitis-run 82-31] Launching vitis_hls: vitis_hls -nolog -run tcl -f /home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl -work_dir /home/ubuntu/lithobench/hls4ml_mini_unet
|
| 2 |
+
|
| 3 |
+
****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2024.1 (64-bit)
|
| 4 |
+
**** SW Build 5069499 on May 21 2024
|
| 5 |
+
**** IP Build 5075265 on Wed May 22 21:45:21 MDT 2024
|
| 6 |
+
**** SharedData Build 5076995 on Wed May 22 18:29:18 MDT 2024
|
| 7 |
+
**** Start of session at: Mon Mar 30 15:35:30 2026
|
| 8 |
+
** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
|
| 9 |
+
** Copyright 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
| 10 |
+
|
| 11 |
+
source /opt/Xilinx/Vitis_HLS/2024.1/scripts/vitis_hls/hls.tcl -notrace
|
| 12 |
+
INFO: [HLS 200-10] For user 'ubuntu' on host 'ip-172-31-42-252.ec2.internal' (Linux_x86_64 version 5.15.0-1084-aws) on Mon Mar 30 15:35:32 UTC 2026
|
| 13 |
+
INFO: [HLS 200-10] On os Ubuntu 20.04.6 LTS
|
| 14 |
+
INFO: [HLS 200-10] In directory '/home/ubuntu/lithobench/hls4ml_mini_unet'
|
| 15 |
+
Sourcing Tcl script '/home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl'
|
| 16 |
+
INFO: [HLS 200-1510] Running: open_project myproject_prj
|
| 17 |
+
INFO: [HLS 200-10] Opening project '/home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj'.
|
| 18 |
+
INFO: [HLS 200-1510] Running: set_top myproject
|
| 19 |
+
INFO: [HLS 200-1510] Running: add_files firmware/myproject.cpp -cflags -std=c++0x
|
| 20 |
+
INFO: [HLS 200-10] Adding design file 'firmware/myproject.cpp' to the project
|
| 21 |
+
INFO: [HLS 200-1510] Running: add_files -tb myproject_test.cpp -cflags -std=c++0x
|
| 22 |
+
INFO: [HLS 200-10] Adding test bench file 'myproject_test.cpp' to the project
|
| 23 |
+
INFO: [HLS 200-1510] Running: add_files -tb firmware/weights
|
| 24 |
+
INFO: [HLS 200-10] Adding test bench file 'firmware/weights' to the project
|
| 25 |
+
INFO: [HLS 200-1510] Running: add_files -tb tb_data
|
| 26 |
+
INFO: [HLS 200-10] Adding test bench file 'tb_data' to the project
|
| 27 |
+
INFO: [HLS 200-1510] Running: open_solution solution1
|
| 28 |
+
INFO: [HLS 200-10] Opening solution '/home/ubuntu/lithobench/hls4ml_mini_unet/myproject_prj/solution1'.
|
| 29 |
+
INFO: [SYN 201-201] Setting up clock 'default' with a period of 5ns.
|
| 30 |
+
INFO: [SYN 201-201] Setting up clock 'default' with an uncertainty of 1.35ns.
|
| 31 |
+
INFO: [HLS 200-1611] Setting target device to 'xcvu47p-fsvh2892-2L-e'
|
| 32 |
+
INFO: [HLS 200-1505] Using flow_target 'vivado'
|
| 33 |
+
Resolution: For help on HLS 200-1505 see docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1448-hls-guidance&resourceid=200-1505.html
|
| 34 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -name_max_length=80
|
| 35 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 36 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -complex-mul-dsp=0
|
| 37 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 38 |
+
INFO: [HLS 200-1464] Running solution command: config_compile -unsafe_math_optimizations=0
|
| 39 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 40 |
+
INFO: [HLS 200-1464] Running solution command: config_schedule -enable_dsp_full_reg=0
|
| 41 |
+
INFO: [HLS 200-1464] Running solution command: config_array_partition -complete_threshold=4096
|
| 42 |
+
INFO: [XFORM 203-102] Size-based automatic array partition enabled: cut-off elements per dimension is 4096.
|
| 43 |
+
INFO: [HLS 200-1510] Running: config_array_partition -maximum_size 4096
|
| 44 |
+
ERROR: [HLS 200-101] config_array_partition: Unknown option '-maximum_size'.
|
| 45 |
+
ERROR: [HLS 200-101] config_array_partition: Unknown option '4096'.
|
| 46 |
+
SYNTAX
|
| 47 |
+
config_array_partition [OPTIONS]
|
| 48 |
+
-auto_partition_threshold <uint:*4*> *** DEPRECATED***
|
| 49 |
+
-auto_promotion_threshold <uint:*64*> *** DEPRECATED***
|
| 50 |
+
-complete_threshold <uint:*4*>
|
| 51 |
+
-throughput_driven <off|auto|aggressive|*on*>
|
| 52 |
+
|
| 53 |
+
SEE ALSO
|
| 54 |
+
INI: syn.array_partition.complete_threshold syn.array_partition.throughput_driven
|
| 55 |
+
docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1399-vitis-hls&resourceid=vyw1583260160301.html
|
| 56 |
+
|
| 57 |
+
INFO: [HLS 200-1510] Running: config_compile -name_max_length 80
|
| 58 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 59 |
+
INFO: [HLS 200-1510] Running: set_part xcvu47p-fsvh2892-2L-e
|
| 60 |
+
INFO: [XFORM 203-1161] The maximum of name length is set to 80.
|
| 61 |
+
INFO: [HLS 200-1510] Running: config_schedule -enable_dsp_full_reg=false
|
| 62 |
+
INFO: [HLS 200-1510] Running: create_clock -period 5 -name default
|
| 63 |
+
INFO: [HLS 200-1510] Running: set_clock_uncertainty 27% default
|
| 64 |
+
***** C/RTL SYNTHESIS *****
|
| 65 |
+
INFO: [HLS 200-1510] Running: config_compile -expression_balance off
|
| 66 |
+
ERROR: [HLS 200-101] config_compile: Unknown option '-expression_balance'.
|
| 67 |
+
ERROR: [HLS 200-101] config_compile: Unknown option 'off'.
|
| 68 |
+
SYNTAX
|
| 69 |
+
config_compile [OPTIONS]
|
| 70 |
+
-design_size_maximum_warning <int:*100000*>
|
| 71 |
+
-enable_auto_rewind [=false|*true*]
|
| 72 |
+
-ignore_long_run_time [=true|*false*]
|
| 73 |
+
-name_max_length <uint:*80*>
|
| 74 |
+
-no_signed_zeros [=true|*false*]
|
| 75 |
+
-pipeline_flush_in_task <always|never|*ii1*>
|
| 76 |
+
-pipeline_loops <uint:*64*>
|
| 77 |
+
-pipeline_style <stp|flp|frp|*auto*>
|
| 78 |
+
-pragma_strict_mode [=true|*false*]
|
| 79 |
+
-pre_tcl <string>
|
| 80 |
+
-unsafe_math_optimizations [=true|*false*]
|
| 81 |
+
|
| 82 |
+
SEE ALSO
|
| 83 |
+
INI: syn.compile.*
|
| 84 |
+
docs.xilinx.com/access/sources/dita/topic?Doc_Version=2024.1%20English&url=ug1399-vitis-hls&resourceid=vyw1583260160301.html
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
invoked from within
|
| 88 |
+
"config_compile -expression_balance off"
|
| 89 |
+
invoked from within
|
| 90 |
+
"if {$opt(synth)} {
|
| 91 |
+
puts "***** C/RTL SYNTHESIS *****"
|
| 92 |
+
|
| 93 |
+
set time_start [clock clicks -milliseconds]
|
| 94 |
+
config_compile -expression_balance off
|
| 95 |
+
..."
|
| 96 |
+
(file "/home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl" line 165)
|
| 97 |
+
invoked from within
|
| 98 |
+
"source /home/ubuntu/lithobench/hls4ml_mini_unet/build_prj.tcl"
|
| 99 |
+
("uplevel" body line 1)
|
| 100 |
+
invoked from within
|
| 101 |
+
"uplevel \#0 [list source $tclfile] "
|
| 102 |
+
|
| 103 |
+
INFO: [HLS 200-112] Total CPU user time: 2.3 seconds. Total CPU system time: 0.34 seconds. Total elapsed time: 2.46 seconds; peak allocated memory: 276.859 MB.
|
| 104 |
+
INFO: [vitis-run 60-1662] Stopping dispatch session having empty uuid.
|
logs/hls_run_tcl_450811.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_4666.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_6671.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
logs/hls_run_tcl_7008.backup.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
myproject_prj/hls.app
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<AutoPilot:project xmlns:AutoPilot="com.autoesl.autopilot.project" projectType="C/C++" name="myproject_prj" ideType="classic" top="myproject">
|
| 2 |
+
<files>
|
| 3 |
+
<file name="firmware/myproject.cpp" sc="0" tb="false" cflags="-std=c++0x" csimflags="" blackbox="false"/>
|
| 4 |
+
<file name="../../tb_data" sc="0" tb="1" cflags="-Wno-unknown-pragmas" csimflags="" blackbox="false"/>
|
| 5 |
+
<file name="../../firmware/weights" sc="0" tb="1" cflags="-Wno-unknown-pragmas" csimflags="" blackbox="false"/>
|
| 6 |
+
<file name="../../myproject_test.cpp" sc="0" tb="1" cflags="-std=c++0x -Wno-unknown-pragmas" csimflags="" blackbox="false"/>
|
| 7 |
+
</files>
|
| 8 |
+
<solutions>
|
| 9 |
+
<solution name="solution1" status=""/>
|
| 10 |
+
</solutions>
|
| 11 |
+
</AutoPilot:project>
|
| 12 |
+
|
myproject_prj/solution1/solution1.aps
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<AutoPilot:solution xmlns:AutoPilot="com.autoesl.autopilot.solution">
|
| 2 |
+
<config>
|
| 3 |
+
<config_compile name_max_length="80" complex-mul-dsp="0" unsafe_math_optimizations="0"/>
|
| 4 |
+
<config_schedule enable_dsp_full_reg="0"/>
|
| 5 |
+
<config_array_partition complete_threshold="4096"/>
|
| 6 |
+
</config>
|
| 7 |
+
<name>
|
| 8 |
+
<value string="solution1"/>
|
| 9 |
+
</name>
|
| 10 |
+
<project>
|
| 11 |
+
<value string="myproject_prj"/>
|
| 12 |
+
</project>
|
| 13 |
+
<flowTarget value="vivado"/>
|
| 14 |
+
<targetInfo>
|
| 15 |
+
<TargetInfo value="xcvu47p:-fsvh2892:-2L-e"/>
|
| 16 |
+
</targetInfo>
|
| 17 |
+
<libraryList>
|
| 18 |
+
<library value="xilinx/virtexuplus/virtexuplus" name="DefaultPlatform"/>
|
| 19 |
+
</libraryList>
|
| 20 |
+
<clockList>
|
| 21 |
+
<clock default="false" name="default" uncertainty="27%" period="4"/>
|
| 22 |
+
</clockList>
|
| 23 |
+
</AutoPilot:solution>
|
| 24 |
+
|
myproject_prj/solution1/solution1.directive
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<AutoPilot:ProjectResources xmlns:AutoPilot="com.autoesl.autopilot.ui.directiveView">
|
| 2 |
+
<sourceFile name="">
|
| 3 |
+
<directive functionName="myproject" label="" functionLabel="">
|
| 4 |
+
<pragma name="TOP">
|
| 5 |
+
<option name="name" value="myproject"/>
|
| 6 |
+
</pragma>
|
| 7 |
+
</directive>
|
| 8 |
+
</sourceFile>
|
| 9 |
+
</AutoPilot:ProjectResources>
|
| 10 |
+
|
myproject_prj/solution1/solution1_data.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
myproject_prj/solution1/syn/report/clone_stream_array_ap_fixed_32u_array_ap_fixed_16_6_5_3_0_32u_8192_s_csynth.xml
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<profile>
|
| 2 |
+
|
| 3 |
+
<ReportVersion>
|
| 4 |
+
<Version>2024.1</Version>
|
| 5 |
+
</ReportVersion>
|
| 6 |
+
|
| 7 |
+
<UserAssignments>
|
| 8 |
+
<unit>ns</unit>
|
| 9 |
+
<ProductFamily>virtexuplusHBM</ProductFamily>
|
| 10 |
+
<Part>xcvu47p-fsvh2892-2L-e</Part>
|
| 11 |
+
<TopModelName>clone_stream_array_ap_fixed_32u_array_ap_fixed_16_6_5_3_0_32u_8192_s</TopModelName>
|
| 12 |
+
<TargetClockPeriod>4.00</TargetClockPeriod>
|
| 13 |
+
<ClockUncertainty>1.35</ClockUncertainty>
|
| 14 |
+
<FlowTarget>vivado</FlowTarget>
|
| 15 |
+
</UserAssignments>
|
| 16 |
+
|
| 17 |
+
<PerformanceEstimates>
|
| 18 |
+
<PipelineType>loop auto-rewind stp(delay=0 clock cycles(s))</PipelineType>
|
| 19 |
+
<SummaryOfTimingAnalysis>
|
| 20 |
+
<unit>ns</unit>
|
| 21 |
+
<EstimatedClockPeriod>2.590</EstimatedClockPeriod>
|
| 22 |
+
</SummaryOfTimingAnalysis>
|
| 23 |
+
<SummaryOfOverallLatency>
|
| 24 |
+
<unit>clock cycles</unit>
|
| 25 |
+
<Best-caseLatency>257</Best-caseLatency>
|
| 26 |
+
<Average-caseLatency>257</Average-caseLatency>
|
| 27 |
+
<Worst-caseLatency>257</Worst-caseLatency>
|
| 28 |
+
<Best-caseRealTimeLatency>1.028 us</Best-caseRealTimeLatency>
|
| 29 |
+
<Average-caseRealTimeLatency>1.028 us</Average-caseRealTimeLatency>
|
| 30 |
+
<Worst-caseRealTimeLatency>1.028 us</Worst-caseRealTimeLatency>
|
| 31 |
+
<Interval-min>256</Interval-min>
|
| 32 |
+
<Interval-max>256</Interval-max>
|
| 33 |
+
</SummaryOfOverallLatency>
|
| 34 |
+
<SummaryOfLoopLatency>
|
| 35 |
+
<CloneLoop>
|
| 36 |
+
<Slack>2.65</Slack>
|
| 37 |
+
<TripCount>256</TripCount>
|
| 38 |
+
<Latency>255</Latency>
|
| 39 |
+
<AbsoluteTimeLatency>1020</AbsoluteTimeLatency>
|
| 40 |
+
<PipelineII>1</PipelineII>
|
| 41 |
+
<PipelineDepth>1</PipelineDepth>
|
| 42 |
+
<InstanceList>
|
| 43 |
+
</InstanceList>
|
| 44 |
+
</CloneLoop>
|
| 45 |
+
</SummaryOfLoopLatency>
|
| 46 |
+
<SummaryOfViolations>
|
| 47 |
+
<IssueType>-</IssueType>
|
| 48 |
+
<ViolationType>-</ViolationType>
|
| 49 |
+
<SourceLocation>firmware/nnet_utils/nnet_stream.h:22</SourceLocation>
|
| 50 |
+
<SummaryOfLoopViolations>
|
| 51 |
+
<CloneLoop>
|
| 52 |
+
<Name>CloneLoop</Name>
|
| 53 |
+
<IssueType>-</IssueType>
|
| 54 |
+
<ViolationType>-</ViolationType>
|
| 55 |
+
<SourceLocation>firmware/nnet_utils/nnet_stream.h:22</SourceLocation>
|
| 56 |
+
</CloneLoop>
|
| 57 |
+
</SummaryOfLoopViolations>
|
| 58 |
+
</SummaryOfViolations>
|
| 59 |
+
</PerformanceEstimates>
|
| 60 |
+
|
| 61 |
+
<AreaEstimates>
|
| 62 |
+
<Resources>
|
| 63 |
+
<FF>11</FF>
|
| 64 |
+
<LUT>95</LUT>
|
| 65 |
+
<BRAM_18K>0</BRAM_18K>
|
| 66 |
+
<DSP>0</DSP>
|
| 67 |
+
<URAM>0</URAM>
|
| 68 |
+
</Resources>
|
| 69 |
+
<AvailableResources>
|
| 70 |
+
<BRAM_18K>4032</BRAM_18K>
|
| 71 |
+
<DSP>9024</DSP>
|
| 72 |
+
<FF>2607360</FF>
|
| 73 |
+
<LUT>1303680</LUT>
|
| 74 |
+
<URAM>960</URAM>
|
| 75 |
+
</AvailableResources>
|
| 76 |
+
</AreaEstimates>
|
| 77 |
+
|
| 78 |
+
<InterfaceSummary>
|
| 79 |
+
<RtlPorts>
|
| 80 |
+
<name>ap_clk</name>
|
| 81 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 82 |
+
<Type>return value</Type>
|
| 83 |
+
<Scope></Scope>
|
| 84 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 85 |
+
<IOConfig></IOConfig>
|
| 86 |
+
<Dir>in</Dir>
|
| 87 |
+
<Bits>1</Bits>
|
| 88 |
+
<Attribute>control</Attribute>
|
| 89 |
+
</RtlPorts>
|
| 90 |
+
<RtlPorts>
|
| 91 |
+
<name>ap_rst</name>
|
| 92 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 93 |
+
<Type>return value</Type>
|
| 94 |
+
<Scope></Scope>
|
| 95 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 96 |
+
<IOConfig></IOConfig>
|
| 97 |
+
<Dir>in</Dir>
|
| 98 |
+
<Bits>1</Bits>
|
| 99 |
+
<Attribute>control</Attribute>
|
| 100 |
+
</RtlPorts>
|
| 101 |
+
<RtlPorts>
|
| 102 |
+
<name>ap_start</name>
|
| 103 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 104 |
+
<Type>return value</Type>
|
| 105 |
+
<Scope></Scope>
|
| 106 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 107 |
+
<IOConfig></IOConfig>
|
| 108 |
+
<Dir>in</Dir>
|
| 109 |
+
<Bits>1</Bits>
|
| 110 |
+
<Attribute>control</Attribute>
|
| 111 |
+
</RtlPorts>
|
| 112 |
+
<RtlPorts>
|
| 113 |
+
<name>start_full_n</name>
|
| 114 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 115 |
+
<Type>return value</Type>
|
| 116 |
+
<Scope></Scope>
|
| 117 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 118 |
+
<IOConfig></IOConfig>
|
| 119 |
+
<Dir>in</Dir>
|
| 120 |
+
<Bits>1</Bits>
|
| 121 |
+
<Attribute>unknown</Attribute>
|
| 122 |
+
</RtlPorts>
|
| 123 |
+
<RtlPorts>
|
| 124 |
+
<name>ap_done</name>
|
| 125 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 126 |
+
<Type>return value</Type>
|
| 127 |
+
<Scope></Scope>
|
| 128 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 129 |
+
<IOConfig></IOConfig>
|
| 130 |
+
<Dir>out</Dir>
|
| 131 |
+
<Bits>1</Bits>
|
| 132 |
+
<Attribute>control</Attribute>
|
| 133 |
+
</RtlPorts>
|
| 134 |
+
<RtlPorts>
|
| 135 |
+
<name>ap_continue</name>
|
| 136 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 137 |
+
<Type>return value</Type>
|
| 138 |
+
<Scope></Scope>
|
| 139 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 140 |
+
<IOConfig></IOConfig>
|
| 141 |
+
<Dir>in</Dir>
|
| 142 |
+
<Bits>1</Bits>
|
| 143 |
+
<Attribute>control</Attribute>
|
| 144 |
+
</RtlPorts>
|
| 145 |
+
<RtlPorts>
|
| 146 |
+
<name>ap_idle</name>
|
| 147 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 148 |
+
<Type>return value</Type>
|
| 149 |
+
<Scope></Scope>
|
| 150 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 151 |
+
<IOConfig></IOConfig>
|
| 152 |
+
<Dir>out</Dir>
|
| 153 |
+
<Bits>1</Bits>
|
| 154 |
+
<Attribute>control</Attribute>
|
| 155 |
+
</RtlPorts>
|
| 156 |
+
<RtlPorts>
|
| 157 |
+
<name>ap_ready</name>
|
| 158 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 159 |
+
<Type>return value</Type>
|
| 160 |
+
<Scope></Scope>
|
| 161 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 162 |
+
<IOConfig></IOConfig>
|
| 163 |
+
<Dir>out</Dir>
|
| 164 |
+
<Bits>1</Bits>
|
| 165 |
+
<Attribute>control</Attribute>
|
| 166 |
+
</RtlPorts>
|
| 167 |
+
<RtlPorts>
|
| 168 |
+
<name>start_out</name>
|
| 169 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 170 |
+
<Type>return value</Type>
|
| 171 |
+
<Scope></Scope>
|
| 172 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 173 |
+
<IOConfig></IOConfig>
|
| 174 |
+
<Dir>out</Dir>
|
| 175 |
+
<Bits>1</Bits>
|
| 176 |
+
<Attribute>unknown</Attribute>
|
| 177 |
+
</RtlPorts>
|
| 178 |
+
<RtlPorts>
|
| 179 |
+
<name>start_write</name>
|
| 180 |
+
<Object>clone_stream<array<ap_fixed,32u>,array<ap_fixed<16,6,5,3,0>,32u>,8192></Object>
|
| 181 |
+
<Type>return value</Type>
|
| 182 |
+
<Scope></Scope>
|
| 183 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 184 |
+
<IOConfig></IOConfig>
|
| 185 |
+
<Dir>out</Dir>
|
| 186 |
+
<Bits>1</Bits>
|
| 187 |
+
<Attribute>unknown</Attribute>
|
| 188 |
+
</RtlPorts>
|
| 189 |
+
<RtlPorts>
|
| 190 |
+
<name>layer15_out_dout</name>
|
| 191 |
+
<Object>layer15_out</Object>
|
| 192 |
+
<Type>pointer</Type>
|
| 193 |
+
<Scope></Scope>
|
| 194 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 195 |
+
<IOConfig></IOConfig>
|
| 196 |
+
<Dir>in</Dir>
|
| 197 |
+
<Bits>512</Bits>
|
| 198 |
+
<Attribute>control</Attribute>
|
| 199 |
+
</RtlPorts>
|
| 200 |
+
<RtlPorts>
|
| 201 |
+
<name>layer15_out_num_data_valid</name>
|
| 202 |
+
<Object>layer15_out</Object>
|
| 203 |
+
<Type>pointer</Type>
|
| 204 |
+
<Scope></Scope>
|
| 205 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 206 |
+
<IOConfig></IOConfig>
|
| 207 |
+
<Dir>in</Dir>
|
| 208 |
+
<Bits>9</Bits>
|
| 209 |
+
<Attribute>control</Attribute>
|
| 210 |
+
</RtlPorts>
|
| 211 |
+
<RtlPorts>
|
| 212 |
+
<name>layer15_out_fifo_cap</name>
|
| 213 |
+
<Object>layer15_out</Object>
|
| 214 |
+
<Type>pointer</Type>
|
| 215 |
+
<Scope></Scope>
|
| 216 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 217 |
+
<IOConfig></IOConfig>
|
| 218 |
+
<Dir>in</Dir>
|
| 219 |
+
<Bits>9</Bits>
|
| 220 |
+
<Attribute>unknown</Attribute>
|
| 221 |
+
</RtlPorts>
|
| 222 |
+
<RtlPorts>
|
| 223 |
+
<name>layer15_out_empty_n</name>
|
| 224 |
+
<Object>layer15_out</Object>
|
| 225 |
+
<Type>pointer</Type>
|
| 226 |
+
<Scope></Scope>
|
| 227 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 228 |
+
<IOConfig></IOConfig>
|
| 229 |
+
<Dir>in</Dir>
|
| 230 |
+
<Bits>1</Bits>
|
| 231 |
+
<Attribute>control</Attribute>
|
| 232 |
+
</RtlPorts>
|
| 233 |
+
<RtlPorts>
|
| 234 |
+
<name>layer15_out_read</name>
|
| 235 |
+
<Object>layer15_out</Object>
|
| 236 |
+
<Type>pointer</Type>
|
| 237 |
+
<Scope></Scope>
|
| 238 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 239 |
+
<IOConfig></IOConfig>
|
| 240 |
+
<Dir>out</Dir>
|
| 241 |
+
<Bits>1</Bits>
|
| 242 |
+
<Attribute>control</Attribute>
|
| 243 |
+
</RtlPorts>
|
| 244 |
+
<RtlPorts>
|
| 245 |
+
<name>layer43_cpy1_din</name>
|
| 246 |
+
<Object>layer43_cpy1</Object>
|
| 247 |
+
<Type>pointer</Type>
|
| 248 |
+
<Scope></Scope>
|
| 249 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 250 |
+
<IOConfig></IOConfig>
|
| 251 |
+
<Dir>out</Dir>
|
| 252 |
+
<Bits>512</Bits>
|
| 253 |
+
<Attribute>control</Attribute>
|
| 254 |
+
</RtlPorts>
|
| 255 |
+
<RtlPorts>
|
| 256 |
+
<name>layer43_cpy1_num_data_valid</name>
|
| 257 |
+
<Object>layer43_cpy1</Object>
|
| 258 |
+
<Type>pointer</Type>
|
| 259 |
+
<Scope></Scope>
|
| 260 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 261 |
+
<IOConfig></IOConfig>
|
| 262 |
+
<Dir>in</Dir>
|
| 263 |
+
<Bits>9</Bits>
|
| 264 |
+
<Attribute>control</Attribute>
|
| 265 |
+
</RtlPorts>
|
| 266 |
+
<RtlPorts>
|
| 267 |
+
<name>layer43_cpy1_fifo_cap</name>
|
| 268 |
+
<Object>layer43_cpy1</Object>
|
| 269 |
+
<Type>pointer</Type>
|
| 270 |
+
<Scope></Scope>
|
| 271 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 272 |
+
<IOConfig></IOConfig>
|
| 273 |
+
<Dir>in</Dir>
|
| 274 |
+
<Bits>9</Bits>
|
| 275 |
+
<Attribute>unknown</Attribute>
|
| 276 |
+
</RtlPorts>
|
| 277 |
+
<RtlPorts>
|
| 278 |
+
<name>layer43_cpy1_full_n</name>
|
| 279 |
+
<Object>layer43_cpy1</Object>
|
| 280 |
+
<Type>pointer</Type>
|
| 281 |
+
<Scope></Scope>
|
| 282 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 283 |
+
<IOConfig></IOConfig>
|
| 284 |
+
<Dir>in</Dir>
|
| 285 |
+
<Bits>1</Bits>
|
| 286 |
+
<Attribute>control</Attribute>
|
| 287 |
+
</RtlPorts>
|
| 288 |
+
<RtlPorts>
|
| 289 |
+
<name>layer43_cpy1_write</name>
|
| 290 |
+
<Object>layer43_cpy1</Object>
|
| 291 |
+
<Type>pointer</Type>
|
| 292 |
+
<Scope></Scope>
|
| 293 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 294 |
+
<IOConfig></IOConfig>
|
| 295 |
+
<Dir>out</Dir>
|
| 296 |
+
<Bits>1</Bits>
|
| 297 |
+
<Attribute>control</Attribute>
|
| 298 |
+
</RtlPorts>
|
| 299 |
+
<RtlPorts>
|
| 300 |
+
<name>layer43_cpy2_din</name>
|
| 301 |
+
<Object>layer43_cpy2</Object>
|
| 302 |
+
<Type>pointer</Type>
|
| 303 |
+
<Scope></Scope>
|
| 304 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 305 |
+
<IOConfig></IOConfig>
|
| 306 |
+
<Dir>out</Dir>
|
| 307 |
+
<Bits>512</Bits>
|
| 308 |
+
<Attribute>control</Attribute>
|
| 309 |
+
</RtlPorts>
|
| 310 |
+
<RtlPorts>
|
| 311 |
+
<name>layer43_cpy2_num_data_valid</name>
|
| 312 |
+
<Object>layer43_cpy2</Object>
|
| 313 |
+
<Type>pointer</Type>
|
| 314 |
+
<Scope></Scope>
|
| 315 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 316 |
+
<IOConfig></IOConfig>
|
| 317 |
+
<Dir>in</Dir>
|
| 318 |
+
<Bits>9</Bits>
|
| 319 |
+
<Attribute>control</Attribute>
|
| 320 |
+
</RtlPorts>
|
| 321 |
+
<RtlPorts>
|
| 322 |
+
<name>layer43_cpy2_fifo_cap</name>
|
| 323 |
+
<Object>layer43_cpy2</Object>
|
| 324 |
+
<Type>pointer</Type>
|
| 325 |
+
<Scope></Scope>
|
| 326 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 327 |
+
<IOConfig></IOConfig>
|
| 328 |
+
<Dir>in</Dir>
|
| 329 |
+
<Bits>9</Bits>
|
| 330 |
+
<Attribute>unknown</Attribute>
|
| 331 |
+
</RtlPorts>
|
| 332 |
+
<RtlPorts>
|
| 333 |
+
<name>layer43_cpy2_full_n</name>
|
| 334 |
+
<Object>layer43_cpy2</Object>
|
| 335 |
+
<Type>pointer</Type>
|
| 336 |
+
<Scope></Scope>
|
| 337 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 338 |
+
<IOConfig></IOConfig>
|
| 339 |
+
<Dir>in</Dir>
|
| 340 |
+
<Bits>1</Bits>
|
| 341 |
+
<Attribute>control</Attribute>
|
| 342 |
+
</RtlPorts>
|
| 343 |
+
<RtlPorts>
|
| 344 |
+
<name>layer43_cpy2_write</name>
|
| 345 |
+
<Object>layer43_cpy2</Object>
|
| 346 |
+
<Type>pointer</Type>
|
| 347 |
+
<Scope></Scope>
|
| 348 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 349 |
+
<IOConfig></IOConfig>
|
| 350 |
+
<Dir>out</Dir>
|
| 351 |
+
<Bits>1</Bits>
|
| 352 |
+
<Attribute>control</Attribute>
|
| 353 |
+
</RtlPorts>
|
| 354 |
+
</InterfaceSummary>
|
| 355 |
+
|
| 356 |
+
</profile>
|
myproject_prj/solution1/syn/report/clone_stream_array_ap_fixed_8u_array_ap_fixed_16_6_5_3_0_8u_32768_s_csynth.xml
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
|
| 7 |
+
<UserAssignments>
|
| 8 |
+
<unit>ns</unit>
|
| 9 |
+
<ProductFamily>virtexuplusHBM</ProductFamily>
|
| 10 |
+
<Part>xcvu47p-fsvh2892-2L-e</Part>
|
| 11 |
+
<TopModelName>clone_stream_array_ap_fixed_8u_array_ap_fixed_16_6_5_3_0_8u_32768_s</TopModelName>
|
| 12 |
+
<TargetClockPeriod>4.00</TargetClockPeriod>
|
| 13 |
+
<ClockUncertainty>1.35</ClockUncertainty>
|
| 14 |
+
<FlowTarget>vivado</FlowTarget>
|
| 15 |
+
</UserAssignments>
|
| 16 |
+
|
| 17 |
+
<PerformanceEstimates>
|
| 18 |
+
<PipelineType>loop auto-rewind stp(delay=0 clock cycles(s))</PipelineType>
|
| 19 |
+
<SummaryOfTimingAnalysis>
|
| 20 |
+
<unit>ns</unit>
|
| 21 |
+
<EstimatedClockPeriod>2.448</EstimatedClockPeriod>
|
| 22 |
+
</SummaryOfTimingAnalysis>
|
| 23 |
+
<SummaryOfOverallLatency>
|
| 24 |
+
<unit>clock cycles</unit>
|
| 25 |
+
<Best-caseLatency>4097</Best-caseLatency>
|
| 26 |
+
<Average-caseLatency>4097</Average-caseLatency>
|
| 27 |
+
<Worst-caseLatency>4097</Worst-caseLatency>
|
| 28 |
+
<Best-caseRealTimeLatency>16.388 us</Best-caseRealTimeLatency>
|
| 29 |
+
<Average-caseRealTimeLatency>16.388 us</Average-caseRealTimeLatency>
|
| 30 |
+
<Worst-caseRealTimeLatency>16.388 us</Worst-caseRealTimeLatency>
|
| 31 |
+
<Interval-min>4096</Interval-min>
|
| 32 |
+
<Interval-max>4096</Interval-max>
|
| 33 |
+
</SummaryOfOverallLatency>
|
| 34 |
+
<SummaryOfLoopLatency>
|
| 35 |
+
<CloneLoop>
|
| 36 |
+
<Slack>2.65</Slack>
|
| 37 |
+
<TripCount>4096</TripCount>
|
| 38 |
+
<Latency>4095</Latency>
|
| 39 |
+
<AbsoluteTimeLatency>16380</AbsoluteTimeLatency>
|
| 40 |
+
<PipelineII>1</PipelineII>
|
| 41 |
+
<PipelineDepth>1</PipelineDepth>
|
| 42 |
+
<InstanceList>
|
| 43 |
+
</InstanceList>
|
| 44 |
+
</CloneLoop>
|
| 45 |
+
</SummaryOfLoopLatency>
|
| 46 |
+
<SummaryOfViolations>
|
| 47 |
+
<IssueType>-</IssueType>
|
| 48 |
+
<ViolationType>-</ViolationType>
|
| 49 |
+
<SourceLocation>firmware/nnet_utils/nnet_stream.h:22</SourceLocation>
|
| 50 |
+
<SummaryOfLoopViolations>
|
| 51 |
+
<CloneLoop>
|
| 52 |
+
<Name>CloneLoop</Name>
|
| 53 |
+
<IssueType>-</IssueType>
|
| 54 |
+
<ViolationType>-</ViolationType>
|
| 55 |
+
<SourceLocation>firmware/nnet_utils/nnet_stream.h:22</SourceLocation>
|
| 56 |
+
</CloneLoop>
|
| 57 |
+
</SummaryOfLoopViolations>
|
| 58 |
+
</SummaryOfViolations>
|
| 59 |
+
</PerformanceEstimates>
|
| 60 |
+
|
| 61 |
+
<AreaEstimates>
|
| 62 |
+
<Resources>
|
| 63 |
+
<FF>15</FF>
|
| 64 |
+
<LUT>103</LUT>
|
| 65 |
+
<BRAM_18K>0</BRAM_18K>
|
| 66 |
+
<DSP>0</DSP>
|
| 67 |
+
<URAM>0</URAM>
|
| 68 |
+
</Resources>
|
| 69 |
+
<AvailableResources>
|
| 70 |
+
<BRAM_18K>4032</BRAM_18K>
|
| 71 |
+
<DSP>9024</DSP>
|
| 72 |
+
<FF>2607360</FF>
|
| 73 |
+
<LUT>1303680</LUT>
|
| 74 |
+
<URAM>960</URAM>
|
| 75 |
+
</AvailableResources>
|
| 76 |
+
</AreaEstimates>
|
| 77 |
+
|
| 78 |
+
<InterfaceSummary>
|
| 79 |
+
<RtlPorts>
|
| 80 |
+
<name>ap_clk</name>
|
| 81 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 82 |
+
<Type>return value</Type>
|
| 83 |
+
<Scope></Scope>
|
| 84 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 85 |
+
<IOConfig></IOConfig>
|
| 86 |
+
<Dir>in</Dir>
|
| 87 |
+
<Bits>1</Bits>
|
| 88 |
+
<Attribute>control</Attribute>
|
| 89 |
+
</RtlPorts>
|
| 90 |
+
<RtlPorts>
|
| 91 |
+
<name>ap_rst</name>
|
| 92 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 93 |
+
<Type>return value</Type>
|
| 94 |
+
<Scope></Scope>
|
| 95 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 96 |
+
<IOConfig></IOConfig>
|
| 97 |
+
<Dir>in</Dir>
|
| 98 |
+
<Bits>1</Bits>
|
| 99 |
+
<Attribute>control</Attribute>
|
| 100 |
+
</RtlPorts>
|
| 101 |
+
<RtlPorts>
|
| 102 |
+
<name>ap_start</name>
|
| 103 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 104 |
+
<Type>return value</Type>
|
| 105 |
+
<Scope></Scope>
|
| 106 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 107 |
+
<IOConfig></IOConfig>
|
| 108 |
+
<Dir>in</Dir>
|
| 109 |
+
<Bits>1</Bits>
|
| 110 |
+
<Attribute>control</Attribute>
|
| 111 |
+
</RtlPorts>
|
| 112 |
+
<RtlPorts>
|
| 113 |
+
<name>start_full_n</name>
|
| 114 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 115 |
+
<Type>return value</Type>
|
| 116 |
+
<Scope></Scope>
|
| 117 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 118 |
+
<IOConfig></IOConfig>
|
| 119 |
+
<Dir>in</Dir>
|
| 120 |
+
<Bits>1</Bits>
|
| 121 |
+
<Attribute>unknown</Attribute>
|
| 122 |
+
</RtlPorts>
|
| 123 |
+
<RtlPorts>
|
| 124 |
+
<name>ap_done</name>
|
| 125 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 126 |
+
<Type>return value</Type>
|
| 127 |
+
<Scope></Scope>
|
| 128 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 129 |
+
<IOConfig></IOConfig>
|
| 130 |
+
<Dir>out</Dir>
|
| 131 |
+
<Bits>1</Bits>
|
| 132 |
+
<Attribute>control</Attribute>
|
| 133 |
+
</RtlPorts>
|
| 134 |
+
<RtlPorts>
|
| 135 |
+
<name>ap_continue</name>
|
| 136 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 137 |
+
<Type>return value</Type>
|
| 138 |
+
<Scope></Scope>
|
| 139 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 140 |
+
<IOConfig></IOConfig>
|
| 141 |
+
<Dir>in</Dir>
|
| 142 |
+
<Bits>1</Bits>
|
| 143 |
+
<Attribute>control</Attribute>
|
| 144 |
+
</RtlPorts>
|
| 145 |
+
<RtlPorts>
|
| 146 |
+
<name>ap_idle</name>
|
| 147 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 148 |
+
<Type>return value</Type>
|
| 149 |
+
<Scope></Scope>
|
| 150 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 151 |
+
<IOConfig></IOConfig>
|
| 152 |
+
<Dir>out</Dir>
|
| 153 |
+
<Bits>1</Bits>
|
| 154 |
+
<Attribute>control</Attribute>
|
| 155 |
+
</RtlPorts>
|
| 156 |
+
<RtlPorts>
|
| 157 |
+
<name>ap_ready</name>
|
| 158 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 159 |
+
<Type>return value</Type>
|
| 160 |
+
<Scope></Scope>
|
| 161 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 162 |
+
<IOConfig></IOConfig>
|
| 163 |
+
<Dir>out</Dir>
|
| 164 |
+
<Bits>1</Bits>
|
| 165 |
+
<Attribute>control</Attribute>
|
| 166 |
+
</RtlPorts>
|
| 167 |
+
<RtlPorts>
|
| 168 |
+
<name>start_out</name>
|
| 169 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 170 |
+
<Type>return value</Type>
|
| 171 |
+
<Scope></Scope>
|
| 172 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 173 |
+
<IOConfig></IOConfig>
|
| 174 |
+
<Dir>out</Dir>
|
| 175 |
+
<Bits>1</Bits>
|
| 176 |
+
<Attribute>unknown</Attribute>
|
| 177 |
+
</RtlPorts>
|
| 178 |
+
<RtlPorts>
|
| 179 |
+
<name>start_write</name>
|
| 180 |
+
<Object>clone_stream<array<ap_fixed,8u>,array<ap_fixed<16,6,5,3,0>,8u>,32768></Object>
|
| 181 |
+
<Type>return value</Type>
|
| 182 |
+
<Scope></Scope>
|
| 183 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 184 |
+
<IOConfig></IOConfig>
|
| 185 |
+
<Dir>out</Dir>
|
| 186 |
+
<Bits>1</Bits>
|
| 187 |
+
<Attribute>unknown</Attribute>
|
| 188 |
+
</RtlPorts>
|
| 189 |
+
<RtlPorts>
|
| 190 |
+
<name>layer5_out_dout</name>
|
| 191 |
+
<Object>layer5_out</Object>
|
| 192 |
+
<Type>pointer</Type>
|
| 193 |
+
<Scope></Scope>
|
| 194 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 195 |
+
<IOConfig></IOConfig>
|
| 196 |
+
<Dir>in</Dir>
|
| 197 |
+
<Bits>128</Bits>
|
| 198 |
+
<Attribute>control</Attribute>
|
| 199 |
+
</RtlPorts>
|
| 200 |
+
<RtlPorts>
|
| 201 |
+
<name>layer5_out_num_data_valid</name>
|
| 202 |
+
<Object>layer5_out</Object>
|
| 203 |
+
<Type>pointer</Type>
|
| 204 |
+
<Scope></Scope>
|
| 205 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 206 |
+
<IOConfig></IOConfig>
|
| 207 |
+
<Dir>in</Dir>
|
| 208 |
+
<Bits>13</Bits>
|
| 209 |
+
<Attribute>control</Attribute>
|
| 210 |
+
</RtlPorts>
|
| 211 |
+
<RtlPorts>
|
| 212 |
+
<name>layer5_out_fifo_cap</name>
|
| 213 |
+
<Object>layer5_out</Object>
|
| 214 |
+
<Type>pointer</Type>
|
| 215 |
+
<Scope></Scope>
|
| 216 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 217 |
+
<IOConfig></IOConfig>
|
| 218 |
+
<Dir>in</Dir>
|
| 219 |
+
<Bits>13</Bits>
|
| 220 |
+
<Attribute>unknown</Attribute>
|
| 221 |
+
</RtlPorts>
|
| 222 |
+
<RtlPorts>
|
| 223 |
+
<name>layer5_out_empty_n</name>
|
| 224 |
+
<Object>layer5_out</Object>
|
| 225 |
+
<Type>pointer</Type>
|
| 226 |
+
<Scope></Scope>
|
| 227 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 228 |
+
<IOConfig></IOConfig>
|
| 229 |
+
<Dir>in</Dir>
|
| 230 |
+
<Bits>1</Bits>
|
| 231 |
+
<Attribute>control</Attribute>
|
| 232 |
+
</RtlPorts>
|
| 233 |
+
<RtlPorts>
|
| 234 |
+
<name>layer5_out_read</name>
|
| 235 |
+
<Object>layer5_out</Object>
|
| 236 |
+
<Type>pointer</Type>
|
| 237 |
+
<Scope></Scope>
|
| 238 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 239 |
+
<IOConfig></IOConfig>
|
| 240 |
+
<Dir>out</Dir>
|
| 241 |
+
<Bits>1</Bits>
|
| 242 |
+
<Attribute>control</Attribute>
|
| 243 |
+
</RtlPorts>
|
| 244 |
+
<RtlPorts>
|
| 245 |
+
<name>layer41_cpy1_din</name>
|
| 246 |
+
<Object>layer41_cpy1</Object>
|
| 247 |
+
<Type>pointer</Type>
|
| 248 |
+
<Scope></Scope>
|
| 249 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 250 |
+
<IOConfig></IOConfig>
|
| 251 |
+
<Dir>out</Dir>
|
| 252 |
+
<Bits>128</Bits>
|
| 253 |
+
<Attribute>control</Attribute>
|
| 254 |
+
</RtlPorts>
|
| 255 |
+
<RtlPorts>
|
| 256 |
+
<name>layer41_cpy1_num_data_valid</name>
|
| 257 |
+
<Object>layer41_cpy1</Object>
|
| 258 |
+
<Type>pointer</Type>
|
| 259 |
+
<Scope></Scope>
|
| 260 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 261 |
+
<IOConfig></IOConfig>
|
| 262 |
+
<Dir>in</Dir>
|
| 263 |
+
<Bits>13</Bits>
|
| 264 |
+
<Attribute>control</Attribute>
|
| 265 |
+
</RtlPorts>
|
| 266 |
+
<RtlPorts>
|
| 267 |
+
<name>layer41_cpy1_fifo_cap</name>
|
| 268 |
+
<Object>layer41_cpy1</Object>
|
| 269 |
+
<Type>pointer</Type>
|
| 270 |
+
<Scope></Scope>
|
| 271 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 272 |
+
<IOConfig></IOConfig>
|
| 273 |
+
<Dir>in</Dir>
|
| 274 |
+
<Bits>13</Bits>
|
| 275 |
+
<Attribute>unknown</Attribute>
|
| 276 |
+
</RtlPorts>
|
| 277 |
+
<RtlPorts>
|
| 278 |
+
<name>layer41_cpy1_full_n</name>
|
| 279 |
+
<Object>layer41_cpy1</Object>
|
| 280 |
+
<Type>pointer</Type>
|
| 281 |
+
<Scope></Scope>
|
| 282 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 283 |
+
<IOConfig></IOConfig>
|
| 284 |
+
<Dir>in</Dir>
|
| 285 |
+
<Bits>1</Bits>
|
| 286 |
+
<Attribute>control</Attribute>
|
| 287 |
+
</RtlPorts>
|
| 288 |
+
<RtlPorts>
|
| 289 |
+
<name>layer41_cpy1_write</name>
|
| 290 |
+
<Object>layer41_cpy1</Object>
|
| 291 |
+
<Type>pointer</Type>
|
| 292 |
+
<Scope></Scope>
|
| 293 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 294 |
+
<IOConfig></IOConfig>
|
| 295 |
+
<Dir>out</Dir>
|
| 296 |
+
<Bits>1</Bits>
|
| 297 |
+
<Attribute>control</Attribute>
|
| 298 |
+
</RtlPorts>
|
| 299 |
+
<RtlPorts>
|
| 300 |
+
<name>layer41_cpy2_din</name>
|
| 301 |
+
<Object>layer41_cpy2</Object>
|
| 302 |
+
<Type>pointer</Type>
|
| 303 |
+
<Scope></Scope>
|
| 304 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 305 |
+
<IOConfig></IOConfig>
|
| 306 |
+
<Dir>out</Dir>
|
| 307 |
+
<Bits>128</Bits>
|
| 308 |
+
<Attribute>control</Attribute>
|
| 309 |
+
</RtlPorts>
|
| 310 |
+
<RtlPorts>
|
| 311 |
+
<name>layer41_cpy2_num_data_valid</name>
|
| 312 |
+
<Object>layer41_cpy2</Object>
|
| 313 |
+
<Type>pointer</Type>
|
| 314 |
+
<Scope></Scope>
|
| 315 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 316 |
+
<IOConfig></IOConfig>
|
| 317 |
+
<Dir>in</Dir>
|
| 318 |
+
<Bits>13</Bits>
|
| 319 |
+
<Attribute>control</Attribute>
|
| 320 |
+
</RtlPorts>
|
| 321 |
+
<RtlPorts>
|
| 322 |
+
<name>layer41_cpy2_fifo_cap</name>
|
| 323 |
+
<Object>layer41_cpy2</Object>
|
| 324 |
+
<Type>pointer</Type>
|
| 325 |
+
<Scope></Scope>
|
| 326 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 327 |
+
<IOConfig></IOConfig>
|
| 328 |
+
<Dir>in</Dir>
|
| 329 |
+
<Bits>13</Bits>
|
| 330 |
+
<Attribute>unknown</Attribute>
|
| 331 |
+
</RtlPorts>
|
| 332 |
+
<RtlPorts>
|
| 333 |
+
<name>layer41_cpy2_full_n</name>
|
| 334 |
+
<Object>layer41_cpy2</Object>
|
| 335 |
+
<Type>pointer</Type>
|
| 336 |
+
<Scope></Scope>
|
| 337 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 338 |
+
<IOConfig></IOConfig>
|
| 339 |
+
<Dir>in</Dir>
|
| 340 |
+
<Bits>1</Bits>
|
| 341 |
+
<Attribute>control</Attribute>
|
| 342 |
+
</RtlPorts>
|
| 343 |
+
<RtlPorts>
|
| 344 |
+
<name>layer41_cpy2_write</name>
|
| 345 |
+
<Object>layer41_cpy2</Object>
|
| 346 |
+
<Type>pointer</Type>
|
| 347 |
+
<Scope></Scope>
|
| 348 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 349 |
+
<IOConfig></IOConfig>
|
| 350 |
+
<Dir>out</Dir>
|
| 351 |
+
<Bits>1</Bits>
|
| 352 |
+
<Attribute>control</Attribute>
|
| 353 |
+
</RtlPorts>
|
| 354 |
+
</InterfaceSummary>
|
| 355 |
+
|
| 356 |
+
</profile>
|
myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_32u_config12_s_csynth.rpt
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
================================================================
|
| 4 |
+
== Vitis HLS Report for 'compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_32u_config12_s'
|
| 5 |
+
================================================================
|
| 6 |
+
* Date: Sun Apr 5 21:47:00 2026
|
| 7 |
+
|
| 8 |
+
* Version: 2024.1 (Build 5069499 on May 21 2024)
|
| 9 |
+
* Project: myproject_prj
|
| 10 |
+
* Solution: solution1 (Vivado IP Flow Target)
|
| 11 |
+
* Product family: virtexuplusHBM
|
| 12 |
+
* Target device: xcvu47p-fsvh2892-2L-e
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
================================================================
|
| 16 |
+
== Performance Estimates
|
| 17 |
+
================================================================
|
| 18 |
+
+ Timing:
|
| 19 |
+
* Summary:
|
| 20 |
+
+--------+---------+----------+------------+
|
| 21 |
+
| Clock | Target | Estimated| Uncertainty|
|
| 22 |
+
+--------+---------+----------+------------+
|
| 23 |
+
|ap_clk | 4.00 ns| 4.437 ns| 1.35 ns|
|
| 24 |
+
+--------+---------+----------+------------+
|
| 25 |
+
|
| 26 |
+
+ Latency:
|
| 27 |
+
* Summary:
|
| 28 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 29 |
+
| Latency (cycles) | Latency (absolute) | Interval | Pipeline|
|
| 30 |
+
| min | max | min | max | min | max | Type |
|
| 31 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 32 |
+
| 2| 581| 8.873 ns| 2.578 us| 2| 581| no|
|
| 33 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 34 |
+
|
| 35 |
+
+ Detail:
|
| 36 |
+
* Instance:
|
| 37 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 38 |
+
| | | Latency (cycles) | Latency (absolute) | Interval | Pipeline |
|
| 39 |
+
| Instance | Module | min | max | min | max | min | max | Type |
|
| 40 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 41 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_16u_config12_s_fu_543 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_16u_config12_s | 0| 0| 0 ns| 0 ns| 1| 1| yes|
|
| 42 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config12_mult_s_fu_931 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config12_mult_s | 578| 579| 2.564 us| 2.569 us| 576| 576| loop rewind stp(delay=0 clock cycles(s))|
|
| 43 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 44 |
+
|
| 45 |
+
* Loop:
|
| 46 |
+
N/A
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
================================================================
|
| 51 |
+
== Utilization Estimates
|
| 52 |
+
================================================================
|
| 53 |
+
* Summary:
|
| 54 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 55 |
+
| Name | BRAM_18K| DSP | FF | LUT | URAM|
|
| 56 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 57 |
+
|DSP | -| -| -| -| -|
|
| 58 |
+
|Expression | -| -| 0| 505| -|
|
| 59 |
+
|FIFO | -| -| -| -| -|
|
| 60 |
+
|Instance | 8| 8| 9548| 9887| -|
|
| 61 |
+
|Memory | -| -| -| -| -|
|
| 62 |
+
|Multiplexer | -| -| 0| 70| -|
|
| 63 |
+
|Register | -| -| 2438| -| -|
|
| 64 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 65 |
+
|Total | 8| 8| 11986| 10462| 0|
|
| 66 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 67 |
+
|Available SLR | 1344| 3008| 869120| 434560| 320|
|
| 68 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 69 |
+
|Utilization SLR (%) | ~0| ~0| 1| 2| 0|
|
| 70 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 71 |
+
|Available | 4032| 9024| 2607360| 1303680| 960|
|
| 72 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 73 |
+
|Utilization (%) | ~0| ~0| ~0| ~0| 0|
|
| 74 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 75 |
+
|
| 76 |
+
+ Detail:
|
| 77 |
+
* Instance:
|
| 78 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+------+-----+
|
| 79 |
+
| Instance | Module | BRAM_18K| DSP| FF | LUT | URAM|
|
| 80 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+------+-----+
|
| 81 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config12_mult_s_fu_931 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config12_mult_s | 8| 8| 7499| 7999| 0|
|
| 82 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_16u_config12_s_fu_543 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_16u_config12_s | 0| 0| 2049| 1888| 0|
|
| 83 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+------+-----+
|
| 84 |
+
|Total | | 8| 8| 9548| 9887| 0|
|
| 85 |
+
+------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+------+-----+
|
| 86 |
+
|
| 87 |
+
* DSP:
|
| 88 |
+
N/A
|
| 89 |
+
|
| 90 |
+
* Memory:
|
| 91 |
+
N/A
|
| 92 |
+
|
| 93 |
+
* FIFO:
|
| 94 |
+
N/A
|
| 95 |
+
|
| 96 |
+
* Expression:
|
| 97 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 98 |
+
| Variable Name | Operation| DSP| FF| LUT| Bitwidth P0| Bitwidth P1|
|
| 99 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 100 |
+
|add_ln303_fu_1496_p2 | +| 0| 0| 39| 32| 1|
|
| 101 |
+
|add_ln307_fu_1543_p2 | +| 0| 0| 39| 32| 1|
|
| 102 |
+
|add_ln313_fu_1565_p2 | +| 0| 0| 39| 32| 1|
|
| 103 |
+
|add_ln318_fu_1513_p2 | +| 0| 0| 39| 32| 1|
|
| 104 |
+
|and_ln284_7_fu_1293_p2 | and| 0| 0| 2| 1| 1|
|
| 105 |
+
|and_ln284_fu_1287_p2 | and| 0| 0| 2| 1| 1|
|
| 106 |
+
|ap_block_state3 | and| 0| 0| 2| 1| 1|
|
| 107 |
+
|ap_block_state3_on_subcall_done | and| 0| 0| 2| 1| 1|
|
| 108 |
+
|ap_condition_1153 | and| 0| 0| 2| 1| 1|
|
| 109 |
+
|ap_condition_822 | and| 0| 0| 2| 1| 1|
|
| 110 |
+
|ap_predicate_op37_call_state3 | and| 0| 0| 2| 1| 1|
|
| 111 |
+
|icmp_ln284_19_fu_1249_p2 | icmp| 0| 0| 39| 32| 2|
|
| 112 |
+
|icmp_ln284_20_fu_1265_p2 | icmp| 0| 0| 38| 31| 1|
|
| 113 |
+
|icmp_ln284_21_fu_1281_p2 | icmp| 0| 0| 38| 31| 1|
|
| 114 |
+
|icmp_ln284_fu_1231_p2 | icmp| 0| 0| 39| 32| 2|
|
| 115 |
+
|icmp_ln303_fu_1501_p2 | icmp| 0| 0| 39| 32| 5|
|
| 116 |
+
|icmp_ln307_fu_1548_p2 | icmp| 0| 0| 39| 32| 5|
|
| 117 |
+
|icmp_ln313_fu_1560_p2 | icmp| 0| 0| 39| 32| 2|
|
| 118 |
+
|select_ln313_fu_1570_p3 | select| 0| 0| 32| 1| 2|
|
| 119 |
+
|select_ln318_fu_1518_p3 | select| 0| 0| 32| 1| 2|
|
| 120 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 121 |
+
|Total | | 0| 0| 505| 359| 33|
|
| 122 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 123 |
+
|
| 124 |
+
* Multiplexer:
|
| 125 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 126 |
+
| Name | LUT| Input Size| Bits| Total Bits|
|
| 127 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 128 |
+
|ap_NS_fsm | 20| 4| 1| 4|
|
| 129 |
+
|ap_phi_mux_storemerge_phi_fu_536_p4 | 14| 3| 32| 96|
|
| 130 |
+
|layer12_out_blk_n | 9| 2| 1| 2|
|
| 131 |
+
|pX_8 | 9| 2| 32| 64|
|
| 132 |
+
|pY_8 | 9| 2| 32| 64|
|
| 133 |
+
|sX_8 | 9| 2| 32| 64|
|
| 134 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 135 |
+
|Total | 70| 15| 130| 294|
|
| 136 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 137 |
+
|
| 138 |
+
* Register:
|
| 139 |
+
+-----------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 140 |
+
| Name | FF | LUT| Bits| Const Bits|
|
| 141 |
+
+-----------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 142 |
+
|and_ln284_7_reg_1608 | 1| 0| 1| 0|
|
| 143 |
+
|ap_CS_fsm | 3| 0| 3| 0|
|
| 144 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config12_mult_s_fu_931_ap_start_reg | 1| 0| 1| 0|
|
| 145 |
+
|icmp_ln284_reg_1594 | 1| 0| 1| 0|
|
| 146 |
+
|pX_8 | 32| 0| 32| 0|
|
| 147 |
+
|pY_8 | 32| 0| 32| 0|
|
| 148 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4416 | 16| 0| 16| 0|
|
| 149 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4417 | 16| 0| 16| 0|
|
| 150 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4419 | 16| 0| 16| 0|
|
| 151 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4420 | 16| 0| 16| 0|
|
| 152 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4421 | 16| 0| 16| 0|
|
| 153 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4422 | 16| 0| 16| 0|
|
| 154 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4423 | 16| 0| 16| 0|
|
| 155 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4424 | 16| 0| 16| 0|
|
| 156 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4425 | 16| 0| 16| 0|
|
| 157 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4426 | 16| 0| 16| 0|
|
| 158 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4427 | 16| 0| 16| 0|
|
| 159 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4428 | 16| 0| 16| 0|
|
| 160 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4430 | 16| 0| 16| 0|
|
| 161 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4431 | 16| 0| 16| 0|
|
| 162 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4432 | 16| 0| 16| 0|
|
| 163 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4433 | 16| 0| 16| 0|
|
| 164 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4434 | 16| 0| 16| 0|
|
| 165 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4435 | 16| 0| 16| 0|
|
| 166 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4436 | 16| 0| 16| 0|
|
| 167 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4437 | 16| 0| 16| 0|
|
| 168 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4438 | 16| 0| 16| 0|
|
| 169 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4439 | 16| 0| 16| 0|
|
| 170 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4441 | 16| 0| 16| 0|
|
| 171 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4442 | 16| 0| 16| 0|
|
| 172 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4443 | 16| 0| 16| 0|
|
| 173 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4444 | 16| 0| 16| 0|
|
| 174 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4445 | 16| 0| 16| 0|
|
| 175 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4446 | 16| 0| 16| 0|
|
| 176 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4447 | 16| 0| 16| 0|
|
| 177 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4448 | 16| 0| 16| 0|
|
| 178 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4449 | 16| 0| 16| 0|
|
| 179 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4450 | 16| 0| 16| 0|
|
| 180 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4452 | 16| 0| 16| 0|
|
| 181 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4453 | 16| 0| 16| 0|
|
| 182 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4454 | 16| 0| 16| 0|
|
| 183 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4455 | 16| 0| 16| 0|
|
| 184 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4456 | 16| 0| 16| 0|
|
| 185 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4457 | 16| 0| 16| 0|
|
| 186 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4458 | 16| 0| 16| 0|
|
| 187 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4459 | 16| 0| 16| 0|
|
| 188 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4460 | 16| 0| 16| 0|
|
| 189 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4461 | 16| 0| 16| 0|
|
| 190 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4463 | 16| 0| 16| 0|
|
| 191 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4464 | 16| 0| 16| 0|
|
| 192 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4465 | 16| 0| 16| 0|
|
| 193 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4466 | 16| 0| 16| 0|
|
| 194 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4467 | 16| 0| 16| 0|
|
| 195 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4468 | 16| 0| 16| 0|
|
| 196 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4469 | 16| 0| 16| 0|
|
| 197 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4470 | 16| 0| 16| 0|
|
| 198 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4471 | 16| 0| 16| 0|
|
| 199 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4472 | 16| 0| 16| 0|
|
| 200 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4474 | 16| 0| 16| 0|
|
| 201 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4475 | 16| 0| 16| 0|
|
| 202 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4476 | 16| 0| 16| 0|
|
| 203 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4477 | 16| 0| 16| 0|
|
| 204 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4478 | 16| 0| 16| 0|
|
| 205 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4479 | 16| 0| 16| 0|
|
| 206 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4480 | 16| 0| 16| 0|
|
| 207 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4481 | 16| 0| 16| 0|
|
| 208 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4482 | 16| 0| 16| 0|
|
| 209 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4483 | 16| 0| 16| 0|
|
| 210 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4485 | 16| 0| 16| 0|
|
| 211 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4486 | 16| 0| 16| 0|
|
| 212 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4487 | 16| 0| 16| 0|
|
| 213 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4488 | 16| 0| 16| 0|
|
| 214 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4489 | 16| 0| 16| 0|
|
| 215 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4490 | 16| 0| 16| 0|
|
| 216 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4491 | 16| 0| 16| 0|
|
| 217 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4492 | 16| 0| 16| 0|
|
| 218 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4493 | 16| 0| 16| 0|
|
| 219 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4494 | 16| 0| 16| 0|
|
| 220 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4496 | 16| 0| 16| 0|
|
| 221 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4497 | 16| 0| 16| 0|
|
| 222 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4498 | 16| 0| 16| 0|
|
| 223 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4499 | 16| 0| 16| 0|
|
| 224 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4500 | 16| 0| 16| 0|
|
| 225 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4501 | 16| 0| 16| 0|
|
| 226 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4502 | 16| 0| 16| 0|
|
| 227 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4503 | 16| 0| 16| 0|
|
| 228 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4504 | 16| 0| 16| 0|
|
| 229 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4505 | 16| 0| 16| 0|
|
| 230 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4507 | 16| 0| 16| 0|
|
| 231 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4508 | 16| 0| 16| 0|
|
| 232 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4509 | 16| 0| 16| 0|
|
| 233 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4510 | 16| 0| 16| 0|
|
| 234 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4511 | 16| 0| 16| 0|
|
| 235 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4512 | 16| 0| 16| 0|
|
| 236 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4513 | 16| 0| 16| 0|
|
| 237 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4514 | 16| 0| 16| 0|
|
| 238 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4515 | 16| 0| 16| 0|
|
| 239 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4516 | 16| 0| 16| 0|
|
| 240 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4518 | 16| 0| 16| 0|
|
| 241 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4519 | 16| 0| 16| 0|
|
| 242 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4520 | 16| 0| 16| 0|
|
| 243 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4521 | 16| 0| 16| 0|
|
| 244 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4522 | 16| 0| 16| 0|
|
| 245 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4523 | 16| 0| 16| 0|
|
| 246 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4524 | 16| 0| 16| 0|
|
| 247 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4525 | 16| 0| 16| 0|
|
| 248 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4526 | 16| 0| 16| 0|
|
| 249 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4527 | 16| 0| 16| 0|
|
| 250 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4529 | 16| 0| 16| 0|
|
| 251 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4530 | 16| 0| 16| 0|
|
| 252 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4531 | 16| 0| 16| 0|
|
| 253 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4532 | 16| 0| 16| 0|
|
| 254 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4533 | 16| 0| 16| 0|
|
| 255 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4534 | 16| 0| 16| 0|
|
| 256 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4535 | 16| 0| 16| 0|
|
| 257 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4536 | 16| 0| 16| 0|
|
| 258 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4537 | 16| 0| 16| 0|
|
| 259 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4538 | 16| 0| 16| 0|
|
| 260 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4540 | 16| 0| 16| 0|
|
| 261 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4541 | 16| 0| 16| 0|
|
| 262 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4542 | 16| 0| 16| 0|
|
| 263 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4543 | 16| 0| 16| 0|
|
| 264 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4544 | 16| 0| 16| 0|
|
| 265 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4545 | 16| 0| 16| 0|
|
| 266 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4546 | 16| 0| 16| 0|
|
| 267 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4547 | 16| 0| 16| 0|
|
| 268 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4548 | 16| 0| 16| 0|
|
| 269 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4549 | 16| 0| 16| 0|
|
| 270 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4551 | 16| 0| 16| 0|
|
| 271 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4552 | 16| 0| 16| 0|
|
| 272 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4553 | 16| 0| 16| 0|
|
| 273 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4554 | 16| 0| 16| 0|
|
| 274 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4555 | 16| 0| 16| 0|
|
| 275 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4556 | 16| 0| 16| 0|
|
| 276 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4557 | 16| 0| 16| 0|
|
| 277 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4558 | 16| 0| 16| 0|
|
| 278 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4559 | 16| 0| 16| 0|
|
| 279 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4560 | 16| 0| 16| 0|
|
| 280 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4562 | 16| 0| 16| 0|
|
| 281 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4563 | 16| 0| 16| 0|
|
| 282 |
+
|sX_8 | 32| 0| 32| 0|
|
| 283 |
+
|sY_8 | 32| 0| 32| 0|
|
| 284 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_158 | 16| 0| 16| 0|
|
| 285 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_159 | 16| 0| 16| 0|
|
| 286 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_160 | 16| 0| 16| 0|
|
| 287 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_161 | 16| 0| 16| 0|
|
| 288 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_162 | 16| 0| 16| 0|
|
| 289 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_163 | 16| 0| 16| 0|
|
| 290 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_164 | 16| 0| 16| 0|
|
| 291 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_165 | 16| 0| 16| 0|
|
| 292 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_166 | 16| 0| 16| 0|
|
| 293 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_167 | 16| 0| 16| 0|
|
| 294 |
+
+-----------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 295 |
+
|Total |2438| 0| 2438| 0|
|
| 296 |
+
+-----------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
================================================================
|
| 301 |
+
== Interface
|
| 302 |
+
================================================================
|
| 303 |
+
* Summary:
|
| 304 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 305 |
+
| RTL Ports | Dir | Bits | Protocol | Source Object | C Type |
|
| 306 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 307 |
+
|ap_clk | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 308 |
+
|ap_rst | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 309 |
+
|ap_start | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 310 |
+
|ap_done | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 311 |
+
|ap_idle | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 312 |
+
|ap_ready | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,32u>,config12>| return value|
|
| 313 |
+
|p_read | in| 16| ap_none| p_read| scalar|
|
| 314 |
+
|p_read1 | in| 16| ap_none| p_read1| scalar|
|
| 315 |
+
|p_read2 | in| 16| ap_none| p_read2| scalar|
|
| 316 |
+
|p_read3 | in| 16| ap_none| p_read3| scalar|
|
| 317 |
+
|p_read4 | in| 16| ap_none| p_read4| scalar|
|
| 318 |
+
|p_read5 | in| 16| ap_none| p_read5| scalar|
|
| 319 |
+
|p_read6 | in| 16| ap_none| p_read6| scalar|
|
| 320 |
+
|p_read7 | in| 16| ap_none| p_read7| scalar|
|
| 321 |
+
|p_read8 | in| 16| ap_none| p_read8| scalar|
|
| 322 |
+
|p_read9 | in| 16| ap_none| p_read9| scalar|
|
| 323 |
+
|p_read10 | in| 16| ap_none| p_read10| scalar|
|
| 324 |
+
|p_read11 | in| 16| ap_none| p_read11| scalar|
|
| 325 |
+
|p_read12 | in| 16| ap_none| p_read12| scalar|
|
| 326 |
+
|p_read13 | in| 16| ap_none| p_read13| scalar|
|
| 327 |
+
|p_read14 | in| 16| ap_none| p_read14| scalar|
|
| 328 |
+
|p_read15 | in| 16| ap_none| p_read15| scalar|
|
| 329 |
+
|layer12_out_din | out| 1312| ap_fifo| layer12_out| pointer|
|
| 330 |
+
|layer12_out_num_data_valid | in| 9| ap_fifo| layer12_out| pointer|
|
| 331 |
+
|layer12_out_fifo_cap | in| 9| ap_fifo| layer12_out| pointer|
|
| 332 |
+
|layer12_out_full_n | in| 1| ap_fifo| layer12_out| pointer|
|
| 333 |
+
|layer12_out_write | out| 1| ap_fifo| layer12_out| pointer|
|
| 334 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 335 |
+
|
myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_8u_config35_s_csynth.rpt
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
================================================================
|
| 4 |
+
== Vitis HLS Report for 'compute_output_buffer_2d_array_array_ap_fixed_41_21_5_3_0_8u_config35_s'
|
| 5 |
+
================================================================
|
| 6 |
+
* Date: Sun Apr 5 21:50:35 2026
|
| 7 |
+
|
| 8 |
+
* Version: 2024.1 (Build 5069499 on May 21 2024)
|
| 9 |
+
* Project: myproject_prj
|
| 10 |
+
* Solution: solution1 (Vivado IP Flow Target)
|
| 11 |
+
* Product family: virtexuplusHBM
|
| 12 |
+
* Target device: xcvu47p-fsvh2892-2L-e
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
================================================================
|
| 16 |
+
== Performance Estimates
|
| 17 |
+
================================================================
|
| 18 |
+
+ Timing:
|
| 19 |
+
* Summary:
|
| 20 |
+
+--------+---------+----------+------------+
|
| 21 |
+
| Clock | Target | Estimated| Uncertainty|
|
| 22 |
+
+--------+---------+----------+------------+
|
| 23 |
+
|ap_clk | 4.00 ns| 2.533 ns| 1.35 ns|
|
| 24 |
+
+--------+---------+----------+------------+
|
| 25 |
+
|
| 26 |
+
+ Latency:
|
| 27 |
+
* Summary:
|
| 28 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 29 |
+
| Latency (cycles) | Latency (absolute) | Interval | Pipeline|
|
| 30 |
+
| min | max | min | max | min | max | Type |
|
| 31 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 32 |
+
| 2| 221| 8.000 ns| 0.884 us| 2| 221| no|
|
| 33 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 34 |
+
|
| 35 |
+
+ Detail:
|
| 36 |
+
* Instance:
|
| 37 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 38 |
+
| | | Latency (cycles) | Latency (absolute) | Interval | Pipeline |
|
| 39 |
+
| Instance | Module | min | max | min | max | min | max | Type |
|
| 40 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 41 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_24u_config35_s_fu_781 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_24u_config35_s | 0| 0| 0 ns| 0 ns| 1| 1| yes|
|
| 42 |
+
|grp_dense_resource_rf_leq_nin_ap_fixed_ap_fixed_41_21_5_3_0_config35_mult_s_fu_1361 |dense_resource_rf_leq_nin_ap_fixed_ap_fixed_41_21_5_3_0_config35_mult_s | 217| 218| 0.868 us| 0.872 us| 216| 216| loop rewind stp(delay=0 clock cycles(s))|
|
| 43 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 44 |
+
|
| 45 |
+
* Loop:
|
| 46 |
+
N/A
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
================================================================
|
| 51 |
+
== Utilization Estimates
|
| 52 |
+
================================================================
|
| 53 |
+
* Summary:
|
| 54 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 55 |
+
| Name | BRAM_18K| DSP | FF | LUT | URAM|
|
| 56 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 57 |
+
|DSP | -| -| -| -| -|
|
| 58 |
+
|Expression | -| -| 0| 501| -|
|
| 59 |
+
|FIFO | -| -| -| -| -|
|
| 60 |
+
|Instance | 4| 8| 10784| 10117| -|
|
| 61 |
+
|Memory | -| -| -| -| -|
|
| 62 |
+
|Multiplexer | -| -| 0| 76| -|
|
| 63 |
+
|Register | -| -| 3919| -| -|
|
| 64 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 65 |
+
|Total | 4| 8| 14703| 10694| 0|
|
| 66 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 67 |
+
|Available SLR | 1344| 3008| 869120| 434560| 320|
|
| 68 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 69 |
+
|Utilization SLR (%) | ~0| ~0| 1| 2| 0|
|
| 70 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 71 |
+
|Available | 4032| 9024| 2607360| 1303680| 960|
|
| 72 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 73 |
+
|Utilization (%) | ~0| ~0| ~0| ~0| 0|
|
| 74 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 75 |
+
|
| 76 |
+
+ Detail:
|
| 77 |
+
* Instance:
|
| 78 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+----+------+------+-----+
|
| 79 |
+
| Instance | Module | BRAM_18K| DSP| FF | LUT | URAM|
|
| 80 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+----+------+------+-----+
|
| 81 |
+
|grp_dense_resource_rf_leq_nin_ap_fixed_ap_fixed_41_21_5_3_0_config35_mult_s_fu_1361 |dense_resource_rf_leq_nin_ap_fixed_ap_fixed_41_21_5_3_0_config35_mult_s | 4| 8| 7711| 7285| 0|
|
| 82 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_24u_config35_s_fu_781 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_24u_config35_s | 0| 0| 3073| 2832| 0|
|
| 83 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+----+------+------+-----+
|
| 84 |
+
|Total | | 4| 8| 10784| 10117| 0|
|
| 85 |
+
+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------+---------+----+------+------+-----+
|
| 86 |
+
|
| 87 |
+
* DSP:
|
| 88 |
+
N/A
|
| 89 |
+
|
| 90 |
+
* Memory:
|
| 91 |
+
N/A
|
| 92 |
+
|
| 93 |
+
* FIFO:
|
| 94 |
+
N/A
|
| 95 |
+
|
| 96 |
+
* Expression:
|
| 97 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 98 |
+
| Variable Name | Operation| DSP| FF| LUT| Bitwidth P0| Bitwidth P1|
|
| 99 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 100 |
+
|add_ln303_fu_1916_p2 | +| 0| 0| 39| 32| 1|
|
| 101 |
+
|add_ln307_fu_1963_p2 | +| 0| 0| 39| 32| 1|
|
| 102 |
+
|add_ln313_fu_1985_p2 | +| 0| 0| 39| 32| 1|
|
| 103 |
+
|add_ln318_fu_1933_p2 | +| 0| 0| 39| 32| 1|
|
| 104 |
+
|and_ln284_6_fu_1865_p2 | and| 0| 0| 2| 1| 1|
|
| 105 |
+
|and_ln284_fu_1859_p2 | and| 0| 0| 2| 1| 1|
|
| 106 |
+
|ap_block_state4 | and| 0| 0| 2| 1| 1|
|
| 107 |
+
|ap_condition_1647 | and| 0| 0| 2| 1| 1|
|
| 108 |
+
|ap_predicate_op56_write_state4 | and| 0| 0| 2| 1| 1|
|
| 109 |
+
|icmp_ln284_16_fu_1821_p2 | icmp| 0| 0| 39| 32| 2|
|
| 110 |
+
|icmp_ln284_17_fu_1837_p2 | icmp| 0| 0| 38| 31| 1|
|
| 111 |
+
|icmp_ln284_18_fu_1853_p2 | icmp| 0| 0| 38| 31| 1|
|
| 112 |
+
|icmp_ln284_fu_1803_p2 | icmp| 0| 0| 39| 32| 2|
|
| 113 |
+
|icmp_ln303_fu_1921_p2 | icmp| 0| 0| 39| 32| 7|
|
| 114 |
+
|icmp_ln307_fu_1968_p2 | icmp| 0| 0| 39| 32| 7|
|
| 115 |
+
|icmp_ln313_fu_1980_p2 | icmp| 0| 0| 39| 32| 2|
|
| 116 |
+
|select_ln313_fu_1990_p3 | select| 0| 0| 32| 1| 2|
|
| 117 |
+
|select_ln318_fu_1938_p3 | select| 0| 0| 32| 1| 2|
|
| 118 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 119 |
+
|Total | | 0| 0| 501| 357| 35|
|
| 120 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 121 |
+
|
| 122 |
+
* Multiplexer:
|
| 123 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 124 |
+
| Name | LUT| Input Size| Bits| Total Bits|
|
| 125 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 126 |
+
|ap_NS_fsm | 26| 5| 1| 5|
|
| 127 |
+
|ap_phi_mux_storemerge_phi_fu_774_p4 | 14| 3| 32| 96|
|
| 128 |
+
|layer35_out_blk_n | 9| 2| 1| 2|
|
| 129 |
+
|pX_6 | 9| 2| 32| 64|
|
| 130 |
+
|pY_6 | 9| 2| 32| 64|
|
| 131 |
+
|sX_6 | 9| 2| 32| 64|
|
| 132 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 133 |
+
|Total | 76| 16| 130| 295|
|
| 134 |
+
+-------------------------------------+----+-----------+-----+-----------+
|
| 135 |
+
|
| 136 |
+
* Register:
|
| 137 |
+
+--------------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 138 |
+
| Name | FF | LUT| Bits| Const Bits|
|
| 139 |
+
+--------------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 140 |
+
|and_ln284_6_reg_2028 | 1| 0| 1| 0|
|
| 141 |
+
|ap_CS_fsm | 4| 0| 4| 0|
|
| 142 |
+
|grp_dense_resource_rf_leq_nin_ap_fixed_ap_fixed_41_21_5_3_0_config35_mult_s_fu_1361_ap_start_reg | 1| 0| 1| 0|
|
| 143 |
+
|icmp_ln284_reg_2014 | 1| 0| 1| 0|
|
| 144 |
+
|pX_6 | 32| 0| 32| 0|
|
| 145 |
+
|pY_6 | 32| 0| 32| 0|
|
| 146 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4564 | 16| 0| 16| 0|
|
| 147 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4565 | 16| 0| 16| 0|
|
| 148 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4566 | 16| 0| 16| 0|
|
| 149 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4567 | 16| 0| 16| 0|
|
| 150 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4568 | 16| 0| 16| 0|
|
| 151 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4569 | 16| 0| 16| 0|
|
| 152 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4570 | 16| 0| 16| 0|
|
| 153 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4571 | 16| 0| 16| 0|
|
| 154 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4573 | 16| 0| 16| 0|
|
| 155 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4574 | 16| 0| 16| 0|
|
| 156 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4575 | 16| 0| 16| 0|
|
| 157 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4576 | 16| 0| 16| 0|
|
| 158 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4577 | 16| 0| 16| 0|
|
| 159 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4578 | 16| 0| 16| 0|
|
| 160 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4579 | 16| 0| 16| 0|
|
| 161 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4580 | 16| 0| 16| 0|
|
| 162 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4581 | 16| 0| 16| 0|
|
| 163 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4582 | 16| 0| 16| 0|
|
| 164 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4584 | 16| 0| 16| 0|
|
| 165 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4585 | 16| 0| 16| 0|
|
| 166 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4586 | 16| 0| 16| 0|
|
| 167 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4587 | 16| 0| 16| 0|
|
| 168 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4588 | 16| 0| 16| 0|
|
| 169 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4589 | 16| 0| 16| 0|
|
| 170 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4590 | 16| 0| 16| 0|
|
| 171 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4591 | 16| 0| 16| 0|
|
| 172 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4592 | 16| 0| 16| 0|
|
| 173 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4593 | 16| 0| 16| 0|
|
| 174 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4595 | 16| 0| 16| 0|
|
| 175 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4596 | 16| 0| 16| 0|
|
| 176 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4597 | 16| 0| 16| 0|
|
| 177 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4598 | 16| 0| 16| 0|
|
| 178 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4599 | 16| 0| 16| 0|
|
| 179 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4600 | 16| 0| 16| 0|
|
| 180 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4601 | 16| 0| 16| 0|
|
| 181 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4602 | 16| 0| 16| 0|
|
| 182 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4603 | 16| 0| 16| 0|
|
| 183 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4604 | 16| 0| 16| 0|
|
| 184 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4606 | 16| 0| 16| 0|
|
| 185 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4607 | 16| 0| 16| 0|
|
| 186 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4608 | 16| 0| 16| 0|
|
| 187 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4609 | 16| 0| 16| 0|
|
| 188 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4610 | 16| 0| 16| 0|
|
| 189 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4611 | 16| 0| 16| 0|
|
| 190 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4612 | 16| 0| 16| 0|
|
| 191 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4613 | 16| 0| 16| 0|
|
| 192 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4614 | 16| 0| 16| 0|
|
| 193 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4615 | 16| 0| 16| 0|
|
| 194 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4617 | 16| 0| 16| 0|
|
| 195 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4618 | 16| 0| 16| 0|
|
| 196 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4619 | 16| 0| 16| 0|
|
| 197 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4620 | 16| 0| 16| 0|
|
| 198 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4621 | 16| 0| 16| 0|
|
| 199 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4622 | 16| 0| 16| 0|
|
| 200 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4623 | 16| 0| 16| 0|
|
| 201 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4624 | 16| 0| 16| 0|
|
| 202 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4625 | 16| 0| 16| 0|
|
| 203 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4626 | 16| 0| 16| 0|
|
| 204 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4628 | 16| 0| 16| 0|
|
| 205 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4629 | 16| 0| 16| 0|
|
| 206 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4630 | 16| 0| 16| 0|
|
| 207 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4631 | 16| 0| 16| 0|
|
| 208 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4632 | 16| 0| 16| 0|
|
| 209 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4633 | 16| 0| 16| 0|
|
| 210 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4634 | 16| 0| 16| 0|
|
| 211 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4635 | 16| 0| 16| 0|
|
| 212 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4636 | 16| 0| 16| 0|
|
| 213 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4637 | 16| 0| 16| 0|
|
| 214 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4639 | 16| 0| 16| 0|
|
| 215 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4640 | 16| 0| 16| 0|
|
| 216 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4641 | 16| 0| 16| 0|
|
| 217 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4642 | 16| 0| 16| 0|
|
| 218 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4643 | 16| 0| 16| 0|
|
| 219 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4644 | 16| 0| 16| 0|
|
| 220 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4645 | 16| 0| 16| 0|
|
| 221 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4646 | 16| 0| 16| 0|
|
| 222 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4647 | 16| 0| 16| 0|
|
| 223 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4648 | 16| 0| 16| 0|
|
| 224 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4650 | 16| 0| 16| 0|
|
| 225 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4651 | 16| 0| 16| 0|
|
| 226 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4652 | 16| 0| 16| 0|
|
| 227 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4653 | 16| 0| 16| 0|
|
| 228 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4654 | 16| 0| 16| 0|
|
| 229 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4655 | 16| 0| 16| 0|
|
| 230 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4656 | 16| 0| 16| 0|
|
| 231 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4657 | 16| 0| 16| 0|
|
| 232 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4658 | 16| 0| 16| 0|
|
| 233 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4659 | 16| 0| 16| 0|
|
| 234 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4661 | 16| 0| 16| 0|
|
| 235 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4662 | 16| 0| 16| 0|
|
| 236 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4663 | 16| 0| 16| 0|
|
| 237 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4664 | 16| 0| 16| 0|
|
| 238 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4665 | 16| 0| 16| 0|
|
| 239 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4666 | 16| 0| 16| 0|
|
| 240 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4667 | 16| 0| 16| 0|
|
| 241 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4668 | 16| 0| 16| 0|
|
| 242 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4669 | 16| 0| 16| 0|
|
| 243 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4670 | 16| 0| 16| 0|
|
| 244 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4672 | 16| 0| 16| 0|
|
| 245 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4673 | 16| 0| 16| 0|
|
| 246 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4674 | 16| 0| 16| 0|
|
| 247 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4675 | 16| 0| 16| 0|
|
| 248 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4676 | 16| 0| 16| 0|
|
| 249 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4677 | 16| 0| 16| 0|
|
| 250 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4678 | 16| 0| 16| 0|
|
| 251 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4679 | 16| 0| 16| 0|
|
| 252 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4680 | 16| 0| 16| 0|
|
| 253 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4681 | 16| 0| 16| 0|
|
| 254 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4683 | 16| 0| 16| 0|
|
| 255 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4684 | 16| 0| 16| 0|
|
| 256 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4685 | 16| 0| 16| 0|
|
| 257 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4686 | 16| 0| 16| 0|
|
| 258 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4687 | 16| 0| 16| 0|
|
| 259 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4688 | 16| 0| 16| 0|
|
| 260 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4689 | 16| 0| 16| 0|
|
| 261 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4690 | 16| 0| 16| 0|
|
| 262 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4691 | 16| 0| 16| 0|
|
| 263 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4692 | 16| 0| 16| 0|
|
| 264 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4694 | 16| 0| 16| 0|
|
| 265 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4695 | 16| 0| 16| 0|
|
| 266 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4696 | 16| 0| 16| 0|
|
| 267 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4697 | 16| 0| 16| 0|
|
| 268 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4698 | 16| 0| 16| 0|
|
| 269 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4699 | 16| 0| 16| 0|
|
| 270 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4700 | 16| 0| 16| 0|
|
| 271 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4701 | 16| 0| 16| 0|
|
| 272 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4702 | 16| 0| 16| 0|
|
| 273 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4703 | 16| 0| 16| 0|
|
| 274 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4705 | 16| 0| 16| 0|
|
| 275 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4706 | 16| 0| 16| 0|
|
| 276 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4707 | 16| 0| 16| 0|
|
| 277 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4708 | 16| 0| 16| 0|
|
| 278 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4709 | 16| 0| 16| 0|
|
| 279 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4710 | 16| 0| 16| 0|
|
| 280 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4711 | 16| 0| 16| 0|
|
| 281 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4712 | 16| 0| 16| 0|
|
| 282 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4713 | 16| 0| 16| 0|
|
| 283 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4714 | 16| 0| 16| 0|
|
| 284 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4716 | 16| 0| 16| 0|
|
| 285 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4717 | 16| 0| 16| 0|
|
| 286 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4718 | 16| 0| 16| 0|
|
| 287 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4719 | 16| 0| 16| 0|
|
| 288 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4720 | 16| 0| 16| 0|
|
| 289 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4721 | 16| 0| 16| 0|
|
| 290 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4722 | 16| 0| 16| 0|
|
| 291 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4723 | 16| 0| 16| 0|
|
| 292 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4724 | 16| 0| 16| 0|
|
| 293 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4725 | 16| 0| 16| 0|
|
| 294 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4727 | 16| 0| 16| 0|
|
| 295 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4728 | 16| 0| 16| 0|
|
| 296 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4729 | 16| 0| 16| 0|
|
| 297 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4730 | 16| 0| 16| 0|
|
| 298 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4731 | 16| 0| 16| 0|
|
| 299 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4732 | 16| 0| 16| 0|
|
| 300 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4733 | 16| 0| 16| 0|
|
| 301 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4734 | 16| 0| 16| 0|
|
| 302 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4735 | 16| 0| 16| 0|
|
| 303 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4736 | 16| 0| 16| 0|
|
| 304 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4738 | 16| 0| 16| 0|
|
| 305 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4739 | 16| 0| 16| 0|
|
| 306 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4740 | 16| 0| 16| 0|
|
| 307 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4741 | 16| 0| 16| 0|
|
| 308 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4742 | 16| 0| 16| 0|
|
| 309 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4743 | 16| 0| 16| 0|
|
| 310 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4744 | 16| 0| 16| 0|
|
| 311 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4745 | 16| 0| 16| 0|
|
| 312 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4746 | 16| 0| 16| 0|
|
| 313 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4747 | 16| 0| 16| 0|
|
| 314 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4749 | 16| 0| 16| 0|
|
| 315 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4750 | 16| 0| 16| 0|
|
| 316 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4751 | 16| 0| 16| 0|
|
| 317 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4752 | 16| 0| 16| 0|
|
| 318 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4753 | 16| 0| 16| 0|
|
| 319 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4754 | 16| 0| 16| 0|
|
| 320 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4755 | 16| 0| 16| 0|
|
| 321 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4756 | 16| 0| 16| 0|
|
| 322 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4757 | 16| 0| 16| 0|
|
| 323 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4758 | 16| 0| 16| 0|
|
| 324 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4760 | 16| 0| 16| 0|
|
| 325 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4761 | 16| 0| 16| 0|
|
| 326 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4762 | 16| 0| 16| 0|
|
| 327 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4763 | 16| 0| 16| 0|
|
| 328 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4764 | 16| 0| 16| 0|
|
| 329 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4765 | 16| 0| 16| 0|
|
| 330 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4766 | 16| 0| 16| 0|
|
| 331 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4767 | 16| 0| 16| 0|
|
| 332 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4768 | 16| 0| 16| 0|
|
| 333 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4769 | 16| 0| 16| 0|
|
| 334 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4771 | 16| 0| 16| 0|
|
| 335 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4772 | 16| 0| 16| 0|
|
| 336 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4773 | 16| 0| 16| 0|
|
| 337 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4774 | 16| 0| 16| 0|
|
| 338 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4775 | 16| 0| 16| 0|
|
| 339 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4776 | 16| 0| 16| 0|
|
| 340 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4777 | 16| 0| 16| 0|
|
| 341 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4778 | 16| 0| 16| 0|
|
| 342 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4779 | 16| 0| 16| 0|
|
| 343 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4780 | 16| 0| 16| 0|
|
| 344 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4782 | 16| 0| 16| 0|
|
| 345 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4783 | 16| 0| 16| 0|
|
| 346 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4784 | 16| 0| 16| 0|
|
| 347 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4785 | 16| 0| 16| 0|
|
| 348 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4786 | 16| 0| 16| 0|
|
| 349 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4787 | 16| 0| 16| 0|
|
| 350 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4788 | 16| 0| 16| 0|
|
| 351 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4789 | 16| 0| 16| 0|
|
| 352 |
+
|res_out_1_reg_2037 | 41| 0| 41| 0|
|
| 353 |
+
|res_out_2_reg_2042 | 41| 0| 41| 0|
|
| 354 |
+
|res_out_3_reg_2047 | 41| 0| 41| 0|
|
| 355 |
+
|res_out_4_reg_2052 | 41| 0| 41| 0|
|
| 356 |
+
|res_out_5_reg_2057 | 41| 0| 41| 0|
|
| 357 |
+
|res_out_6_reg_2062 | 41| 0| 41| 0|
|
| 358 |
+
|res_out_7_reg_2067 | 41| 0| 41| 0|
|
| 359 |
+
|res_out_reg_2032 | 41| 0| 41| 0|
|
| 360 |
+
|sX_6 | 32| 0| 32| 0|
|
| 361 |
+
|sY_6 | 32| 0| 32| 0|
|
| 362 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_90 | 16| 0| 16| 0|
|
| 363 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_91 | 16| 0| 16| 0|
|
| 364 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_92 | 16| 0| 16| 0|
|
| 365 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_93 | 16| 0| 16| 0|
|
| 366 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_94 | 16| 0| 16| 0|
|
| 367 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_95 | 16| 0| 16| 0|
|
| 368 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_96 | 16| 0| 16| 0|
|
| 369 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_97 | 16| 0| 16| 0|
|
| 370 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_98 | 16| 0| 16| 0|
|
| 371 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_99 | 16| 0| 16| 0|
|
| 372 |
+
+--------------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 373 |
+
|Total |3919| 0| 3919| 0|
|
| 374 |
+
+--------------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
================================================================
|
| 379 |
+
== Interface
|
| 380 |
+
================================================================
|
| 381 |
+
* Summary:
|
| 382 |
+
+----------------------------+-----+-----+------------+--------------------------------------------------------------------------+--------------+
|
| 383 |
+
| RTL Ports | Dir | Bits| Protocol | Source Object | C Type |
|
| 384 |
+
+----------------------------+-----+-----+------------+--------------------------------------------------------------------------+--------------+
|
| 385 |
+
|ap_clk | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 386 |
+
|ap_rst | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 387 |
+
|ap_start | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 388 |
+
|ap_done | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 389 |
+
|ap_idle | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 390 |
+
|ap_ready | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<41,21,5,3,0>,8u>,config35>| return value|
|
| 391 |
+
|p_read | in| 16| ap_none| p_read| scalar|
|
| 392 |
+
|p_read1 | in| 16| ap_none| p_read1| scalar|
|
| 393 |
+
|p_read2 | in| 16| ap_none| p_read2| scalar|
|
| 394 |
+
|p_read3 | in| 16| ap_none| p_read3| scalar|
|
| 395 |
+
|p_read4 | in| 16| ap_none| p_read4| scalar|
|
| 396 |
+
|p_read5 | in| 16| ap_none| p_read5| scalar|
|
| 397 |
+
|p_read6 | in| 16| ap_none| p_read6| scalar|
|
| 398 |
+
|p_read7 | in| 16| ap_none| p_read7| scalar|
|
| 399 |
+
|p_read8 | in| 16| ap_none| p_read8| scalar|
|
| 400 |
+
|p_read9 | in| 16| ap_none| p_read9| scalar|
|
| 401 |
+
|p_read10 | in| 16| ap_none| p_read10| scalar|
|
| 402 |
+
|p_read11 | in| 16| ap_none| p_read11| scalar|
|
| 403 |
+
|p_read12 | in| 16| ap_none| p_read12| scalar|
|
| 404 |
+
|p_read13 | in| 16| ap_none| p_read13| scalar|
|
| 405 |
+
|p_read14 | in| 16| ap_none| p_read14| scalar|
|
| 406 |
+
|p_read15 | in| 16| ap_none| p_read15| scalar|
|
| 407 |
+
|p_read16 | in| 16| ap_none| p_read16| scalar|
|
| 408 |
+
|p_read17 | in| 16| ap_none| p_read17| scalar|
|
| 409 |
+
|p_read18 | in| 16| ap_none| p_read18| scalar|
|
| 410 |
+
|p_read19 | in| 16| ap_none| p_read19| scalar|
|
| 411 |
+
|p_read20 | in| 16| ap_none| p_read20| scalar|
|
| 412 |
+
|p_read21 | in| 16| ap_none| p_read21| scalar|
|
| 413 |
+
|p_read22 | in| 16| ap_none| p_read22| scalar|
|
| 414 |
+
|p_read23 | in| 16| ap_none| p_read23| scalar|
|
| 415 |
+
|layer35_out_din | out| 328| ap_fifo| layer35_out| pointer|
|
| 416 |
+
|layer35_out_num_data_valid | in| 13| ap_fifo| layer35_out| pointer|
|
| 417 |
+
|layer35_out_fifo_cap | in| 13| ap_fifo| layer35_out| pointer|
|
| 418 |
+
|layer35_out_full_n | in| 1| ap_fifo| layer35_out| pointer|
|
| 419 |
+
|layer35_out_write | out| 1| ap_fifo| layer35_out| pointer|
|
| 420 |
+
+----------------------------+-----+-----+------------+--------------------------------------------------------------------------+--------------+
|
| 421 |
+
|
myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_16u_config29_s_csynth.xml
ADDED
|
@@ -0,0 +1,710 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<profile>
|
| 2 |
+
|
| 3 |
+
<ReportVersion>
|
| 4 |
+
<Version>2024.1</Version>
|
| 5 |
+
</ReportVersion>
|
| 6 |
+
|
| 7 |
+
<UserAssignments>
|
| 8 |
+
<unit>ns</unit>
|
| 9 |
+
<ProductFamily>virtexuplusHBM</ProductFamily>
|
| 10 |
+
<Part>xcvu47p-fsvh2892-2L-e</Part>
|
| 11 |
+
<TopModelName>compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_16u_config29_s</TopModelName>
|
| 12 |
+
<TargetClockPeriod>4.00</TargetClockPeriod>
|
| 13 |
+
<ClockUncertainty>1.35</ClockUncertainty>
|
| 14 |
+
<FlowTarget>vivado</FlowTarget>
|
| 15 |
+
</UserAssignments>
|
| 16 |
+
|
| 17 |
+
<PerformanceEstimates>
|
| 18 |
+
<PipelineType>no</PipelineType>
|
| 19 |
+
<SummaryOfTimingAnalysis>
|
| 20 |
+
<unit>ns</unit>
|
| 21 |
+
<EstimatedClockPeriod>2.533</EstimatedClockPeriod>
|
| 22 |
+
</SummaryOfTimingAnalysis>
|
| 23 |
+
<SummaryOfOverallLatency>
|
| 24 |
+
<unit>clock cycles</unit>
|
| 25 |
+
<Best-caseLatency>2</Best-caseLatency>
|
| 26 |
+
<Average-caseLatency>147</Average-caseLatency>
|
| 27 |
+
<Worst-caseLatency>437</Worst-caseLatency>
|
| 28 |
+
<Best-caseRealTimeLatency>8.000 ns</Best-caseRealTimeLatency>
|
| 29 |
+
<Average-caseRealTimeLatency>0.588 us</Average-caseRealTimeLatency>
|
| 30 |
+
<Worst-caseRealTimeLatency>1.748 us</Worst-caseRealTimeLatency>
|
| 31 |
+
<Interval-min>2</Interval-min>
|
| 32 |
+
<Interval-max>437</Interval-max>
|
| 33 |
+
</SummaryOfOverallLatency>
|
| 34 |
+
<SummaryOfViolations>
|
| 35 |
+
<IssueType>-</IssueType>
|
| 36 |
+
<ViolationType>-</ViolationType>
|
| 37 |
+
<SourceLocation>firmware/nnet_utils/nnet_conv_stream.h:281</SourceLocation>
|
| 38 |
+
</SummaryOfViolations>
|
| 39 |
+
</PerformanceEstimates>
|
| 40 |
+
|
| 41 |
+
<AreaEstimates>
|
| 42 |
+
<Resources>
|
| 43 |
+
<BRAM_18K>8</BRAM_18K>
|
| 44 |
+
<DSP>16</DSP>
|
| 45 |
+
<FF>29287</FF>
|
| 46 |
+
<LUT>20707</LUT>
|
| 47 |
+
<URAM>0</URAM>
|
| 48 |
+
</Resources>
|
| 49 |
+
<AvailableResources>
|
| 50 |
+
<BRAM_18K>4032</BRAM_18K>
|
| 51 |
+
<DSP>9024</DSP>
|
| 52 |
+
<FF>2607360</FF>
|
| 53 |
+
<LUT>1303680</LUT>
|
| 54 |
+
<URAM>960</URAM>
|
| 55 |
+
</AvailableResources>
|
| 56 |
+
</AreaEstimates>
|
| 57 |
+
|
| 58 |
+
<InterfaceSummary>
|
| 59 |
+
<RtlPorts>
|
| 60 |
+
<name>ap_clk</name>
|
| 61 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 62 |
+
<Type>return value</Type>
|
| 63 |
+
<Scope></Scope>
|
| 64 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 65 |
+
<IOConfig></IOConfig>
|
| 66 |
+
<Dir>in</Dir>
|
| 67 |
+
<Bits>1</Bits>
|
| 68 |
+
<Attribute>control</Attribute>
|
| 69 |
+
</RtlPorts>
|
| 70 |
+
<RtlPorts>
|
| 71 |
+
<name>ap_rst</name>
|
| 72 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 73 |
+
<Type>return value</Type>
|
| 74 |
+
<Scope></Scope>
|
| 75 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 76 |
+
<IOConfig></IOConfig>
|
| 77 |
+
<Dir>in</Dir>
|
| 78 |
+
<Bits>1</Bits>
|
| 79 |
+
<Attribute>control</Attribute>
|
| 80 |
+
</RtlPorts>
|
| 81 |
+
<RtlPorts>
|
| 82 |
+
<name>ap_start</name>
|
| 83 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 84 |
+
<Type>return value</Type>
|
| 85 |
+
<Scope></Scope>
|
| 86 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 87 |
+
<IOConfig></IOConfig>
|
| 88 |
+
<Dir>in</Dir>
|
| 89 |
+
<Bits>1</Bits>
|
| 90 |
+
<Attribute>control</Attribute>
|
| 91 |
+
</RtlPorts>
|
| 92 |
+
<RtlPorts>
|
| 93 |
+
<name>ap_done</name>
|
| 94 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 95 |
+
<Type>return value</Type>
|
| 96 |
+
<Scope></Scope>
|
| 97 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 98 |
+
<IOConfig></IOConfig>
|
| 99 |
+
<Dir>out</Dir>
|
| 100 |
+
<Bits>1</Bits>
|
| 101 |
+
<Attribute>control</Attribute>
|
| 102 |
+
</RtlPorts>
|
| 103 |
+
<RtlPorts>
|
| 104 |
+
<name>ap_idle</name>
|
| 105 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 106 |
+
<Type>return value</Type>
|
| 107 |
+
<Scope></Scope>
|
| 108 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 109 |
+
<IOConfig></IOConfig>
|
| 110 |
+
<Dir>out</Dir>
|
| 111 |
+
<Bits>1</Bits>
|
| 112 |
+
<Attribute>control</Attribute>
|
| 113 |
+
</RtlPorts>
|
| 114 |
+
<RtlPorts>
|
| 115 |
+
<name>ap_ready</name>
|
| 116 |
+
<Object>compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,16u>,config29></Object>
|
| 117 |
+
<Type>return value</Type>
|
| 118 |
+
<Scope></Scope>
|
| 119 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 120 |
+
<IOConfig></IOConfig>
|
| 121 |
+
<Dir>out</Dir>
|
| 122 |
+
<Bits>1</Bits>
|
| 123 |
+
<Attribute>control</Attribute>
|
| 124 |
+
</RtlPorts>
|
| 125 |
+
<RtlPorts>
|
| 126 |
+
<name>p_read</name>
|
| 127 |
+
<Object>p_read</Object>
|
| 128 |
+
<Type>scalar</Type>
|
| 129 |
+
<Scope></Scope>
|
| 130 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 131 |
+
<IOConfig></IOConfig>
|
| 132 |
+
<Dir>in</Dir>
|
| 133 |
+
<Bits>16</Bits>
|
| 134 |
+
<Attribute>data</Attribute>
|
| 135 |
+
</RtlPorts>
|
| 136 |
+
<RtlPorts>
|
| 137 |
+
<name>p_read1</name>
|
| 138 |
+
<Object>p_read1</Object>
|
| 139 |
+
<Type>scalar</Type>
|
| 140 |
+
<Scope></Scope>
|
| 141 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 142 |
+
<IOConfig></IOConfig>
|
| 143 |
+
<Dir>in</Dir>
|
| 144 |
+
<Bits>16</Bits>
|
| 145 |
+
<Attribute>data</Attribute>
|
| 146 |
+
</RtlPorts>
|
| 147 |
+
<RtlPorts>
|
| 148 |
+
<name>p_read2</name>
|
| 149 |
+
<Object>p_read2</Object>
|
| 150 |
+
<Type>scalar</Type>
|
| 151 |
+
<Scope></Scope>
|
| 152 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 153 |
+
<IOConfig></IOConfig>
|
| 154 |
+
<Dir>in</Dir>
|
| 155 |
+
<Bits>16</Bits>
|
| 156 |
+
<Attribute>data</Attribute>
|
| 157 |
+
</RtlPorts>
|
| 158 |
+
<RtlPorts>
|
| 159 |
+
<name>p_read3</name>
|
| 160 |
+
<Object>p_read3</Object>
|
| 161 |
+
<Type>scalar</Type>
|
| 162 |
+
<Scope></Scope>
|
| 163 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 164 |
+
<IOConfig></IOConfig>
|
| 165 |
+
<Dir>in</Dir>
|
| 166 |
+
<Bits>16</Bits>
|
| 167 |
+
<Attribute>data</Attribute>
|
| 168 |
+
</RtlPorts>
|
| 169 |
+
<RtlPorts>
|
| 170 |
+
<name>p_read4</name>
|
| 171 |
+
<Object>p_read4</Object>
|
| 172 |
+
<Type>scalar</Type>
|
| 173 |
+
<Scope></Scope>
|
| 174 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 175 |
+
<IOConfig></IOConfig>
|
| 176 |
+
<Dir>in</Dir>
|
| 177 |
+
<Bits>16</Bits>
|
| 178 |
+
<Attribute>data</Attribute>
|
| 179 |
+
</RtlPorts>
|
| 180 |
+
<RtlPorts>
|
| 181 |
+
<name>p_read5</name>
|
| 182 |
+
<Object>p_read5</Object>
|
| 183 |
+
<Type>scalar</Type>
|
| 184 |
+
<Scope></Scope>
|
| 185 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 186 |
+
<IOConfig></IOConfig>
|
| 187 |
+
<Dir>in</Dir>
|
| 188 |
+
<Bits>16</Bits>
|
| 189 |
+
<Attribute>data</Attribute>
|
| 190 |
+
</RtlPorts>
|
| 191 |
+
<RtlPorts>
|
| 192 |
+
<name>p_read6</name>
|
| 193 |
+
<Object>p_read6</Object>
|
| 194 |
+
<Type>scalar</Type>
|
| 195 |
+
<Scope></Scope>
|
| 196 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 197 |
+
<IOConfig></IOConfig>
|
| 198 |
+
<Dir>in</Dir>
|
| 199 |
+
<Bits>16</Bits>
|
| 200 |
+
<Attribute>data</Attribute>
|
| 201 |
+
</RtlPorts>
|
| 202 |
+
<RtlPorts>
|
| 203 |
+
<name>p_read7</name>
|
| 204 |
+
<Object>p_read7</Object>
|
| 205 |
+
<Type>scalar</Type>
|
| 206 |
+
<Scope></Scope>
|
| 207 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 208 |
+
<IOConfig></IOConfig>
|
| 209 |
+
<Dir>in</Dir>
|
| 210 |
+
<Bits>16</Bits>
|
| 211 |
+
<Attribute>data</Attribute>
|
| 212 |
+
</RtlPorts>
|
| 213 |
+
<RtlPorts>
|
| 214 |
+
<name>p_read8</name>
|
| 215 |
+
<Object>p_read8</Object>
|
| 216 |
+
<Type>scalar</Type>
|
| 217 |
+
<Scope></Scope>
|
| 218 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 219 |
+
<IOConfig></IOConfig>
|
| 220 |
+
<Dir>in</Dir>
|
| 221 |
+
<Bits>16</Bits>
|
| 222 |
+
<Attribute>data</Attribute>
|
| 223 |
+
</RtlPorts>
|
| 224 |
+
<RtlPorts>
|
| 225 |
+
<name>p_read9</name>
|
| 226 |
+
<Object>p_read9</Object>
|
| 227 |
+
<Type>scalar</Type>
|
| 228 |
+
<Scope></Scope>
|
| 229 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 230 |
+
<IOConfig></IOConfig>
|
| 231 |
+
<Dir>in</Dir>
|
| 232 |
+
<Bits>16</Bits>
|
| 233 |
+
<Attribute>data</Attribute>
|
| 234 |
+
</RtlPorts>
|
| 235 |
+
<RtlPorts>
|
| 236 |
+
<name>p_read10</name>
|
| 237 |
+
<Object>p_read10</Object>
|
| 238 |
+
<Type>scalar</Type>
|
| 239 |
+
<Scope></Scope>
|
| 240 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 241 |
+
<IOConfig></IOConfig>
|
| 242 |
+
<Dir>in</Dir>
|
| 243 |
+
<Bits>16</Bits>
|
| 244 |
+
<Attribute>data</Attribute>
|
| 245 |
+
</RtlPorts>
|
| 246 |
+
<RtlPorts>
|
| 247 |
+
<name>p_read11</name>
|
| 248 |
+
<Object>p_read11</Object>
|
| 249 |
+
<Type>scalar</Type>
|
| 250 |
+
<Scope></Scope>
|
| 251 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 252 |
+
<IOConfig></IOConfig>
|
| 253 |
+
<Dir>in</Dir>
|
| 254 |
+
<Bits>16</Bits>
|
| 255 |
+
<Attribute>data</Attribute>
|
| 256 |
+
</RtlPorts>
|
| 257 |
+
<RtlPorts>
|
| 258 |
+
<name>p_read12</name>
|
| 259 |
+
<Object>p_read12</Object>
|
| 260 |
+
<Type>scalar</Type>
|
| 261 |
+
<Scope></Scope>
|
| 262 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 263 |
+
<IOConfig></IOConfig>
|
| 264 |
+
<Dir>in</Dir>
|
| 265 |
+
<Bits>16</Bits>
|
| 266 |
+
<Attribute>data</Attribute>
|
| 267 |
+
</RtlPorts>
|
| 268 |
+
<RtlPorts>
|
| 269 |
+
<name>p_read13</name>
|
| 270 |
+
<Object>p_read13</Object>
|
| 271 |
+
<Type>scalar</Type>
|
| 272 |
+
<Scope></Scope>
|
| 273 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 274 |
+
<IOConfig></IOConfig>
|
| 275 |
+
<Dir>in</Dir>
|
| 276 |
+
<Bits>16</Bits>
|
| 277 |
+
<Attribute>data</Attribute>
|
| 278 |
+
</RtlPorts>
|
| 279 |
+
<RtlPorts>
|
| 280 |
+
<name>p_read14</name>
|
| 281 |
+
<Object>p_read14</Object>
|
| 282 |
+
<Type>scalar</Type>
|
| 283 |
+
<Scope></Scope>
|
| 284 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 285 |
+
<IOConfig></IOConfig>
|
| 286 |
+
<Dir>in</Dir>
|
| 287 |
+
<Bits>16</Bits>
|
| 288 |
+
<Attribute>data</Attribute>
|
| 289 |
+
</RtlPorts>
|
| 290 |
+
<RtlPorts>
|
| 291 |
+
<name>p_read15</name>
|
| 292 |
+
<Object>p_read15</Object>
|
| 293 |
+
<Type>scalar</Type>
|
| 294 |
+
<Scope></Scope>
|
| 295 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 296 |
+
<IOConfig></IOConfig>
|
| 297 |
+
<Dir>in</Dir>
|
| 298 |
+
<Bits>16</Bits>
|
| 299 |
+
<Attribute>data</Attribute>
|
| 300 |
+
</RtlPorts>
|
| 301 |
+
<RtlPorts>
|
| 302 |
+
<name>p_read16</name>
|
| 303 |
+
<Object>p_read16</Object>
|
| 304 |
+
<Type>scalar</Type>
|
| 305 |
+
<Scope></Scope>
|
| 306 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 307 |
+
<IOConfig></IOConfig>
|
| 308 |
+
<Dir>in</Dir>
|
| 309 |
+
<Bits>16</Bits>
|
| 310 |
+
<Attribute>data</Attribute>
|
| 311 |
+
</RtlPorts>
|
| 312 |
+
<RtlPorts>
|
| 313 |
+
<name>p_read17</name>
|
| 314 |
+
<Object>p_read17</Object>
|
| 315 |
+
<Type>scalar</Type>
|
| 316 |
+
<Scope></Scope>
|
| 317 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 318 |
+
<IOConfig></IOConfig>
|
| 319 |
+
<Dir>in</Dir>
|
| 320 |
+
<Bits>16</Bits>
|
| 321 |
+
<Attribute>data</Attribute>
|
| 322 |
+
</RtlPorts>
|
| 323 |
+
<RtlPorts>
|
| 324 |
+
<name>p_read18</name>
|
| 325 |
+
<Object>p_read18</Object>
|
| 326 |
+
<Type>scalar</Type>
|
| 327 |
+
<Scope></Scope>
|
| 328 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 329 |
+
<IOConfig></IOConfig>
|
| 330 |
+
<Dir>in</Dir>
|
| 331 |
+
<Bits>16</Bits>
|
| 332 |
+
<Attribute>data</Attribute>
|
| 333 |
+
</RtlPorts>
|
| 334 |
+
<RtlPorts>
|
| 335 |
+
<name>p_read19</name>
|
| 336 |
+
<Object>p_read19</Object>
|
| 337 |
+
<Type>scalar</Type>
|
| 338 |
+
<Scope></Scope>
|
| 339 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 340 |
+
<IOConfig></IOConfig>
|
| 341 |
+
<Dir>in</Dir>
|
| 342 |
+
<Bits>16</Bits>
|
| 343 |
+
<Attribute>data</Attribute>
|
| 344 |
+
</RtlPorts>
|
| 345 |
+
<RtlPorts>
|
| 346 |
+
<name>p_read20</name>
|
| 347 |
+
<Object>p_read20</Object>
|
| 348 |
+
<Type>scalar</Type>
|
| 349 |
+
<Scope></Scope>
|
| 350 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 351 |
+
<IOConfig></IOConfig>
|
| 352 |
+
<Dir>in</Dir>
|
| 353 |
+
<Bits>16</Bits>
|
| 354 |
+
<Attribute>data</Attribute>
|
| 355 |
+
</RtlPorts>
|
| 356 |
+
<RtlPorts>
|
| 357 |
+
<name>p_read21</name>
|
| 358 |
+
<Object>p_read21</Object>
|
| 359 |
+
<Type>scalar</Type>
|
| 360 |
+
<Scope></Scope>
|
| 361 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 362 |
+
<IOConfig></IOConfig>
|
| 363 |
+
<Dir>in</Dir>
|
| 364 |
+
<Bits>16</Bits>
|
| 365 |
+
<Attribute>data</Attribute>
|
| 366 |
+
</RtlPorts>
|
| 367 |
+
<RtlPorts>
|
| 368 |
+
<name>p_read22</name>
|
| 369 |
+
<Object>p_read22</Object>
|
| 370 |
+
<Type>scalar</Type>
|
| 371 |
+
<Scope></Scope>
|
| 372 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 373 |
+
<IOConfig></IOConfig>
|
| 374 |
+
<Dir>in</Dir>
|
| 375 |
+
<Bits>16</Bits>
|
| 376 |
+
<Attribute>data</Attribute>
|
| 377 |
+
</RtlPorts>
|
| 378 |
+
<RtlPorts>
|
| 379 |
+
<name>p_read23</name>
|
| 380 |
+
<Object>p_read23</Object>
|
| 381 |
+
<Type>scalar</Type>
|
| 382 |
+
<Scope></Scope>
|
| 383 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 384 |
+
<IOConfig></IOConfig>
|
| 385 |
+
<Dir>in</Dir>
|
| 386 |
+
<Bits>16</Bits>
|
| 387 |
+
<Attribute>data</Attribute>
|
| 388 |
+
</RtlPorts>
|
| 389 |
+
<RtlPorts>
|
| 390 |
+
<name>p_read24</name>
|
| 391 |
+
<Object>p_read24</Object>
|
| 392 |
+
<Type>scalar</Type>
|
| 393 |
+
<Scope></Scope>
|
| 394 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 395 |
+
<IOConfig></IOConfig>
|
| 396 |
+
<Dir>in</Dir>
|
| 397 |
+
<Bits>16</Bits>
|
| 398 |
+
<Attribute>data</Attribute>
|
| 399 |
+
</RtlPorts>
|
| 400 |
+
<RtlPorts>
|
| 401 |
+
<name>p_read25</name>
|
| 402 |
+
<Object>p_read25</Object>
|
| 403 |
+
<Type>scalar</Type>
|
| 404 |
+
<Scope></Scope>
|
| 405 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 406 |
+
<IOConfig></IOConfig>
|
| 407 |
+
<Dir>in</Dir>
|
| 408 |
+
<Bits>16</Bits>
|
| 409 |
+
<Attribute>data</Attribute>
|
| 410 |
+
</RtlPorts>
|
| 411 |
+
<RtlPorts>
|
| 412 |
+
<name>p_read26</name>
|
| 413 |
+
<Object>p_read26</Object>
|
| 414 |
+
<Type>scalar</Type>
|
| 415 |
+
<Scope></Scope>
|
| 416 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 417 |
+
<IOConfig></IOConfig>
|
| 418 |
+
<Dir>in</Dir>
|
| 419 |
+
<Bits>16</Bits>
|
| 420 |
+
<Attribute>data</Attribute>
|
| 421 |
+
</RtlPorts>
|
| 422 |
+
<RtlPorts>
|
| 423 |
+
<name>p_read27</name>
|
| 424 |
+
<Object>p_read27</Object>
|
| 425 |
+
<Type>scalar</Type>
|
| 426 |
+
<Scope></Scope>
|
| 427 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 428 |
+
<IOConfig></IOConfig>
|
| 429 |
+
<Dir>in</Dir>
|
| 430 |
+
<Bits>16</Bits>
|
| 431 |
+
<Attribute>data</Attribute>
|
| 432 |
+
</RtlPorts>
|
| 433 |
+
<RtlPorts>
|
| 434 |
+
<name>p_read28</name>
|
| 435 |
+
<Object>p_read28</Object>
|
| 436 |
+
<Type>scalar</Type>
|
| 437 |
+
<Scope></Scope>
|
| 438 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 439 |
+
<IOConfig></IOConfig>
|
| 440 |
+
<Dir>in</Dir>
|
| 441 |
+
<Bits>16</Bits>
|
| 442 |
+
<Attribute>data</Attribute>
|
| 443 |
+
</RtlPorts>
|
| 444 |
+
<RtlPorts>
|
| 445 |
+
<name>p_read29</name>
|
| 446 |
+
<Object>p_read29</Object>
|
| 447 |
+
<Type>scalar</Type>
|
| 448 |
+
<Scope></Scope>
|
| 449 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 450 |
+
<IOConfig></IOConfig>
|
| 451 |
+
<Dir>in</Dir>
|
| 452 |
+
<Bits>16</Bits>
|
| 453 |
+
<Attribute>data</Attribute>
|
| 454 |
+
</RtlPorts>
|
| 455 |
+
<RtlPorts>
|
| 456 |
+
<name>p_read30</name>
|
| 457 |
+
<Object>p_read30</Object>
|
| 458 |
+
<Type>scalar</Type>
|
| 459 |
+
<Scope></Scope>
|
| 460 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 461 |
+
<IOConfig></IOConfig>
|
| 462 |
+
<Dir>in</Dir>
|
| 463 |
+
<Bits>16</Bits>
|
| 464 |
+
<Attribute>data</Attribute>
|
| 465 |
+
</RtlPorts>
|
| 466 |
+
<RtlPorts>
|
| 467 |
+
<name>p_read31</name>
|
| 468 |
+
<Object>p_read31</Object>
|
| 469 |
+
<Type>scalar</Type>
|
| 470 |
+
<Scope></Scope>
|
| 471 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 472 |
+
<IOConfig></IOConfig>
|
| 473 |
+
<Dir>in</Dir>
|
| 474 |
+
<Bits>16</Bits>
|
| 475 |
+
<Attribute>data</Attribute>
|
| 476 |
+
</RtlPorts>
|
| 477 |
+
<RtlPorts>
|
| 478 |
+
<name>p_read32</name>
|
| 479 |
+
<Object>p_read32</Object>
|
| 480 |
+
<Type>scalar</Type>
|
| 481 |
+
<Scope></Scope>
|
| 482 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 483 |
+
<IOConfig></IOConfig>
|
| 484 |
+
<Dir>in</Dir>
|
| 485 |
+
<Bits>16</Bits>
|
| 486 |
+
<Attribute>data</Attribute>
|
| 487 |
+
</RtlPorts>
|
| 488 |
+
<RtlPorts>
|
| 489 |
+
<name>p_read33</name>
|
| 490 |
+
<Object>p_read33</Object>
|
| 491 |
+
<Type>scalar</Type>
|
| 492 |
+
<Scope></Scope>
|
| 493 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 494 |
+
<IOConfig></IOConfig>
|
| 495 |
+
<Dir>in</Dir>
|
| 496 |
+
<Bits>16</Bits>
|
| 497 |
+
<Attribute>data</Attribute>
|
| 498 |
+
</RtlPorts>
|
| 499 |
+
<RtlPorts>
|
| 500 |
+
<name>p_read34</name>
|
| 501 |
+
<Object>p_read34</Object>
|
| 502 |
+
<Type>scalar</Type>
|
| 503 |
+
<Scope></Scope>
|
| 504 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 505 |
+
<IOConfig></IOConfig>
|
| 506 |
+
<Dir>in</Dir>
|
| 507 |
+
<Bits>16</Bits>
|
| 508 |
+
<Attribute>data</Attribute>
|
| 509 |
+
</RtlPorts>
|
| 510 |
+
<RtlPorts>
|
| 511 |
+
<name>p_read35</name>
|
| 512 |
+
<Object>p_read35</Object>
|
| 513 |
+
<Type>scalar</Type>
|
| 514 |
+
<Scope></Scope>
|
| 515 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 516 |
+
<IOConfig></IOConfig>
|
| 517 |
+
<Dir>in</Dir>
|
| 518 |
+
<Bits>16</Bits>
|
| 519 |
+
<Attribute>data</Attribute>
|
| 520 |
+
</RtlPorts>
|
| 521 |
+
<RtlPorts>
|
| 522 |
+
<name>p_read36</name>
|
| 523 |
+
<Object>p_read36</Object>
|
| 524 |
+
<Type>scalar</Type>
|
| 525 |
+
<Scope></Scope>
|
| 526 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 527 |
+
<IOConfig></IOConfig>
|
| 528 |
+
<Dir>in</Dir>
|
| 529 |
+
<Bits>16</Bits>
|
| 530 |
+
<Attribute>data</Attribute>
|
| 531 |
+
</RtlPorts>
|
| 532 |
+
<RtlPorts>
|
| 533 |
+
<name>p_read37</name>
|
| 534 |
+
<Object>p_read37</Object>
|
| 535 |
+
<Type>scalar</Type>
|
| 536 |
+
<Scope></Scope>
|
| 537 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 538 |
+
<IOConfig></IOConfig>
|
| 539 |
+
<Dir>in</Dir>
|
| 540 |
+
<Bits>16</Bits>
|
| 541 |
+
<Attribute>data</Attribute>
|
| 542 |
+
</RtlPorts>
|
| 543 |
+
<RtlPorts>
|
| 544 |
+
<name>p_read38</name>
|
| 545 |
+
<Object>p_read38</Object>
|
| 546 |
+
<Type>scalar</Type>
|
| 547 |
+
<Scope></Scope>
|
| 548 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 549 |
+
<IOConfig></IOConfig>
|
| 550 |
+
<Dir>in</Dir>
|
| 551 |
+
<Bits>16</Bits>
|
| 552 |
+
<Attribute>data</Attribute>
|
| 553 |
+
</RtlPorts>
|
| 554 |
+
<RtlPorts>
|
| 555 |
+
<name>p_read39</name>
|
| 556 |
+
<Object>p_read39</Object>
|
| 557 |
+
<Type>scalar</Type>
|
| 558 |
+
<Scope></Scope>
|
| 559 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 560 |
+
<IOConfig></IOConfig>
|
| 561 |
+
<Dir>in</Dir>
|
| 562 |
+
<Bits>16</Bits>
|
| 563 |
+
<Attribute>data</Attribute>
|
| 564 |
+
</RtlPorts>
|
| 565 |
+
<RtlPorts>
|
| 566 |
+
<name>p_read40</name>
|
| 567 |
+
<Object>p_read40</Object>
|
| 568 |
+
<Type>scalar</Type>
|
| 569 |
+
<Scope></Scope>
|
| 570 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 571 |
+
<IOConfig></IOConfig>
|
| 572 |
+
<Dir>in</Dir>
|
| 573 |
+
<Bits>16</Bits>
|
| 574 |
+
<Attribute>data</Attribute>
|
| 575 |
+
</RtlPorts>
|
| 576 |
+
<RtlPorts>
|
| 577 |
+
<name>p_read41</name>
|
| 578 |
+
<Object>p_read41</Object>
|
| 579 |
+
<Type>scalar</Type>
|
| 580 |
+
<Scope></Scope>
|
| 581 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 582 |
+
<IOConfig></IOConfig>
|
| 583 |
+
<Dir>in</Dir>
|
| 584 |
+
<Bits>16</Bits>
|
| 585 |
+
<Attribute>data</Attribute>
|
| 586 |
+
</RtlPorts>
|
| 587 |
+
<RtlPorts>
|
| 588 |
+
<name>p_read42</name>
|
| 589 |
+
<Object>p_read42</Object>
|
| 590 |
+
<Type>scalar</Type>
|
| 591 |
+
<Scope></Scope>
|
| 592 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 593 |
+
<IOConfig></IOConfig>
|
| 594 |
+
<Dir>in</Dir>
|
| 595 |
+
<Bits>16</Bits>
|
| 596 |
+
<Attribute>data</Attribute>
|
| 597 |
+
</RtlPorts>
|
| 598 |
+
<RtlPorts>
|
| 599 |
+
<name>p_read43</name>
|
| 600 |
+
<Object>p_read43</Object>
|
| 601 |
+
<Type>scalar</Type>
|
| 602 |
+
<Scope></Scope>
|
| 603 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 604 |
+
<IOConfig></IOConfig>
|
| 605 |
+
<Dir>in</Dir>
|
| 606 |
+
<Bits>16</Bits>
|
| 607 |
+
<Attribute>data</Attribute>
|
| 608 |
+
</RtlPorts>
|
| 609 |
+
<RtlPorts>
|
| 610 |
+
<name>p_read44</name>
|
| 611 |
+
<Object>p_read44</Object>
|
| 612 |
+
<Type>scalar</Type>
|
| 613 |
+
<Scope></Scope>
|
| 614 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 615 |
+
<IOConfig></IOConfig>
|
| 616 |
+
<Dir>in</Dir>
|
| 617 |
+
<Bits>16</Bits>
|
| 618 |
+
<Attribute>data</Attribute>
|
| 619 |
+
</RtlPorts>
|
| 620 |
+
<RtlPorts>
|
| 621 |
+
<name>p_read45</name>
|
| 622 |
+
<Object>p_read45</Object>
|
| 623 |
+
<Type>scalar</Type>
|
| 624 |
+
<Scope></Scope>
|
| 625 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 626 |
+
<IOConfig></IOConfig>
|
| 627 |
+
<Dir>in</Dir>
|
| 628 |
+
<Bits>16</Bits>
|
| 629 |
+
<Attribute>data</Attribute>
|
| 630 |
+
</RtlPorts>
|
| 631 |
+
<RtlPorts>
|
| 632 |
+
<name>p_read46</name>
|
| 633 |
+
<Object>p_read46</Object>
|
| 634 |
+
<Type>scalar</Type>
|
| 635 |
+
<Scope></Scope>
|
| 636 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 637 |
+
<IOConfig></IOConfig>
|
| 638 |
+
<Dir>in</Dir>
|
| 639 |
+
<Bits>16</Bits>
|
| 640 |
+
<Attribute>data</Attribute>
|
| 641 |
+
</RtlPorts>
|
| 642 |
+
<RtlPorts>
|
| 643 |
+
<name>p_read47</name>
|
| 644 |
+
<Object>p_read47</Object>
|
| 645 |
+
<Type>scalar</Type>
|
| 646 |
+
<Scope></Scope>
|
| 647 |
+
<IOProtocol>ap_none</IOProtocol>
|
| 648 |
+
<IOConfig></IOConfig>
|
| 649 |
+
<Dir>in</Dir>
|
| 650 |
+
<Bits>16</Bits>
|
| 651 |
+
<Attribute>data</Attribute>
|
| 652 |
+
</RtlPorts>
|
| 653 |
+
<RtlPorts>
|
| 654 |
+
<name>layer29_out_din</name>
|
| 655 |
+
<Object>layer29_out</Object>
|
| 656 |
+
<Type>pointer</Type>
|
| 657 |
+
<Scope></Scope>
|
| 658 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 659 |
+
<IOConfig></IOConfig>
|
| 660 |
+
<Dir>out</Dir>
|
| 661 |
+
<Bits>672</Bits>
|
| 662 |
+
<Attribute>control</Attribute>
|
| 663 |
+
</RtlPorts>
|
| 664 |
+
<RtlPorts>
|
| 665 |
+
<name>layer29_out_num_data_valid</name>
|
| 666 |
+
<Object>layer29_out</Object>
|
| 667 |
+
<Type>pointer</Type>
|
| 668 |
+
<Scope></Scope>
|
| 669 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 670 |
+
<IOConfig></IOConfig>
|
| 671 |
+
<Dir>in</Dir>
|
| 672 |
+
<Bits>11</Bits>
|
| 673 |
+
<Attribute>control</Attribute>
|
| 674 |
+
</RtlPorts>
|
| 675 |
+
<RtlPorts>
|
| 676 |
+
<name>layer29_out_fifo_cap</name>
|
| 677 |
+
<Object>layer29_out</Object>
|
| 678 |
+
<Type>pointer</Type>
|
| 679 |
+
<Scope></Scope>
|
| 680 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 681 |
+
<IOConfig></IOConfig>
|
| 682 |
+
<Dir>in</Dir>
|
| 683 |
+
<Bits>11</Bits>
|
| 684 |
+
<Attribute>unknown</Attribute>
|
| 685 |
+
</RtlPorts>
|
| 686 |
+
<RtlPorts>
|
| 687 |
+
<name>layer29_out_full_n</name>
|
| 688 |
+
<Object>layer29_out</Object>
|
| 689 |
+
<Type>pointer</Type>
|
| 690 |
+
<Scope></Scope>
|
| 691 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 692 |
+
<IOConfig></IOConfig>
|
| 693 |
+
<Dir>in</Dir>
|
| 694 |
+
<Bits>1</Bits>
|
| 695 |
+
<Attribute>control</Attribute>
|
| 696 |
+
</RtlPorts>
|
| 697 |
+
<RtlPorts>
|
| 698 |
+
<name>layer29_out_write</name>
|
| 699 |
+
<Object>layer29_out</Object>
|
| 700 |
+
<Type>pointer</Type>
|
| 701 |
+
<Scope></Scope>
|
| 702 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 703 |
+
<IOConfig></IOConfig>
|
| 704 |
+
<Dir>out</Dir>
|
| 705 |
+
<Bits>1</Bits>
|
| 706 |
+
<Attribute>control</Attribute>
|
| 707 |
+
</RtlP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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
================================================================
|
| 4 |
+
== Vitis HLS Report for 'compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_32u_config14_s'
|
| 5 |
+
================================================================
|
| 6 |
+
* Date: Sun Apr 5 21:47:13 2026
|
| 7 |
+
|
| 8 |
+
* Version: 2024.1 (Build 5069499 on May 21 2024)
|
| 9 |
+
* Project: myproject_prj
|
| 10 |
+
* Solution: solution1 (Vivado IP Flow Target)
|
| 11 |
+
* Product family: virtexuplusHBM
|
| 12 |
+
* Target device: xcvu47p-fsvh2892-2L-e
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
================================================================
|
| 16 |
+
== Performance Estimates
|
| 17 |
+
================================================================
|
| 18 |
+
+ Timing:
|
| 19 |
+
* Summary:
|
| 20 |
+
+--------+---------+----------+------------+
|
| 21 |
+
| Clock | Target | Estimated| Uncertainty|
|
| 22 |
+
+--------+---------+----------+------------+
|
| 23 |
+
|ap_clk | 4.00 ns| 4.118 ns| 1.35 ns|
|
| 24 |
+
+--------+---------+----------+------------+
|
| 25 |
+
|
| 26 |
+
+ Latency:
|
| 27 |
+
* Summary:
|
| 28 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 29 |
+
| Latency (cycles) | Latency (absolute) | Interval | Pipeline|
|
| 30 |
+
| min | max | min | max | min | max | Type |
|
| 31 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 32 |
+
| 2| 581| 8.236 ns| 2.393 us| 2| 581| no|
|
| 33 |
+
+---------+---------+----------+----------+-----+-----+---------+
|
| 34 |
+
|
| 35 |
+
+ Detail:
|
| 36 |
+
* Instance:
|
| 37 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 38 |
+
| | | Latency (cycles) | Latency (absolute) | Interval | Pipeline |
|
| 39 |
+
| Instance | Module | min | max | min | max | min | max | Type |
|
| 40 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 41 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config14_s_fu_1023 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config14_s | 0| 0| 0 ns| 0 ns| 1| 1| yes|
|
| 42 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config14_mult_s_fu_1795 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config14_mult_s | 577| 578| 2.376 us| 2.380 us| 576| 576| loop rewind stp(delay=0 clock cycles(s))|
|
| 43 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+-----+-----+------------------------------------------+
|
| 44 |
+
|
| 45 |
+
* Loop:
|
| 46 |
+
N/A
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
================================================================
|
| 51 |
+
== Utilization Estimates
|
| 52 |
+
================================================================
|
| 53 |
+
* Summary:
|
| 54 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 55 |
+
| Name | BRAM_18K| DSP | FF | LUT | URAM|
|
| 56 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 57 |
+
|DSP | -| -| -| -| -|
|
| 58 |
+
|Expression | -| -| 0| 501| -|
|
| 59 |
+
|FIFO | -| -| -| -| -|
|
| 60 |
+
|Instance | 15| 16| 11522| 19870| -|
|
| 61 |
+
|Memory | -| -| -| -| -|
|
| 62 |
+
|Multiplexer | -| -| 0| 76| -|
|
| 63 |
+
|Register | -| -| 6087| -| -|
|
| 64 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 65 |
+
|Total | 15| 16| 17609| 20447| 0|
|
| 66 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 67 |
+
|Available SLR | 1344| 3008| 869120| 434560| 320|
|
| 68 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 69 |
+
|Utilization SLR (%) | 1| ~0| 2| 4| 0|
|
| 70 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 71 |
+
|Available | 4032| 9024| 2607360| 1303680| 960|
|
| 72 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 73 |
+
|Utilization (%) | ~0| ~0| ~0| 1| 0|
|
| 74 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 75 |
+
|
| 76 |
+
+ Detail:
|
| 77 |
+
* Instance:
|
| 78 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+-------+-----+
|
| 79 |
+
| Instance | Module | BRAM_18K| DSP| FF | LUT | URAM|
|
| 80 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+-------+-----+
|
| 81 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config14_mult_s_fu_1795 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config14_mult_s | 15| 16| 7425| 16094| 0|
|
| 82 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config14_s_fu_1023 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config14_s | 0| 0| 4097| 3776| 0|
|
| 83 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+-------+-----+
|
| 84 |
+
|Total | | 15| 16| 11522| 19870| 0|
|
| 85 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+------+-------+-----+
|
| 86 |
+
|
| 87 |
+
* DSP:
|
| 88 |
+
N/A
|
| 89 |
+
|
| 90 |
+
* Memory:
|
| 91 |
+
N/A
|
| 92 |
+
|
| 93 |
+
* FIFO:
|
| 94 |
+
N/A
|
| 95 |
+
|
| 96 |
+
* Expression:
|
| 97 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 98 |
+
| Variable Name | Operation| DSP| FF| LUT| Bitwidth P0| Bitwidth P1|
|
| 99 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 100 |
+
|add_ln303_fu_2616_p2 | +| 0| 0| 39| 32| 1|
|
| 101 |
+
|add_ln307_fu_2663_p2 | +| 0| 0| 39| 32| 1|
|
| 102 |
+
|add_ln313_fu_2685_p2 | +| 0| 0| 39| 32| 1|
|
| 103 |
+
|add_ln318_fu_2633_p2 | +| 0| 0| 39| 32| 1|
|
| 104 |
+
|and_ln284_4_fu_2445_p2 | and| 0| 0| 2| 1| 1|
|
| 105 |
+
|and_ln284_fu_2439_p2 | and| 0| 0| 2| 1| 1|
|
| 106 |
+
|ap_block_state4 | and| 0| 0| 2| 1| 1|
|
| 107 |
+
|ap_condition_2223 | and| 0| 0| 2| 1| 1|
|
| 108 |
+
|ap_predicate_op88_write_state4 | and| 0| 0| 2| 1| 1|
|
| 109 |
+
|icmp_ln284_10_fu_2401_p2 | icmp| 0| 0| 39| 32| 2|
|
| 110 |
+
|icmp_ln284_11_fu_2417_p2 | icmp| 0| 0| 38| 31| 1|
|
| 111 |
+
|icmp_ln284_12_fu_2433_p2 | icmp| 0| 0| 38| 31| 1|
|
| 112 |
+
|icmp_ln284_fu_2383_p2 | icmp| 0| 0| 39| 32| 2|
|
| 113 |
+
|icmp_ln303_fu_2621_p2 | icmp| 0| 0| 39| 32| 5|
|
| 114 |
+
|icmp_ln307_fu_2668_p2 | icmp| 0| 0| 39| 32| 5|
|
| 115 |
+
|icmp_ln313_fu_2680_p2 | icmp| 0| 0| 39| 32| 2|
|
| 116 |
+
|select_ln313_fu_2690_p3 | select| 0| 0| 32| 1| 2|
|
| 117 |
+
|select_ln318_fu_2638_p3 | select| 0| 0| 32| 1| 2|
|
| 118 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 119 |
+
|Total | | 0| 0| 501| 357| 31|
|
| 120 |
+
+--------------------------------+----------+----+---+----+------------+------------+
|
| 121 |
+
|
| 122 |
+
* Multiplexer:
|
| 123 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 124 |
+
| Name | LUT| Input Size| Bits| Total Bits|
|
| 125 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 126 |
+
|ap_NS_fsm | 26| 5| 1| 5|
|
| 127 |
+
|ap_phi_mux_storemerge_phi_fu_1016_p4 | 14| 3| 32| 96|
|
| 128 |
+
|layer14_out_blk_n | 9| 2| 1| 2|
|
| 129 |
+
|pX_5 | 9| 2| 32| 64|
|
| 130 |
+
|pY_5 | 9| 2| 32| 64|
|
| 131 |
+
|sX_5 | 9| 2| 32| 64|
|
| 132 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 133 |
+
|Total | 76| 16| 130| 295|
|
| 134 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 135 |
+
|
| 136 |
+
* Register:
|
| 137 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 138 |
+
| Name | FF | LUT| Bits| Const Bits|
|
| 139 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 140 |
+
|and_ln284_4_reg_2728 | 1| 0| 1| 0|
|
| 141 |
+
|ap_CS_fsm | 4| 0| 4| 0|
|
| 142 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config14_mult_s_fu_1795_ap_start_reg | 1| 0| 1| 0|
|
| 143 |
+
|icmp_ln284_reg_2714 | 1| 0| 1| 0|
|
| 144 |
+
|pX_5 | 32| 0| 32| 0|
|
| 145 |
+
|pY_5 | 32| 0| 32| 0|
|
| 146 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4790 | 16| 0| 16| 0|
|
| 147 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4791 | 16| 0| 16| 0|
|
| 148 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4793 | 16| 0| 16| 0|
|
| 149 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4794 | 16| 0| 16| 0|
|
| 150 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4795 | 16| 0| 16| 0|
|
| 151 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4796 | 16| 0| 16| 0|
|
| 152 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4797 | 16| 0| 16| 0|
|
| 153 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4798 | 16| 0| 16| 0|
|
| 154 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4799 | 16| 0| 16| 0|
|
| 155 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4800 | 16| 0| 16| 0|
|
| 156 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4801 | 16| 0| 16| 0|
|
| 157 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4802 | 16| 0| 16| 0|
|
| 158 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4804 | 16| 0| 16| 0|
|
| 159 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4805 | 16| 0| 16| 0|
|
| 160 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4806 | 16| 0| 16| 0|
|
| 161 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4807 | 16| 0| 16| 0|
|
| 162 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4808 | 16| 0| 16| 0|
|
| 163 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4809 | 16| 0| 16| 0|
|
| 164 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4810 | 16| 0| 16| 0|
|
| 165 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4811 | 16| 0| 16| 0|
|
| 166 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4812 | 16| 0| 16| 0|
|
| 167 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4813 | 16| 0| 16| 0|
|
| 168 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4815 | 16| 0| 16| 0|
|
| 169 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4816 | 16| 0| 16| 0|
|
| 170 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4817 | 16| 0| 16| 0|
|
| 171 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4818 | 16| 0| 16| 0|
|
| 172 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4819 | 16| 0| 16| 0|
|
| 173 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4820 | 16| 0| 16| 0|
|
| 174 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4821 | 16| 0| 16| 0|
|
| 175 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4822 | 16| 0| 16| 0|
|
| 176 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4823 | 16| 0| 16| 0|
|
| 177 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4824 | 16| 0| 16| 0|
|
| 178 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4826 | 16| 0| 16| 0|
|
| 179 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4827 | 16| 0| 16| 0|
|
| 180 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4828 | 16| 0| 16| 0|
|
| 181 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4829 | 16| 0| 16| 0|
|
| 182 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4830 | 16| 0| 16| 0|
|
| 183 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4831 | 16| 0| 16| 0|
|
| 184 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4832 | 16| 0| 16| 0|
|
| 185 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4833 | 16| 0| 16| 0|
|
| 186 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4834 | 16| 0| 16| 0|
|
| 187 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4835 | 16| 0| 16| 0|
|
| 188 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4837 | 16| 0| 16| 0|
|
| 189 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4838 | 16| 0| 16| 0|
|
| 190 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4839 | 16| 0| 16| 0|
|
| 191 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4840 | 16| 0| 16| 0|
|
| 192 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4841 | 16| 0| 16| 0|
|
| 193 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4842 | 16| 0| 16| 0|
|
| 194 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4843 | 16| 0| 16| 0|
|
| 195 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4844 | 16| 0| 16| 0|
|
| 196 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4845 | 16| 0| 16| 0|
|
| 197 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4846 | 16| 0| 16| 0|
|
| 198 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4848 | 16| 0| 16| 0|
|
| 199 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4849 | 16| 0| 16| 0|
|
| 200 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4850 | 16| 0| 16| 0|
|
| 201 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4851 | 16| 0| 16| 0|
|
| 202 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4852 | 16| 0| 16| 0|
|
| 203 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4853 | 16| 0| 16| 0|
|
| 204 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4854 | 16| 0| 16| 0|
|
| 205 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4855 | 16| 0| 16| 0|
|
| 206 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4856 | 16| 0| 16| 0|
|
| 207 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4857 | 16| 0| 16| 0|
|
| 208 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4859 | 16| 0| 16| 0|
|
| 209 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4860 | 16| 0| 16| 0|
|
| 210 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4861 | 16| 0| 16| 0|
|
| 211 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4862 | 16| 0| 16| 0|
|
| 212 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4863 | 16| 0| 16| 0|
|
| 213 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4864 | 16| 0| 16| 0|
|
| 214 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4865 | 16| 0| 16| 0|
|
| 215 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4866 | 16| 0| 16| 0|
|
| 216 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4867 | 16| 0| 16| 0|
|
| 217 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4868 | 16| 0| 16| 0|
|
| 218 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4870 | 16| 0| 16| 0|
|
| 219 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4871 | 16| 0| 16| 0|
|
| 220 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4872 | 16| 0| 16| 0|
|
| 221 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4873 | 16| 0| 16| 0|
|
| 222 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4874 | 16| 0| 16| 0|
|
| 223 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4875 | 16| 0| 16| 0|
|
| 224 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4876 | 16| 0| 16| 0|
|
| 225 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4877 | 16| 0| 16| 0|
|
| 226 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4878 | 16| 0| 16| 0|
|
| 227 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4879 | 16| 0| 16| 0|
|
| 228 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4881 | 16| 0| 16| 0|
|
| 229 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4882 | 16| 0| 16| 0|
|
| 230 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4883 | 16| 0| 16| 0|
|
| 231 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4884 | 16| 0| 16| 0|
|
| 232 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4885 | 16| 0| 16| 0|
|
| 233 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4886 | 16| 0| 16| 0|
|
| 234 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4887 | 16| 0| 16| 0|
|
| 235 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4888 | 16| 0| 16| 0|
|
| 236 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4889 | 16| 0| 16| 0|
|
| 237 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4890 | 16| 0| 16| 0|
|
| 238 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4892 | 16| 0| 16| 0|
|
| 239 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4893 | 16| 0| 16| 0|
|
| 240 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4894 | 16| 0| 16| 0|
|
| 241 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4895 | 16| 0| 16| 0|
|
| 242 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4896 | 16| 0| 16| 0|
|
| 243 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4897 | 16| 0| 16| 0|
|
| 244 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4898 | 16| 0| 16| 0|
|
| 245 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4899 | 16| 0| 16| 0|
|
| 246 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4900 | 16| 0| 16| 0|
|
| 247 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4901 | 16| 0| 16| 0|
|
| 248 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4903 | 16| 0| 16| 0|
|
| 249 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4904 | 16| 0| 16| 0|
|
| 250 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4905 | 16| 0| 16| 0|
|
| 251 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4906 | 16| 0| 16| 0|
|
| 252 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4907 | 16| 0| 16| 0|
|
| 253 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4908 | 16| 0| 16| 0|
|
| 254 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4909 | 16| 0| 16| 0|
|
| 255 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4910 | 16| 0| 16| 0|
|
| 256 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4911 | 16| 0| 16| 0|
|
| 257 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4912 | 16| 0| 16| 0|
|
| 258 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4914 | 16| 0| 16| 0|
|
| 259 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4915 | 16| 0| 16| 0|
|
| 260 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4916 | 16| 0| 16| 0|
|
| 261 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4917 | 16| 0| 16| 0|
|
| 262 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4918 | 16| 0| 16| 0|
|
| 263 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4919 | 16| 0| 16| 0|
|
| 264 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4920 | 16| 0| 16| 0|
|
| 265 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4921 | 16| 0| 16| 0|
|
| 266 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4922 | 16| 0| 16| 0|
|
| 267 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4923 | 16| 0| 16| 0|
|
| 268 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4925 | 16| 0| 16| 0|
|
| 269 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4926 | 16| 0| 16| 0|
|
| 270 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4927 | 16| 0| 16| 0|
|
| 271 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4928 | 16| 0| 16| 0|
|
| 272 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4929 | 16| 0| 16| 0|
|
| 273 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4930 | 16| 0| 16| 0|
|
| 274 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4931 | 16| 0| 16| 0|
|
| 275 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4932 | 16| 0| 16| 0|
|
| 276 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4933 | 16| 0| 16| 0|
|
| 277 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4934 | 16| 0| 16| 0|
|
| 278 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4936 | 16| 0| 16| 0|
|
| 279 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4937 | 16| 0| 16| 0|
|
| 280 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4938 | 16| 0| 16| 0|
|
| 281 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4939 | 16| 0| 16| 0|
|
| 282 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4940 | 16| 0| 16| 0|
|
| 283 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4941 | 16| 0| 16| 0|
|
| 284 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4942 | 16| 0| 16| 0|
|
| 285 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4943 | 16| 0| 16| 0|
|
| 286 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4944 | 16| 0| 16| 0|
|
| 287 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4945 | 16| 0| 16| 0|
|
| 288 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4947 | 16| 0| 16| 0|
|
| 289 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4948 | 16| 0| 16| 0|
|
| 290 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4949 | 16| 0| 16| 0|
|
| 291 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4950 | 16| 0| 16| 0|
|
| 292 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4951 | 16| 0| 16| 0|
|
| 293 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4952 | 16| 0| 16| 0|
|
| 294 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4953 | 16| 0| 16| 0|
|
| 295 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4954 | 16| 0| 16| 0|
|
| 296 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4955 | 16| 0| 16| 0|
|
| 297 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4956 | 16| 0| 16| 0|
|
| 298 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4958 | 16| 0| 16| 0|
|
| 299 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4959 | 16| 0| 16| 0|
|
| 300 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4960 | 16| 0| 16| 0|
|
| 301 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4961 | 16| 0| 16| 0|
|
| 302 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4962 | 16| 0| 16| 0|
|
| 303 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4963 | 16| 0| 16| 0|
|
| 304 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4964 | 16| 0| 16| 0|
|
| 305 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4965 | 16| 0| 16| 0|
|
| 306 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4966 | 16| 0| 16| 0|
|
| 307 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4967 | 16| 0| 16| 0|
|
| 308 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4969 | 16| 0| 16| 0|
|
| 309 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4970 | 16| 0| 16| 0|
|
| 310 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4971 | 16| 0| 16| 0|
|
| 311 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4972 | 16| 0| 16| 0|
|
| 312 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4973 | 16| 0| 16| 0|
|
| 313 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4974 | 16| 0| 16| 0|
|
| 314 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4975 | 16| 0| 16| 0|
|
| 315 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4976 | 16| 0| 16| 0|
|
| 316 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4977 | 16| 0| 16| 0|
|
| 317 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4978 | 16| 0| 16| 0|
|
| 318 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4980 | 16| 0| 16| 0|
|
| 319 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4981 | 16| 0| 16| 0|
|
| 320 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4982 | 16| 0| 16| 0|
|
| 321 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4983 | 16| 0| 16| 0|
|
| 322 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4984 | 16| 0| 16| 0|
|
| 323 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4985 | 16| 0| 16| 0|
|
| 324 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4986 | 16| 0| 16| 0|
|
| 325 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4987 | 16| 0| 16| 0|
|
| 326 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4988 | 16| 0| 16| 0|
|
| 327 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4989 | 16| 0| 16| 0|
|
| 328 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4991 | 16| 0| 16| 0|
|
| 329 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4992 | 16| 0| 16| 0|
|
| 330 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4993 | 16| 0| 16| 0|
|
| 331 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4994 | 16| 0| 16| 0|
|
| 332 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4995 | 16| 0| 16| 0|
|
| 333 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4996 | 16| 0| 16| 0|
|
| 334 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4997 | 16| 0| 16| 0|
|
| 335 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4998 | 16| 0| 16| 0|
|
| 336 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_4999 | 16| 0| 16| 0|
|
| 337 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5000 | 16| 0| 16| 0|
|
| 338 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5002 | 16| 0| 16| 0|
|
| 339 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5003 | 16| 0| 16| 0|
|
| 340 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5004 | 16| 0| 16| 0|
|
| 341 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5005 | 16| 0| 16| 0|
|
| 342 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5006 | 16| 0| 16| 0|
|
| 343 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5007 | 16| 0| 16| 0|
|
| 344 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5008 | 16| 0| 16| 0|
|
| 345 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5009 | 16| 0| 16| 0|
|
| 346 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5010 | 16| 0| 16| 0|
|
| 347 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5011 | 16| 0| 16| 0|
|
| 348 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5013 | 16| 0| 16| 0|
|
| 349 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5014 | 16| 0| 16| 0|
|
| 350 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5015 | 16| 0| 16| 0|
|
| 351 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5016 | 16| 0| 16| 0|
|
| 352 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5017 | 16| 0| 16| 0|
|
| 353 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5018 | 16| 0| 16| 0|
|
| 354 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5019 | 16| 0| 16| 0|
|
| 355 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5020 | 16| 0| 16| 0|
|
| 356 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5021 | 16| 0| 16| 0|
|
| 357 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5022 | 16| 0| 16| 0|
|
| 358 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5024 | 16| 0| 16| 0|
|
| 359 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5025 | 16| 0| 16| 0|
|
| 360 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5026 | 16| 0| 16| 0|
|
| 361 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5027 | 16| 0| 16| 0|
|
| 362 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5028 | 16| 0| 16| 0|
|
| 363 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5029 | 16| 0| 16| 0|
|
| 364 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5030 | 16| 0| 16| 0|
|
| 365 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5031 | 16| 0| 16| 0|
|
| 366 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5032 | 16| 0| 16| 0|
|
| 367 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5033 | 16| 0| 16| 0|
|
| 368 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5035 | 16| 0| 16| 0|
|
| 369 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5036 | 16| 0| 16| 0|
|
| 370 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5037 | 16| 0| 16| 0|
|
| 371 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5038 | 16| 0| 16| 0|
|
| 372 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5039 | 16| 0| 16| 0|
|
| 373 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5040 | 16| 0| 16| 0|
|
| 374 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5041 | 16| 0| 16| 0|
|
| 375 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5042 | 16| 0| 16| 0|
|
| 376 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5043 | 16| 0| 16| 0|
|
| 377 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5044 | 16| 0| 16| 0|
|
| 378 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5046 | 16| 0| 16| 0|
|
| 379 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5047 | 16| 0| 16| 0|
|
| 380 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5048 | 16| 0| 16| 0|
|
| 381 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5049 | 16| 0| 16| 0|
|
| 382 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5050 | 16| 0| 16| 0|
|
| 383 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5051 | 16| 0| 16| 0|
|
| 384 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5052 | 16| 0| 16| 0|
|
| 385 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5053 | 16| 0| 16| 0|
|
| 386 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5054 | 16| 0| 16| 0|
|
| 387 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5055 | 16| 0| 16| 0|
|
| 388 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5057 | 16| 0| 16| 0|
|
| 389 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5058 | 16| 0| 16| 0|
|
| 390 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5059 | 16| 0| 16| 0|
|
| 391 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5060 | 16| 0| 16| 0|
|
| 392 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5061 | 16| 0| 16| 0|
|
| 393 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5062 | 16| 0| 16| 0|
|
| 394 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5063 | 16| 0| 16| 0|
|
| 395 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5064 | 16| 0| 16| 0|
|
| 396 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5065 | 16| 0| 16| 0|
|
| 397 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5066 | 16| 0| 16| 0|
|
| 398 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5068 | 16| 0| 16| 0|
|
| 399 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5069 | 16| 0| 16| 0|
|
| 400 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5070 | 16| 0| 16| 0|
|
| 401 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5071 | 16| 0| 16| 0|
|
| 402 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5072 | 16| 0| 16| 0|
|
| 403 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5073 | 16| 0| 16| 0|
|
| 404 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5074 | 16| 0| 16| 0|
|
| 405 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5075 | 16| 0| 16| 0|
|
| 406 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5076 | 16| 0| 16| 0|
|
| 407 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5077 | 16| 0| 16| 0|
|
| 408 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5079 | 16| 0| 16| 0|
|
| 409 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5080 | 16| 0| 16| 0|
|
| 410 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5081 | 16| 0| 16| 0|
|
| 411 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5082 | 16| 0| 16| 0|
|
| 412 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5083 | 16| 0| 16| 0|
|
| 413 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5084 | 16| 0| 16| 0|
|
| 414 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5085 | 16| 0| 16| 0|
|
| 415 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5086 | 16| 0| 16| 0|
|
| 416 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5087 | 16| 0| 16| 0|
|
| 417 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5088 | 16| 0| 16| 0|
|
| 418 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5090 | 16| 0| 16| 0|
|
| 419 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5091 | 16| 0| 16| 0|
|
| 420 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5092 | 16| 0| 16| 0|
|
| 421 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5093 | 16| 0| 16| 0|
|
| 422 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5094 | 16| 0| 16| 0|
|
| 423 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5095 | 16| 0| 16| 0|
|
| 424 |
+
|res_out_162_reg_2782 | 42| 0| 42| 0|
|
| 425 |
+
|res_out_163_reg_2787 | 42| 0| 42| 0|
|
| 426 |
+
|res_out_164_reg_2792 | 42| 0| 42| 0|
|
| 427 |
+
|res_out_165_reg_2797 | 42| 0| 42| 0|
|
| 428 |
+
|res_out_166_reg_2802 | 42| 0| 42| 0|
|
| 429 |
+
|res_out_167_reg_2807 | 42| 0| 42| 0|
|
| 430 |
+
|res_out_168_reg_2812 | 42| 0| 42| 0|
|
| 431 |
+
|res_out_169_reg_2817 | 42| 0| 42| 0|
|
| 432 |
+
|res_out_170_reg_2822 | 42| 0| 42| 0|
|
| 433 |
+
|res_out_171_reg_2827 | 42| 0| 42| 0|
|
| 434 |
+
|res_out_172_reg_2832 | 42| 0| 42| 0|
|
| 435 |
+
|res_out_173_reg_2837 | 42| 0| 42| 0|
|
| 436 |
+
|res_out_174_reg_2842 | 42| 0| 42| 0|
|
| 437 |
+
|res_out_175_reg_2847 | 42| 0| 42| 0|
|
| 438 |
+
|res_out_176_reg_2852 | 42| 0| 42| 0|
|
| 439 |
+
|res_out_177_reg_2857 | 42| 0| 42| 0|
|
| 440 |
+
|res_out_178_reg_2862 | 42| 0| 42| 0|
|
| 441 |
+
|res_out_179_reg_2867 | 42| 0| 42| 0|
|
| 442 |
+
|res_out_180_reg_2872 | 42| 0| 42| 0|
|
| 443 |
+
|res_out_181_reg_2877 | 42| 0| 42| 0|
|
| 444 |
+
|res_out_182_reg_2882 | 42| 0| 42| 0|
|
| 445 |
+
|res_out_183_reg_2887 | 42| 0| 42| 0|
|
| 446 |
+
|res_out_1_reg_2737 | 42| 0| 42| 0|
|
| 447 |
+
|res_out_2_reg_2742 | 42| 0| 42| 0|
|
| 448 |
+
|res_out_3_reg_2747 | 42| 0| 42| 0|
|
| 449 |
+
|res_out_4_reg_2752 | 42| 0| 42| 0|
|
| 450 |
+
|res_out_5_reg_2757 | 42| 0| 42| 0|
|
| 451 |
+
|res_out_6_reg_2762 | 42| 0| 42| 0|
|
| 452 |
+
|res_out_7_reg_2767 | 42| 0| 42| 0|
|
| 453 |
+
|res_out_8_reg_2772 | 42| 0| 42| 0|
|
| 454 |
+
|res_out_9_reg_2777 | 42| 0| 42| 0|
|
| 455 |
+
|res_out_reg_2732 | 42| 0| 42| 0|
|
| 456 |
+
|sX_5 | 32| 0| 32| 0|
|
| 457 |
+
|sY_5 | 32| 0| 32| 0|
|
| 458 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_80 | 16| 0| 16| 0|
|
| 459 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_81 | 16| 0| 16| 0|
|
| 460 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_82 | 16| 0| 16| 0|
|
| 461 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_83 | 16| 0| 16| 0|
|
| 462 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_84 | 16| 0| 16| 0|
|
| 463 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_85 | 16| 0| 16| 0|
|
| 464 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_86 | 16| 0| 16| 0|
|
| 465 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_87 | 16| 0| 16| 0|
|
| 466 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_88 | 16| 0| 16| 0|
|
| 467 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_89 | 16| 0| 16| 0|
|
| 468 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 469 |
+
|Total |6087| 0| 6087| 0|
|
| 470 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
================================================================
|
| 475 |
+
== Interface
|
| 476 |
+
================================================================
|
| 477 |
+
* Summary:
|
| 478 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 479 |
+
| RTL Ports | Dir | Bits | Protocol | Source Object | C Type |
|
| 480 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 481 |
+
|ap_clk | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 482 |
+
|ap_rst | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 483 |
+
|ap_start | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 484 |
+
|ap_done | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 485 |
+
|ap_idle | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 486 |
+
|ap_ready | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config14>| return value|
|
| 487 |
+
|p_read | in| 16| ap_none| p_read| scalar|
|
| 488 |
+
|p_read1 | in| 16| ap_none| p_read1| scalar|
|
| 489 |
+
|p_read2 | in| 16| ap_none| p_read2| scalar|
|
| 490 |
+
|p_read3 | in| 16| ap_none| p_read3| scalar|
|
| 491 |
+
|p_read4 | in| 16| ap_none| p_read4| scalar|
|
| 492 |
+
|p_read5 | in| 16| ap_none| p_read5| scalar|
|
| 493 |
+
|p_read6 | in| 16| ap_none| p_read6| scalar|
|
| 494 |
+
|p_read7 | in| 16| ap_none| p_read7| scalar|
|
| 495 |
+
|p_read8 | in| 16| ap_none| p_read8| scalar|
|
| 496 |
+
|p_read9 | in| 16| ap_none| p_read9| scalar|
|
| 497 |
+
|p_read10 | in| 16| ap_none| p_read10| scalar|
|
| 498 |
+
|p_read11 | in| 16| ap_none| p_read11| scalar|
|
| 499 |
+
|p_read12 | in| 16| ap_none| p_read12| scalar|
|
| 500 |
+
|p_read13 | in| 16| ap_none| p_read13| scalar|
|
| 501 |
+
|p_read14 | in| 16| ap_none| p_read14| scalar|
|
| 502 |
+
|p_read15 | in| 16| ap_none| p_read15| scalar|
|
| 503 |
+
|p_read16 | in| 16| ap_none| p_read16| scalar|
|
| 504 |
+
|p_read17 | in| 16| ap_none| p_read17| scalar|
|
| 505 |
+
|p_read18 | in| 16| ap_none| p_read18| scalar|
|
| 506 |
+
|p_read19 | in| 16| ap_none| p_read19| scalar|
|
| 507 |
+
|p_read20 | in| 16| ap_none| p_read20| scalar|
|
| 508 |
+
|p_read21 | in| 16| ap_none| p_read21| scalar|
|
| 509 |
+
|p_read22 | in| 16| ap_none| p_read22| scalar|
|
| 510 |
+
|p_read23 | in| 16| ap_none| p_read23| scalar|
|
| 511 |
+
|p_read24 | in| 16| ap_none| p_read24| scalar|
|
| 512 |
+
|p_read25 | in| 16| ap_none| p_read25| scalar|
|
| 513 |
+
|p_read26 | in| 16| ap_none| p_read26| scalar|
|
| 514 |
+
|p_read27 | in| 16| ap_none| p_read27| scalar|
|
| 515 |
+
|p_read28 | in| 16| ap_none| p_read28| scalar|
|
| 516 |
+
|p_read29 | in| 16| ap_none| p_read29| scalar|
|
| 517 |
+
|p_read30 | in| 16| ap_none| p_read30| scalar|
|
| 518 |
+
|p_read31 | in| 16| ap_none| p_read31| scalar|
|
| 519 |
+
|layer14_out_din | out| 1344| ap_fifo| layer14_out| pointer|
|
| 520 |
+
|layer14_out_num_data_valid | in| 9| ap_fifo| layer14_out| pointer|
|
| 521 |
+
|layer14_out_fifo_cap | in| 9| ap_fifo| layer14_out| pointer|
|
| 522 |
+
|layer14_out_full_n | in| 1| ap_fifo| layer14_out| pointer|
|
| 523 |
+
|layer14_out_write | out| 1| ap_fifo| layer14_out| pointer|
|
| 524 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 525 |
+
|
myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_32u_config25_s_csynth.rpt
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
================================================================
|
| 4 |
+
== Vitis HLS Report for 'compute_output_buffer_2d_array_array_ap_fixed_42_22_5_3_0_32u_config25_s'
|
| 5 |
+
================================================================
|
| 6 |
+
* Date: Sun Apr 5 21:49:26 2026
|
| 7 |
+
|
| 8 |
+
* Version: 2024.1 (Build 5069499 on May 21 2024)
|
| 9 |
+
* Project: myproject_prj
|
| 10 |
+
* Solution: solution1 (Vivado IP Flow Target)
|
| 11 |
+
* Product family: virtexuplusHBM
|
| 12 |
+
* Target device: xcvu47p-fsvh2892-2L-e
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
================================================================
|
| 16 |
+
== Performance Estimates
|
| 17 |
+
================================================================
|
| 18 |
+
+ Timing:
|
| 19 |
+
* Summary:
|
| 20 |
+
+--------+---------+----------+------------+
|
| 21 |
+
| Clock | Target | Estimated| Uncertainty|
|
| 22 |
+
+--------+---------+----------+------------+
|
| 23 |
+
|ap_clk | 4.00 ns| 4.449 ns| 1.35 ns|
|
| 24 |
+
+--------+---------+----------+------------+
|
| 25 |
+
|
| 26 |
+
+ Latency:
|
| 27 |
+
* Summary:
|
| 28 |
+
+---------+---------+----------+----------+-----+------+---------+
|
| 29 |
+
| Latency (cycles) | Latency (absolute) | Interval | Pipeline|
|
| 30 |
+
| min | max | min | max | min | max | Type |
|
| 31 |
+
+---------+---------+----------+----------+-----+------+---------+
|
| 32 |
+
| 2| 1157| 8.899 ns| 5.148 us| 2| 1157| no|
|
| 33 |
+
+---------+---------+----------+----------+-----+------+---------+
|
| 34 |
+
|
| 35 |
+
+ Detail:
|
| 36 |
+
* Instance:
|
| 37 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+------+------+------------------------------------------+
|
| 38 |
+
| | | Latency (cycles) | Latency (absolute) | Interval | Pipeline |
|
| 39 |
+
| Instance | Module | min | max | min | max | min | max | Type |
|
| 40 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+------+------+------------------------------------------+
|
| 41 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config25_s_fu_1023 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config25_s | 0| 0| 0 ns| 0 ns| 1| 1| yes|
|
| 42 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config25_mult_s_fu_1795 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config25_mult_s | 1154| 1155| 5.135 us| 5.139 us| 1152| 1152| loop rewind stp(delay=0 clock cycles(s))|
|
| 43 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+---------+----------+----------+------+------+------------------------------------------+
|
| 44 |
+
|
| 45 |
+
* Loop:
|
| 46 |
+
N/A
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
================================================================
|
| 51 |
+
== Utilization Estimates
|
| 52 |
+
================================================================
|
| 53 |
+
* Summary:
|
| 54 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 55 |
+
| Name | BRAM_18K| DSP | FF | LUT | URAM|
|
| 56 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 57 |
+
|DSP | -| -| -| -| -|
|
| 58 |
+
|Expression | -| -| 0| 505| -|
|
| 59 |
+
|FIFO | -| -| -| -| -|
|
| 60 |
+
|Instance | 16| 8| 16268| 16447| -|
|
| 61 |
+
|Memory | -| -| -| -| -|
|
| 62 |
+
|Multiplexer | -| -| 0| 70| -|
|
| 63 |
+
|Register | -| -| 4742| -| -|
|
| 64 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 65 |
+
|Total | 16| 8| 21010| 17022| 0|
|
| 66 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 67 |
+
|Available SLR | 1344| 3008| 869120| 434560| 320|
|
| 68 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 69 |
+
|Utilization SLR (%) | 1| ~0| 2| 3| 0|
|
| 70 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 71 |
+
|Available | 4032| 9024| 2607360| 1303680| 960|
|
| 72 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 73 |
+
|Utilization (%) | ~0| ~0| ~0| 1| 0|
|
| 74 |
+
+---------------------+---------+------+---------+---------+-----+
|
| 75 |
+
|
| 76 |
+
+ Detail:
|
| 77 |
+
* Instance:
|
| 78 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+-------+-------+-----+
|
| 79 |
+
| Instance | Module | BRAM_18K| DSP| FF | LUT | URAM|
|
| 80 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+-------+-------+-----+
|
| 81 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config25_mult_s_fu_1795 |dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config25_mult_s | 16| 8| 12171| 12671| 0|
|
| 82 |
+
|call_ln281_shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config25_s_fu_1023 |shift_line_buffer_array_ap_fixed_16_6_5_3_0_32u_config25_s | 0| 0| 4097| 3776| 0|
|
| 83 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+-------+-------+-----+
|
| 84 |
+
|Total | | 16| 8| 16268| 16447| 0|
|
| 85 |
+
+-------------------------------------------------------------------------------+-----------------------------------------------------------------+---------+----+-------+-------+-----+
|
| 86 |
+
|
| 87 |
+
* DSP:
|
| 88 |
+
N/A
|
| 89 |
+
|
| 90 |
+
* Memory:
|
| 91 |
+
N/A
|
| 92 |
+
|
| 93 |
+
* FIFO:
|
| 94 |
+
N/A
|
| 95 |
+
|
| 96 |
+
* Expression:
|
| 97 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 98 |
+
| Variable Name | Operation| DSP| FF| LUT| Bitwidth P0| Bitwidth P1|
|
| 99 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 100 |
+
|add_ln303_fu_2648_p2 | +| 0| 0| 39| 32| 1|
|
| 101 |
+
|add_ln307_fu_2695_p2 | +| 0| 0| 39| 32| 1|
|
| 102 |
+
|add_ln313_fu_2717_p2 | +| 0| 0| 39| 32| 1|
|
| 103 |
+
|add_ln318_fu_2665_p2 | +| 0| 0| 39| 32| 1|
|
| 104 |
+
|and_ln284_3_fu_2445_p2 | and| 0| 0| 2| 1| 1|
|
| 105 |
+
|and_ln284_fu_2439_p2 | and| 0| 0| 2| 1| 1|
|
| 106 |
+
|ap_block_state3 | and| 0| 0| 2| 1| 1|
|
| 107 |
+
|ap_block_state3_on_subcall_done | and| 0| 0| 2| 1| 1|
|
| 108 |
+
|ap_condition_1526 | and| 0| 0| 2| 1| 1|
|
| 109 |
+
|ap_condition_2161 | and| 0| 0| 2| 1| 1|
|
| 110 |
+
|ap_predicate_op53_call_state3 | and| 0| 0| 2| 1| 1|
|
| 111 |
+
|icmp_ln284_7_fu_2401_p2 | icmp| 0| 0| 39| 32| 2|
|
| 112 |
+
|icmp_ln284_8_fu_2417_p2 | icmp| 0| 0| 38| 31| 1|
|
| 113 |
+
|icmp_ln284_9_fu_2433_p2 | icmp| 0| 0| 38| 31| 1|
|
| 114 |
+
|icmp_ln284_fu_2383_p2 | icmp| 0| 0| 39| 32| 2|
|
| 115 |
+
|icmp_ln303_fu_2653_p2 | icmp| 0| 0| 39| 32| 5|
|
| 116 |
+
|icmp_ln307_fu_2700_p2 | icmp| 0| 0| 39| 32| 5|
|
| 117 |
+
|icmp_ln313_fu_2712_p2 | icmp| 0| 0| 39| 32| 2|
|
| 118 |
+
|select_ln313_fu_2722_p3 | select| 0| 0| 32| 1| 2|
|
| 119 |
+
|select_ln318_fu_2670_p3 | select| 0| 0| 32| 1| 2|
|
| 120 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 121 |
+
|Total | | 0| 0| 505| 359| 33|
|
| 122 |
+
+---------------------------------+----------+----+---+----+------------+------------+
|
| 123 |
+
|
| 124 |
+
* Multiplexer:
|
| 125 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 126 |
+
| Name | LUT| Input Size| Bits| Total Bits|
|
| 127 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 128 |
+
|ap_NS_fsm | 20| 4| 1| 4|
|
| 129 |
+
|ap_phi_mux_storemerge_phi_fu_1016_p4 | 14| 3| 32| 96|
|
| 130 |
+
|layer25_out_blk_n | 9| 2| 1| 2|
|
| 131 |
+
|pX_4 | 9| 2| 32| 64|
|
| 132 |
+
|pY_4 | 9| 2| 32| 64|
|
| 133 |
+
|sX_4 | 9| 2| 32| 64|
|
| 134 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 135 |
+
|Total | 70| 15| 130| 294|
|
| 136 |
+
+--------------------------------------+----+-----------+-----+-----------+
|
| 137 |
+
|
| 138 |
+
* Register:
|
| 139 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 140 |
+
| Name | FF | LUT| Bits| Const Bits|
|
| 141 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 142 |
+
|and_ln284_3_reg_2760 | 1| 0| 1| 0|
|
| 143 |
+
|ap_CS_fsm | 3| 0| 3| 0|
|
| 144 |
+
|grp_dense_resource_rf_gt_nin_rem0_ap_fixed_ap_fixed_config25_mult_s_fu_1795_ap_start_reg | 1| 0| 1| 0|
|
| 145 |
+
|icmp_ln284_reg_2746 | 1| 0| 1| 0|
|
| 146 |
+
|pX_4 | 32| 0| 32| 0|
|
| 147 |
+
|pY_4 | 32| 0| 32| 0|
|
| 148 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5096 | 16| 0| 16| 0|
|
| 149 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5097 | 16| 0| 16| 0|
|
| 150 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5098 | 16| 0| 16| 0|
|
| 151 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5099 | 16| 0| 16| 0|
|
| 152 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5101 | 16| 0| 16| 0|
|
| 153 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5102 | 16| 0| 16| 0|
|
| 154 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5103 | 16| 0| 16| 0|
|
| 155 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5104 | 16| 0| 16| 0|
|
| 156 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5105 | 16| 0| 16| 0|
|
| 157 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5106 | 16| 0| 16| 0|
|
| 158 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5107 | 16| 0| 16| 0|
|
| 159 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5108 | 16| 0| 16| 0|
|
| 160 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5109 | 16| 0| 16| 0|
|
| 161 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5110 | 16| 0| 16| 0|
|
| 162 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5112 | 16| 0| 16| 0|
|
| 163 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5113 | 16| 0| 16| 0|
|
| 164 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5114 | 16| 0| 16| 0|
|
| 165 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5115 | 16| 0| 16| 0|
|
| 166 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5116 | 16| 0| 16| 0|
|
| 167 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5117 | 16| 0| 16| 0|
|
| 168 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5118 | 16| 0| 16| 0|
|
| 169 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5119 | 16| 0| 16| 0|
|
| 170 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5120 | 16| 0| 16| 0|
|
| 171 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5121 | 16| 0| 16| 0|
|
| 172 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5123 | 16| 0| 16| 0|
|
| 173 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5124 | 16| 0| 16| 0|
|
| 174 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5125 | 16| 0| 16| 0|
|
| 175 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5126 | 16| 0| 16| 0|
|
| 176 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5127 | 16| 0| 16| 0|
|
| 177 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5128 | 16| 0| 16| 0|
|
| 178 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5129 | 16| 0| 16| 0|
|
| 179 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5130 | 16| 0| 16| 0|
|
| 180 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5131 | 16| 0| 16| 0|
|
| 181 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5132 | 16| 0| 16| 0|
|
| 182 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5134 | 16| 0| 16| 0|
|
| 183 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5135 | 16| 0| 16| 0|
|
| 184 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5136 | 16| 0| 16| 0|
|
| 185 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5137 | 16| 0| 16| 0|
|
| 186 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5138 | 16| 0| 16| 0|
|
| 187 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5139 | 16| 0| 16| 0|
|
| 188 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5140 | 16| 0| 16| 0|
|
| 189 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5141 | 16| 0| 16| 0|
|
| 190 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5142 | 16| 0| 16| 0|
|
| 191 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5143 | 16| 0| 16| 0|
|
| 192 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5145 | 16| 0| 16| 0|
|
| 193 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5146 | 16| 0| 16| 0|
|
| 194 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5147 | 16| 0| 16| 0|
|
| 195 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5148 | 16| 0| 16| 0|
|
| 196 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5149 | 16| 0| 16| 0|
|
| 197 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5150 | 16| 0| 16| 0|
|
| 198 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5151 | 16| 0| 16| 0|
|
| 199 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5152 | 16| 0| 16| 0|
|
| 200 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5153 | 16| 0| 16| 0|
|
| 201 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5154 | 16| 0| 16| 0|
|
| 202 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5156 | 16| 0| 16| 0|
|
| 203 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5157 | 16| 0| 16| 0|
|
| 204 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5158 | 16| 0| 16| 0|
|
| 205 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5159 | 16| 0| 16| 0|
|
| 206 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5160 | 16| 0| 16| 0|
|
| 207 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5161 | 16| 0| 16| 0|
|
| 208 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5162 | 16| 0| 16| 0|
|
| 209 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5163 | 16| 0| 16| 0|
|
| 210 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5164 | 16| 0| 16| 0|
|
| 211 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5165 | 16| 0| 16| 0|
|
| 212 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5167 | 16| 0| 16| 0|
|
| 213 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5168 | 16| 0| 16| 0|
|
| 214 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5169 | 16| 0| 16| 0|
|
| 215 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5170 | 16| 0| 16| 0|
|
| 216 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5171 | 16| 0| 16| 0|
|
| 217 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5172 | 16| 0| 16| 0|
|
| 218 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5173 | 16| 0| 16| 0|
|
| 219 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5174 | 16| 0| 16| 0|
|
| 220 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5175 | 16| 0| 16| 0|
|
| 221 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5176 | 16| 0| 16| 0|
|
| 222 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5178 | 16| 0| 16| 0|
|
| 223 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5179 | 16| 0| 16| 0|
|
| 224 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5180 | 16| 0| 16| 0|
|
| 225 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5181 | 16| 0| 16| 0|
|
| 226 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5182 | 16| 0| 16| 0|
|
| 227 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5183 | 16| 0| 16| 0|
|
| 228 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5184 | 16| 0| 16| 0|
|
| 229 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5185 | 16| 0| 16| 0|
|
| 230 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5186 | 16| 0| 16| 0|
|
| 231 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5187 | 16| 0| 16| 0|
|
| 232 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5189 | 16| 0| 16| 0|
|
| 233 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5190 | 16| 0| 16| 0|
|
| 234 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5191 | 16| 0| 16| 0|
|
| 235 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5192 | 16| 0| 16| 0|
|
| 236 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5193 | 16| 0| 16| 0|
|
| 237 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5194 | 16| 0| 16| 0|
|
| 238 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5195 | 16| 0| 16| 0|
|
| 239 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5196 | 16| 0| 16| 0|
|
| 240 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5197 | 16| 0| 16| 0|
|
| 241 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5198 | 16| 0| 16| 0|
|
| 242 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5200 | 16| 0| 16| 0|
|
| 243 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5201 | 16| 0| 16| 0|
|
| 244 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5202 | 16| 0| 16| 0|
|
| 245 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5203 | 16| 0| 16| 0|
|
| 246 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5204 | 16| 0| 16| 0|
|
| 247 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5205 | 16| 0| 16| 0|
|
| 248 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5206 | 16| 0| 16| 0|
|
| 249 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5207 | 16| 0| 16| 0|
|
| 250 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5208 | 16| 0| 16| 0|
|
| 251 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5209 | 16| 0| 16| 0|
|
| 252 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5211 | 16| 0| 16| 0|
|
| 253 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5212 | 16| 0| 16| 0|
|
| 254 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5213 | 16| 0| 16| 0|
|
| 255 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5214 | 16| 0| 16| 0|
|
| 256 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5215 | 16| 0| 16| 0|
|
| 257 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5216 | 16| 0| 16| 0|
|
| 258 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5217 | 16| 0| 16| 0|
|
| 259 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5218 | 16| 0| 16| 0|
|
| 260 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5219 | 16| 0| 16| 0|
|
| 261 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5220 | 16| 0| 16| 0|
|
| 262 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5222 | 16| 0| 16| 0|
|
| 263 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5223 | 16| 0| 16| 0|
|
| 264 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5224 | 16| 0| 16| 0|
|
| 265 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5225 | 16| 0| 16| 0|
|
| 266 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5226 | 16| 0| 16| 0|
|
| 267 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5227 | 16| 0| 16| 0|
|
| 268 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5228 | 16| 0| 16| 0|
|
| 269 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5229 | 16| 0| 16| 0|
|
| 270 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5230 | 16| 0| 16| 0|
|
| 271 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5231 | 16| 0| 16| 0|
|
| 272 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5233 | 16| 0| 16| 0|
|
| 273 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5234 | 16| 0| 16| 0|
|
| 274 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5235 | 16| 0| 16| 0|
|
| 275 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5236 | 16| 0| 16| 0|
|
| 276 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5237 | 16| 0| 16| 0|
|
| 277 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5238 | 16| 0| 16| 0|
|
| 278 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5239 | 16| 0| 16| 0|
|
| 279 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5240 | 16| 0| 16| 0|
|
| 280 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5241 | 16| 0| 16| 0|
|
| 281 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5242 | 16| 0| 16| 0|
|
| 282 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5244 | 16| 0| 16| 0|
|
| 283 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5245 | 16| 0| 16| 0|
|
| 284 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5246 | 16| 0| 16| 0|
|
| 285 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5247 | 16| 0| 16| 0|
|
| 286 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5248 | 16| 0| 16| 0|
|
| 287 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5249 | 16| 0| 16| 0|
|
| 288 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5250 | 16| 0| 16| 0|
|
| 289 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5251 | 16| 0| 16| 0|
|
| 290 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5252 | 16| 0| 16| 0|
|
| 291 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5253 | 16| 0| 16| 0|
|
| 292 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5255 | 16| 0| 16| 0|
|
| 293 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5256 | 16| 0| 16| 0|
|
| 294 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5257 | 16| 0| 16| 0|
|
| 295 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5258 | 16| 0| 16| 0|
|
| 296 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5259 | 16| 0| 16| 0|
|
| 297 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5260 | 16| 0| 16| 0|
|
| 298 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5261 | 16| 0| 16| 0|
|
| 299 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5262 | 16| 0| 16| 0|
|
| 300 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5263 | 16| 0| 16| 0|
|
| 301 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5264 | 16| 0| 16| 0|
|
| 302 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5266 | 16| 0| 16| 0|
|
| 303 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5267 | 16| 0| 16| 0|
|
| 304 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5268 | 16| 0| 16| 0|
|
| 305 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5269 | 16| 0| 16| 0|
|
| 306 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5270 | 16| 0| 16| 0|
|
| 307 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5271 | 16| 0| 16| 0|
|
| 308 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5272 | 16| 0| 16| 0|
|
| 309 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5273 | 16| 0| 16| 0|
|
| 310 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5274 | 16| 0| 16| 0|
|
| 311 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5275 | 16| 0| 16| 0|
|
| 312 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5277 | 16| 0| 16| 0|
|
| 313 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5278 | 16| 0| 16| 0|
|
| 314 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5279 | 16| 0| 16| 0|
|
| 315 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5280 | 16| 0| 16| 0|
|
| 316 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5281 | 16| 0| 16| 0|
|
| 317 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5282 | 16| 0| 16| 0|
|
| 318 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5283 | 16| 0| 16| 0|
|
| 319 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5284 | 16| 0| 16| 0|
|
| 320 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5285 | 16| 0| 16| 0|
|
| 321 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5286 | 16| 0| 16| 0|
|
| 322 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5288 | 16| 0| 16| 0|
|
| 323 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5289 | 16| 0| 16| 0|
|
| 324 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5290 | 16| 0| 16| 0|
|
| 325 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5291 | 16| 0| 16| 0|
|
| 326 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5292 | 16| 0| 16| 0|
|
| 327 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5293 | 16| 0| 16| 0|
|
| 328 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5294 | 16| 0| 16| 0|
|
| 329 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5295 | 16| 0| 16| 0|
|
| 330 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5296 | 16| 0| 16| 0|
|
| 331 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5297 | 16| 0| 16| 0|
|
| 332 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5299 | 16| 0| 16| 0|
|
| 333 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5300 | 16| 0| 16| 0|
|
| 334 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5301 | 16| 0| 16| 0|
|
| 335 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5302 | 16| 0| 16| 0|
|
| 336 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5303 | 16| 0| 16| 0|
|
| 337 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5304 | 16| 0| 16| 0|
|
| 338 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5305 | 16| 0| 16| 0|
|
| 339 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5306 | 16| 0| 16| 0|
|
| 340 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5307 | 16| 0| 16| 0|
|
| 341 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5308 | 16| 0| 16| 0|
|
| 342 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5310 | 16| 0| 16| 0|
|
| 343 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5311 | 16| 0| 16| 0|
|
| 344 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5312 | 16| 0| 16| 0|
|
| 345 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5313 | 16| 0| 16| 0|
|
| 346 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5314 | 16| 0| 16| 0|
|
| 347 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5315 | 16| 0| 16| 0|
|
| 348 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5316 | 16| 0| 16| 0|
|
| 349 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5317 | 16| 0| 16| 0|
|
| 350 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5318 | 16| 0| 16| 0|
|
| 351 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5319 | 16| 0| 16| 0|
|
| 352 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5321 | 16| 0| 16| 0|
|
| 353 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5322 | 16| 0| 16| 0|
|
| 354 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5323 | 16| 0| 16| 0|
|
| 355 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5324 | 16| 0| 16| 0|
|
| 356 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5325 | 16| 0| 16| 0|
|
| 357 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5326 | 16| 0| 16| 0|
|
| 358 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5327 | 16| 0| 16| 0|
|
| 359 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5328 | 16| 0| 16| 0|
|
| 360 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5329 | 16| 0| 16| 0|
|
| 361 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5330 | 16| 0| 16| 0|
|
| 362 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5332 | 16| 0| 16| 0|
|
| 363 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5333 | 16| 0| 16| 0|
|
| 364 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5334 | 16| 0| 16| 0|
|
| 365 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5335 | 16| 0| 16| 0|
|
| 366 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5336 | 16| 0| 16| 0|
|
| 367 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5337 | 16| 0| 16| 0|
|
| 368 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5338 | 16| 0| 16| 0|
|
| 369 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5339 | 16| 0| 16| 0|
|
| 370 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5340 | 16| 0| 16| 0|
|
| 371 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5341 | 16| 0| 16| 0|
|
| 372 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5343 | 16| 0| 16| 0|
|
| 373 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5344 | 16| 0| 16| 0|
|
| 374 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5345 | 16| 0| 16| 0|
|
| 375 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5346 | 16| 0| 16| 0|
|
| 376 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5347 | 16| 0| 16| 0|
|
| 377 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5348 | 16| 0| 16| 0|
|
| 378 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5349 | 16| 0| 16| 0|
|
| 379 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5350 | 16| 0| 16| 0|
|
| 380 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5351 | 16| 0| 16| 0|
|
| 381 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5352 | 16| 0| 16| 0|
|
| 382 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5354 | 16| 0| 16| 0|
|
| 383 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5355 | 16| 0| 16| 0|
|
| 384 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5356 | 16| 0| 16| 0|
|
| 385 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5357 | 16| 0| 16| 0|
|
| 386 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5358 | 16| 0| 16| 0|
|
| 387 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5359 | 16| 0| 16| 0|
|
| 388 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5360 | 16| 0| 16| 0|
|
| 389 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5361 | 16| 0| 16| 0|
|
| 390 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5362 | 16| 0| 16| 0|
|
| 391 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5363 | 16| 0| 16| 0|
|
| 392 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5365 | 16| 0| 16| 0|
|
| 393 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5366 | 16| 0| 16| 0|
|
| 394 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5367 | 16| 0| 16| 0|
|
| 395 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5368 | 16| 0| 16| 0|
|
| 396 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5369 | 16| 0| 16| 0|
|
| 397 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5370 | 16| 0| 16| 0|
|
| 398 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5371 | 16| 0| 16| 0|
|
| 399 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5372 | 16| 0| 16| 0|
|
| 400 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5373 | 16| 0| 16| 0|
|
| 401 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5374 | 16| 0| 16| 0|
|
| 402 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5376 | 16| 0| 16| 0|
|
| 403 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5377 | 16| 0| 16| 0|
|
| 404 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5378 | 16| 0| 16| 0|
|
| 405 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5379 | 16| 0| 16| 0|
|
| 406 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5380 | 16| 0| 16| 0|
|
| 407 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5381 | 16| 0| 16| 0|
|
| 408 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5382 | 16| 0| 16| 0|
|
| 409 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5383 | 16| 0| 16| 0|
|
| 410 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5384 | 16| 0| 16| 0|
|
| 411 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5385 | 16| 0| 16| 0|
|
| 412 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5387 | 16| 0| 16| 0|
|
| 413 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5388 | 16| 0| 16| 0|
|
| 414 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5389 | 16| 0| 16| 0|
|
| 415 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5390 | 16| 0| 16| 0|
|
| 416 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5391 | 16| 0| 16| 0|
|
| 417 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5392 | 16| 0| 16| 0|
|
| 418 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5393 | 16| 0| 16| 0|
|
| 419 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5394 | 16| 0| 16| 0|
|
| 420 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5395 | 16| 0| 16| 0|
|
| 421 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5396 | 16| 0| 16| 0|
|
| 422 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5398 | 16| 0| 16| 0|
|
| 423 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5399 | 16| 0| 16| 0|
|
| 424 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5400 | 16| 0| 16| 0|
|
| 425 |
+
|p_ZZN4nnet24compute_output_buffer_2dINS_5arrayI8ap_fixedILi16ELi6EL9ap_q_mode5EL9_5401 | 16| 0| 16| 0|
|
| 426 |
+
|sX_4 | 32| 0| 32| 0|
|
| 427 |
+
|sY_4 | 32| 0| 32| 0|
|
| 428 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_70 | 16| 0| 16| 0|
|
| 429 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_71 | 16| 0| 16| 0|
|
| 430 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_72 | 16| 0| 16| 0|
|
| 431 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_73 | 16| 0| 16| 0|
|
| 432 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_74 | 16| 0| 16| 0|
|
| 433 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_75 | 16| 0| 16| 0|
|
| 434 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_76 | 16| 0| 16| 0|
|
| 435 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_77 | 16| 0| 16| 0|
|
| 436 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_78 | 16| 0| 16| 0|
|
| 437 |
+
|void_compute_output_buffer_2d_array_const_ap_shift_reg_n_chan_stream_weig_79 | 16| 0| 16| 0|
|
| 438 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 439 |
+
|Total |4742| 0| 4742| 0|
|
| 440 |
+
+------------------------------------------------------------------------------------------+----+----+-----+-----------+
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
================================================================
|
| 445 |
+
== Interface
|
| 446 |
+
================================================================
|
| 447 |
+
* Summary:
|
| 448 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 449 |
+
| RTL Ports | Dir | Bits | Protocol | Source Object | C Type |
|
| 450 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 451 |
+
|ap_clk | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 452 |
+
|ap_rst | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 453 |
+
|ap_start | in| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 454 |
+
|ap_done | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 455 |
+
|ap_idle | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 456 |
+
|ap_ready | out| 1| ap_ctrl_hs| compute_output_buffer_2d<array,array<ap_fixed<42,22,5,3,0>,32u>,config25>| return value|
|
| 457 |
+
|p_read | in| 16| ap_none| p_read| scalar|
|
| 458 |
+
|p_read1 | in| 16| ap_none| p_read1| scalar|
|
| 459 |
+
|p_read2 | in| 16| ap_none| p_read2| scalar|
|
| 460 |
+
|p_read3 | in| 16| ap_none| p_read3| scalar|
|
| 461 |
+
|p_read4 | in| 16| ap_none| p_read4| scalar|
|
| 462 |
+
|p_read5 | in| 16| ap_none| p_read5| scalar|
|
| 463 |
+
|p_read6 | in| 16| ap_none| p_read6| scalar|
|
| 464 |
+
|p_read7 | in| 16| ap_none| p_read7| scalar|
|
| 465 |
+
|p_read8 | in| 16| ap_none| p_read8| scalar|
|
| 466 |
+
|p_read9 | in| 16| ap_none| p_read9| scalar|
|
| 467 |
+
|p_read10 | in| 16| ap_none| p_read10| scalar|
|
| 468 |
+
|p_read11 | in| 16| ap_none| p_read11| scalar|
|
| 469 |
+
|p_read12 | in| 16| ap_none| p_read12| scalar|
|
| 470 |
+
|p_read13 | in| 16| ap_none| p_read13| scalar|
|
| 471 |
+
|p_read14 | in| 16| ap_none| p_read14| scalar|
|
| 472 |
+
|p_read15 | in| 16| ap_none| p_read15| scalar|
|
| 473 |
+
|p_read16 | in| 16| ap_none| p_read16| scalar|
|
| 474 |
+
|p_read17 | in| 16| ap_none| p_read17| scalar|
|
| 475 |
+
|p_read18 | in| 16| ap_none| p_read18| scalar|
|
| 476 |
+
|p_read19 | in| 16| ap_none| p_read19| scalar|
|
| 477 |
+
|p_read20 | in| 16| ap_none| p_read20| scalar|
|
| 478 |
+
|p_read21 | in| 16| ap_none| p_read21| scalar|
|
| 479 |
+
|p_read22 | in| 16| ap_none| p_read22| scalar|
|
| 480 |
+
|p_read23 | in| 16| ap_none| p_read23| scalar|
|
| 481 |
+
|p_read24 | in| 16| ap_none| p_read24| scalar|
|
| 482 |
+
|p_read25 | in| 16| ap_none| p_read25| scalar|
|
| 483 |
+
|p_read26 | in| 16| ap_none| p_read26| scalar|
|
| 484 |
+
|p_read27 | in| 16| ap_none| p_read27| scalar|
|
| 485 |
+
|p_read28 | in| 16| ap_none| p_read28| scalar|
|
| 486 |
+
|p_read29 | in| 16| ap_none| p_read29| scalar|
|
| 487 |
+
|p_read30 | in| 16| ap_none| p_read30| scalar|
|
| 488 |
+
|p_read31 | in| 16| ap_none| p_read31| scalar|
|
| 489 |
+
|layer25_out_din | out| 1344| ap_fifo| layer25_out| pointer|
|
| 490 |
+
|layer25_out_num_data_valid | in| 9| ap_fifo| layer25_out| pointer|
|
| 491 |
+
|layer25_out_fifo_cap | in| 9| ap_fifo| layer25_out| pointer|
|
| 492 |
+
|layer25_out_full_n | in| 1| ap_fifo| layer25_out| pointer|
|
| 493 |
+
|layer25_out_write | out| 1| ap_fifo| layer25_out| pointer|
|
| 494 |
+
+----------------------------+-----+------+------------+---------------------------------------------------------------------------+--------------+
|
| 495 |
+
|
myproject_prj/solution1/syn/report/compute_output_buffer_2d_array_array_ap_fixed_43_23_5_3_0_32u_config23_s_csynth.rpt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
myproject_prj/solution1/syn/report/concatenate3d_2_array_array_array_ap_fixed_16_6_5_3_0_24u_config34_s_csynth.xml
ADDED
|
@@ -0,0 +1,312 @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amily>
|
| 10 |
+
<Part>xcvu47p-fsvh2892-2L-e</Part>
|
| 11 |
+
<TopModelName>concatenate3d_2_array_array_array_ap_fixed_16_6_5_3_0_24u_config34_s</TopModelName>
|
| 12 |
+
<TargetClockPeriod>4.00</TargetClockPeriod>
|
| 13 |
+
<ClockUncertainty>1.35</ClockUncertainty>
|
| 14 |
+
<FlowTarget>vivado</FlowTarget>
|
| 15 |
+
</UserAssignments>
|
| 16 |
+
|
| 17 |
+
<PerformanceEstimates>
|
| 18 |
+
<PipelineType>loop auto-rewind stp(delay=0 clock cycles(s))</PipelineType>
|
| 19 |
+
<SummaryOfTimingAnalysis>
|
| 20 |
+
<unit>ns</unit>
|
| 21 |
+
<EstimatedClockPeriod>2.460</EstimatedClockPeriod>
|
| 22 |
+
</SummaryOfTimingAnalysis>
|
| 23 |
+
<SummaryOfOverallLatency>
|
| 24 |
+
<unit>clock cycles</unit>
|
| 25 |
+
<Best-caseLatency>4098</Best-caseLatency>
|
| 26 |
+
<Average-caseLatency>4098</Average-caseLatency>
|
| 27 |
+
<Worst-caseLatency>4098</Worst-caseLatency>
|
| 28 |
+
<Best-caseRealTimeLatency>16.392 us</Best-caseRealTimeLatency>
|
| 29 |
+
<Average-caseRealTimeLatency>16.392 us</Average-caseRealTimeLatency>
|
| 30 |
+
<Worst-caseRealTimeLatency>16.392 us</Worst-caseRealTimeLatency>
|
| 31 |
+
<Interval-min>4097</Interval-min>
|
| 32 |
+
<Interval-max>4097</Interval-max>
|
| 33 |
+
</SummaryOfOverallLatency>
|
| 34 |
+
<SummaryOfLoopLatency>
|
| 35 |
+
<ConcatLoopHeight_ConcatLoopWidth>
|
| 36 |
+
<Slack>2.65</Slack>
|
| 37 |
+
<TripCount>4096</TripCount>
|
| 38 |
+
<Latency>4096</Latency>
|
| 39 |
+
<AbsoluteTimeLatency>16384</AbsoluteTimeLatency>
|
| 40 |
+
<PipelineII>1</PipelineII>
|
| 41 |
+
<PipelineDepth>2</PipelineDepth>
|
| 42 |
+
<InstanceList>
|
| 43 |
+
</InstanceList>
|
| 44 |
+
</ConcatLoopHeight_ConcatLoopWidth>
|
| 45 |
+
</SummaryOfLoopLatency>
|
| 46 |
+
<SummaryOfViolations>
|
| 47 |
+
<IssueType>-</IssueType>
|
| 48 |
+
<ViolationType>-</ViolationType>
|
| 49 |
+
<SourceLocation>firmware/nnet_utils/nnet_merge_stream.h:234</SourceLocation>
|
| 50 |
+
<SummaryOfLoopViolations>
|
| 51 |
+
<ConcatLoopHeight_ConcatLoopWidth>
|
| 52 |
+
<Name>ConcatLoopHeight_ConcatLoopWidth</Name>
|
| 53 |
+
<IssueType>-</IssueType>
|
| 54 |
+
<ViolationType>-</ViolationType>
|
| 55 |
+
<SourceLocation>firmware/nnet_utils/nnet_merge_stream.h:234</SourceLocation>
|
| 56 |
+
</ConcatLoopHeight_ConcatLoopWidth>
|
| 57 |
+
</SummaryOfLoopViolations>
|
| 58 |
+
</SummaryOfViolations>
|
| 59 |
+
</PerformanceEstimates>
|
| 60 |
+
|
| 61 |
+
<AreaEstimates>
|
| 62 |
+
<Resources>
|
| 63 |
+
<FF>16</FF>
|
| 64 |
+
<LUT>110</LUT>
|
| 65 |
+
<BRAM_18K>0</BRAM_18K>
|
| 66 |
+
<DSP>0</DSP>
|
| 67 |
+
<URAM>0</URAM>
|
| 68 |
+
</Resources>
|
| 69 |
+
<AvailableResources>
|
| 70 |
+
<BRAM_18K>4032</BRAM_18K>
|
| 71 |
+
<DSP>9024</DSP>
|
| 72 |
+
<FF>2607360</FF>
|
| 73 |
+
<LUT>1303680</LUT>
|
| 74 |
+
<URAM>960</URAM>
|
| 75 |
+
</AvailableResources>
|
| 76 |
+
</AreaEstimates>
|
| 77 |
+
|
| 78 |
+
<InterfaceSummary>
|
| 79 |
+
<RtlPorts>
|
| 80 |
+
<name>ap_clk</name>
|
| 81 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 82 |
+
<Type>return value</Type>
|
| 83 |
+
<Scope></Scope>
|
| 84 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 85 |
+
<IOConfig></IOConfig>
|
| 86 |
+
<Dir>in</Dir>
|
| 87 |
+
<Bits>1</Bits>
|
| 88 |
+
<Attribute>control</Attribute>
|
| 89 |
+
</RtlPorts>
|
| 90 |
+
<RtlPorts>
|
| 91 |
+
<name>ap_rst</name>
|
| 92 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 93 |
+
<Type>return value</Type>
|
| 94 |
+
<Scope></Scope>
|
| 95 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 96 |
+
<IOConfig></IOConfig>
|
| 97 |
+
<Dir>in</Dir>
|
| 98 |
+
<Bits>1</Bits>
|
| 99 |
+
<Attribute>control</Attribute>
|
| 100 |
+
</RtlPorts>
|
| 101 |
+
<RtlPorts>
|
| 102 |
+
<name>ap_start</name>
|
| 103 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 104 |
+
<Type>return value</Type>
|
| 105 |
+
<Scope></Scope>
|
| 106 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 107 |
+
<IOConfig></IOConfig>
|
| 108 |
+
<Dir>in</Dir>
|
| 109 |
+
<Bits>1</Bits>
|
| 110 |
+
<Attribute>control</Attribute>
|
| 111 |
+
</RtlPorts>
|
| 112 |
+
<RtlPorts>
|
| 113 |
+
<name>ap_done</name>
|
| 114 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 115 |
+
<Type>return value</Type>
|
| 116 |
+
<Scope></Scope>
|
| 117 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 118 |
+
<IOConfig></IOConfig>
|
| 119 |
+
<Dir>out</Dir>
|
| 120 |
+
<Bits>1</Bits>
|
| 121 |
+
<Attribute>control</Attribute>
|
| 122 |
+
</RtlPorts>
|
| 123 |
+
<RtlPorts>
|
| 124 |
+
<name>ap_idle</name>
|
| 125 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 126 |
+
<Type>return value</Type>
|
| 127 |
+
<Scope></Scope>
|
| 128 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 129 |
+
<IOConfig></IOConfig>
|
| 130 |
+
<Dir>out</Dir>
|
| 131 |
+
<Bits>1</Bits>
|
| 132 |
+
<Attribute>control</Attribute>
|
| 133 |
+
</RtlPorts>
|
| 134 |
+
<RtlPorts>
|
| 135 |
+
<name>ap_ready</name>
|
| 136 |
+
<Object>concatenate3d_2<array,array,array<ap_fixed<16,6,5,3,0>,24u>,config34></Object>
|
| 137 |
+
<Type>return value</Type>
|
| 138 |
+
<Scope></Scope>
|
| 139 |
+
<IOProtocol>ap_ctrl_hs</IOProtocol>
|
| 140 |
+
<IOConfig></IOConfig>
|
| 141 |
+
<Dir>out</Dir>
|
| 142 |
+
<Bits>1</Bits>
|
| 143 |
+
<Attribute>control</Attribute>
|
| 144 |
+
</RtlPorts>
|
| 145 |
+
<RtlPorts>
|
| 146 |
+
<name>layer33_out_dout</name>
|
| 147 |
+
<Object>layer33_out</Object>
|
| 148 |
+
<Type>pointer</Type>
|
| 149 |
+
<Scope></Scope>
|
| 150 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 151 |
+
<IOConfig></IOConfig>
|
| 152 |
+
<Dir>in</Dir>
|
| 153 |
+
<Bits>256</Bits>
|
| 154 |
+
<Attribute>control</Attribute>
|
| 155 |
+
</RtlPorts>
|
| 156 |
+
<RtlPorts>
|
| 157 |
+
<name>layer33_out_num_data_valid</name>
|
| 158 |
+
<Object>layer33_out</Object>
|
| 159 |
+
<Type>pointer</Type>
|
| 160 |
+
<Scope></Scope>
|
| 161 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 162 |
+
<IOConfig></IOConfig>
|
| 163 |
+
<Dir>in</Dir>
|
| 164 |
+
<Bits>13</Bits>
|
| 165 |
+
<Attribute>control</Attribute>
|
| 166 |
+
</RtlPorts>
|
| 167 |
+
<RtlPorts>
|
| 168 |
+
<name>layer33_out_fifo_cap</name>
|
| 169 |
+
<Object>layer33_out</Object>
|
| 170 |
+
<Type>pointer</Type>
|
| 171 |
+
<Scope></Scope>
|
| 172 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 173 |
+
<IOConfig></IOConfig>
|
| 174 |
+
<Dir>in</Dir>
|
| 175 |
+
<Bits>13</Bits>
|
| 176 |
+
<Attribute>unknown</Attribute>
|
| 177 |
+
</RtlPorts>
|
| 178 |
+
<RtlPorts>
|
| 179 |
+
<name>layer33_out_empty_n</name>
|
| 180 |
+
<Object>layer33_out</Object>
|
| 181 |
+
<Type>pointer</Type>
|
| 182 |
+
<Scope></Scope>
|
| 183 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 184 |
+
<IOConfig></IOConfig>
|
| 185 |
+
<Dir>in</Dir>
|
| 186 |
+
<Bits>1</Bits>
|
| 187 |
+
<Attribute>control</Attribute>
|
| 188 |
+
</RtlPorts>
|
| 189 |
+
<RtlPorts>
|
| 190 |
+
<name>layer33_out_read</name>
|
| 191 |
+
<Object>layer33_out</Object>
|
| 192 |
+
<Type>pointer</Type>
|
| 193 |
+
<Scope></Scope>
|
| 194 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 195 |
+
<IOConfig></IOConfig>
|
| 196 |
+
<Dir>out</Dir>
|
| 197 |
+
<Bits>1</Bits>
|
| 198 |
+
<Attribute>control</Attribute>
|
| 199 |
+
</RtlPorts>
|
| 200 |
+
<RtlPorts>
|
| 201 |
+
<name>layer41_cpy2_dout</name>
|
| 202 |
+
<Object>layer41_cpy2</Object>
|
| 203 |
+
<Type>pointer</Type>
|
| 204 |
+
<Scope></Scope>
|
| 205 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 206 |
+
<IOConfig></IOConfig>
|
| 207 |
+
<Dir>in</Dir>
|
| 208 |
+
<Bits>128</Bits>
|
| 209 |
+
<Attribute>control</Attribute>
|
| 210 |
+
</RtlPorts>
|
| 211 |
+
<RtlPorts>
|
| 212 |
+
<name>layer41_cpy2_num_data_valid</name>
|
| 213 |
+
<Object>layer41_cpy2</Object>
|
| 214 |
+
<Type>pointer</Type>
|
| 215 |
+
<Scope></Scope>
|
| 216 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 217 |
+
<IOConfig></IOConfig>
|
| 218 |
+
<Dir>in</Dir>
|
| 219 |
+
<Bits>13</Bits>
|
| 220 |
+
<Attribute>control</Attribute>
|
| 221 |
+
</RtlPorts>
|
| 222 |
+
<RtlPorts>
|
| 223 |
+
<name>layer41_cpy2_fifo_cap</name>
|
| 224 |
+
<Object>layer41_cpy2</Object>
|
| 225 |
+
<Type>pointer</Type>
|
| 226 |
+
<Scope></Scope>
|
| 227 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 228 |
+
<IOConfig></IOConfig>
|
| 229 |
+
<Dir>in</Dir>
|
| 230 |
+
<Bits>13</Bits>
|
| 231 |
+
<Attribute>unknown</Attribute>
|
| 232 |
+
</RtlPorts>
|
| 233 |
+
<RtlPorts>
|
| 234 |
+
<name>layer41_cpy2_empty_n</name>
|
| 235 |
+
<Object>layer41_cpy2</Object>
|
| 236 |
+
<Type>pointer</Type>
|
| 237 |
+
<Scope></Scope>
|
| 238 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 239 |
+
<IOConfig></IOConfig>
|
| 240 |
+
<Dir>in</Dir>
|
| 241 |
+
<Bits>1</Bits>
|
| 242 |
+
<Attribute>control</Attribute>
|
| 243 |
+
</RtlPorts>
|
| 244 |
+
<RtlPorts>
|
| 245 |
+
<name>layer41_cpy2_read</name>
|
| 246 |
+
<Object>layer41_cpy2</Object>
|
| 247 |
+
<Type>pointer</Type>
|
| 248 |
+
<Scope></Scope>
|
| 249 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 250 |
+
<IOConfig></IOConfig>
|
| 251 |
+
<Dir>out</Dir>
|
| 252 |
+
<Bits>1</Bits>
|
| 253 |
+
<Attribute>control</Attribute>
|
| 254 |
+
</RtlPorts>
|
| 255 |
+
<RtlPorts>
|
| 256 |
+
<name>layer34_out_din</name>
|
| 257 |
+
<Object>layer34_out</Object>
|
| 258 |
+
<Type>pointer</Type>
|
| 259 |
+
<Scope></Scope>
|
| 260 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 261 |
+
<IOConfig></IOConfig>
|
| 262 |
+
<Dir>out</Dir>
|
| 263 |
+
<Bits>384</Bits>
|
| 264 |
+
<Attribute>control</Attribute>
|
| 265 |
+
</RtlPorts>
|
| 266 |
+
<RtlPorts>
|
| 267 |
+
<name>layer34_out_num_data_valid</name>
|
| 268 |
+
<Object>layer34_out</Object>
|
| 269 |
+
<Type>pointer</Type>
|
| 270 |
+
<Scope></Scope>
|
| 271 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 272 |
+
<IOConfig></IOConfig>
|
| 273 |
+
<Dir>in</Dir>
|
| 274 |
+
<Bits>13</Bits>
|
| 275 |
+
<Attribute>control</Attribute>
|
| 276 |
+
</RtlPorts>
|
| 277 |
+
<RtlPorts>
|
| 278 |
+
<name>layer34_out_fifo_cap</name>
|
| 279 |
+
<Object>layer34_out</Object>
|
| 280 |
+
<Type>pointer</Type>
|
| 281 |
+
<Scope></Scope>
|
| 282 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 283 |
+
<IOConfig></IOConfig>
|
| 284 |
+
<Dir>in</Dir>
|
| 285 |
+
<Bits>13</Bits>
|
| 286 |
+
<Attribute>unknown</Attribute>
|
| 287 |
+
</RtlPorts>
|
| 288 |
+
<RtlPorts>
|
| 289 |
+
<name>layer34_out_full_n</name>
|
| 290 |
+
<Object>layer34_out</Object>
|
| 291 |
+
<Type>pointer</Type>
|
| 292 |
+
<Scope></Scope>
|
| 293 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 294 |
+
<IOConfig></IOConfig>
|
| 295 |
+
<Dir>in</Dir>
|
| 296 |
+
<Bits>1</Bits>
|
| 297 |
+
<Attribute>control</Attribute>
|
| 298 |
+
</RtlPorts>
|
| 299 |
+
<RtlPorts>
|
| 300 |
+
<name>layer34_out_write</name>
|
| 301 |
+
<Object>layer34_out</Object>
|
| 302 |
+
<Type>pointer</Type>
|
| 303 |
+
<Scope></Scope>
|
| 304 |
+
<IOProtocol>ap_fifo</IOProtocol>
|
| 305 |
+
<IOConfig></IOConfig>
|
| 306 |
+
<Dir>out</Dir>
|
| 307 |
+
<Bits>1</Bits>
|
| 308 |
+
<Attribute>control</Attribute>
|
| 309 |
+
</RtlPorts>
|
| 310 |
+
</InterfaceSummary>
|
| 311 |
+
|
| 312 |
+
</profile>
|