test03.cpp revision 12855:588919e0e4aa
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 test03.cpp -- 23 24 Original Author: Andy Goodrich, Forte Design Systems, 2003-01-17 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 and l-value bit selection concatenation on sc_lv and sc_bv 39// also test set_word() and set_cword on bit selections 40 41#include "systemc.h" 42 43int sc_main(int argc, char* argv[]) 44{ 45 sc_bv<64> bv1; 46 sc_bv<64> bv2; 47 sc_lv<64> lv1; 48 sc_lv<64> lv2; 49 50 cout << endl; 51 cout << "6666555555555544444444443333333333222222222211111111110000000000" 52 << endl; 53 cout << "3210987654321098765432109876543210987654321098765432109876543210" 54 << endl; 55 cout << "----------------------------------------------------------------" 56 << endl; 57 58 // LV SUPPORT: 59 60 cout << lv1 << " lv1" << endl; 61 cout << lv2 << " lv2 " << endl; 62 63 cout << " (lv1[33], lv2[34]) = 0 " << endl; 64 (lv1[33], lv2[34]) = 0; 65 cout << lv1 << " lv1" << endl; 66 cout << lv2 << " lv2 " << endl; 67 68 cout << "lv1[43].set_cword(0, 0) " << endl; 69 lv1[43].set_cword(0, 0); 70 cout << lv1 << " lv1" << endl; 71 72 cout << "lv2[44].set_word(0, 0)" << endl; 73 lv2[44].set_word(0, 0); 74 cout << lv2 << " lv2" << endl; 75 76 cout << "(lv1,lv2[9]) = 0" << endl; 77 (lv1,lv2[9]) = 0; 78 cout << lv1 << " lv1 " << endl; 79 cout << lv2 << " lv2 " << endl; 80 81 cout << "(lv2[9], lv1) = -1ll" << endl; 82 (lv2[9], lv1) = -1ll; 83 cout << lv1 << " lv1 " << endl; 84 cout << lv2 << " lv2 " << endl; 85 86 87 // BV SUPPORT: 88 89 cout << endl; 90 cout << bv1 << " bv1" << endl; 91 cout << bv2 << " bv2" << endl; 92 93 cout << "(bv1[33], bv2[34]) = 3" << endl; 94 (bv1[33], bv2[34]) = 3; 95 cout << bv1 << " bv1" << endl; 96 cout << bv2 << " bv2" << endl; 97 98 cout << "bv1[43].set_word(0, 1)" << endl; 99 bv1[43].set_word(0, 1); 100 cout << bv1 << " bv1" << endl; 101 102 103 cout << "(bv1,bv2[9]) = 0" << endl; 104 (bv1,bv2[9]) = 0; 105 cout << bv1 << " bv1" << endl; 106 cout << bv2 << " bv2 " << endl; 107 108 cout << "(bv2[9], bv1) = -1ll" << endl; 109 (bv2[9], bv1) = -1ll; 110 cout << bv1 << " bv1" << endl; 111 cout << bv2 << " bv2 " << endl; 112 113 cout << "Program completed" << endl; 114 return 0; 115} 116