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: Martin Janssen, Synopsys, Inc., 2002-03-24 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: 34 Description of Modification: 35 36 *****************************************************************************/ 37 38// test of sc_[u]int_(conc|sub)ref assignment from sc_[un]signed and 39// sc_(bv|lv)_base 40 41#include "systemc.h" 42 43int 44sc_main( int, char*[] ) 45{ 46 sc_bigint<4> a = 1; 47 sc_biguint<4> b = 2; 48 sc_bv<4> c = 3; 49 sc_lv<4> d = 4; 50 51 { 52 cout << "\n*** sc_int ***" << endl; 53 54 sc_int<2> e = 0; 55 sc_int<2> f = 0; 56 sc_int<8> g = 0; 57 58 cout << "sc_int_concref = sc_signed" << endl; 59 (e, f) = a; 60 cout << e << endl; 61 cout << f << endl; 62 63 cout << "sc_int_concref = sc_unsigned" << endl; 64 (e, f) = b; 65 cout << e << endl; 66 cout << f << endl; 67 68 cout << "sc_int_concref = sc_bv_base" << endl; 69 (e, f) = c; 70 cout << e << endl; 71 cout << f << endl; 72 73 cout << "sc_int_concref = sc_lv_base" << endl; 74 (e, f) = d; 75 cout << e << endl; 76 cout << f << endl; 77 78 cout << "sc_int_subref = sc_signed" << endl; 79 g( 7, 4 ) = a; 80 cout << g << endl; 81 82 cout << "sc_int_subref = sc_unsigned" << endl; 83 g( 7, 4 ) = b; 84 cout << g << endl; 85 86 cout << "sc_int_subref = sc_bv_base" << endl; 87 g( 7, 4 ) = c; 88 cout << g << endl; 89 90 cout << "sc_int_subref = sc_lv_base" << endl; 91 g( 7, 4 ) = d; 92 cout << g << endl; 93 } 94 95 { 96 cout << "\n*** sc_uint ***" << endl; 97 98 sc_uint<2> e = 0; 99 sc_uint<2> f = 0; 100 sc_uint<8> g = 0; 101 102 cout << "sc_uint_concref = sc_signed" << endl; 103 (e, f) = a; 104 cout << e << endl; 105 cout << f << endl; 106 107 cout << "sc_uint_concref = sc_unsigned" << endl; 108 (e, f) = b; 109 cout << e << endl; 110 cout << f << endl; 111 112 cout << "sc_uint_concref = sc_bv_base" << endl; 113 (e, f) = c; 114 cout << e << endl; 115 cout << f << endl; 116 117 cout << "sc_uint_concref = sc_lv_base" << endl; 118 (e, f) = d; 119 cout << e << endl; 120 cout << f << endl; 121 122 cout << "sc_uint_subref = sc_signed" << endl; 123 g( 7, 4 ) = a; 124 cout << g << endl; 125 126 cout << "sc_uint_subref = sc_unsigned" << endl; 127 g( 7, 4 ) = b; 128 cout << g << endl; 129 130 cout << "sc_uint_subref = sc_bv_base" << endl; 131 g( 7, 4 ) = c; 132 cout << g << endl; 133 134 cout << "sc_uint_subref = sc_lv_base" << endl; 135 g( 7, 4 ) = d; 136 cout << g << endl; 137 } 138 139 return 0; 140} 141