00001 00002 /* 00003 * VCAllocator.h 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License, 00007 * version 2, as published by the Free Software Foundation. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License along 00015 * with this program; if not, write to the Free Software Foundation, Inc., 00016 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * Author: Lavina Jain 00019 * 00020 */ 00021 00026 00027 #ifndef _VC_ALLOC_ 00028 #define _VC_ALLOC_ 00029 00030 #include "systemc.h" 00031 #include "credit.h" 00032 #include "../config/constants.h" 00033 #include "flit.h" 00034 #include <string> 00035 #include <fstream> 00036 #include <iostream> 00037 00039 using namespace std; 00040 00046 template<UI num_ip = NUM_IC> 00047 struct VCAllocator : public sc_module { 00048 00049 // PORTS ////////////////////////////////////////////////////////////////////////////////// 00050 sc_in<bool> switch_cntrl; 00051 sc_in<bool> vcRequest[num_ip]; 00052 sc_in<sc_uint<2> > opRequest[num_ip]; 00053 00054 sc_out<sc_uint<VCS_BITSIZE+1> > nextVCID[num_ip]; 00055 sc_out<bool> vcReady[num_ip]; 00056 00057 sc_in<creditLine> Icredit[num_ip][NUM_VCS]; 00058 // PORTS END ////////////////////////////////////////////////////////////////////////////////// 00059 00061 SC_CTOR(VCAllocator); 00062 00063 // FUNCTIONS ///////////////////////////////////////////////////////////////////////////// 00064 void allocate_VC(); 00065 void update_credit(); 00066 00067 void setTileID(UI tileID, UI portN, UI portS, UI portE, UI portW); 00068 sc_uint<VCS_BITSIZE+1> getNextVCID(int,int); 00069 // FUNCTIONS END ///////////////////////////////////////////////////////////////////////////// 00070 00071 // VARIABLES ///////////////////////////////////////////////////////////////////////////// 00072 bool vcFree[num_ip][NUM_VCS]; 00073 UI tileID; 00074 UI portN; 00075 UI portS; 00076 UI portE; 00077 UI portW; 00078 // VARIABLES END ///////////////////////////////////////////////////////////////////////////// 00079 }; 00080 00081 #endif