inlining.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 inlining.cpp -- 23 24 Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-22 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 "inlining.h" 40 41// list of defines 42// #define MAXI(a,b) ((a)>(b)?(a):(b)) 43#define MAXI(a,b) ( (a) > (b) ? sc_biguint<4>( a ) : sc_biguint<4>( b ) ) 44#define clockedge wait() 45#define my_print(a) cout << #a << " my print " << a << endl 46#define my_if(a, b, c) if (a < 6 ) { \ 47 b = 0; \ 48 } else { \ 49 b = c; \ 50 }; 51 52void inlining::entry(){ 53 54 sc_biguint<4> tmp1; 55 sc_biguint<4> tmp2; 56 sc_lv<4> tmp3; 57 sc_bv<4> tmp4; 58 59 // reset_loop 60 if (reset.read() == true) { 61 out_value1.write(0); 62 out_value2.write(0); 63 out_valid.write(false); 64 clockedge; 65 } else clockedge; 66 67 // 68 // main loop 69 // 70 while(1) { 71 do { wait(); } while (in_valid == false); 72 73 //reading inputs 74 tmp1 = in_value1.read(); 75 tmp2 = in_value2.read(); 76 tmp3 = in_value3.read(); 77 tmp4 = in_value4.read(); 78 79 //execution 80 ++tmp1; 81 out_value1.write(MAXI(tmp1, tmp2)); 82 my_print(tmp1); 83 my_print(tmp2); 84 clockedge; 85 86 my_if(tmp2, tmp3, tmp4); 87 out_value2.write(tmp4); 88 out_valid.write(true); 89 clockedge; 90 out_valid.write(false); 91 92 } 93} 94 95// EOF 96 97