default_constructor.cpp revision 12855
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 7912855Sgabeblack@google.comstatic void test_fx_float_int() 8012855Sgabeblack@google.com{ 8112855Sgabeblack@google.com IDENT("test_fx_float_int"); 8212855Sgabeblack@google.com 8312855Sgabeblack@google.com sc_fxval a(0); 8412855Sgabeblack@google.com sc_fxval b(1); 8512855Sgabeblack@google.com sc_fxval c(-1); 8612855Sgabeblack@google.com sc_fxval d(INT_MAX); 8712855Sgabeblack@google.com sc_fxval e(INT_MIN); 8812855Sgabeblack@google.com 8912855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 9012855Sgabeblack@google.com} 9112855Sgabeblack@google.com 9212855Sgabeblack@google.comstatic void test_fx_float_uint() 9312855Sgabeblack@google.com{ 9412855Sgabeblack@google.com IDENT("test_fx_float_uint"); 9512855Sgabeblack@google.com 9612855Sgabeblack@google.com sc_fxval a((uint)0); 9712855Sgabeblack@google.com sc_fxval b((uint)1); 9812855Sgabeblack@google.com sc_fxval c((uint)-1); 9912855Sgabeblack@google.com sc_fxval d(UINT_MAX); 10012855Sgabeblack@google.com sc_fxval e((uint)abs(INT_MIN)); 10112855Sgabeblack@google.com 10212855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 10312855Sgabeblack@google.com} 10412855Sgabeblack@google.com 10512855Sgabeblack@google.comstatic void test_fx_float_short() 10612855Sgabeblack@google.com{ 10712855Sgabeblack@google.com IDENT("test_fx_float_short"); 10812855Sgabeblack@google.com 10912855Sgabeblack@google.com sc_fxval a((short)0); 11012855Sgabeblack@google.com sc_fxval b((short)1); 11112855Sgabeblack@google.com sc_fxval c((short)-1); 11212855Sgabeblack@google.com sc_fxval d((short)SHRT_MAX); 11312855Sgabeblack@google.com sc_fxval e((short)SHRT_MIN); 11412855Sgabeblack@google.com 11512855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 11612855Sgabeblack@google.com} 11712855Sgabeblack@google.com 11812855Sgabeblack@google.comstatic void test_fx_float_ushort() 11912855Sgabeblack@google.com{ 12012855Sgabeblack@google.com IDENT("test_fx_float_ushort"); 12112855Sgabeblack@google.com 12212855Sgabeblack@google.com sc_fxval a((ushort)0); 12312855Sgabeblack@google.com sc_fxval b((ushort)1); 12412855Sgabeblack@google.com sc_fxval c((ushort)-1); 12512855Sgabeblack@google.com sc_fxval d(USHRT_MAX); 12612855Sgabeblack@google.com sc_fxval e((ushort)abs(SHRT_MIN)); 12712855Sgabeblack@google.com 12812855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 12912855Sgabeblack@google.com} 13012855Sgabeblack@google.com 13112855Sgabeblack@google.comstatic void test_fx_float_long() 13212855Sgabeblack@google.com{ 13312855Sgabeblack@google.com IDENT("test_fx_float_long"); 13412855Sgabeblack@google.com 13512855Sgabeblack@google.com sc_fxval a((long)0); 13612855Sgabeblack@google.com sc_fxval b((long)1); 13712855Sgabeblack@google.com sc_fxval c((long)-1); 13812855Sgabeblack@google.com sc_fxval d(LONG_MAX); 13912855Sgabeblack@google.com sc_fxval e(LONG_MIN); 14012855Sgabeblack@google.com 14112855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 14212855Sgabeblack@google.com} 14312855Sgabeblack@google.com 14412855Sgabeblack@google.comstatic void test_fx_float_ulong() 14512855Sgabeblack@google.com{ 14612855Sgabeblack@google.com IDENT("test_fx_float_ulong"); 14712855Sgabeblack@google.com 14812855Sgabeblack@google.com sc_fxval a((ulong)0); 14912855Sgabeblack@google.com sc_fxval b((ulong)1); 15012855Sgabeblack@google.com sc_fxval c((ulong)-1); 15112855Sgabeblack@google.com sc_fxval d(ULONG_MAX); 15212855Sgabeblack@google.com sc_fxval e((ulong)abs(LONG_MIN)); 15312855Sgabeblack@google.com 15412855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 15512855Sgabeblack@google.com} 15612855Sgabeblack@google.com 15712855Sgabeblack@google.comstatic void test_fx_float_float() 15812855Sgabeblack@google.com{ 15912855Sgabeblack@google.com IDENT("test_fx_float_float"); 16012855Sgabeblack@google.com 16112855Sgabeblack@google.com sc_fxval a(0.0); 16212855Sgabeblack@google.com sc_fxval b(1.0); 16312855Sgabeblack@google.com sc_fxval c(-1.0); 16412855Sgabeblack@google.com sc_fxval d(FLT_MAX); 16512855Sgabeblack@google.com sc_fxval e(FLT_MIN); 16612855Sgabeblack@google.com 16712855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 16812855Sgabeblack@google.com} 16912855Sgabeblack@google.com 17012855Sgabeblack@google.comstatic void test_fx_float_double() 17112855Sgabeblack@google.com{ 17212855Sgabeblack@google.com IDENT("test_fx_float_double"); 17312855Sgabeblack@google.com 17412855Sgabeblack@google.com sc_fxval a((double)0.0); 17512855Sgabeblack@google.com sc_fxval b((double)1.0); 17612855Sgabeblack@google.com sc_fxval c((double)-1.0); 17712855Sgabeblack@google.com sc_fxval d(DBL_MAX); 17812855Sgabeblack@google.com sc_fxval e(DBL_MIN); 17912855Sgabeblack@google.com 18012855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 18112855Sgabeblack@google.com} 18212855Sgabeblack@google.com 18312855Sgabeblack@google.com//----------------------------------------------------------------------- 18412855Sgabeblack@google.comstatic void test_fx_ufix_char() 18512855Sgabeblack@google.com{ 18612855Sgabeblack@google.com IDENT("test_fx_ufix_char"); 18712855Sgabeblack@google.com 18812855Sgabeblack@google.com sc_ufix a("0"); 18912855Sgabeblack@google.com sc_ufix b("1"); 19012855Sgabeblack@google.com sc_ufix c("-1"); 19112855Sgabeblack@google.com sc_ufix d(T_UCHAR_MAX); 19212855Sgabeblack@google.com sc_ufix e(T_UCHAR_MIN); 19312855Sgabeblack@google.com 19412855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 19512855Sgabeblack@google.com} 19612855Sgabeblack@google.com 19712855Sgabeblack@google.comstatic void test_fx_ufix_int() 19812855Sgabeblack@google.com{ 19912855Sgabeblack@google.com IDENT("test_fx_ufix_int"); 20012855Sgabeblack@google.com 20112855Sgabeblack@google.com sc_ufix a(0); 20212855Sgabeblack@google.com sc_ufix b(1); 20312855Sgabeblack@google.com sc_ufix c(-1); 20412855Sgabeblack@google.com sc_ufix d(INT_MAX); 20512855Sgabeblack@google.com sc_ufix e(INT_MIN); 20612855Sgabeblack@google.com 20712855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 20812855Sgabeblack@google.com} 20912855Sgabeblack@google.com 21012855Sgabeblack@google.comstatic void test_fx_ufix_uint() 21112855Sgabeblack@google.com{ 21212855Sgabeblack@google.com IDENT("test_fx_ufix_uint"); 21312855Sgabeblack@google.com 21412855Sgabeblack@google.com sc_ufix a((uint)0); 21512855Sgabeblack@google.com sc_ufix b((uint)1); 21612855Sgabeblack@google.com sc_ufix c((uint)-1); 21712855Sgabeblack@google.com sc_ufix d(UINT_MAX); 21812855Sgabeblack@google.com sc_ufix e((uint)abs(INT_MIN)); 21912855Sgabeblack@google.com 22012855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 22112855Sgabeblack@google.com} 22212855Sgabeblack@google.com 22312855Sgabeblack@google.comstatic void test_fx_ufix_short() 22412855Sgabeblack@google.com{ 22512855Sgabeblack@google.com IDENT("test_fx_ufix_short"); 22612855Sgabeblack@google.com 22712855Sgabeblack@google.com sc_ufix a((short)0); 22812855Sgabeblack@google.com sc_ufix b((short)1); 22912855Sgabeblack@google.com sc_ufix c((short)-1); 23012855Sgabeblack@google.com sc_ufix d(SHRT_MAX); 23112855Sgabeblack@google.com sc_ufix e(SHRT_MIN); 23212855Sgabeblack@google.com 23312855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 23412855Sgabeblack@google.com} 23512855Sgabeblack@google.com 23612855Sgabeblack@google.comstatic void test_fx_ufix_ushort() 23712855Sgabeblack@google.com{ 23812855Sgabeblack@google.com IDENT("test_fx_ufix_ushort"); 23912855Sgabeblack@google.com 24012855Sgabeblack@google.com sc_ufix a((ushort)0); 24112855Sgabeblack@google.com sc_ufix b((ushort)1); 24212855Sgabeblack@google.com sc_ufix c((ushort)-1); 24312855Sgabeblack@google.com sc_ufix d(USHRT_MAX); 24412855Sgabeblack@google.com sc_ufix e((ushort)abs(SHRT_MIN)); 24512855Sgabeblack@google.com 24612855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 24712855Sgabeblack@google.com} 24812855Sgabeblack@google.com 24912855Sgabeblack@google.comstatic void test_fx_ufix_long() 25012855Sgabeblack@google.com{ 25112855Sgabeblack@google.com IDENT("test_fx_ufix_long"); 25212855Sgabeblack@google.com 25312855Sgabeblack@google.com sc_ufix a((long)0); 25412855Sgabeblack@google.com sc_ufix b((long)1); 25512855Sgabeblack@google.com sc_ufix c((long)-1); 25612855Sgabeblack@google.com sc_ufix d(LONG_MAX); 25712855Sgabeblack@google.com sc_ufix e(LONG_MIN); 25812855Sgabeblack@google.com 25912855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 26012855Sgabeblack@google.com} 26112855Sgabeblack@google.com 26212855Sgabeblack@google.comstatic void test_fx_ufix_ulong() 26312855Sgabeblack@google.com{ 26412855Sgabeblack@google.com IDENT("test_fx_ufix_ulong"); 26512855Sgabeblack@google.com 26612855Sgabeblack@google.com sc_ufix a((ulong)0); 26712855Sgabeblack@google.com sc_ufix b((ulong)1); 26812855Sgabeblack@google.com sc_ufix c((ulong)-1); 26912855Sgabeblack@google.com sc_ufix d(ULONG_MAX); 27012855Sgabeblack@google.com sc_ufix e((ulong)abs(LONG_MIN)); 27112855Sgabeblack@google.com 27212855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 27312855Sgabeblack@google.com} 27412855Sgabeblack@google.com 27512855Sgabeblack@google.comstatic void test_fx_ufix_float() 27612855Sgabeblack@google.com{ 27712855Sgabeblack@google.com IDENT("test_fx_ufix_float"); 27812855Sgabeblack@google.com 27912855Sgabeblack@google.com sc_ufix a(0.0); 28012855Sgabeblack@google.com sc_ufix b(1.0); 28112855Sgabeblack@google.com sc_ufix c(-1.0); 28212855Sgabeblack@google.com sc_ufix d(FLT_MAX); 28312855Sgabeblack@google.com sc_ufix e(FLT_MIN); 28412855Sgabeblack@google.com 28512855Sgabeblack@google.com// cerr << "sc_ufix d(FLT_MAX); does not work (yet)\n"; 28612855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 28712855Sgabeblack@google.com} 28812855Sgabeblack@google.com 28912855Sgabeblack@google.comstatic void test_fx_ufix_double() 29012855Sgabeblack@google.com{ 29112855Sgabeblack@google.com IDENT("test_fx_ufix_double"); 29212855Sgabeblack@google.com 29312855Sgabeblack@google.com sc_ufix a((double)0.0); 29412855Sgabeblack@google.com sc_ufix b((double)1.0); 29512855Sgabeblack@google.com sc_ufix c((double)-1.0); 29612855Sgabeblack@google.com sc_ufix d(DBL_MAX); 29712855Sgabeblack@google.com sc_ufix e(DBL_MIN); 29812855Sgabeblack@google.com 29912855Sgabeblack@google.com// cerr << "sc_ufix d(DBL_MAX); does not work (yet)\n"; 30012855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 30112855Sgabeblack@google.com} 30212855Sgabeblack@google.com 30312855Sgabeblack@google.com//----------------------------------------------------------------------- 30412855Sgabeblack@google.comstatic void test_fx_fix_char() 30512855Sgabeblack@google.com{ 30612855Sgabeblack@google.com IDENT("test_fx_fix_char"); 30712855Sgabeblack@google.com 30812855Sgabeblack@google.com sc_fix a("0"); SHOW(a); 30912855Sgabeblack@google.com sc_fix b("1"); SHOW(b); 31012855Sgabeblack@google.com sc_fix c("-1"); SHOW(c); 31112855Sgabeblack@google.com sc_fix d(T_CHAR_MAX); SHOW(d); 31212855Sgabeblack@google.com sc_fix e(T_CHAR_MIN); SHOW(e); 31312855Sgabeblack@google.com 31412855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 31512855Sgabeblack@google.com} 31612855Sgabeblack@google.com 31712855Sgabeblack@google.comstatic void test_fx_fix_int() 31812855Sgabeblack@google.com{ 31912855Sgabeblack@google.com IDENT("test_fx_fix_int"); 32012855Sgabeblack@google.com 32112855Sgabeblack@google.com sc_fix a(0); 32212855Sgabeblack@google.com sc_fix b(1); 32312855Sgabeblack@google.com sc_fix c(-1); 32412855Sgabeblack@google.com sc_fix d(INT_MAX); 32512855Sgabeblack@google.com sc_fix e(INT_MIN); 32612855Sgabeblack@google.com 32712855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 32812855Sgabeblack@google.com} 32912855Sgabeblack@google.com 33012855Sgabeblack@google.comstatic void test_fx_fix_uint() 33112855Sgabeblack@google.com{ 33212855Sgabeblack@google.com IDENT("test_fx_fix_uint"); 33312855Sgabeblack@google.com 33412855Sgabeblack@google.com sc_fix a((uint)0); 33512855Sgabeblack@google.com sc_fix b((uint)1); 33612855Sgabeblack@google.com sc_fix c((uint)-1); 33712855Sgabeblack@google.com sc_fix d(UINT_MAX); 33812855Sgabeblack@google.com sc_fix e((uint)abs(INT_MIN)); 33912855Sgabeblack@google.com 34012855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 34112855Sgabeblack@google.com} 34212855Sgabeblack@google.comstatic void test_fx_fix_short() 34312855Sgabeblack@google.com{ 34412855Sgabeblack@google.com IDENT("test_fx_fix_short"); 34512855Sgabeblack@google.com 34612855Sgabeblack@google.com sc_fix a((short)0); 34712855Sgabeblack@google.com sc_fix b((short)1); 34812855Sgabeblack@google.com sc_fix c((short)-1); 34912855Sgabeblack@google.com sc_fix d(SHRT_MAX); 35012855Sgabeblack@google.com sc_fix e(SHRT_MIN); 35112855Sgabeblack@google.com 35212855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 35312855Sgabeblack@google.com} 35412855Sgabeblack@google.com 35512855Sgabeblack@google.comstatic void test_fx_fix_ushort() 35612855Sgabeblack@google.com{ 35712855Sgabeblack@google.com IDENT("test_fx_fix_ushort"); 35812855Sgabeblack@google.com 35912855Sgabeblack@google.com sc_fix a((ushort)0); 36012855Sgabeblack@google.com sc_fix b((ushort)1); 36112855Sgabeblack@google.com sc_fix c((ushort)-1); 36212855Sgabeblack@google.com sc_fix d(USHRT_MAX); 36312855Sgabeblack@google.com sc_fix e((ushort)abs(SHRT_MIN)); 36412855Sgabeblack@google.com 36512855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 36612855Sgabeblack@google.com} 36712855Sgabeblack@google.com 36812855Sgabeblack@google.comstatic void test_fx_fix_long() 36912855Sgabeblack@google.com{ 37012855Sgabeblack@google.com IDENT("test_fx_fix_long"); 37112855Sgabeblack@google.com 37212855Sgabeblack@google.com sc_fix a((long)0); 37312855Sgabeblack@google.com sc_fix b((long)1); 37412855Sgabeblack@google.com sc_fix c((long)-1); 37512855Sgabeblack@google.com sc_fix d(LONG_MAX); 37612855Sgabeblack@google.com sc_fix e(LONG_MIN); 37712855Sgabeblack@google.com 37812855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 37912855Sgabeblack@google.com} 38012855Sgabeblack@google.com 38112855Sgabeblack@google.comstatic void test_fx_fix_ulong() 38212855Sgabeblack@google.com{ 38312855Sgabeblack@google.com IDENT("test_fx_fix_ulong"); 38412855Sgabeblack@google.com 38512855Sgabeblack@google.com sc_fix a((ulong)0); 38612855Sgabeblack@google.com sc_fix b((ulong)1); 38712855Sgabeblack@google.com sc_fix c((ulong)-1); 38812855Sgabeblack@google.com sc_fix d(ULONG_MAX); 38912855Sgabeblack@google.com sc_fix e((ulong)abs(LONG_MIN)); 39012855Sgabeblack@google.com 39112855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 39212855Sgabeblack@google.com} 39312855Sgabeblack@google.com 39412855Sgabeblack@google.comstatic void test_fx_fix_float() 39512855Sgabeblack@google.com{ 39612855Sgabeblack@google.com IDENT("test_fx_fix_float"); 39712855Sgabeblack@google.com 39812855Sgabeblack@google.com sc_fix a(0.0); 39912855Sgabeblack@google.com sc_fix b(1.0); 40012855Sgabeblack@google.com sc_fix c(-1.0); 40112855Sgabeblack@google.com sc_fix d(FLT_MAX); 40212855Sgabeblack@google.com sc_fix e(FLT_MIN); 40312855Sgabeblack@google.com 40412855Sgabeblack@google.com// cerr << "sc_fix d(FLT_MAX); does not work (yet)\n"; 40512855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 40612855Sgabeblack@google.com} 40712855Sgabeblack@google.com 40812855Sgabeblack@google.comstatic void test_fx_fix_double() 40912855Sgabeblack@google.com{ 41012855Sgabeblack@google.com IDENT("test_fx_fix_double"); 41112855Sgabeblack@google.com 41212855Sgabeblack@google.com sc_fix a((double)0.0); 41312855Sgabeblack@google.com sc_fix b((double)1.0); 41412855Sgabeblack@google.com sc_fix c((double)-1.0); 41512855Sgabeblack@google.com sc_fix d(DBL_MAX); 41612855Sgabeblack@google.com sc_fix e(DBL_MIN); 41712855Sgabeblack@google.com 41812855Sgabeblack@google.com// cerr << "sc_fix d(DBL_MAX); does not work (yet)\n"; 41912855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 42012855Sgabeblack@google.com} 42112855Sgabeblack@google.com 42212855Sgabeblack@google.com//----------------------------------------------------------------------- 42312855Sgabeblack@google.comstatic void test_fx_fixed_char() 42412855Sgabeblack@google.com{ 42512855Sgabeblack@google.com IDENT("test_fx_fixed_char"); 42612855Sgabeblack@google.com 42712855Sgabeblack@google.com sc_fixed<8, 5> a("0"); 42812855Sgabeblack@google.com sc_fixed<8, 5> b("1"); 42912855Sgabeblack@google.com sc_fixed<8, 5> c("-1"); 43012855Sgabeblack@google.com sc_fixed<8, 5> d(T_CHAR_MAX); 43112855Sgabeblack@google.com sc_fixed<8, 5> e(T_CHAR_MIN); 43212855Sgabeblack@google.com 43312855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n"; 43412855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 43512855Sgabeblack@google.com} 43612855Sgabeblack@google.com 43712855Sgabeblack@google.comstatic void test_fx_fixed_int() 43812855Sgabeblack@google.com{ 43912855Sgabeblack@google.com IDENT("test_fx_fixed_int"); 44012855Sgabeblack@google.com 44112855Sgabeblack@google.com sc_fixed<8, 5> a(0); 44212855Sgabeblack@google.com sc_fixed<8, 5> b(1); 44312855Sgabeblack@google.com sc_fixed<8, 5> c(-1); 44412855Sgabeblack@google.com sc_fixed<8, 5> d(INT_MAX); 44512855Sgabeblack@google.com sc_fixed<8, 5> e(INT_MIN); 44612855Sgabeblack@google.com 44712855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n"; 44812855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 44912855Sgabeblack@google.com} 45012855Sgabeblack@google.com 45112855Sgabeblack@google.comstatic void test_fx_fixed_uint() 45212855Sgabeblack@google.com{ 45312855Sgabeblack@google.com IDENT("test_sc_fixed_uint"); 45412855Sgabeblack@google.com 45512855Sgabeblack@google.com sc_fixed<8, 5> a((uint)0); 45612855Sgabeblack@google.com sc_fixed<8, 5> b((uint)1); 45712855Sgabeblack@google.com sc_fixed<8, 5> c((uint)-1); 45812855Sgabeblack@google.com sc_fixed<8, 5> d(UINT_MAX); 45912855Sgabeblack@google.com sc_fixed<8, 5> e((uint)abs(INT_MIN)); 46012855Sgabeblack@google.com 46112855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(UINT_MAX); does not work\n"; 46212855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 46312855Sgabeblack@google.com} 46412855Sgabeblack@google.com 46512855Sgabeblack@google.comstatic void test_fx_fixed_short() 46612855Sgabeblack@google.com{ 46712855Sgabeblack@google.com IDENT("test_fx_fixed_short"); 46812855Sgabeblack@google.com 46912855Sgabeblack@google.com sc_fixed<8, 5> a((short)0); 47012855Sgabeblack@google.com sc_fixed<8, 5> b((short)1); 47112855Sgabeblack@google.com sc_fixed<8, 5> c((short)-1); 47212855Sgabeblack@google.com sc_fixed<8, 5> d(SHRT_MAX); 47312855Sgabeblack@google.com sc_fixed<8, 5> e(SHRT_MIN); 47412855Sgabeblack@google.com 47512855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(INT_MAX); does not work\n"; 47612855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 47712855Sgabeblack@google.com} 47812855Sgabeblack@google.com 47912855Sgabeblack@google.comstatic void test_fx_fixed_ushort() 48012855Sgabeblack@google.com{ 48112855Sgabeblack@google.com IDENT("test_sc_fixed_ushort"); 48212855Sgabeblack@google.com 48312855Sgabeblack@google.com sc_fixed<8, 5> a((ushort)0); 48412855Sgabeblack@google.com sc_fixed<8, 5> b((ushort)1); 48512855Sgabeblack@google.com sc_fixed<8, 5> c((ushort)-1); 48612855Sgabeblack@google.com sc_fixed<8, 5> d(USHRT_MAX); 48712855Sgabeblack@google.com sc_fixed<8, 5> e((ushort)abs(SHRT_MIN)); 48812855Sgabeblack@google.com 48912855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(UINT_MAX); does not work\n"; 49012855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 49112855Sgabeblack@google.com} 49212855Sgabeblack@google.com 49312855Sgabeblack@google.comstatic void test_fx_fixed_long() 49412855Sgabeblack@google.com{ 49512855Sgabeblack@google.com IDENT("test_sc_fixeded_long"); 49612855Sgabeblack@google.com 49712855Sgabeblack@google.com sc_fixed<8, 5> a((long)0); 49812855Sgabeblack@google.com sc_fixed<8, 5> b((long)1); 49912855Sgabeblack@google.com sc_fixed<8, 5> c((long)-1); 50012855Sgabeblack@google.com sc_fixed<8, 5> d(LONG_MAX); 50112855Sgabeblack@google.com sc_fixed<8, 5> e(LONG_MIN); 50212855Sgabeblack@google.com 50312855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(INT_LONG); does not work\n"; 50412855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 50512855Sgabeblack@google.com} 50612855Sgabeblack@google.com 50712855Sgabeblack@google.comstatic void test_fx_fixed_ulong() 50812855Sgabeblack@google.com{ 50912855Sgabeblack@google.com IDENT("test_fx_fixed_ulong"); 51012855Sgabeblack@google.com 51112855Sgabeblack@google.com sc_fixed<8, 5> a((ulong)0); 51212855Sgabeblack@google.com sc_fixed<8, 5> b((ulong)1); 51312855Sgabeblack@google.com sc_fixed<8, 5> c((ulong)-1); 51412855Sgabeblack@google.com sc_fixed<8, 5> d(ULONG_MAX); 51512855Sgabeblack@google.com sc_fixed<8, 5> e((ulong)abs(LONG_MIN)); 51612855Sgabeblack@google.com 51712855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(ULONG_MAX); does not work\n"; 51812855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 51912855Sgabeblack@google.com} 52012855Sgabeblack@google.com 52112855Sgabeblack@google.comstatic void test_fx_fixed_float() 52212855Sgabeblack@google.com{ 52312855Sgabeblack@google.com IDENT("test_fx_fixed_float"); 52412855Sgabeblack@google.com 52512855Sgabeblack@google.com sc_fixed<8, 5> a(0.0); 52612855Sgabeblack@google.com sc_fixed<8, 5> b(1.0); 52712855Sgabeblack@google.com sc_fixed<8, 5> c(-1.0); 52812855Sgabeblack@google.com sc_fixed<8, 5> d(FLT_MAX); 52912855Sgabeblack@google.com sc_fixed<8, 5> e(FLT_MIN); 53012855Sgabeblack@google.com 53112855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(FLT_MAX); does not work (yet)\n"; 53212855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 53312855Sgabeblack@google.com} 53412855Sgabeblack@google.com 53512855Sgabeblack@google.comstatic void test_fx_fixed_double() 53612855Sgabeblack@google.com{ 53712855Sgabeblack@google.com IDENT("test_fx_fixed_double"); 53812855Sgabeblack@google.com 53912855Sgabeblack@google.com sc_fixed<8, 5> a((double)0.0); 54012855Sgabeblack@google.com sc_fixed<8, 5> b((double)1.0); 54112855Sgabeblack@google.com sc_fixed<8, 5> c((double)-1.0); 54212855Sgabeblack@google.com sc_fixed<8, 5> d(DBL_MAX); 54312855Sgabeblack@google.com sc_fixed<8, 5> e(DBL_MIN); 54412855Sgabeblack@google.com 54512855Sgabeblack@google.com// cerr << "sc_fixed<8, 5> d(DBL_MAX); does not work (yet)\n"; 54612855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 54712855Sgabeblack@google.com} 54812855Sgabeblack@google.com 54912855Sgabeblack@google.com//----------------------------------------------------------------------- 55012855Sgabeblack@google.comstatic void test_fx_ufixed_char() 55112855Sgabeblack@google.com{ 55212855Sgabeblack@google.com IDENT("test_fx_ufixed_char"); 55312855Sgabeblack@google.com 55412855Sgabeblack@google.com sc_ufixed<8, 5> a("0"); 55512855Sgabeblack@google.com sc_ufixed<8, 5> b("1"); 55612855Sgabeblack@google.com sc_ufixed<8, 5> c("-1"); 55712855Sgabeblack@google.com sc_ufixed<8, 5> d(T_UCHAR_MAX); 55812855Sgabeblack@google.com sc_ufixed<8, 5> e(T_UCHAR_MIN); 55912855Sgabeblack@google.com 56012855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n"; 56112855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 56212855Sgabeblack@google.com} 56312855Sgabeblack@google.com 56412855Sgabeblack@google.comstatic void test_fx_ufixed_int() 56512855Sgabeblack@google.com{ 56612855Sgabeblack@google.com IDENT("test_fx_ufixed_int"); 56712855Sgabeblack@google.com 56812855Sgabeblack@google.com sc_ufixed<8, 5> a(0); 56912855Sgabeblack@google.com sc_ufixed<8, 5> b(1); 57012855Sgabeblack@google.com sc_ufixed<8, 5> c(-1); 57112855Sgabeblack@google.com sc_ufixed<8, 5> d(INT_MAX); 57212855Sgabeblack@google.com sc_ufixed<8, 5> e(INT_MIN); 57312855Sgabeblack@google.com 57412855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n"; 57512855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 57612855Sgabeblack@google.com} 57712855Sgabeblack@google.com 57812855Sgabeblack@google.comstatic void test_fx_ufixed_uint() 57912855Sgabeblack@google.com{ 58012855Sgabeblack@google.com IDENT("test_fx_ufixed_uint"); 58112855Sgabeblack@google.com 58212855Sgabeblack@google.com sc_ufixed<8, 5> a((uint)0); 58312855Sgabeblack@google.com sc_ufixed<8, 5> b((uint)1); 58412855Sgabeblack@google.com sc_ufixed<8, 5> c((uint)-1); 58512855Sgabeblack@google.com sc_ufixed<8, 5> d(UINT_MAX); 58612855Sgabeblack@google.com sc_ufixed<8, 5> e((uint)abs(INT_MIN)); 58712855Sgabeblack@google.com 58812855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(UINT_MAX); does not work\n"; 58912855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 59012855Sgabeblack@google.com} 59112855Sgabeblack@google.com 59212855Sgabeblack@google.comstatic void test_fx_ufixed_short() 59312855Sgabeblack@google.com{ 59412855Sgabeblack@google.com IDENT("test_fx_ufixed_short"); 59512855Sgabeblack@google.com 59612855Sgabeblack@google.com sc_ufixed<8, 5> a((short)0); 59712855Sgabeblack@google.com sc_ufixed<8, 5> b((short)1); 59812855Sgabeblack@google.com sc_ufixed<8, 5> c((short)-1); 59912855Sgabeblack@google.com sc_ufixed<8, 5> d(SHRT_MAX); 60012855Sgabeblack@google.com sc_ufixed<8, 5> e(SHRT_MIN); 60112855Sgabeblack@google.com 60212855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(INT_MAX); does not work\n"; 60312855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 60412855Sgabeblack@google.com} 60512855Sgabeblack@google.com 60612855Sgabeblack@google.comstatic void test_fx_ufixed_ushort() 60712855Sgabeblack@google.com{ 60812855Sgabeblack@google.com IDENT("test_fx_ufixed_ushort"); 60912855Sgabeblack@google.com 61012855Sgabeblack@google.com sc_ufixed<8, 5> a((ushort)0); 61112855Sgabeblack@google.com sc_ufixed<8, 5> b((ushort)1); 61212855Sgabeblack@google.com sc_ufixed<8, 5> c((ushort)-1); 61312855Sgabeblack@google.com sc_ufixed<8, 5> d(USHRT_MAX); 61412855Sgabeblack@google.com sc_ufixed<8, 5> e((ushort)abs(SHRT_MIN)); 61512855Sgabeblack@google.com 61612855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(UINT_MAX); does not work\n"; 61712855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 61812855Sgabeblack@google.com} 61912855Sgabeblack@google.com 62012855Sgabeblack@google.comstatic void test_fx_ufixed_long() 62112855Sgabeblack@google.com{ 62212855Sgabeblack@google.com IDENT("test_fx_ufixeded_long"); 62312855Sgabeblack@google.com 62412855Sgabeblack@google.com sc_ufixed<8, 5> a((long)0); 62512855Sgabeblack@google.com sc_ufixed<8, 5> b((long)1); 62612855Sgabeblack@google.com sc_ufixed<8, 5> c((long)-1); 62712855Sgabeblack@google.com sc_ufixed<8, 5> d(LONG_MAX); 62812855Sgabeblack@google.com sc_ufixed<8, 5> e(LONG_MIN); 62912855Sgabeblack@google.com 63012855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(INT_LONG); does not work\n"; 63112855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 63212855Sgabeblack@google.com} 63312855Sgabeblack@google.com 63412855Sgabeblack@google.comstatic void test_fx_ufixed_ulong() 63512855Sgabeblack@google.com{ 63612855Sgabeblack@google.com IDENT("test_fx_ufixed_ulong"); 63712855Sgabeblack@google.com 63812855Sgabeblack@google.com sc_ufixed<8, 5> a((ulong)0); 63912855Sgabeblack@google.com sc_ufixed<8, 5> b((ulong)1); 64012855Sgabeblack@google.com sc_ufixed<8, 5> c((ulong)-1); 64112855Sgabeblack@google.com sc_ufixed<8, 5> d(ULONG_MAX); 64212855Sgabeblack@google.com sc_ufixed<8, 5> e((ulong)abs(LONG_MIN)); 64312855Sgabeblack@google.com 64412855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(ULONG_MAX); does not work\n"; 64512855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 64612855Sgabeblack@google.com} 64712855Sgabeblack@google.com 64812855Sgabeblack@google.comstatic void test_fx_ufixed_float() 64912855Sgabeblack@google.com{ 65012855Sgabeblack@google.com IDENT("test_fx_ufixed_float"); 65112855Sgabeblack@google.com 65212855Sgabeblack@google.com sc_ufixed<8, 5> a(0.0); 65312855Sgabeblack@google.com sc_ufixed<8, 5> b(1.0); 65412855Sgabeblack@google.com sc_ufixed<8, 5> c(-1.0); 65512855Sgabeblack@google.com sc_ufixed<8, 5> d(FLT_MAX); 65612855Sgabeblack@google.com sc_ufixed<8, 5> e(FLT_MIN); 65712855Sgabeblack@google.com 65812855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(FLT_MAX); does not work (yet)\n"; 65912855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 66012855Sgabeblack@google.com} 66112855Sgabeblack@google.com 66212855Sgabeblack@google.comstatic void test_fx_ufixed_double() 66312855Sgabeblack@google.com{ 66412855Sgabeblack@google.com IDENT("test_fx_ufixed_double"); 66512855Sgabeblack@google.com 66612855Sgabeblack@google.com sc_ufixed<8, 5> a((double)0.0); 66712855Sgabeblack@google.com sc_ufixed<8, 5> b((double)1.0); 66812855Sgabeblack@google.com sc_ufixed<8, 5> c((double)-1.0); 66912855Sgabeblack@google.com sc_ufixed<8, 5> d(DBL_MAX); 67012855Sgabeblack@google.com sc_ufixed<8, 5> e(DBL_MIN); 67112855Sgabeblack@google.com 67212855Sgabeblack@google.com// cerr << "sc_ufixed<8, 5> d(DBL_MAX); does not work (yet)\n"; 67312855Sgabeblack@google.com SHOW(a); SHOW(b); SHOW(c); SHOW(d); SHOW(e); 67412855Sgabeblack@google.com} 67512855Sgabeblack@google.com 67612855Sgabeblack@google.comvoid default_constructor() 67712855Sgabeblack@google.com{ 67812855Sgabeblack@google.com cerr << "************** default_constructor for fx_float\n"; 67912855Sgabeblack@google.com test_fx_float_char(); 68012855Sgabeblack@google.com test_fx_float_int(); 68112855Sgabeblack@google.com test_fx_float_uint(); 68212855Sgabeblack@google.com test_fx_float_short(); 68312855Sgabeblack@google.com test_fx_float_ushort(); 68412855Sgabeblack@google.com test_fx_float_long(); 68512855Sgabeblack@google.com test_fx_float_ulong(); 68612855Sgabeblack@google.com test_fx_float_float(); 68712855Sgabeblack@google.com test_fx_float_double(); 68812855Sgabeblack@google.com 68912855Sgabeblack@google.com cerr << "************** default_constructor for fx_ufix\n"; 69012855Sgabeblack@google.com test_fx_ufix_char(); 69112855Sgabeblack@google.com test_fx_ufix_int(); 69212855Sgabeblack@google.com test_fx_ufix_uint(); 69312855Sgabeblack@google.com test_fx_ufix_short(); 69412855Sgabeblack@google.com test_fx_ufix_ushort(); 69512855Sgabeblack@google.com test_fx_ufix_long(); 69612855Sgabeblack@google.com test_fx_ufix_ulong(); 69712855Sgabeblack@google.com test_fx_ufix_float(); 69812855Sgabeblack@google.com test_fx_ufix_double(); 69912855Sgabeblack@google.com 70012855Sgabeblack@google.com cerr << "************** default_constructor for fx_fix\n"; 70112855Sgabeblack@google.com test_fx_fix_char(); 70212855Sgabeblack@google.com test_fx_fix_int(); 70312855Sgabeblack@google.com test_fx_fix_uint(); 70412855Sgabeblack@google.com test_fx_fix_short(); 70512855Sgabeblack@google.com test_fx_fix_ushort(); 70612855Sgabeblack@google.com test_fx_fix_long(); 70712855Sgabeblack@google.com test_fx_fix_ulong(); 70812855Sgabeblack@google.com test_fx_fix_float(); 70912855Sgabeblack@google.com test_fx_fix_double(); 71012855Sgabeblack@google.com 71112855Sgabeblack@google.com cerr << "************** default_constructor for <wl,iwl>fx_fixed\n"; 71212855Sgabeblack@google.com test_fx_fixed_char(); 71312855Sgabeblack@google.com test_fx_fixed_int(); 71412855Sgabeblack@google.com test_fx_fixed_uint(); 71512855Sgabeblack@google.com test_fx_fixed_short(); 71612855Sgabeblack@google.com test_fx_fixed_ushort(); 71712855Sgabeblack@google.com test_fx_fixed_long(); 71812855Sgabeblack@google.com test_fx_fixed_ulong(); 71912855Sgabeblack@google.com test_fx_fixed_float(); 72012855Sgabeblack@google.com test_fx_fixed_double(); 72112855Sgabeblack@google.com 72212855Sgabeblack@google.com cerr << "************** default_constructor for <wl,iwl>fx_ufixed\n"; 72312855Sgabeblack@google.com test_fx_ufixed_char(); 72412855Sgabeblack@google.com test_fx_ufixed_int(); 72512855Sgabeblack@google.com test_fx_ufixed_uint(); 72612855Sgabeblack@google.com test_fx_ufixed_short(); 72712855Sgabeblack@google.com test_fx_ufixed_ushort(); 72812855Sgabeblack@google.com test_fx_ufixed_long(); 72912855Sgabeblack@google.com test_fx_ufixed_ulong(); 73012855Sgabeblack@google.com test_fx_ufixed_float(); 73112855Sgabeblack@google.com test_fx_ufixed_double(); 73212855Sgabeblack@google.com} 733