datatypes.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 datatypes.cpp -- 23 24 Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-14 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 45 sc_bigint<8> tmp1; 46 sc_bigint<8> tmp1r; 47 sc_biguint<8> tmp2; 48 sc_biguint<8> tmp2r; 49 long tmp3; 50 long tmp3r; 51 int tmp4; 52 int tmp4r; 53 short tmp5; 54 short tmp5r; 55 char tmp6; 56 char tmp6r; 57 58// define 1 dimensional array 59 int tmp7[2]; 60 char tmp8[2]; 61 62// reset_loop 63 if (reset.read() == true) { 64 out_valid.write(false); 65 out_ack.write(false); 66 wait(); 67 } else wait(); 68 69// 70// main loop 71// 72 73// initialization of sc_array 74 75 tmp7[0] = 3; 76 tmp7[1] = 12; 77 tmp8[0] = 'R'; 78 tmp8[1] = 'G'; 79 80 81 while(1) { 82 while(in_valid.read()==false) wait(); 83 84 //reading the inputs 85 tmp1 = in_value1.read(); 86 tmp2 = in_value2.read(); 87 tmp3 = in_value3.read(); 88 tmp4 = in_value4.read(); 89 tmp5 = in_value5.read(); 90 tmp6 = in_value6.read(); 91 92 out_ack.write(true); 93 94 //execute mixed data type subtraction operations 95 tmp1r = tmp1 - tmp2; 96 tmp2r = tmp6 - tmp1; 97 tmp3r = tmp4 - tmp6; 98 tmp4r = --tmp5; 99 tmp4r -= 1; 100 tmp5r = tmp6 - tmp4; 101 tmp6r = tmp8[0] - tmp7[1]; 102 103 //write outputs 104 out_value1.write(tmp1r); 105 out_value2.write(tmp2r); 106 out_value3.write(tmp3r); 107 out_value4.write(tmp4r); 108 out_value5.write(tmp5r); 109 out_value6.write(tmp6r); 110 111 out_valid.write(true); 112 wait(); 113 out_ack.write(false); 114 out_valid.write(false); 115 116 } 117 118} // End 119 120