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#define SC_INCLUDE_FX
50#define SC_FXVAL_IMPLICIT_CONV
51#include "systemc.h"
52
53typedef unsigned int   uint;
54typedef unsigned short ushort;
55typedef unsigned long  ulong;
56
57#define SHOW_ASSIGN_CONSTRUCTORS(a) cerr << #a << " : " << double(a) << " : " << a.to_string(SC_HEX) << "\n"
58#define IDENT_ASSIGN_CONSTRUCTORS(a) cerr << "--assign_constructor-Inf-Inf-Inf-Inf-Inf- " << a << "\n"
59
60//----------------------------------------------------------------
61// copy-initialisation from builtin types no longer works with sc_fxval,
62// unless SC_FXVAL_IMPLICIT_CONV is defined
63
64#if defined(SC_FXVAL_IMPLICIT_CONV)
65static void test_fx_float_int()
66{
67  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_int");
68
69  sc_fxval a = 0;
70  sc_fxval b = 1;
71  sc_fxval c = -1;
72  sc_fxval d = INT_MAX;
73  sc_fxval e = INT_MIN;
74
75  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
76}
77
78static void test_fx_float_uint()
79{
80  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_uint");
81
82  sc_fxval a = (uint)0;
83  sc_fxval b = (uint)1;
84  sc_fxval c = (uint)-1;
85  sc_fxval d = UINT_MAX;
86  sc_fxval e = (uint)abs(INT_MIN);
87
88  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
89}
90
91static void test_fx_float_short()
92{
93  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_short");
94
95  sc_fxval a = (short)0;
96  sc_fxval b = (short)1;
97  sc_fxval c = (short)-1;
98  sc_fxval d = SHRT_MAX;
99  sc_fxval e = SHRT_MIN;
100
101  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
102}
103
104static void test_fx_float_ushort()
105{
106  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_ushort");
107
108  sc_fxval a = (ushort)0;
109  sc_fxval b = (ushort)1;
110  sc_fxval c = (ushort)-1;
111  sc_fxval d = USHRT_MAX;
112  sc_fxval e = (ushort)abs(SHRT_MIN);
113
114  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
115}
116
117static void test_fx_float_long()
118{
119  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_long");
120
121  sc_fxval a = (long)0;
122  sc_fxval b = (long)1;
123  sc_fxval c = (long)-1;
124  sc_fxval d = LONG_MAX;
125  sc_fxval e = LONG_MIN;
126
127  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
128}
129
130static void test_fx_float_ulong()
131{
132  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_ulong");
133
134  sc_fxval a = (ulong)0;
135  sc_fxval b = (ulong)1;
136  sc_fxval c = (ulong)-1;
137  sc_fxval d = ULONG_MAX;
138  sc_fxval e = (ulong)abs(LONG_MIN);
139
140  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
141}
142
143static void test_fx_float_float()
144{
145  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_float");
146
147  sc_fxval a = 0.0;
148  sc_fxval b = 1.0;
149  sc_fxval c = -1.0;
150  sc_fxval d = FLT_MAX;
151  sc_fxval e = FLT_MIN;
152
153  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
154}
155
156static void test_fx_float_double()
157{
158  IDENT_ASSIGN_CONSTRUCTORS("test_fx_float_double");
159
160  sc_fxval a = (double)0.0;
161  sc_fxval b = (double)1.0;
162  sc_fxval c = (double)-1.0;
163  sc_fxval d = DBL_MAX;
164  sc_fxval e = DBL_MIN;
165
166  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
167}
168#endif // defined(SC_FXVAL_IMPLICIT_CONV)
169
170//----------------------------------------------------------------
171static void test_fx_ufix_int()
172{
173  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_int");
174
175  sc_ufix a = 0;
176  sc_ufix b = 1;
177  sc_ufix c = -1;
178  sc_ufix d = INT_MAX;
179  sc_ufix e = INT_MIN;
180
181  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
182}
183
184static void test_fx_ufix_uint()
185{
186  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_uint");
187
188  sc_ufix a = (uint)0;
189  sc_ufix b = (uint)1;
190  sc_ufix c = (uint)-1;
191  sc_ufix d = UINT_MAX;
192  sc_ufix e = (uint)abs(INT_MIN);
193
194  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
195}
196
197static void test_fx_ufix_short()
198{
199  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_short");
200
201  sc_ufix a = (short)0;
202  sc_ufix b = (short)1;
203  sc_ufix c = (short)-1;
204  sc_ufix d = SHRT_MAX;
205  sc_ufix e = SHRT_MIN;
206
207  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
208}
209
210static void test_fx_ufix_ushort()
211{
212  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_ushort");
213
214  sc_ufix a = (ushort)0;
215  sc_ufix b = (ushort)1;
216  sc_ufix c = (ushort)-1;
217  sc_ufix d = USHRT_MAX;
218  sc_ufix e = (ushort)abs(SHRT_MIN);
219
220  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
221}
222
223static void test_fx_ufix_long()
224{
225  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_long");
226
227  sc_ufix a = (long)0;
228  sc_ufix b = (long)1;
229  sc_ufix c = (long)-1;
230  sc_ufix d = LONG_MAX;
231  sc_ufix e = LONG_MIN;
232
233  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
234}
235
236static void test_fx_ufix_ulong()
237{
238  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_ulong");
239
240  sc_ufix a = (ulong)0;
241  sc_ufix b = (ulong)1;
242  sc_ufix c = (ulong)-1;
243  sc_ufix d = ULONG_MAX;
244  sc_ufix e = (ulong)abs(LONG_MIN);
245
246  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
247}
248
249static void test_fx_ufix_float()
250{
251  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_float");
252
253  sc_ufix a = 0.0;
254  sc_ufix b = 1.0;
255  sc_ufix c = -1.0;
256   sc_ufix d = FLT_MAX;
257   sc_ufix e = FLT_MIN;
258
259  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
260}
261
262static void test_fx_ufix_double()
263{
264  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufix_double");
265
266  sc_ufix a = (double)0.0;
267  sc_ufix b = (double)1.0;
268  sc_ufix c = (double)-1.0;
269   sc_ufix d = DBL_MAX;
270   sc_ufix e = DBL_MIN;
271
272  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
273}
274
275//----------------------------------------------------------------
276static void test_fx_fix_int()
277{
278  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_int");
279
280  sc_fix a = 0;
281  sc_fix b = 1;
282  sc_fix c = -1;
283  sc_fix d = INT_MAX;
284  sc_fix e = INT_MIN;
285
286  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
287}
288
289static void test_fx_fix_uint()
290{
291  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_uint");
292
293  sc_fix a = (uint)0;
294  sc_fix b = (uint)1;
295  sc_fix c = (uint)-1;
296  sc_fix d = UINT_MAX;
297  sc_fix e = (uint)abs(INT_MIN);
298
299  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
300}
301
302static void test_fx_fix_short()
303{
304  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_short");
305
306  sc_fix a = (short)0;
307  sc_fix b = (short)1;
308  sc_fix c = (short)-1;
309  sc_fix d = SHRT_MAX;
310  sc_fix e = SHRT_MIN;
311
312  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
313}
314
315static void test_fx_fix_ushort()
316{
317  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_ushort");
318
319  sc_fix a = (ushort)0;
320  sc_fix b = (ushort)1;
321  sc_fix c = (ushort)-1;
322  sc_fix d = USHRT_MAX;
323  sc_fix e = (ushort)abs(SHRT_MIN);
324
325  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
326}
327
328static void test_fx_fix_long()
329{
330  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_long");
331
332  sc_fix a = (long)0;
333  sc_fix b = (long)1;
334  sc_fix c = (long)-1;
335  sc_fix d = LONG_MAX;
336  sc_fix e = LONG_MIN;
337
338  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
339}
340
341static void test_fx_fix_ulong()
342{
343  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_ulong");
344
345  sc_fix a = (ulong)0;
346  sc_fix b = (ulong)1;
347  sc_fix c = (ulong)-1;
348  sc_fix d = ULONG_MAX;
349  sc_fix e = (ulong)abs(LONG_MIN);
350
351  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
352}
353
354static void test_fx_fix_float()
355{
356  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_float");
357
358  sc_fix a = 0.0;
359  sc_fix b = 1.0;
360  sc_fix c = -1.0;
361   sc_fix d = FLT_MAX;
362   sc_fix e = FLT_MIN;
363
364  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
365}
366
367static void test_fx_fix_double()
368{
369  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fix_double");
370
371  sc_fix a = (double)0.0;
372  sc_fix b = (double)1.0;
373  sc_fix c = (double)-1.0;
374   sc_fix d = DBL_MAX;
375   sc_fix e = DBL_MIN;
376
377  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
378}
379
380//----------------------------------------------------------------
381static void test_fx_fixed_int()
382{
383  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_int");
384
385  sc_fixed<8, 5> a = 0;
386  sc_fixed<8, 5> b = 1;
387  sc_fixed<8, 5> c = -1;
388   sc_fixed<8, 5> d = INT_MAX;
389   sc_fixed<8, 5> e = INT_MIN;
390
391  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
392}
393
394static void test_fx_fixed_uint()
395{
396  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_uint");
397
398  sc_fixed<8, 5> a = (uint)0;
399  sc_fixed<8, 5> b = (uint)1;
400   sc_fixed<8, 5> c = (uint)-1;
401   sc_fixed<8, 5> d = UINT_MAX;
402   sc_fixed<8, 5> e = (uint)abs(INT_MIN);
403
404  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
405}
406
407static void test_fx_fixed_short()
408{
409  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_short");
410
411  sc_fixed<8, 5> a = (short)0;
412  sc_fixed<8, 5> b = (short)1;
413  sc_fixed<8, 5> c = (short)-1;
414   sc_fixed<8, 5> d = SHRT_MAX;
415   sc_fixed<8, 5> e = SHRT_MIN;
416
417  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
418}
419
420static void test_fx_fixed_ushort()
421{
422  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_ushort");
423
424  sc_fixed<8, 5> a = (ushort)0;
425  sc_fixed<8, 5> b = (ushort)1;
426   sc_fixed<8, 5> c = (ushort)-1;
427   sc_fixed<8, 5> d = USHRT_MAX;
428   sc_fixed<8, 5> e = (ushort)abs(SHRT_MIN);
429
430  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
431}
432
433static void test_fx_fixed_long()
434{
435  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_long");
436
437  sc_fixed<8, 5> a = (long)0;
438  sc_fixed<8, 5> b = (long)1;
439  sc_fixed<8, 5> c = (long)-1;
440   sc_fixed<8, 5> d = LONG_MAX;
441   sc_fixed<8, 5> e = LONG_MIN;
442
443  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
444}
445
446static void test_fx_fixed_ulong()
447{
448  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_ulong");
449
450  sc_fixed<8, 5> a = (ulong)0;
451  sc_fixed<8, 5> b = (ulong)1;
452   sc_fixed<8, 5> c = (ulong)-1;
453   sc_fixed<8, 5> d = ULONG_MAX;
454   sc_fixed<8, 5> e = (ulong)abs(LONG_MIN);
455
456  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
457}
458
459static void test_fx_fixed_float()
460{
461  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_float");
462
463  sc_fixed<8, 5> a = 0.0;
464  sc_fixed<8, 5> b = 1.0;
465  sc_fixed<8, 5> c = -1.0;
466   sc_fixed<8, 5> d = FLT_MAX;
467   sc_fixed<8, 5> e = FLT_MIN;
468
469  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
470}
471
472static void test_fx_fixed_double()
473{
474  IDENT_ASSIGN_CONSTRUCTORS("test_fx_fixed_double");
475
476  sc_fixed<8, 5> a = (double)0.0;
477  sc_fixed<8, 5> b = (double)1.0;
478  sc_fixed<8, 5> c = (double)-1.0;
479   sc_fixed<8, 5> d = DBL_MAX;
480   sc_fixed<8, 5> e = DBL_MIN;
481
482  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
483}
484
485//----------------------------------------------------------------
486static void test_fx_ufixed_int()
487{
488  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_int");
489
490  sc_ufixed<8, 5> a = 0;
491  sc_ufixed<8, 5> b = 1;
492  sc_ufixed<8, 5> c = -1;
493   sc_ufixed<8, 5> d = INT_MAX;
494   sc_ufixed<8, 5> e = INT_MIN;
495
496  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
497}
498
499static void test_fx_ufixed_uint()
500{
501  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_uint");
502
503  sc_ufixed<8, 5> a = (uint)0;
504  sc_ufixed<8, 5> b = (uint)1;
505   sc_ufixed<8, 5> c = (uint)-1;
506   sc_ufixed<8, 5> d = UINT_MAX;
507   sc_ufixed<8, 5> e = (uint)abs(INT_MIN);
508
509  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
510}
511
512static void test_fx_ufixed_short()
513{
514  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_short");
515
516  sc_ufixed<8, 5> a = (short)0;
517  sc_ufixed<8, 5> b = (short)1;
518  sc_ufixed<8, 5> c = (short)-1;
519   sc_ufixed<8, 5> d = SHRT_MAX;
520   sc_ufixed<8, 5> e = SHRT_MIN;
521
522  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
523}
524
525static void test_fx_ufixed_ushort()
526{
527  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_ushort");
528
529  sc_ufixed<8, 5> a = (ushort)0;
530  sc_ufixed<8, 5> b = (ushort)1;
531   sc_ufixed<8, 5> c = (ushort)-1;
532   sc_ufixed<8, 5> d = USHRT_MAX;
533   sc_ufixed<8, 5> e = (ushort)abs(SHRT_MIN);
534
535  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
536}
537
538static void test_fx_ufixed_long()
539{
540  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_long");
541
542  sc_ufixed<8, 5> a = (long)0;
543  sc_ufixed<8, 5> b = (long)1;
544  sc_ufixed<8, 5> c = (long)-1;
545   sc_ufixed<8, 5> d = LONG_MAX;
546   sc_ufixed<8, 5> e = LONG_MIN;
547
548  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
549}
550
551static void test_fx_ufixed_ulong()
552{
553  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_ulong");
554
555  sc_ufixed<8, 5> a = (ulong)0;
556  sc_ufixed<8, 5> b = (ulong)1;
557   sc_ufixed<8, 5> c = (ulong)-1;
558   sc_ufixed<8, 5> d = ULONG_MAX;
559   sc_ufixed<8, 5> e = (ulong)abs(LONG_MIN);
560
561  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b);  SHOW_ASSIGN_CONSTRUCTORS(c); SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
562}
563
564static void test_fx_ufixed_float()
565{
566  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_float");
567
568  sc_ufixed<8, 5> a = 0.0;
569  sc_ufixed<8, 5> b = 1.0;
570  sc_ufixed<8, 5> c = -1.0;
571   sc_ufixed<8, 5> d = FLT_MAX;
572   sc_ufixed<8, 5> e = FLT_MIN;
573
574  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
575}
576
577static void test_fx_ufixed_double()
578{
579  IDENT_ASSIGN_CONSTRUCTORS("test_fx_ufixed_double");
580
581  sc_ufixed<8, 5> a = (double)0.0;
582  sc_ufixed<8, 5> b = (double)1.0;
583  sc_ufixed<8, 5> c = (double)-1.0;
584   sc_ufixed<8, 5> d = DBL_MAX;
585   sc_ufixed<8, 5> e = DBL_MIN;
586
587  SHOW_ASSIGN_CONSTRUCTORS(a); SHOW_ASSIGN_CONSTRUCTORS(b); SHOW_ASSIGN_CONSTRUCTORS(c);  SHOW_ASSIGN_CONSTRUCTORS(d); SHOW_ASSIGN_CONSTRUCTORS(e);
588}
589
590void assign_constructor()
591{
592#if defined(SC_FXVAL_IMPLICIT_CONV)
593  cerr << "************** assign_constructor test_fx_float_\n";
594  test_fx_float_int();
595  test_fx_float_uint();
596  test_fx_float_short();
597  test_fx_float_ushort();
598  test_fx_float_long();
599  test_fx_float_ulong();
600  test_fx_float_float();
601  test_fx_float_double();
602#endif // defined(SC_FXVAL_IMPLICIT_CONV)
603  cerr << "************** assign_constructor test_fx_ufix_\n";
604  test_fx_ufix_int();
605  test_fx_ufix_uint();
606  test_fx_ufix_short();
607  test_fx_ufix_ushort();
608  test_fx_ufix_long();
609  test_fx_ufix_ulong();
610  test_fx_ufix_float();
611  test_fx_ufix_double();
612  cerr << "************** assign_constructor test_fx_fix_\n";
613  test_fx_fix_int();
614  test_fx_fix_uint();
615  test_fx_fix_short();
616  test_fx_fix_ushort();
617  test_fx_fix_long();
618  test_fx_fix_ulong();
619  test_fx_fix_float();
620  test_fx_fix_double();
621  cerr << "************** assign_constructor test_fx_fixed_\n";
622  test_fx_fixed_int();
623  test_fx_fixed_uint();
624  test_fx_fixed_short();
625  test_fx_fixed_ushort();
626  test_fx_fixed_long();
627  test_fx_fixed_ulong();
628  test_fx_fixed_float();
629  test_fx_fixed_double();
630  cerr << "************** assign_constructor test_fx_ufixed_\n";
631  test_fx_ufixed_int();
632  test_fx_ufixed_uint();
633  test_fx_ufixed_short();
634  test_fx_ufixed_ushort();
635  test_fx_ufixed_long();
636  test_fx_ufixed_ulong();
637  test_fx_ufixed_float();
638  test_fx_ufixed_double();
639}
640