INSEE 05.04.2011
Interconnection Nertworks Simulation and Evaluation Environment
C:/cygwin/home/Javier/insee/src/misc.h
Go to the documentation of this file.
00001 
00010 #ifndef _misc
00011 #define _misc
00012 
00013 #include "constants.h"
00014 #include <errno.h>
00015 #include <stdio.h>
00016 #include <stdlib.h>
00017 
00024 #define ztm(m) (long) (m * ( (1.0*rand() ) / (RAND_MAX+1.0)))
00025 
00032 #define abs(m) ((m<0) ? (-m) : (m))
00033 
00039 #define sign(x) (x<0 ? -1 : 1)
00040 
00041 #define P_NULL (-1) ///< Definition of a NULL value.
00042 
00050 #ifndef max
00051 #define max(a,b)            (((a) > (b)) ? (a) : (b))
00052 #endif
00053 
00061 #ifndef min
00062 #define min(a,b)            (((a) > (b)) ? (b) : (a))
00063 #endif
00064 
00072 #ifndef mod
00073 #define mod(a,b)            ((((a)%(b)) <  0 ) ? ((a)%(b)) + (b) : ((a)%(b)) )
00074 #endif
00075 
00079 typedef enum bool_t {
00080         FALSE = 0, TRUE = 1
00081 } bool_t;
00082 
00086 typedef enum topo_t {
00087         // Original fsin topologies
00088         TORUS, MESH, MIDIMEW, TWISTED,
00089         // Direct topologies
00090         DIRECT,
00091         // Other cube-based topologies
00092         ICUBE, CUBE,
00093         // Indirect Topologies
00094         FATTREE, SLIMTREE, THINTREE, INDIRECT,
00095         // File defined: TO DO
00096         FILEDEF
00097 } topo_t;
00098 
00102 typedef enum vc_management_t {
00103         BUBBLE_MANAGEMENT,              // Normal bubble -- requires just 1 VC
00104         DALLY_MANAGEMENT,               // Dally management -- requires at least 2 VC
00105         DOUBLE_MANAGEMENT,              // Double bubble: XY, YX. More options for 3D
00106         TREE_MANAGEMENT,                // Fattree, thintree, slimtree.
00107         ICUBE_MANAGEMENT,               // indirect cube.
00108 } vc_management_t;
00109 
00113 typedef enum traffic_pattern_t {
00114         UNIFORM,        // Random selection of destination
00115         LOCAL,  // 50% of the traffic goes to [0,1], 25% goes to [2,3], 12.5% goes to [4-7], 12.5% goes further.
00116         SEMI,           // Uniform traffic in the left-half of a cube-like network
00117         HOTREGION,      // 1/4 of traffic goes to first 1/8 of network; remaining traffic is uniform
00118         DISTRIBUTE,     // Starting from node n+1, sent packets to n+1, n+2, n+3, ...
00119         RSDIST,         // Like DISTRIBUTE, but starting with a random destination
00120         TRANSPOSE,      // Matrix transpose permutation
00121         TORNADO,        // Tornado permutation
00122         COMPLEMENT,     // Bit-complement permutation
00123         BUTTERFLY,      // Butterfly permutation CHECK CHECK CHECK
00124         SHUFFLE,        // Perfect shuffle permutation
00125         REVERSAL,       // Bit-reversal permutation
00126         TRACE,          // Load from trace file
00127         POPULATION,     // Load a population of a distribution from a trace file
00128         HISTOGRAM,      // load the histogram of a distribution from a trace file
00129         HOTSPOT         // 5% of traffic goes to the eth connection in (0,0), 95% uniform
00130 } traffic_pattern_t;
00131 
00135 typedef enum cons_mode_t {
00136         SINGLE_CONS, MULTIPLE_CONS
00137 } cons_mode_t;
00138 
00142 typedef enum routing_t {
00143         DIMENSION_ORDER_ROUTING,        // DOR means Dimesion Order Routing.
00144         DIRECTION_ORDER_ROUTING,        // DOR means Direction Order Routing.
00145         CUBE_ROUTING,                           // Just for cubes.
00146         STATIC_ROUTING,                         // Static routing for trees and indirect cube .
00147         ADAPTIVE_ROUTING,                       // Adaptive routing for trees and indirect cube .
00148         IC_1M_ROUTING,              // STATIC DOR in icubes
00149         IC_4M_ROUTING,              // STATIC DOR in icubes (4meshes)
00150         MULTISTAGE_ROUTING,                     // Just for multistage.
00151 } routing_t;
00152 
00156 typedef enum req_mode_t {
00157         // Variants for BUBBLE
00158 ONE_OR_MORE_REQUIRED,
00159         BUBBLE_OBLIVIOUS_REQ, DOUBLE_OBLIVIOUS_REQ, TREE_REQ, ICUBE_REQ, 
00160 TWO_OR_MORE_REQUIRED,
00161         BUBBLE_ADAPTIVE_RANDOM_REQ, BUBBLE_ADAPTIVE_SHORTEST_REQ, BUBBLE_ADAPTIVE_SMART_REQ, DOUBLE_ADAPTIVE_REQ, BIMODAL_REQ,
00162         // Variants for DALLY
00163         DALLY_TRC_REQ, DALLY_BASIC_REQ, DALLY_IMPROVED_REQ,
00164 THREE_OR_MORE_REQUIRED,
00165         DALLY_ADAPTIVE_REQ,
00166 SIX_REQUIRED,
00167         HEXA_ADAPTIVE_REQ, HEXA_OBLIVIOUS_REQ
00168 } req_mode_t;
00169 
00173 typedef enum arb_mode_t {
00174         ROUNDROBIN_ARB, FIFO_ARB, LONGEST_ARB, RANDOM_ARB, AGE_ARB
00175 } arb_mode_t;
00176 
00180 typedef enum inj_mode_t {
00181         // No prerouting
00182         SHORTEST_INJ,
00183         // With prerouting
00184         DOR_INJ, DOR_SHORTEST_INJ, SHORTEST_PROFITABLE_INJ, LONGEST_PATH_INJ
00185 } inj_mode_t;
00186 
00190 typedef enum placement_t{
00191         CONSECUTIVE_PLACE, SHUFFLE_PLACE, RANDOM_PLACE, SHIFT_PLACE, ROW_PLACE, COLUMN_PLACE, QUADRANT_PLACE, ICUBE_PLACE, DIAGONAL_PLACE, FILE_PLACE
00192 } placement_t;
00193 
00197 typedef enum source_t{
00198         NO_SOURCE, INDEPENDENT_SOURCE, OTHER_SOURCE
00199 } source_t;
00200 
00201 // Some declarations.
00202 void * alloc(long);
00203 void panic(char *mes);
00204 
00205 #endif /* _misc */
00206