INSEE 05.04.2011
Interconnection Nertworks Simulation and Evaluation Environment
C:/cygwin/home/Javier/insee/src/router.h
Go to the documentation of this file.
00001 
00005 #ifndef _router
00006 #define _router
00007 
00008 #include "globals.h"
00009 
00016 #define dir(j,k) ((j*nways) + k)
00017 
00024 #define port_address(p,c) ((p*nchan) + c)
00025 
00029 #define address(cx,cy,cz) (cx + cy*nodes_x + cz*nodes_x*nodes_y)
00030 
00031 #define ESCAPE 0        ///< The Escape VC is always #0
00032 #define NULL_PORT -1    ///< A way to denote "no port"
00033 #define NULL_PACKET 0xffffffff  ///< A way to denote "no packet"
00034 
00039 typedef enum dim {
00040         D_X = 0,
00041         D_Y = 1,
00042         D_Z = 2,
00043         INJ = 3,
00044         CON = 4
00045 } dim;
00046 
00050 typedef enum multistages {
00051         STAGE = 0,
00052         POSITION = 1
00053 } multistages;
00054 
00058 typedef enum way {
00059         UP = 0,         
00060         DOWN = 1        
00061 } way;
00062 
00066 typedef long channel;
00067 
00072 typedef enum bet_type {
00073         B_ESCAPE = -1,          // The Escape VC
00074         B_TRIAL_0 = D_X,        // An adaptive VC in the X direction
00075         B_TRIAL_1 = D_Y,        // An adaptive VC in the Y direction
00076         B_TRIAL_2 = D_Z         // An adaptive VC in the Z direction
00077 } bet_type;
00078 
00082 typedef long port_type;
00083 
00087 typedef struct port {
00088         // Input section
00089         queue q;                
00090         bet_type bet;   
00091         port_type aop;  
00092         long tor;               
00093 
00094         // Output section
00095         long *req;              
00096         port_type ri;   
00097         port_type sip;  
00098 
00099         // Others
00100         long * histo;           
00101         long utilization;       
00102         bool_t faulty;          
00103 } port;
00104 
00109 typedef struct router {
00110         // General info
00111         long rcoord[3]; 
00112         long * nbor;    
00113         long * nborp;   
00114 
00115         // Ports
00116         port * p;               
00117         long * op_i;    
00118 
00119         // Injection
00120         inj_queue * qi;                         
00121         port_type injecting_port;       
00122         port_type next_port;            
00123         packet_t saved_packet;          
00124         long pending_packet;            
00125         long triggered;                         
00126 
00127 #if (PCOUNT!=0)
00128 
00132         long pcount;
00133 #endif
00134 
00135         // Congestion with timeouts.
00136         unsigned long timeout_counter;  
00137         unsigned long timeout_packet;   
00138 
00139         bool_t congested;                               
00140 
00141         source_t source;           
00142         
00143         // Ports and injectors
00144 #if (TRACE_SUPPORT == 1)
00145         event_q events;         
00146         event_l occurs; 
00147 #endif /* TRACE */
00148 
00149 #if (TRACE_SUPPORT > 1)
00150         event_q events;         
00151         event_l *occurs;        
00152 #endif /* TRACE */
00153 } router;
00154 #endif /* _router */
00155