default_constructor.cpp revision 12855:588919e0e4aa
112855Sgabeblack@google.com/*****************************************************************************
212855Sgabeblack@google.com
312855Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412855Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512855Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612855Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712855Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812855Sgabeblack@google.com  License.  You may obtain a copy of the License at
912855Sgabeblack@google.com
1012855Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112855Sgabeblack@google.com
1212855Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312855Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412855Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512855Sgabeblack@google.com  implied.  See the License for the specific language governing
1612855Sgabeblack@google.com  permissions and limitations under the License.
1712855Sgabeblack@google.com
1812855Sgabeblack@google.com *****************************************************************************/
1912855Sgabeblack@google.com
2012855Sgabeblack@google.com/*****************************************************************************
2112855Sgabeblack@google.com
2212855Sgabeblack@google.com  default_constructor.cpp --
2312855Sgabeblack@google.com
2412855Sgabeblack@google.com  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
2512855Sgabeblack@google.com
2612855Sgabeblack@google.com *****************************************************************************/
2712855Sgabeblack@google.com
2812855Sgabeblack@google.com/*****************************************************************************
2912855Sgabeblack@google.com
3012855Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112855Sgabeblack@google.com  changes you are making here.
3212855Sgabeblack@google.com
3312855Sgabeblack@google.com      Name, Affiliation, Date:
3412855Sgabeblack@google.com  Description of Modification:
3512855Sgabeblack@google.com
3612855Sgabeblack@google.com *****************************************************************************/
3712855Sgabeblack@google.com
3812855Sgabeblack@google.com// This may look like C code, but it is really -*- C++ -*-
3912855Sgabeblack@google.com//
4012855Sgabeblack@google.com// default_constructor.cxx --
4112855Sgabeblack@google.com// Copyright Synopsys 1998
4212855Sgabeblack@google.com// Author          : Ric Hilderink
4312855Sgabeblack@google.com// Created On      : Wed Dec 30 09:38:31 1998
4412855Sgabeblack@google.com// Status          : none
4512855Sgabeblack@google.com//
4612855Sgabeblack@google.com
4712855Sgabeblack@google.com#include <limits.h>
4812855Sgabeblack@google.com#include <float.h>
4912855Sgabeblack@google.com
5012855Sgabeblack@google.com#define SC_INCLUDE_FX
5112855Sgabeblack@google.com#include "systemc.h"
5212855Sgabeblack@google.com#include "fx_precision_double.h"
5312855Sgabeblack@google.com
5412855Sgabeblack@google.comtypedef unsigned int   uint;
5512855Sgabeblack@google.comtypedef unsigned short ushort;
5612855Sgabeblack@google.comtypedef unsigned long  ulong;
5712855Sgabeblack@google.com
5812855Sgabeblack@google.com#define SHOW(a) cerr << #a << " : " << double(a) << " : " << a.to_string(SC_HEX) << "\n"
5912855Sgabeblack@google.com#define IDENT(a) cerr << "--default_constructor-Inf-Inf-Inf-Inf-Inf- " << a << "\n"
6012855Sgabeblack@google.com
6112855Sgabeblack@google.com#define T_CHAR_MAX "0b010101110100110111001011"
6212855Sgabeblack@google.com#define T_CHAR_MIN "-0xsmdeadbeafe-101"
6312855Sgabeblack@google.com#define T_UCHAR_MAX "0b010101110100110111001011e+101"
6412855Sgabeblack@google.com#define T_UCHAR_MIN "0xdeadbeafe-101"
6512855Sgabeblack@google.com
6612855Sgabeblack@google.comstatic void test_fx_float_char()
6712855Sgabeblack@google.com{
6812855Sgabeblack@google.com  IDENT("test_fx_float_char");
6912855Sgabeblack@google.com
7012855Sgabeblack@google.com  sc_fxval a("0");
7112855Sgabeblack@google.com  sc_fxval b("1");
7212855Sgabeblack@google.com  sc_fxval c("-1");
7312855Sgabeblack@google.com  sc_fxval d(T_CHAR_MAX);
7412855Sgabeblack@google.com  sc_fxval e(T_CHAR_MIN);
7512855Sgabeblack@google.com
7612855Sgabeblack@google.com  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
7712855Sgabeblack@google.com}
7812855Sgabeblack@google.com
79static void test_fx_float_int()
80{
81  IDENT("test_fx_float_int");
82
83  sc_fxval a(0);
84  sc_fxval b(1);
85  sc_fxval c(-1);
86  sc_fxval d(INT_MAX);
87  sc_fxval e(INT_MIN);
88
89  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
90}
91
92static void test_fx_float_uint()
93{
94  IDENT("test_fx_float_uint");
95
96  sc_fxval a((uint)0);
97  sc_fxval b((uint)1);
98  sc_fxval c((uint)-1);
99  sc_fxval d(UINT_MAX);
100  sc_fxval e((uint)abs(INT_MIN));
101
102  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
103}
104
105static void test_fx_float_short()
106{
107  IDENT("test_fx_float_short");
108
109  sc_fxval a((short)0);
110  sc_fxval b((short)1);
111  sc_fxval c((short)-1);
112  sc_fxval d((short)SHRT_MAX);
113  sc_fxval e((short)SHRT_MIN);
114
115  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
116}
117
118static void test_fx_float_ushort()
119{
120  IDENT("test_fx_float_ushort");
121
122  sc_fxval a((ushort)0);
123  sc_fxval b((ushort)1);
124  sc_fxval c((ushort)-1);
125  sc_fxval d(USHRT_MAX);
126  sc_fxval e((ushort)abs(SHRT_MIN));
127
128  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
129}
130
131static void test_fx_float_long()
132{
133  IDENT("test_fx_float_long");
134
135  sc_fxval a((long)0);
136  sc_fxval b((long)1);
137  sc_fxval c((long)-1);
138  sc_fxval d(LONG_MAX);
139  sc_fxval e(LONG_MIN);
140
141  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
142}
143
144static void test_fx_float_ulong()
145{
146  IDENT("test_fx_float_ulong");
147
148  sc_fxval a((ulong)0);
149  sc_fxval b((ulong)1);
150  sc_fxval c((ulong)-1);
151  sc_fxval d(ULONG_MAX);
152  sc_fxval e((ulong)abs(LONG_MIN));
153
154  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
155}
156
157static void test_fx_float_float()
158{
159  IDENT("test_fx_float_float");
160
161  sc_fxval a(0.0);
162  sc_fxval b(1.0);
163  sc_fxval c(-1.0);
164  sc_fxval d(FLT_MAX);
165  sc_fxval e(FLT_MIN);
166
167  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
168}
169
170static void test_fx_float_double()
171{
172  IDENT("test_fx_float_double");
173
174  sc_fxval a((double)0.0);
175  sc_fxval b((double)1.0);
176  sc_fxval c((double)-1.0);
177  sc_fxval d(DBL_MAX);
178  sc_fxval e(DBL_MIN);
179
180  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
181}
182
183//-----------------------------------------------------------------------
184static void test_fx_ufix_char()
185{
186  IDENT("test_fx_ufix_char");
187
188  sc_ufix a("0");
189  sc_ufix b("1");
190  sc_ufix c("-1");
191  sc_ufix d(T_UCHAR_MAX);
192  sc_ufix e(T_UCHAR_MIN);
193
194  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
195}
196
197static void test_fx_ufix_int()
198{
199  IDENT("test_fx_ufix_int");
200
201  sc_ufix a(0);
202  sc_ufix b(1);
203  sc_ufix c(-1);
204  sc_ufix d(INT_MAX);
205  sc_ufix e(INT_MIN);
206
207  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
208}
209
210static void test_fx_ufix_uint()
211{
212  IDENT("test_fx_ufix_uint");
213
214  sc_ufix a((uint)0);
215  sc_ufix b((uint)1);
216  sc_ufix c((uint)-1);
217  sc_ufix d(UINT_MAX);
218  sc_ufix e((uint)abs(INT_MIN));
219
220  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
221}
222
223static void test_fx_ufix_short()
224{
225  IDENT("test_fx_ufix_short");
226
227  sc_ufix a((short)0);
228  sc_ufix b((short)1);
229  sc_ufix c((short)-1);
230  sc_ufix d(SHRT_MAX);
231  sc_ufix e(SHRT_MIN);
232
233  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
234}
235
236static void test_fx_ufix_ushort()
237{
238  IDENT("test_fx_ufix_ushort");
239
240  sc_ufix a((ushort)0);
241  sc_ufix b((ushort)1);
242  sc_ufix c((ushort)-1);
243  sc_ufix d(USHRT_MAX);
244  sc_ufix e((ushort)abs(SHRT_MIN));
245
246  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
247}
248
249static void test_fx_ufix_long()
250{
251  IDENT("test_fx_ufix_long");
252
253  sc_ufix a((long)0);
254  sc_ufix b((long)1);
255  sc_ufix c((long)-1);
256  sc_ufix d(LONG_MAX);
257  sc_ufix e(LONG_MIN);
258
259  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
260}
261
262static void test_fx_ufix_ulong()
263{
264  IDENT("test_fx_ufix_ulong");
265
266  sc_ufix a((ulong)0);
267  sc_ufix b((ulong)1);
268  sc_ufix c((ulong)-1);
269  sc_ufix d(ULONG_MAX);
270  sc_ufix e((ulong)abs(LONG_MIN));
271
272  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
273}
274
275static void test_fx_ufix_float()
276{
277  IDENT("test_fx_ufix_float");
278
279  sc_ufix a(0.0);
280  sc_ufix b(1.0);
281  sc_ufix c(-1.0);
282  sc_ufix d(FLT_MAX);
283  sc_ufix e(FLT_MIN);
284
285//  cerr << "sc_ufix d(FLT_MAX); does not work (yet)\n";
286  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
287}
288
289static void test_fx_ufix_double()
290{
291  IDENT("test_fx_ufix_double");
292
293  sc_ufix a((double)0.0);
294  sc_ufix b((double)1.0);
295  sc_ufix c((double)-1.0);
296  sc_ufix d(DBL_MAX);
297  sc_ufix e(DBL_MIN);
298
299//  cerr << "sc_ufix d(DBL_MAX); does not work (yet)\n";
300  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
301}
302
303//-----------------------------------------------------------------------
304static void test_fx_fix_char()
305{
306  IDENT("test_fx_fix_char");
307
308  sc_fix a("0"); SHOW(a);
309  sc_fix b("1"); SHOW(b);
310  sc_fix c("-1"); SHOW(c);
311  sc_fix d(T_CHAR_MAX); SHOW(d);
312  sc_fix e(T_CHAR_MIN); SHOW(e);
313
314  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
315}
316
317static void test_fx_fix_int()
318{
319  IDENT("test_fx_fix_int");
320
321  sc_fix a(0);
322  sc_fix b(1);
323  sc_fix c(-1);
324  sc_fix d(INT_MAX);
325  sc_fix e(INT_MIN);
326
327  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
328}
329
330static void test_fx_fix_uint()
331{
332  IDENT("test_fx_fix_uint");
333
334  sc_fix a((uint)0);
335  sc_fix b((uint)1);
336  sc_fix c((uint)-1);
337  sc_fix d(UINT_MAX);
338  sc_fix e((uint)abs(INT_MIN));
339
340  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
341}
342static void test_fx_fix_short()
343{
344  IDENT("test_fx_fix_short");
345
346  sc_fix a((short)0);
347  sc_fix b((short)1);
348  sc_fix c((short)-1);
349  sc_fix d(SHRT_MAX);
350  sc_fix e(SHRT_MIN);
351
352  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
353}
354
355static void test_fx_fix_ushort()
356{
357  IDENT("test_fx_fix_ushort");
358
359  sc_fix a((ushort)0);
360  sc_fix b((ushort)1);
361  sc_fix c((ushort)-1);
362  sc_fix d(USHRT_MAX);
363  sc_fix e((ushort)abs(SHRT_MIN));
364
365  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
366}
367
368static void test_fx_fix_long()
369{
370  IDENT("test_fx_fix_long");
371
372  sc_fix a((long)0);
373  sc_fix b((long)1);
374  sc_fix c((long)-1);
375  sc_fix d(LONG_MAX);
376  sc_fix e(LONG_MIN);
377
378  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
379}
380
381static void test_fx_fix_ulong()
382{
383  IDENT("test_fx_fix_ulong");
384
385  sc_fix a((ulong)0);
386  sc_fix b((ulong)1);
387  sc_fix c((ulong)-1);
388  sc_fix d(ULONG_MAX);
389  sc_fix e((ulong)abs(LONG_MIN));
390
391  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
392}
393
394static void test_fx_fix_float()
395{
396  IDENT("test_fx_fix_float");
397
398  sc_fix a(0.0);
399  sc_fix b(1.0);
400  sc_fix c(-1.0);
401  sc_fix d(FLT_MAX);
402  sc_fix e(FLT_MIN);
403
404//  cerr << "sc_fix d(FLT_MAX); does not work (yet)\n";
405  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
406}
407
408static void test_fx_fix_double()
409{
410  IDENT("test_fx_fix_double");
411
412  sc_fix a((double)0.0);
413  sc_fix b((double)1.0);
414  sc_fix c((double)-1.0);
415  sc_fix d(DBL_MAX);
416  sc_fix e(DBL_MIN);
417
418//  cerr << "sc_fix d(DBL_MAX); does not work (yet)\n";
419  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
420}
421
422//-----------------------------------------------------------------------
423static void test_fx_fixed_char()
424{
425  IDENT("test_fx_fixed_char");
426
427  sc_fixed<8, 5> a("0");
428  sc_fixed<8, 5> b("1");
429  sc_fixed<8, 5> c("-1");
430  sc_fixed<8, 5> d(T_CHAR_MAX);
431  sc_fixed<8, 5> e(T_CHAR_MIN);
432
433//  cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n";
434  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
435}
436
437static void test_fx_fixed_int()
438{
439  IDENT("test_fx_fixed_int");
440
441  sc_fixed<8, 5> a(0);
442  sc_fixed<8, 5> b(1);
443  sc_fixed<8, 5> c(-1);
444  sc_fixed<8, 5> d(INT_MAX);
445  sc_fixed<8, 5> e(INT_MIN);
446
447//  cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n";
448  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
449}
450
451static void test_fx_fixed_uint()
452{
453  IDENT("test_sc_fixed_uint");
454
455  sc_fixed<8, 5> a((uint)0);
456  sc_fixed<8, 5> b((uint)1);
457  sc_fixed<8, 5> c((uint)-1);
458  sc_fixed<8, 5> d(UINT_MAX);
459  sc_fixed<8, 5> e((uint)abs(INT_MIN));
460
461//  cerr << "sc_fixed<8, 5> d(UINT_MAX); does not work\n";
462  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
463}
464
465static void test_fx_fixed_short()
466{
467  IDENT("test_fx_fixed_short");
468
469  sc_fixed<8, 5> a((short)0);
470  sc_fixed<8, 5> b((short)1);
471  sc_fixed<8, 5> c((short)-1);
472  sc_fixed<8, 5> d(SHRT_MAX);
473  sc_fixed<8, 5> e(SHRT_MIN);
474
475//  cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n";
476  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
477}
478
479static void test_fx_fixed_ushort()
480{
481  IDENT("test_sc_fixed_ushort");
482
483  sc_fixed<8, 5> a((ushort)0);
484  sc_fixed<8, 5> b((ushort)1);
485  sc_fixed<8, 5> c((ushort)-1);
486  sc_fixed<8, 5> d(USHRT_MAX);
487  sc_fixed<8, 5> e((ushort)abs(SHRT_MIN));
488
489//  cerr << "sc_fixed<8, 5> d(UINT_MAX); does not work\n";
490  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
491}
492
493static void test_fx_fixed_long()
494{
495  IDENT("test_sc_fixeded_long");
496
497  sc_fixed<8, 5> a((long)0);
498  sc_fixed<8, 5> b((long)1);
499  sc_fixed<8, 5> c((long)-1);
500  sc_fixed<8, 5> d(LONG_MAX);
501  sc_fixed<8, 5> e(LONG_MIN);
502
503//  cerr << "sc_fixed<8, 5> d(INT_LONG); does not work\n";
504  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
505}
506
507static void test_fx_fixed_ulong()
508{
509  IDENT("test_fx_fixed_ulong");
510
511  sc_fixed<8, 5> a((ulong)0);
512  sc_fixed<8, 5> b((ulong)1);
513  sc_fixed<8, 5> c((ulong)-1);
514  sc_fixed<8, 5> d(ULONG_MAX);
515  sc_fixed<8, 5> e((ulong)abs(LONG_MIN));
516
517//  cerr << "sc_fixed<8, 5> d(ULONG_MAX); does not work\n";
518  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
519}
520
521static void test_fx_fixed_float()
522{
523  IDENT("test_fx_fixed_float");
524
525  sc_fixed<8, 5> a(0.0);
526  sc_fixed<8, 5> b(1.0);
527  sc_fixed<8, 5> c(-1.0);
528  sc_fixed<8, 5> d(FLT_MAX);
529  sc_fixed<8, 5> e(FLT_MIN);
530
531//  cerr << "sc_fixed<8, 5> d(FLT_MAX); does not work (yet)\n";
532  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
533}
534
535static void test_fx_fixed_double()
536{
537  IDENT("test_fx_fixed_double");
538
539  sc_fixed<8, 5> a((double)0.0);
540  sc_fixed<8, 5> b((double)1.0);
541  sc_fixed<8, 5> c((double)-1.0);
542  sc_fixed<8, 5> d(DBL_MAX);
543  sc_fixed<8, 5> e(DBL_MIN);
544
545//  cerr << "sc_fixed<8, 5> d(DBL_MAX); does not work (yet)\n";
546  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
547}
548
549//-----------------------------------------------------------------------
550static void test_fx_ufixed_char()
551{
552  IDENT("test_fx_ufixed_char");
553
554  sc_ufixed<8, 5> a("0");
555  sc_ufixed<8, 5> b("1");
556  sc_ufixed<8, 5> c("-1");
557  sc_ufixed<8, 5> d(T_UCHAR_MAX);
558  sc_ufixed<8, 5> e(T_UCHAR_MIN);
559
560//  cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n";
561  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
562}
563
564static void test_fx_ufixed_int()
565{
566  IDENT("test_fx_ufixed_int");
567
568  sc_ufixed<8, 5> a(0);
569  sc_ufixed<8, 5> b(1);
570  sc_ufixed<8, 5> c(-1);
571  sc_ufixed<8, 5> d(INT_MAX);
572  sc_ufixed<8, 5> e(INT_MIN);
573
574//  cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n";
575  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
576}
577
578static void test_fx_ufixed_uint()
579{
580  IDENT("test_fx_ufixed_uint");
581
582  sc_ufixed<8, 5> a((uint)0);
583  sc_ufixed<8, 5> b((uint)1);
584  sc_ufixed<8, 5> c((uint)-1);
585  sc_ufixed<8, 5> d(UINT_MAX);
586  sc_ufixed<8, 5> e((uint)abs(INT_MIN));
587
588//  cerr << "sc_ufixed<8, 5> d(UINT_MAX); does not work\n";
589  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
590}
591
592static void test_fx_ufixed_short()
593{
594  IDENT("test_fx_ufixed_short");
595
596  sc_ufixed<8, 5> a((short)0);
597  sc_ufixed<8, 5> b((short)1);
598  sc_ufixed<8, 5> c((short)-1);
599  sc_ufixed<8, 5> d(SHRT_MAX);
600  sc_ufixed<8, 5> e(SHRT_MIN);
601
602//  cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n";
603  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
604}
605
606static void test_fx_ufixed_ushort()
607{
608  IDENT("test_fx_ufixed_ushort");
609
610  sc_ufixed<8, 5> a((ushort)0);
611  sc_ufixed<8, 5> b((ushort)1);
612  sc_ufixed<8, 5> c((ushort)-1);
613  sc_ufixed<8, 5> d(USHRT_MAX);
614  sc_ufixed<8, 5> e((ushort)abs(SHRT_MIN));
615
616//  cerr << "sc_ufixed<8, 5> d(UINT_MAX); does not work\n";
617  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
618}
619
620static void test_fx_ufixed_long()
621{
622  IDENT("test_fx_ufixeded_long");
623
624  sc_ufixed<8, 5> a((long)0);
625  sc_ufixed<8, 5> b((long)1);
626  sc_ufixed<8, 5> c((long)-1);
627  sc_ufixed<8, 5> d(LONG_MAX);
628  sc_ufixed<8, 5> e(LONG_MIN);
629
630//  cerr << "sc_ufixed<8, 5> d(INT_LONG); does not work\n";
631  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
632}
633
634static void test_fx_ufixed_ulong()
635{
636  IDENT("test_fx_ufixed_ulong");
637
638  sc_ufixed<8, 5> a((ulong)0);
639  sc_ufixed<8, 5> b((ulong)1);
640  sc_ufixed<8, 5> c((ulong)-1);
641  sc_ufixed<8, 5> d(ULONG_MAX);
642  sc_ufixed<8, 5> e((ulong)abs(LONG_MIN));
643
644//  cerr << "sc_ufixed<8, 5> d(ULONG_MAX); does not work\n";
645  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
646}
647
648static void test_fx_ufixed_float()
649{
650  IDENT("test_fx_ufixed_float");
651
652  sc_ufixed<8, 5> a(0.0);
653  sc_ufixed<8, 5> b(1.0);
654  sc_ufixed<8, 5> c(-1.0);
655  sc_ufixed<8, 5> d(FLT_MAX);
656  sc_ufixed<8, 5> e(FLT_MIN);
657
658//  cerr << "sc_ufixed<8, 5> d(FLT_MAX); does not work (yet)\n";
659  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
660}
661
662static void test_fx_ufixed_double()
663{
664  IDENT("test_fx_ufixed_double");
665
666  sc_ufixed<8, 5> a((double)0.0);
667  sc_ufixed<8, 5> b((double)1.0);
668  sc_ufixed<8, 5> c((double)-1.0);
669  sc_ufixed<8, 5> d(DBL_MAX);
670  sc_ufixed<8, 5> e(DBL_MIN);
671
672//  cerr << "sc_ufixed<8, 5> d(DBL_MAX); does not work (yet)\n";
673  SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e);
674}
675
676void default_constructor()
677{
678  cerr << "************** default_constructor for fx_float\n";
679  test_fx_float_char();
680  test_fx_float_int();
681  test_fx_float_uint();
682  test_fx_float_short();
683  test_fx_float_ushort();
684  test_fx_float_long();
685  test_fx_float_ulong();
686  test_fx_float_float();
687  test_fx_float_double();
688
689  cerr << "************** default_constructor for fx_ufix\n";
690  test_fx_ufix_char();
691  test_fx_ufix_int();
692  test_fx_ufix_uint();
693  test_fx_ufix_short();
694  test_fx_ufix_ushort();
695  test_fx_ufix_long();
696  test_fx_ufix_ulong();
697  test_fx_ufix_float();
698  test_fx_ufix_double();
699
700  cerr << "************** default_constructor for fx_fix\n";
701  test_fx_fix_char();
702  test_fx_fix_int();
703  test_fx_fix_uint();
704  test_fx_fix_short();
705  test_fx_fix_ushort();
706  test_fx_fix_long();
707  test_fx_fix_ulong();
708  test_fx_fix_float();
709  test_fx_fix_double();
710
711  cerr << "************** default_constructor for <wl,iwl>fx_fixed\n";
712  test_fx_fixed_char();
713  test_fx_fixed_int();
714  test_fx_fixed_uint();
715  test_fx_fixed_short();
716  test_fx_fixed_ushort();
717  test_fx_fixed_long();
718  test_fx_fixed_ulong();
719  test_fx_fixed_float();
720  test_fx_fixed_double();
721
722  cerr << "************** default_constructor for <wl,iwl>fx_ufixed\n";
723  test_fx_ufixed_char();
724  test_fx_ufixed_int();
725  test_fx_ufixed_uint();
726  test_fx_ufixed_short();
727  test_fx_ufixed_ushort();
728  test_fx_ufixed_long();
729  test_fx_ufixed_ulong();
730  test_fx_ufixed_float();
731  test_fx_ufixed_double();
732}
733