00001 00002 /* 00003 * Controller.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 _CONTROLLER_ 00028 #define _CONTROLLER_ 00029 00030 #include "systemc.h" 00031 #include "credit.h" 00032 #include "../config/constants.h" 00033 #include "router.h" 00034 #include <string> 00035 #include <fstream> 00036 #include <iostream> 00037 #include <dlfcn.h> 00038 00039 using namespace std; 00040 00046 template<UI num_ip = NUM_IC> 00047 struct Controller : public sc_module { 00048 00049 // PORTS //////////////////////////////////////////////////////////////////////////////// 00050 sc_in<bool> switch_cntrl; 00051 sc_in<request_type> rtRequest[num_ip]; 00052 sc_in<sc_uint<ADDR_SIZE> > destRequest[num_ip]; 00053 sc_in<sc_uint<ADDR_SIZE> > sourceAddress[num_ip]; 00054 sc_in<creditLine> Icredit[num_ip][NUM_VCS]; 00055 sc_out<bool> rtReady[num_ip]; 00056 sc_out<sc_uint<3> > nextRt[num_ip]; 00057 // PORTS END ///////////////////////////////////////////////////////////////////////////// 00058 00060 SC_CTOR(Controller); 00061 00062 // PROCESSES ///////////////////////////////////////////////////////////////////////////// 00064 void setTileID(UI tileID, UI portN, UI portS, UI portE, UI portW); 00065 void allocate_route(); 00066 UI idToDir(UI); 00067 UI dirToId(UI); 00068 // PROCESSES END ///////////////////////////////////////////////////////////////////////// 00069 00070 // VARIABLES ///////////////////////////////////////////////////////////////////////////// 00071 UI tileID; 00072 UI portN; 00073 UI portS; 00074 UI portE; 00075 UI portW; 00076 00077 router *rtable; 00078 // VARIABLES END ///////////////////////////////////////////////////////////////////////// 00079 }; 00080 00081 #endif 00082