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 datatypes.cpp -- 23 24 Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30 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 39#include "datatypes.h" 40 41void datatypes::entry() 42 43{ 44 sc_bigint<8> tmp1; 45 sc_bigint<8> tmp1r; 46 sc_biguint<8> tmp2; 47 sc_biguint<8> tmp2r; 48 long tmp3; 49 long tmp3r; 50 int tmp4; 51 int tmp4r; 52 short tmp5; 53 short tmp5r; 54 char tmp6; 55 char tmp6r; 56 bool tmp7; 57 bool tmp7r; 58 sc_bv<4> tmp8; 59 sc_bv<4> tmp8r; 60 sc_lv<4> tmp9; 61 sc_lv<4> tmp9r; 62 63// define 1 dimensional array 64 int tmpa[2]; 65 char tmpb[2]; 66 67// reset_loop 68 if (reset.read() == true) { 69 out_valid.write(false); 70 out_ack.write(false); 71 wait(); 72 } else wait(); 73 74// 75// main loop 76// 77// initialization of sc_array 78 79 tmpa[0] = 12; 80 tmpa[1] = 127; 81 tmpb[1] = 'G'; 82 83 84 while(1) { 85 while(in_valid.read()==false) wait(); 86 87 //reading the inputs 88 tmp1 = in_value1.read(); 89 tmp2 = in_value2.read(); 90 tmp3 = in_value3.read(); 91 tmp4 = in_value4.read(); 92 tmp5 = in_value5.read(); 93 tmp6 = in_value6.read(); 94 tmpb[0] = in_value7.read(); 95 tmp7 = in_value8.read(); 96 tmp8 = in_value9.read(); 97 tmp9 = in_value10.read(); 98 99 out_ack.write(true); 100 101 //execute mixed data type not operations 102 103 // signed(8) <- ~ unsigned(8) 104 tmp1r = ~ tmp2; 105 // unsigned(8) <- ~ long 106 tmp2r = ~ tmp3; 107 // long <- ~ char 108 tmp3r = ~ tmp6; 109 // int <- ~ short 110 tmp4r = ~ tmp5; 111 // short <- ~ int 112 tmp5r = ~ tmp4; 113 // char <- ~ char_array[0] 114 // tmp6r = ~ tmp8[0]; 115 tmp6r = ~ tmp8[0].to_bool(); 116 // bool <- ! bool; 117 tmp7r = !tmp7; 118 // sc_bool_vector(4) <- ~ sc_logic_vector(4) 119 tmp8r = ~ tmp9; 120 // sc_logic_vector(4) <- ~ sc_bool_vector(4) 121 tmp9r = ~ tmp9; 122 123 //write outputs 124 out_value1.write(tmp1r); 125 out_value2.write(tmp2r); 126 out_value3.write(tmp3r); 127 out_value4.write(tmp4r); 128 out_value5.write(tmp5r); 129 out_value6.write(tmp6r); 130 out_value7.write(tmp7r); 131 out_value8.write(tmp8r); 132 out_value9.write(tmp9r); 133 134 out_valid.write(true); 135 wait(); 136 out_ack.write(false); 137 out_valid.write(false); 138 139 } 140 141} // End 142 143 144