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 test01.cpp -- 23 24 Original Author: David Long, Doulos 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: Andy Goodrich, Forte Design Systems 34 Description of Modification: Expanded number of tests and added part 35 selection to make sure internal representation 36 works. 37 38 *****************************************************************************/ 39 40#include <systemc.h> 41 42int sc_main(int,char**) { 43 int i; 44 int64 j; 45 sc_int<64> I; 46 sc_uint<64> UI; 47 sc_bigint<64> BI; 48 sc_biguint<64> BUI; 49 sc_bv<64> BV; 50 sc_bigint<70> BBI; 51 sc_biguint<70> BBUI; 52 53 cout << "int = 8 " << endl; 54 i = 8; 55 I = i; 56 cout << "I = " << I.to_string(SC_BIN) << " " << I(5,3) << endl; 57 58 UI = i; 59 cout << "UI = " << UI.to_string(SC_BIN) << " " << I(5,3) << endl; 60 61 BI= i; 62 cout << "BI = " << BI.to_string(SC_BIN) << " " << I(5,3) << endl; 63 64 BUI = i; 65 cout << "BUI = " << BUI.to_string(SC_BIN) << " " << I(5,3) << endl; 66 67 BV = i; 68 cout << "BV = " << BV.to_string(SC_BIN) << " " << I(5,3) << endl; 69 70 BBI= i; 71 cout << "BBI = " << BBI.to_string(SC_BIN) << " " << I(5,3) << endl; 72 73 BBUI = i; 74 cout << "BBUI = " << BBUI.to_string(SC_BIN) << " " << I(5,3) << endl; 75 76 cout << "int = -1 " << endl; 77 i = -1; 78 I = i; 79 cout << "I = " << I.to_string(SC_BIN) << " " << I(5,3) << endl; 80 81 UI = i; 82 cout << "UI = " << UI.to_string(SC_BIN) << " " << I(5,3) << endl; 83 84 BI= i; 85 cout << "BI = " << BI.to_string(SC_BIN) << " " << I(5,3) << endl; 86 87 BUI = i; 88 cout << "BUI = " << BUI.to_string(SC_BIN) << " " << I(5,3) << endl; 89 90 BV = i; 91 cout << "BV = " << BV.to_string(SC_BIN) << " " << I(5,3) << endl; 92 93 BBI= i; 94 cout << "BBI = " << BBI.to_string(SC_BIN) << " " << I(5,3) << endl; 95 96 BBUI = i; 97 cout << "BBUI = " << BBUI.to_string(SC_BIN) << " " << I(5,3) << endl; 98 99 cout << endl; 100 cout << "int64 = -2 " << endl; 101 j = -2; 102 103 I = j; 104 cout << "I = " << I.to_string(SC_BIN) << " " << I(5,3) << endl; 105 106 UI = j; 107 cout << "UI = " << UI.to_string(SC_BIN) << " " << I(5,3) << endl; 108 109 BI= j; 110 cout << "BI = " << BI.to_string(SC_BIN) << " " << I(5,3) << endl; 111 112 BUI = j; 113 cout << "BUI = " << BUI.to_string(SC_BIN) << " " << I(5,3) << endl; 114 115 BV = j; 116 cout << "BV = " << BV.to_string(SC_BIN) << " " << I(5,3) << endl; 117 118 BBI= j; 119 cout << "BBI = " << BBI.to_string(SC_BIN) << " " << I(5,3) << endl; 120 121 BBUI = j; 122 cout << "BBUI = " << BBUI.to_string(SC_BIN) << " " << I(5,3) << endl; 123 124 return 0; 125} 126 127