da4ml 0.5.0__cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. da4ml/__init__.py +4 -0
  2. da4ml/_binary/__init__.py +15 -0
  3. da4ml/_binary/dais_bin.cpython-312-x86_64-linux-gnu.so +0 -0
  4. da4ml/_binary/dais_bin.pyi +5 -0
  5. da4ml/_cli/__init__.py +30 -0
  6. da4ml/_cli/convert.py +194 -0
  7. da4ml/_cli/report.py +295 -0
  8. da4ml/_version.py +32 -0
  9. da4ml/cmvm/__init__.py +4 -0
  10. da4ml/cmvm/api.py +264 -0
  11. da4ml/cmvm/core/__init__.py +221 -0
  12. da4ml/cmvm/core/indexers.py +83 -0
  13. da4ml/cmvm/core/state_opr.py +284 -0
  14. da4ml/cmvm/types.py +739 -0
  15. da4ml/cmvm/util/__init__.py +7 -0
  16. da4ml/cmvm/util/bit_decompose.py +86 -0
  17. da4ml/cmvm/util/mat_decompose.py +121 -0
  18. da4ml/codegen/__init__.py +9 -0
  19. da4ml/codegen/hls/__init__.py +4 -0
  20. da4ml/codegen/hls/hls_codegen.py +196 -0
  21. da4ml/codegen/hls/hls_model.py +255 -0
  22. da4ml/codegen/hls/source/ap_types/ap_binary.h +78 -0
  23. da4ml/codegen/hls/source/ap_types/ap_common.h +376 -0
  24. da4ml/codegen/hls/source/ap_types/ap_decl.h +212 -0
  25. da4ml/codegen/hls/source/ap_types/ap_fixed.h +360 -0
  26. da4ml/codegen/hls/source/ap_types/ap_fixed_base.h +2354 -0
  27. da4ml/codegen/hls/source/ap_types/ap_fixed_ref.h +718 -0
  28. da4ml/codegen/hls/source/ap_types/ap_fixed_special.h +230 -0
  29. da4ml/codegen/hls/source/ap_types/ap_int.h +330 -0
  30. da4ml/codegen/hls/source/ap_types/ap_int_base.h +1885 -0
  31. da4ml/codegen/hls/source/ap_types/ap_int_ref.h +1346 -0
  32. da4ml/codegen/hls/source/ap_types/ap_int_special.h +223 -0
  33. da4ml/codegen/hls/source/ap_types/ap_shift_reg.h +138 -0
  34. da4ml/codegen/hls/source/ap_types/etc/ap_private.h +7199 -0
  35. da4ml/codegen/hls/source/ap_types/hls_math.h +27 -0
  36. da4ml/codegen/hls/source/ap_types/hls_stream.h +263 -0
  37. da4ml/codegen/hls/source/ap_types/utils/x_hls_utils.h +80 -0
  38. da4ml/codegen/hls/source/binder_util.hh +71 -0
  39. da4ml/codegen/hls/source/build_binder.mk +22 -0
  40. da4ml/codegen/hls/source/vitis_bitshift.hh +32 -0
  41. da4ml/codegen/rtl/__init__.py +15 -0
  42. da4ml/codegen/rtl/common_source/binder_util.hh +99 -0
  43. da4ml/codegen/rtl/common_source/build_binder.mk +34 -0
  44. da4ml/codegen/rtl/common_source/build_quartus_prj.tcl +104 -0
  45. da4ml/codegen/rtl/common_source/build_vivado_prj.tcl +111 -0
  46. da4ml/codegen/rtl/common_source/ioutil.hh +124 -0
  47. da4ml/codegen/rtl/common_source/template.sdc +27 -0
  48. da4ml/codegen/rtl/common_source/template.xdc +30 -0
  49. da4ml/codegen/rtl/rtl_model.py +486 -0
  50. da4ml/codegen/rtl/verilog/__init__.py +10 -0
  51. da4ml/codegen/rtl/verilog/comb.py +239 -0
  52. da4ml/codegen/rtl/verilog/io_wrapper.py +113 -0
  53. da4ml/codegen/rtl/verilog/pipeline.py +67 -0
  54. da4ml/codegen/rtl/verilog/source/lookup_table.v +27 -0
  55. da4ml/codegen/rtl/verilog/source/multiplier.v +37 -0
  56. da4ml/codegen/rtl/verilog/source/mux.v +58 -0
  57. da4ml/codegen/rtl/verilog/source/negative.v +31 -0
  58. da4ml/codegen/rtl/verilog/source/shift_adder.v +59 -0
  59. da4ml/codegen/rtl/vhdl/__init__.py +9 -0
  60. da4ml/codegen/rtl/vhdl/comb.py +206 -0
  61. da4ml/codegen/rtl/vhdl/io_wrapper.py +120 -0
  62. da4ml/codegen/rtl/vhdl/pipeline.py +71 -0
  63. da4ml/codegen/rtl/vhdl/source/lookup_table.vhd +52 -0
  64. da4ml/codegen/rtl/vhdl/source/multiplier.vhd +40 -0
  65. da4ml/codegen/rtl/vhdl/source/mux.vhd +102 -0
  66. da4ml/codegen/rtl/vhdl/source/negative.vhd +35 -0
  67. da4ml/codegen/rtl/vhdl/source/shift_adder.vhd +101 -0
  68. da4ml/converter/__init__.py +63 -0
  69. da4ml/converter/hgq2/__init__.py +3 -0
  70. da4ml/converter/hgq2/layers/__init__.py +11 -0
  71. da4ml/converter/hgq2/layers/_base.py +132 -0
  72. da4ml/converter/hgq2/layers/activation.py +81 -0
  73. da4ml/converter/hgq2/layers/attn.py +148 -0
  74. da4ml/converter/hgq2/layers/batchnorm.py +15 -0
  75. da4ml/converter/hgq2/layers/conv.py +149 -0
  76. da4ml/converter/hgq2/layers/dense.py +39 -0
  77. da4ml/converter/hgq2/layers/ops.py +240 -0
  78. da4ml/converter/hgq2/layers/pool.py +107 -0
  79. da4ml/converter/hgq2/layers/table.py +176 -0
  80. da4ml/converter/hgq2/parser.py +161 -0
  81. da4ml/trace/__init__.py +6 -0
  82. da4ml/trace/fixed_variable.py +965 -0
  83. da4ml/trace/fixed_variable_array.py +600 -0
  84. da4ml/trace/ops/__init__.py +13 -0
  85. da4ml/trace/ops/einsum_utils.py +305 -0
  86. da4ml/trace/ops/quantization.py +74 -0
  87. da4ml/trace/ops/reduce_utils.py +105 -0
  88. da4ml/trace/pipeline.py +181 -0
  89. da4ml/trace/tracer.py +186 -0
  90. da4ml/typing/__init__.py +3 -0
  91. da4ml-0.5.0.dist-info/METADATA +85 -0
  92. da4ml-0.5.0.dist-info/RECORD +96 -0
  93. da4ml-0.5.0.dist-info/WHEEL +6 -0
  94. da4ml-0.5.0.dist-info/entry_points.txt +3 -0
  95. da4ml-0.5.0.dist-info/sboms/auditwheel.cdx.json +1 -0
  96. da4ml.libs/libgomp-e985bcbb.so.1.0.0 +0 -0
@@ -0,0 +1,360 @@
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 -*-