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 copy_ctors.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 sc_[u]fix constructors with fixed-point type argument 3912855Sgabeblack@google.com 4012855Sgabeblack@google.com#define SC_INCLUDE_FX 4112855Sgabeblack@google.com#include "systemc.h" 4212855Sgabeblack@google.com 4312855Sgabeblack@google.com#define WRITE(a) \ 4412855Sgabeblack@google.com cout << a.type_params() << endl 4512855Sgabeblack@google.com 4612855Sgabeblack@google.comint 4712855Sgabeblack@google.comsc_main( int, char*[] ) 4812855Sgabeblack@google.com{ 4912855Sgabeblack@google.com sc_fixed<1,2,SC_RND,SC_SAT> fxd; 5012855Sgabeblack@google.com sc_fixed_fast<3,4,SC_RND_ZERO,SC_SAT_ZERO> fxdf; 5112855Sgabeblack@google.com sc_ufixed<5,6,SC_RND_MIN_INF,SC_SAT_SYM> ufxd; 5212855Sgabeblack@google.com sc_ufixed_fast<7,8,SC_RND_INF,SC_WRAP> ufxdf; 5312855Sgabeblack@google.com 5412855Sgabeblack@google.com sc_fix fx( 9, 10, SC_RND_CONV, SC_SAT ); 5512855Sgabeblack@google.com sc_fix_fast fxf( 11, 12, SC_TRN, SC_SAT_ZERO ); 5612855Sgabeblack@google.com sc_ufix ufx( 13, 14, SC_TRN_ZERO, SC_SAT_SYM ); 5712855Sgabeblack@google.com sc_ufix_fast ufxf( 15, 16, SC_RND, SC_WRAP ); 5812855Sgabeblack@google.com 5912855Sgabeblack@google.com WRITE( fxd ); 6012855Sgabeblack@google.com WRITE( fxdf ); 6112855Sgabeblack@google.com WRITE( ufxd ); 6212855Sgabeblack@google.com WRITE( ufxdf ); 6312855Sgabeblack@google.com 6412855Sgabeblack@google.com WRITE( fx ); 6512855Sgabeblack@google.com WRITE( fxf ); 6612855Sgabeblack@google.com WRITE( ufx ); 6712855Sgabeblack@google.com WRITE( ufxf ); 6812855Sgabeblack@google.com 6912855Sgabeblack@google.com // sc_fix 7012855Sgabeblack@google.com sc_fix fx01( fxd ); 7112855Sgabeblack@google.com sc_fix fx02( fxdf ); 7212855Sgabeblack@google.com sc_fix fx03( ufxd ); 7312855Sgabeblack@google.com sc_fix fx04( ufxdf ); 7412855Sgabeblack@google.com sc_fix fx05( fx ); 7512855Sgabeblack@google.com sc_fix fx06( fxf ); 7612855Sgabeblack@google.com sc_fix fx07( ufx ); 7712855Sgabeblack@google.com sc_fix fx08( ufxf ); 7812855Sgabeblack@google.com 7912855Sgabeblack@google.com cout << endl; 8012855Sgabeblack@google.com WRITE( fx01 ); 8112855Sgabeblack@google.com WRITE( fx02 ); 8212855Sgabeblack@google.com WRITE( fx03 ); 8312855Sgabeblack@google.com WRITE( fx04 ); 8412855Sgabeblack@google.com WRITE( fx05 ); 8512855Sgabeblack@google.com WRITE( fx06 ); 8612855Sgabeblack@google.com WRITE( fx07 ); 8712855Sgabeblack@google.com WRITE( fx08 ); 8812855Sgabeblack@google.com 8912855Sgabeblack@google.com // sc_fix_fast 9012855Sgabeblack@google.com sc_fix_fast fxf01( fxd ); 9112855Sgabeblack@google.com sc_fix_fast fxf02( fxdf ); 9212855Sgabeblack@google.com sc_fix_fast fxf03( ufxd ); 9312855Sgabeblack@google.com sc_fix_fast fxf04( ufxdf ); 9412855Sgabeblack@google.com sc_fix_fast fxf05( fx ); 9512855Sgabeblack@google.com sc_fix_fast fxf06( fxf ); 9612855Sgabeblack@google.com sc_fix_fast fxf07( ufx ); 9712855Sgabeblack@google.com sc_fix_fast fxf08( ufxf ); 9812855Sgabeblack@google.com 9912855Sgabeblack@google.com cout << endl; 10012855Sgabeblack@google.com WRITE( fxf01 ); 10112855Sgabeblack@google.com WRITE( fxf02 ); 10212855Sgabeblack@google.com WRITE( fxf03 ); 10312855Sgabeblack@google.com WRITE( fxf04 ); 10412855Sgabeblack@google.com WRITE( fxf05 ); 10512855Sgabeblack@google.com WRITE( fxf06 ); 10612855Sgabeblack@google.com WRITE( fxf07 ); 10712855Sgabeblack@google.com WRITE( fxf08 ); 10812855Sgabeblack@google.com 10912855Sgabeblack@google.com // sc_ufix 11012855Sgabeblack@google.com sc_ufix ufx01( fxd ); 11112855Sgabeblack@google.com sc_ufix ufx02( fxdf ); 11212855Sgabeblack@google.com sc_ufix ufx03( ufxd ); 11312855Sgabeblack@google.com sc_ufix ufx04( ufxdf ); 11412855Sgabeblack@google.com sc_ufix ufx05( fx ); 11512855Sgabeblack@google.com sc_ufix ufx06( fxf ); 11612855Sgabeblack@google.com sc_ufix ufx07( ufx ); 11712855Sgabeblack@google.com sc_ufix ufx08( ufxf ); 11812855Sgabeblack@google.com 11912855Sgabeblack@google.com cout << endl; 12012855Sgabeblack@google.com WRITE( ufx01 ); 12112855Sgabeblack@google.com WRITE( ufx02 ); 12212855Sgabeblack@google.com WRITE( ufx03 ); 12312855Sgabeblack@google.com WRITE( ufx04 ); 12412855Sgabeblack@google.com WRITE( ufx05 ); 12512855Sgabeblack@google.com WRITE( ufx06 ); 12612855Sgabeblack@google.com WRITE( ufx07 ); 12712855Sgabeblack@google.com WRITE( ufx08 ); 12812855Sgabeblack@google.com 12912855Sgabeblack@google.com // sc_ufix_fast 13012855Sgabeblack@google.com sc_ufix_fast ufxf01( fxd ); 13112855Sgabeblack@google.com sc_ufix_fast ufxf02( fxdf ); 13212855Sgabeblack@google.com sc_ufix_fast ufxf03( ufxd ); 13312855Sgabeblack@google.com sc_ufix_fast ufxf04( ufxdf ); 13412855Sgabeblack@google.com sc_ufix_fast ufxf05( fx ); 13512855Sgabeblack@google.com sc_ufix_fast ufxf06( fxf ); 13612855Sgabeblack@google.com sc_ufix_fast ufxf07( ufx ); 13712855Sgabeblack@google.com sc_ufix_fast ufxf08( ufxf ); 13812855Sgabeblack@google.com 13912855Sgabeblack@google.com cout << endl; 14012855Sgabeblack@google.com WRITE( ufxf01 ); 14112855Sgabeblack@google.com WRITE( ufxf02 ); 14212855Sgabeblack@google.com WRITE( ufxf03 ); 14312855Sgabeblack@google.com WRITE( ufxf04 ); 14412855Sgabeblack@google.com WRITE( ufxf05 ); 14512855Sgabeblack@google.com WRITE( ufxf06 ); 14612855Sgabeblack@google.com WRITE( ufxf07 ); 14712855Sgabeblack@google.com WRITE( ufxf08 ); 14812855Sgabeblack@google.com 14912855Sgabeblack@google.com // misc 15012855Sgabeblack@google.com sc_fix fx09( fx, 123, 456 ); 15112855Sgabeblack@google.com sc_fix_fast fxf09( fxf, SC_RND, SC_SAT ); 15212855Sgabeblack@google.com sc_ufix ufx09( ufx, 456, 123 ); 15312855Sgabeblack@google.com sc_ufix_fast ufxf09( ufxf, SC_TRN, SC_WRAP ); 15412855Sgabeblack@google.com 15512855Sgabeblack@google.com cout << endl; 15612855Sgabeblack@google.com WRITE( fx09 ); 15712855Sgabeblack@google.com WRITE( fxf09 ); 15812855Sgabeblack@google.com WRITE( ufx09 ); 15912855Sgabeblack@google.com WRITE( ufxf09 ); 16012855Sgabeblack@google.com 16112855Sgabeblack@google.com return 0; 16212855Sgabeblack@google.com} 163