assign_constructor.cpp revision 12855:588919e0e4aa
1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  assign_constructor.cpp --
23
24  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38// This may look like C code, but it is really -*- C++ -*-
39//
40// assign_constructor.cxx --
41// Copyright Synopsys 1998
42// Author          : Ric Hilderink
43// Created On      : Wed Dec 30 09:47:21 1998
44// Status          : none
45//
46
47#include <limits.h>
48#include <float.h>
49
50#define SC_INCLUDE_FX
51#define SC_FXVAL_IMPLICIT_CONV
52#include "systemc.h"
53#include "fx_precision_double.h"
54
55typedef unsigned int   uint;
56typedef unsigned short ushort;
57typedef unsigned long  ulong;
58
59#define SHOW_ASSIGN_CONSTRUCTORS(a) cerr << #a << " : " << double(a) << " : " << a.to_string(SC_HEX) << "\n"
60#define IDENT_ASSIGN_CONSTRUCTORS(a) cerr << "--assign_constructor-Inf-Inf-Inf-Inf-Inf- " << a << "\n"
61
62//----------------------------------------------------------------
63// copy-initialisation from builtin types no longer works with
64// sc_fxval_fast, unless SC_FXVAL_IMPLICIT_CONV is defined.
65#if defined(SC_FXVAL_IMPLICIT_CONV)
66static void test_fx_float_int()
67{
68  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_int");
69
70  sc_fxval a = 0;
71  sc_fxval b = 1;
72  sc_fxval c = -1;
73  sc_fxval d = INT_MAX;
74  sc_fxval e = INT_MIN;
75
76  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
77}
78
79static void test_fx_float_uint()
80{
81  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_uint");
82
83  sc_fxval a = (uint)0;
84  sc_fxval b = (uint)1;
85  sc_fxval c = (uint)-1;
86  sc_fxval d = UINT_MAX;
87  sc_fxval e = (uint)abs(INT_MIN);
88
89  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
90}
91
92static void test_fx_float_short()
93{
94  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_short");
95
96  sc_fxval a = (short)0;
97  sc_fxval b = (short)1;
98  sc_fxval c = (short)-1;
99  sc_fxval d = SHRT_MAX;
100  sc_fxval e = SHRT_MIN;
101
102  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
103}
104
105static void test_fx_float_ushort()
106{
107  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_ushort");
108
109  sc_fxval a = (ushort)0;
110  sc_fxval b = (ushort)1;
111  sc_fxval c = (ushort)-1;
112  sc_fxval d = USHRT_MAX;
113  sc_fxval e = (ushort)abs(SHRT_MIN);
114
115  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
116}
117
118static void test_fx_float_long()
119{
120  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_long");
121
122  sc_fxval a = (long)0;
123  sc_fxval b = (long)1;
124  sc_fxval c = (long)-1;
125  sc_fxval d = LONG_MAX;
126  sc_fxval e = LONG_MIN;
127
128  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
129}
130
131static void test_fx_float_ulong()
132{
133  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_ulong");
134
135  sc_fxval a = (ulong)0;
136  sc_fxval b = (ulong)1;
137  sc_fxval c = (ulong)-1;
138  sc_fxval d = ULONG_MAX;
139  sc_fxval e = (ulong)abs(LONG_MIN);
140
141  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
142}
143
144static void test_fx_float_float()
145{
146  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_float");
147
148  sc_fxval a = 0.0;
149  sc_fxval b = 1.0;
150  sc_fxval c = -1.0;
151  sc_fxval d = FLT_MAX;
152  sc_fxval e = FLT_MIN;
153
154  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
155}
156
157static void test_fx_float_double()
158{
159  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_double");
160
161  sc_fxval a = (double)0.0;
162  sc_fxval b = (double)1.0;
163  sc_fxval c = (double)-1.0;
164  sc_fxval d = DBL_MAX;
165  sc_fxval e = DBL_MIN;
166
167  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
168}
169
170#endif // defined(SC_FXVAL_IMPLICIT_CONV)
171
172//----------------------------------------------------------------
173static void test_fx_ufix_int()
174{
175  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_int");
176
177  sc_ufix a = 0;
178  sc_ufix b = 1;
179  sc_ufix c = -1;
180  sc_ufix d = INT_MAX;
181  sc_ufix e = INT_MIN;
182
183  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
184}
185
186static void test_fx_ufix_uint()
187{
188  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_uint");
189
190  sc_ufix a = (uint)0;
191  sc_ufix b = (uint)1;
192  sc_ufix c = (uint)-1;
193  sc_ufix d = UINT_MAX;
194  sc_ufix e = (uint)abs(INT_MIN);
195
196  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
197}
198
199static void test_fx_ufix_short()
200{
201  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_short");
202
203  sc_ufix a = (short)0;
204  sc_ufix b = (short)1;
205  sc_ufix c = (short)-1;
206  sc_ufix d = SHRT_MAX;
207  sc_ufix e = SHRT_MIN;
208
209  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
210}
211
212static void test_fx_ufix_ushort()
213{
214  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_ushort");
215
216  sc_ufix a = (ushort)0;
217  sc_ufix b = (ushort)1;
218  sc_ufix c = (ushort)-1;
219  sc_ufix d = USHRT_MAX;
220  sc_ufix e = (ushort)abs(SHRT_MIN);
221
222  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
223}
224
225static void test_fx_ufix_long()
226{
227  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_long");
228
229  sc_ufix a = (long)0;
230  sc_ufix b = (long)1;
231  sc_ufix c = (long)-1;
232  sc_ufix d = LONG_MAX;
233  sc_ufix e = LONG_MIN;
234
235  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
236}
237
238static void test_fx_ufix_ulong()
239{
240  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_ulong");
241
242  sc_ufix a = (ulong)0;
243  sc_ufix b = (ulong)1;
244  sc_ufix c = (ulong)-1;
245  sc_ufix d = ULONG_MAX;
246  sc_ufix e = (ulong)abs(LONG_MIN);
247
248  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
249}
250
251static void test_fx_ufix_float()
252{
253  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_float");
254
255  sc_ufix a = 0.0;
256  sc_ufix b = 1.0;
257  sc_ufix c = -1.0;
258   sc_ufix d = FLT_MAX;
259   sc_ufix e = FLT_MIN;
260
261  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
262}
263
264static void test_fx_ufix_double()
265{
266  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_double");
267
268  sc_ufix a = (double)0.0;
269  sc_ufix b = (double)1.0;
270  sc_ufix c = (double)-1.0;
271   sc_ufix d = DBL_MAX;
272   sc_ufix e = DBL_MIN;
273
274  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
275}
276
277//----------------------------------------------------------------
278static void test_fx_fix_int()
279{
280  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_int");
281
282  sc_fix a = 0;
283  sc_fix b = 1;
284  sc_fix c = -1;
285  sc_fix d = INT_MAX;
286  sc_fix e = INT_MIN;
287
288  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
289}
290
291static void test_fx_fix_uint()
292{
293  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_uint");
294
295  sc_fix a = (uint)0;
296  sc_fix b = (uint)1;
297  sc_fix c = (uint)-1;
298  sc_fix d = UINT_MAX;
299  sc_fix e = (uint)abs(INT_MIN);
300
301  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
302}
303
304static void test_fx_fix_short()
305{
306  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_short");
307
308  sc_fix a = (short)0;
309  sc_fix b = (short)1;
310  sc_fix c = (short)-1;
311  sc_fix d = SHRT_MAX;
312  sc_fix e = SHRT_MIN;
313
314  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
315}
316
317static void test_fx_fix_ushort()
318{
319  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_ushort");
320
321  sc_fix a = (ushort)0;
322  sc_fix b = (ushort)1;
323  sc_fix c = (ushort)-1;
324  sc_fix d = USHRT_MAX;
325  sc_fix e = (ushort)abs(SHRT_MIN);
326
327  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
328}
329
330static void test_fx_fix_long()
331{
332  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_long");
333
334  sc_fix a = (long)0;
335  sc_fix b = (long)1;
336  sc_fix c = (long)-1;
337  sc_fix d = LONG_MAX;
338  sc_fix e = LONG_MIN;
339
340  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
341}
342
343static void test_fx_fix_ulong()
344{
345  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_ulong");
346
347  sc_fix a = (ulong)0;
348  sc_fix b = (ulong)1;
349  sc_fix c = (ulong)-1;
350  sc_fix d = ULONG_MAX;
351  sc_fix e = (ulong)abs(LONG_MIN);
352
353  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
354}
355
356static void test_fx_fix_float()
357{
358  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_float");
359
360  sc_fix a = 0.0;
361  sc_fix b = 1.0;
362  sc_fix c = -1.0;
363   sc_fix d = FLT_MAX;
364   sc_fix e = FLT_MIN;
365
366  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
367}
368
369static void test_fx_fix_double()
370{
371  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_double");
372
373  sc_fix a = (double)0.0;
374  sc_fix b = (double)1.0;
375  sc_fix c = (double)-1.0;
376   sc_fix d = DBL_MAX;
377   sc_fix e = DBL_MIN;
378
379  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
380}
381
382//----------------------------------------------------------------
383static void test_fx_fixed_int()
384{
385  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_int");
386
387  sc_fixed<8, 5> a = 0;
388  sc_fixed<8, 5> b = 1;
389  sc_fixed<8, 5> c = -1;
390   sc_fixed<8, 5> d = INT_MAX;
391   sc_fixed<8, 5> e = INT_MIN;
392
393  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
394}
395
396static void test_fx_fixed_uint()
397{
398  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_uint");
399
400  sc_fixed<8, 5> a = (uint)0;
401  sc_fixed<8, 5> b = (uint)1;
402   sc_fixed<8, 5> c = (uint)-1;
403   sc_fixed<8, 5> d = UINT_MAX;
404   sc_fixed<8, 5> e = (uint)abs(INT_MIN);
405
406  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
407}
408
409static void test_fx_fixed_short()
410{
411  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_short");
412
413  sc_fixed<8, 5> a = (short)0;
414  sc_fixed<8, 5> b = (short)1;
415  sc_fixed<8, 5> c = (short)-1;
416   sc_fixed<8, 5> d = SHRT_MAX;
417   sc_fixed<8, 5> e = SHRT_MIN;
418
419  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
420}
421
422static void test_fx_fixed_ushort()
423{
424  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_ushort");
425
426  sc_fixed<8, 5> a = (ushort)0;
427  sc_fixed<8, 5> b = (ushort)1;
428   sc_fixed<8, 5> c = (ushort)-1;
429   sc_fixed<8, 5> d = USHRT_MAX;
430   sc_fixed<8, 5> e = (ushort)abs(SHRT_MIN);
431
432  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
433}
434
435static void test_fx_fixed_long()
436{
437  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_long");
438
439  sc_fixed<8, 5> a = (long)0;
440  sc_fixed<8, 5> b = (long)1;
441  sc_fixed<8, 5> c = (long)-1;
442   sc_fixed<8, 5> d = LONG_MAX;
443   sc_fixed<8, 5> e = LONG_MIN;
444
445  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
446}
447
448static void test_fx_fixed_ulong()
449{
450  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_ulong");
451
452  sc_fixed<8, 5> a = (ulong)0;
453  sc_fixed<8, 5> b = (ulong)1;
454   sc_fixed<8, 5> c = (ulong)-1;
455   sc_fixed<8, 5> d = ULONG_MAX;
456   sc_fixed<8, 5> e = (ulong)abs(LONG_MIN);
457
458  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
459}
460
461static void test_fx_fixed_float()
462{
463  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_float");
464
465  sc_fixed<8, 5> a = 0.0;
466  sc_fixed<8, 5> b = 1.0;
467  sc_fixed<8, 5> c = -1.0;
468   sc_fixed<8, 5> d = FLT_MAX;
469   sc_fixed<8, 5> e = FLT_MIN;
470
471  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
472}
473
474static void test_fx_fixed_double()
475{
476  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_double");
477
478  sc_fixed<8, 5> a = (double)0.0;
479  sc_fixed<8, 5> b = (double)1.0;
480  sc_fixed<8, 5> c = (double)-1.0;
481   sc_fixed<8, 5> d = DBL_MAX;
482   sc_fixed<8, 5> e = DBL_MIN;
483
484  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
485}
486
487//----------------------------------------------------------------
488static void test_fx_ufixed_int()
489{
490  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_int");
491
492  sc_ufixed<8, 5> a = 0;
493  sc_ufixed<8, 5> b = 1;
494  sc_ufixed<8, 5> c = -1;
495   sc_ufixed<8, 5> d = INT_MAX;
496   sc_ufixed<8, 5> e = INT_MIN;
497
498  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
499}
500
501static void test_fx_ufixed_uint()
502{
503  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_uint");
504
505  sc_ufixed<8, 5> a = (uint)0;
506  sc_ufixed<8, 5> b = (uint)1;
507   sc_ufixed<8, 5> c = (uint)-1;
508   sc_ufixed<8, 5> d = UINT_MAX;
509   sc_ufixed<8, 5> e = (uint)abs(INT_MIN);
510
511  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
512}
513
514static void test_fx_ufixed_short()
515{
516  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_short");
517
518  sc_ufixed<8, 5> a = (short)0;
519  sc_ufixed<8, 5> b = (short)1;
520  sc_ufixed<8, 5> c = (short)-1;
521   sc_ufixed<8, 5> d = SHRT_MAX;
522   sc_ufixed<8, 5> e = SHRT_MIN;
523
524  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
525}
526
527static void test_fx_ufixed_ushort()
528{
529  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_ushort");
530
531  sc_ufixed<8, 5> a = (ushort)0;
532  sc_ufixed<8, 5> b = (ushort)1;
533   sc_ufixed<8, 5> c = (ushort)-1;
534   sc_ufixed<8, 5> d = USHRT_MAX;
535   sc_ufixed<8, 5> e = (ushort)abs(SHRT_MIN);
536
537  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
538}
539
540static void test_fx_ufixed_long()
541{
542  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_long");
543
544  sc_ufixed<8, 5> a = (long)0;
545  sc_ufixed<8, 5> b = (long)1;
546  sc_ufixed<8, 5> c = (long)-1;
547   sc_ufixed<8, 5> d = LONG_MAX;
548   sc_ufixed<8, 5> e = LONG_MIN;
549
550  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
551}
552
553static void test_fx_ufixed_ulong()
554{
555  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_ulong");
556
557  sc_ufixed<8, 5> a = (ulong)0;
558  sc_ufixed<8, 5> b = (ulong)1;
559   sc_ufixed<8, 5> c = (ulong)-1;
560   sc_ufixed<8, 5> d = ULONG_MAX;
561   sc_ufixed<8, 5> e = (ulong)abs(LONG_MIN);
562
563  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
564}
565
566static void test_fx_ufixed_float()
567{
568  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_float");
569
570  sc_ufixed<8, 5> a = 0.0;
571  sc_ufixed<8, 5> b = 1.0;
572  sc_ufixed<8, 5> c = -1.0;
573   sc_ufixed<8, 5> d = FLT_MAX;
574   sc_ufixed<8, 5> e = FLT_MIN;
575
576  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
577}
578
579static void test_fx_ufixed_double()
580{
581  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_double");
582
583  sc_ufixed<8, 5> a = (double)0.0;
584  sc_ufixed<8, 5> b = (double)1.0;
585  sc_ufixed<8, 5> c = (double)-1.0;
586   sc_ufixed<8, 5> d = DBL_MAX;
587   sc_ufixed<8, 5> e = DBL_MIN;
588
589  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
590}
591
592void assign_constructor()
593{
594#if defined(SC_FXVAL_IMPLICIT_CONV)
595  cerr << "************** assign_constructor test_fx_float_\n";
596  test_fx_float_int();
597  test_fx_float_uint();
598  test_fx_float_short();
599  test_fx_float_ushort();
600  test_fx_float_long();
601  test_fx_float_ulong();
602  test_fx_float_float();
603  test_fx_float_double();
604#endif // defined(SC_FXVAL_IMPLICIT_CONV)
605  cerr << "************** assign_constructor test_fx_ufix_\n";
606  test_fx_ufix_int();
607  test_fx_ufix_uint();
608  test_fx_ufix_short();
609  test_fx_ufix_ushort();
610  test_fx_ufix_long();
611  test_fx_ufix_ulong();
612  test_fx_ufix_float();
613  test_fx_ufix_double();
614  cerr << "************** assign_constructor test_fx_fix_\n";
615  test_fx_fix_int();
616  test_fx_fix_uint();
617  test_fx_fix_short();
618  test_fx_fix_ushort();
619  test_fx_fix_long();
620  test_fx_fix_ulong();
621  test_fx_fix_float();
622  test_fx_fix_double();
623  cerr << "************** assign_constructor test_fx_fixed_\n";
624  test_fx_fixed_int();
625  test_fx_fixed_uint();
626  test_fx_fixed_short();
627  test_fx_fixed_ushort();
628  test_fx_fixed_long();
629  test_fx_fixed_ulong();
630  test_fx_fixed_float();
631  test_fx_fixed_double();
632  cerr << "************** assign_constructor test_fx_ufixed_\n";
633  test_fx_ufixed_int();
634  test_fx_ufixed_uint();
635  test_fx_ufixed_short();
636  test_fx_ufixed_ushort();
637  test_fx_ufixed_long();
638  test_fx_ufixed_ulong();
639  test_fx_ufixed_float();
640  test_fx_ufixed_double();
641}
642