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  test01.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// test of i/o streaming of the datatypes
3912855Sgabeblack@google.com
4012855Sgabeblack@google.com#define SC_INCLUDE_FX
4112855Sgabeblack@google.com#include "systemc.h"
4212855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
4312855Sgabeblack@google.com#   include "sstream"
4412855Sgabeblack@google.com#else
4512855Sgabeblack@google.com#   include "strstream.h"
4612855Sgabeblack@google.com#endif
4712855Sgabeblack@google.com
4812855Sgabeblack@google.com// THE FOLLOWING SPECIALIZATIONS FOR sc_bitref<X> AND sc_subref<X> GO AWAY
4912855Sgabeblack@google.com// WHEN sc_bv and sc_lv ARE INTEGRATED INTO THE NORMAL CONCATENATION SCHEME:
5012855Sgabeblack@google.com
5112855Sgabeblack@google.comtemplate <class X>
5212855Sgabeblack@google.comvoid
5312855Sgabeblack@google.comtest( sc_dt::sc_bitref<X> a )
5412855Sgabeblack@google.com{
5512855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
5612855Sgabeblack@google.com    std::stringstream ss;
5712855Sgabeblack@google.com# else
5812855Sgabeblack@google.com	strstream ss;
5912855Sgabeblack@google.com# endif
6012855Sgabeblack@google.com
6112855Sgabeblack@google.com    cout << a << endl;
6212855Sgabeblack@google.com    ss << a;
6312855Sgabeblack@google.com    ss >> a;
6412855Sgabeblack@google.com    cout << a << endl;
6512855Sgabeblack@google.com}
6612855Sgabeblack@google.com
6712855Sgabeblack@google.comtemplate <class X>
6812855Sgabeblack@google.comvoid
6912855Sgabeblack@google.comtest( sc_dt::sc_subref<X> a )
7012855Sgabeblack@google.com{
7112855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
7212855Sgabeblack@google.com    std::stringstream ss;
7312855Sgabeblack@google.com# else
7412855Sgabeblack@google.com	strstream ss;
7512855Sgabeblack@google.com# endif
7612855Sgabeblack@google.com
7712855Sgabeblack@google.com    cout << a << endl;
7812855Sgabeblack@google.com    ss << a;
7912855Sgabeblack@google.com    ss >> a;
8012855Sgabeblack@google.com    cout << a << endl;
8112855Sgabeblack@google.com}
8212855Sgabeblack@google.com
8312855Sgabeblack@google.com
8412855Sgabeblack@google.comvoid
8512855Sgabeblack@google.comtest( sc_dt::sc_fxnum_bitref a )
8612855Sgabeblack@google.com{
8712855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
8812855Sgabeblack@google.com    std::stringstream ss;
8912855Sgabeblack@google.com# else
9012855Sgabeblack@google.com	strstream ss;
9112855Sgabeblack@google.com# endif
9212855Sgabeblack@google.com
9312855Sgabeblack@google.com    cout << a << endl;
9412855Sgabeblack@google.com    ss << a;
9512855Sgabeblack@google.com    ss >> a;
9612855Sgabeblack@google.com    cout << a << endl;
9712855Sgabeblack@google.com}
9812855Sgabeblack@google.com
9912855Sgabeblack@google.comvoid
10012855Sgabeblack@google.comtest( sc_dt::sc_fxnum_fast_bitref a )
10112855Sgabeblack@google.com{
10212855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
10312855Sgabeblack@google.com    std::stringstream ss;
10412855Sgabeblack@google.com# else
10512855Sgabeblack@google.com	strstream ss;
10612855Sgabeblack@google.com# endif
10712855Sgabeblack@google.com
10812855Sgabeblack@google.com    cout << a << endl;
10912855Sgabeblack@google.com    ss << a;
11012855Sgabeblack@google.com    ss >> a;
11112855Sgabeblack@google.com    cout << a << endl;
11212855Sgabeblack@google.com}
11312855Sgabeblack@google.com
11412855Sgabeblack@google.com
11512855Sgabeblack@google.comvoid
11612855Sgabeblack@google.comtest( sc_dt::sc_fxnum_subref a )
11712855Sgabeblack@google.com{
11812855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
11912855Sgabeblack@google.com    std::stringstream ss;
12012855Sgabeblack@google.com# else
12112855Sgabeblack@google.com	strstream ss;
12212855Sgabeblack@google.com# endif
12312855Sgabeblack@google.com
12412855Sgabeblack@google.com    cout << a << endl;
12512855Sgabeblack@google.com    ss << a;
12612855Sgabeblack@google.com    ss >> a;
12712855Sgabeblack@google.com    cout << a << endl;
12812855Sgabeblack@google.com}
12912855Sgabeblack@google.com
13012855Sgabeblack@google.comvoid
13112855Sgabeblack@google.comtest( sc_dt::sc_fxnum_fast_subref a )
13212855Sgabeblack@google.com{
13312855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
13412855Sgabeblack@google.com    std::stringstream ss;
13512855Sgabeblack@google.com# else
13612855Sgabeblack@google.com	strstream ss;
13712855Sgabeblack@google.com# endif
13812855Sgabeblack@google.com
13912855Sgabeblack@google.com    cout << a << endl;
14012855Sgabeblack@google.com    ss << a;
14112855Sgabeblack@google.com    ss >> a;
14212855Sgabeblack@google.com    cout << a << endl;
14312855Sgabeblack@google.com}
14412855Sgabeblack@google.com
14512855Sgabeblack@google.comtemplate <class T>
14612855Sgabeblack@google.comvoid
14712855Sgabeblack@google.comtest( T& a )
14812855Sgabeblack@google.com{
14912855Sgabeblack@google.com# if (defined(__GNUC__) && (__GNUC__ >= 3))|| (defined(_MSC_VER) && (_MSC_VER >= 1300))
15012855Sgabeblack@google.com    std::stringstream ss;
15112855Sgabeblack@google.com# else
15212855Sgabeblack@google.com	strstream ss;
15312855Sgabeblack@google.com# endif
15412855Sgabeblack@google.com
15512855Sgabeblack@google.com    cout << a << endl;
15612855Sgabeblack@google.com    ss << a;
15712855Sgabeblack@google.com    ss >> a;
15812855Sgabeblack@google.com    cout << a << endl;
15912855Sgabeblack@google.com}
16012855Sgabeblack@google.com
16112855Sgabeblack@google.comvoid
16212855Sgabeblack@google.comtest_bit()
16312855Sgabeblack@google.com{
16412855Sgabeblack@google.com    cout << "\n*** test_bit ***" << endl;
16512855Sgabeblack@google.com
16612855Sgabeblack@google.com    // sc_bit
16712855Sgabeblack@google.com    {
16812855Sgabeblack@google.com        cout << "\nsc_bit" << endl;
16912855Sgabeblack@google.com        sc_bit a( true );
17012855Sgabeblack@google.com        sc_bit b( false );
17112855Sgabeblack@google.com        test( a );
17212855Sgabeblack@google.com        test( b );
17312855Sgabeblack@google.com    }
17412855Sgabeblack@google.com
17512855Sgabeblack@google.com    // sc_logic
17612855Sgabeblack@google.com    {
17712855Sgabeblack@google.com        cout << "\nsc_logic" << endl;
17812855Sgabeblack@google.com        sc_logic a( SC_LOGIC_0 );
17912855Sgabeblack@google.com        sc_logic b( SC_LOGIC_1 );
18012855Sgabeblack@google.com        sc_logic c( SC_LOGIC_Z );
18112855Sgabeblack@google.com        sc_logic d( SC_LOGIC_X );
18212855Sgabeblack@google.com        test( a );
18312855Sgabeblack@google.com        test( b );
18412855Sgabeblack@google.com        test( c );
18512855Sgabeblack@google.com        test( d );
18612855Sgabeblack@google.com    }
18712855Sgabeblack@google.com
18812855Sgabeblack@google.com    // sc_bv
18912855Sgabeblack@google.com    {
19012855Sgabeblack@google.com        cout << "\nsc_bv" << endl;
19112855Sgabeblack@google.com        sc_bv<4> a( "0101" );
19212855Sgabeblack@google.com        sc_bv<8> b( "11110000" );
19312855Sgabeblack@google.com        test( a );
19412855Sgabeblack@google.com        test( b );
19512855Sgabeblack@google.com    }
19612855Sgabeblack@google.com
19712855Sgabeblack@google.com    // sc_lv
19812855Sgabeblack@google.com    {
19912855Sgabeblack@google.com        cout << "\nsc_lv" << endl;
20012855Sgabeblack@google.com        sc_lv<4> a( "01ZX" );
20112855Sgabeblack@google.com        sc_lv<8> b( "XXZZ1100" );
20212855Sgabeblack@google.com        test( a );
20312855Sgabeblack@google.com        test( b );
20412855Sgabeblack@google.com    }
20512855Sgabeblack@google.com
20612855Sgabeblack@google.com    // sc_bitref
20712855Sgabeblack@google.com    {
20812855Sgabeblack@google.com        cout << "\nsc_bitref" << endl;
20912855Sgabeblack@google.com        sc_bv<4> a( "0101" );
21012855Sgabeblack@google.com        sc_lv<4> b( "01ZX" );
21112855Sgabeblack@google.com        test( a[0] );
21212855Sgabeblack@google.com        test( b[0] );
21312855Sgabeblack@google.com    }
21412855Sgabeblack@google.com
21512855Sgabeblack@google.com    // sc_subref
21612855Sgabeblack@google.com    {
21712855Sgabeblack@google.com        cout << "\nsc_subref" << endl;
21812855Sgabeblack@google.com        sc_bv<4> a( "0101" );
21912855Sgabeblack@google.com        sc_lv<4> b( "01ZX" );
22012855Sgabeblack@google.com        test( a( 1, 0 ) );
22112855Sgabeblack@google.com        test( b( 1, 0 ) );
22212855Sgabeblack@google.com    }
22312855Sgabeblack@google.com
22412855Sgabeblack@google.com    // sc_concref
22512855Sgabeblack@google.com    {
22612855Sgabeblack@google.com        cout << "\nsc_concref" << endl;
22712855Sgabeblack@google.com        sc_bv<4> a( "0101" );
22812855Sgabeblack@google.com        sc_lv<4> b( "01ZX" );
22912855Sgabeblack@google.com#if 0 // #### re-enable when concatenation support is homogenous.
23012855Sgabeblack@google.com        test( ( a[1], a[0] ) );
23112855Sgabeblack@google.com        test( ( b[1], b[0] ) );
23212855Sgabeblack@google.com#endif // 0
23312855Sgabeblack@google.com    }
23412855Sgabeblack@google.com}
23512855Sgabeblack@google.com
23612855Sgabeblack@google.comvoid
23712855Sgabeblack@google.comtest_int()
23812855Sgabeblack@google.com{
23912855Sgabeblack@google.com    cout << "\n*** test_int ***" << endl;
24012855Sgabeblack@google.com
24112855Sgabeblack@google.com    // sc_int
24212855Sgabeblack@google.com    {
24312855Sgabeblack@google.com        cout << "\nsc_int" << endl;
24412855Sgabeblack@google.com        sc_int<4> a = -7;
24512855Sgabeblack@google.com        sc_int<8> b = 15;
24612855Sgabeblack@google.com        test( a );
24712855Sgabeblack@google.com        test( b );
24812855Sgabeblack@google.com    }
24912855Sgabeblack@google.com
25012855Sgabeblack@google.com    // sc_int_bitref
25112855Sgabeblack@google.com    {
25212855Sgabeblack@google.com        cout << "\nsc_int_bitref" << endl;
25312855Sgabeblack@google.com        sc_int<4> a = -7;
25412855Sgabeblack@google.com        sc_int<8> b = 15;
25512855Sgabeblack@google.com        test( a[0] );
25612855Sgabeblack@google.com        test( b[0] );
25712855Sgabeblack@google.com    }
25812855Sgabeblack@google.com
25912855Sgabeblack@google.com    // sc_int_subref
26012855Sgabeblack@google.com    {
26112855Sgabeblack@google.com        cout << "\nsc_int_subref" << endl;
26212855Sgabeblack@google.com        sc_int<4> a = -7;
26312855Sgabeblack@google.com        sc_int<8> b = 15;
26412855Sgabeblack@google.com        test( a( 3, 0 ) );
26512855Sgabeblack@google.com        test( b( 3, 0 ) );
26612855Sgabeblack@google.com    }
26712855Sgabeblack@google.com
26812855Sgabeblack@google.com    // sc_int_concref
26912855Sgabeblack@google.com    {
27012855Sgabeblack@google.com        cout << "\nsc_int_concref" << endl;
27112855Sgabeblack@google.com        sc_int<4> a = -7;
27212855Sgabeblack@google.com        sc_int<8> b = 15;
27312855Sgabeblack@google.com        test( (a[1], a[0]) );
27412855Sgabeblack@google.com        test( (b[1], b[0]) );
27512855Sgabeblack@google.com    }
27612855Sgabeblack@google.com
27712855Sgabeblack@google.com    // sc_uint
27812855Sgabeblack@google.com    {
27912855Sgabeblack@google.com        cout << "\nsc_uint" << endl;
28012855Sgabeblack@google.com        sc_uint<4> a = -7;
28112855Sgabeblack@google.com        sc_uint<8> b = 15;
28212855Sgabeblack@google.com        test( a );
28312855Sgabeblack@google.com        test( b );
28412855Sgabeblack@google.com    }
28512855Sgabeblack@google.com
28612855Sgabeblack@google.com    // sc_uint_bitref
28712855Sgabeblack@google.com    {
28812855Sgabeblack@google.com        cout << "\nsc_uint_bitref" << endl;
28912855Sgabeblack@google.com        sc_uint<4> a = -7;
29012855Sgabeblack@google.com        sc_uint<8> b = 15;
29112855Sgabeblack@google.com        test( a[0] );
29212855Sgabeblack@google.com        test( b[0] );
29312855Sgabeblack@google.com    }
29412855Sgabeblack@google.com
29512855Sgabeblack@google.com    // sc_uint_subref
29612855Sgabeblack@google.com    {
29712855Sgabeblack@google.com        cout << "\nsc_uint_subref" << endl;
29812855Sgabeblack@google.com        sc_uint<4> a = -7;
29912855Sgabeblack@google.com        sc_uint<8> b = 15;
30012855Sgabeblack@google.com        test( a( 3, 0 ) );
30112855Sgabeblack@google.com        test( b( 3, 0 ) );
30212855Sgabeblack@google.com    }
30312855Sgabeblack@google.com
30412855Sgabeblack@google.com    // sc_uint_concref
30512855Sgabeblack@google.com    {
30612855Sgabeblack@google.com        cout << "\nsc_uint_concref" << endl;
30712855Sgabeblack@google.com        sc_uint<4> a = -7;
30812855Sgabeblack@google.com        sc_uint<8> b = 15;
30912855Sgabeblack@google.com        test( (a[1], a[0]) );
31012855Sgabeblack@google.com        test( (b[1], b[0]) );
31112855Sgabeblack@google.com    }
31212855Sgabeblack@google.com
31312855Sgabeblack@google.com    // sc_bigint
31412855Sgabeblack@google.com    {
31512855Sgabeblack@google.com        cout << "\nsc_bigint" << endl;
31612855Sgabeblack@google.com        sc_bigint<4> a = -7;
31712855Sgabeblack@google.com        sc_bigint<8> b = 15;
31812855Sgabeblack@google.com        test( a );
31912855Sgabeblack@google.com        test( b );
32012855Sgabeblack@google.com    }
32112855Sgabeblack@google.com
32212855Sgabeblack@google.com    // sc_signed_bitref
32312855Sgabeblack@google.com    {
32412855Sgabeblack@google.com        cout << "\nsc_signed_bitref" << endl;
32512855Sgabeblack@google.com        sc_bigint<4> a = -7;
32612855Sgabeblack@google.com        sc_bigint<8> b = 15;
32712855Sgabeblack@google.com        test( a[0] );
32812855Sgabeblack@google.com        test( b[0] );
32912855Sgabeblack@google.com    }
33012855Sgabeblack@google.com
33112855Sgabeblack@google.com    // sc_signed_subref
33212855Sgabeblack@google.com    {
33312855Sgabeblack@google.com        cout << "\nsc_signed_subref" << endl;
33412855Sgabeblack@google.com        sc_bigint<4> a = -7;
33512855Sgabeblack@google.com        sc_bigint<8> b = 15;
33612855Sgabeblack@google.com        test( a( 3, 0 ) );
33712855Sgabeblack@google.com        test( b( 3, 0 ) );
33812855Sgabeblack@google.com    }
33912855Sgabeblack@google.com
34012855Sgabeblack@google.com    // sc_signed_concref
34112855Sgabeblack@google.com    {
34212855Sgabeblack@google.com        sc_bigint<4> a = -7;
34312855Sgabeblack@google.com        sc_bigint<8> b = 15;
34412855Sgabeblack@google.com        test( (a[1], a[0]) );
34512855Sgabeblack@google.com        test( (b[1], b[0]) );
34612855Sgabeblack@google.com    }
34712855Sgabeblack@google.com
34812855Sgabeblack@google.com    // sc_biguint
34912855Sgabeblack@google.com    {
35012855Sgabeblack@google.com        cout << "\nsc_biguint" << endl;
35112855Sgabeblack@google.com        sc_biguint<4> a = -7;
35212855Sgabeblack@google.com        sc_biguint<8> b = 15;
35312855Sgabeblack@google.com        test( a );
35412855Sgabeblack@google.com        test( b );
35512855Sgabeblack@google.com    }
35612855Sgabeblack@google.com
35712855Sgabeblack@google.com    // sc_unsigned_bitref
35812855Sgabeblack@google.com    {
35912855Sgabeblack@google.com        cout << "\nsc_unsigned_bitref" << endl;
36012855Sgabeblack@google.com        sc_biguint<4> a = -7;
36112855Sgabeblack@google.com        sc_biguint<8> b = 15;
36212855Sgabeblack@google.com        test( a[0] );
36312855Sgabeblack@google.com        test( b[0] );
36412855Sgabeblack@google.com    }
36512855Sgabeblack@google.com
36612855Sgabeblack@google.com    // sc_unsigned_subref
36712855Sgabeblack@google.com    {
36812855Sgabeblack@google.com        cout << "\nsc_unsigned_subref" << endl;
36912855Sgabeblack@google.com        sc_biguint<4> a = -7;
37012855Sgabeblack@google.com        sc_biguint<8> b = 15;
37112855Sgabeblack@google.com        test( a( 3, 0 ) );
37212855Sgabeblack@google.com        test( b( 3, 0 ) );
37312855Sgabeblack@google.com    }
37412855Sgabeblack@google.com
37512855Sgabeblack@google.com    // sc_unsigned_concref
37612855Sgabeblack@google.com    {
37712855Sgabeblack@google.com        sc_biguint<4> a = -7;
37812855Sgabeblack@google.com        sc_biguint<8> b = 15;
37912855Sgabeblack@google.com        test( (a[1], a[0]) );
38012855Sgabeblack@google.com        test( (b[1], b[0]) );
38112855Sgabeblack@google.com    }
38212855Sgabeblack@google.com}
38312855Sgabeblack@google.com
38412855Sgabeblack@google.comvoid
38512855Sgabeblack@google.comtest_fx()
38612855Sgabeblack@google.com{
38712855Sgabeblack@google.com    cout << "\n*** test_fx ***" << endl;
38812855Sgabeblack@google.com
38912855Sgabeblack@google.com    // sc_fxnum
39012855Sgabeblack@google.com    {
39112855Sgabeblack@google.com        cout << "\nsc_fxnum" << endl;
39212855Sgabeblack@google.com        sc_fixed<4,4> a = -7;
39312855Sgabeblack@google.com        sc_fixed<8,8> b = 15;
39412855Sgabeblack@google.com        test( a );
39512855Sgabeblack@google.com        test( b );
39612855Sgabeblack@google.com    }
39712855Sgabeblack@google.com
39812855Sgabeblack@google.com    // sc_fxnum_fast
39912855Sgabeblack@google.com    {
40012855Sgabeblack@google.com        cout << "\nsc_fxnum_fast" << endl;
40112855Sgabeblack@google.com        sc_fixed_fast<4,4> a = -7;
40212855Sgabeblack@google.com        sc_fixed_fast<8,8> b = 15;
40312855Sgabeblack@google.com        test( a );
40412855Sgabeblack@google.com        test( b );
40512855Sgabeblack@google.com    }
40612855Sgabeblack@google.com
40712855Sgabeblack@google.com    // sc_fxnum_bitref
40812855Sgabeblack@google.com    {
40912855Sgabeblack@google.com        cout << "\nsc_fxnum_bitref" << endl;
41012855Sgabeblack@google.com        sc_fixed<4,4> a = -7;
41112855Sgabeblack@google.com        sc_fixed<8,8> b = 15;
41212855Sgabeblack@google.com        test( a[0] );
41312855Sgabeblack@google.com        test( b[0] );
41412855Sgabeblack@google.com    }
41512855Sgabeblack@google.com
41612855Sgabeblack@google.com    // sc_fxnum_fast_bitref
41712855Sgabeblack@google.com    {
41812855Sgabeblack@google.com        cout << "\nsc_fxnum_fast_bitref" << endl;
41912855Sgabeblack@google.com        sc_fixed_fast<4,4> a = -7;
42012855Sgabeblack@google.com        sc_fixed_fast<8,8> b = 15;
42112855Sgabeblack@google.com        test( a[0] );
42212855Sgabeblack@google.com        test( b[0] );
42312855Sgabeblack@google.com    }
42412855Sgabeblack@google.com
42512855Sgabeblack@google.com    // sc_fxnum_subref
42612855Sgabeblack@google.com    {
42712855Sgabeblack@google.com        cout << "\nsc_fxnum_subref" << endl;
42812855Sgabeblack@google.com        sc_fixed<4,4> a = -7;
42912855Sgabeblack@google.com        sc_fixed<8,8> b = 15;
43012855Sgabeblack@google.com        test( a( 3, 0 ) );
43112855Sgabeblack@google.com        test( b( 3, 0 ) );
43212855Sgabeblack@google.com    }
43312855Sgabeblack@google.com
43412855Sgabeblack@google.com    // sc_fxnum_fast_subref
43512855Sgabeblack@google.com    {
43612855Sgabeblack@google.com        cout << "\nsc_fxnum_fast_subref" << endl;
43712855Sgabeblack@google.com        sc_fixed_fast<4,4> a = -7;
43812855Sgabeblack@google.com        sc_fixed_fast<8,8> b = 15;
43912855Sgabeblack@google.com        test( a( 3, 0 ) );
44012855Sgabeblack@google.com        test( b( 3, 0 ) );
44112855Sgabeblack@google.com    }
44212855Sgabeblack@google.com
44312855Sgabeblack@google.com    // sc_fxval
44412855Sgabeblack@google.com    {
44512855Sgabeblack@google.com        cout << "\nsc_fxval" << endl;
44612855Sgabeblack@google.com        sc_fxval a(-7);
44712855Sgabeblack@google.com        sc_fxval b(15);
44812855Sgabeblack@google.com        test( a );
44912855Sgabeblack@google.com        test( b );
45012855Sgabeblack@google.com    }
45112855Sgabeblack@google.com
45212855Sgabeblack@google.com    // sc_fxval_fast
45312855Sgabeblack@google.com    {
45412855Sgabeblack@google.com        cout << "\nsc_fxval_fast" << endl;
45512855Sgabeblack@google.com        sc_fxval_fast a(-7);
45612855Sgabeblack@google.com        sc_fxval_fast b(15);
45712855Sgabeblack@google.com        test( a );
45812855Sgabeblack@google.com        test( b );
45912855Sgabeblack@google.com    }
46012855Sgabeblack@google.com}
46112855Sgabeblack@google.com
46212855Sgabeblack@google.comint
46312855Sgabeblack@google.comsc_main( int, char*[] )
46412855Sgabeblack@google.com{
46512855Sgabeblack@google.com    test_bit();
46612855Sgabeblack@google.com    test_int();
46712855Sgabeblack@google.com    test_fx();
46812855Sgabeblack@google.com
46912855Sgabeblack@google.com    return 0;
47012855Sgabeblack@google.com}
471