INSEE 05.04.2011
Interconnection Nertworks Simulation and Evaluation Environment
Defines | Typedefs | Enumerations | Functions
C:/cygwin/home/Javier/insee/src/misc.h File Reference

Some miscellaneus tools & definitions. More...

#include "constants.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ztm(m)   (long) (m * ( (1.0*rand() ) / (RAND_MAX+1.0)))
#define abs(m)   ((m<0) ? (-m) : (m))
#define sign(x)   (x<0 ? -1 : 1)
#define P_NULL   (-1)
 Definition of a NULL value.
#define max(a, b)   (((a) > (b)) ? (a) : (b))
#define min(a, b)   (((a) > (b)) ? (b) : (a))
#define mod(a, b)   ((((a)%(b)) < 0 ) ? ((a)%(b)) + (b) : ((a)%(b)) )

Typedefs

typedef enum bool_t bool_t
typedef enum topo_t topo_t
typedef enum vc_management_t vc_management_t
typedef enum traffic_pattern_t traffic_pattern_t
typedef enum cons_mode_t cons_mode_t
typedef enum routing_t routing_t
typedef enum req_mode_t req_mode_t
typedef enum arb_mode_t arb_mode_t
typedef enum inj_mode_t inj_mode_t
typedef enum placement_t placement_t
typedef enum source_t source_t

Enumerations

enum  bool_t { FALSE = 0, TRUE = 1 }
enum  topo_t {
  TORUS, MESH, MIDIMEW, TWISTED,
  DIRECT, ICUBE, CUBE, FATTREE,
  SLIMTREE, THINTREE, INDIRECT, FILEDEF
}
enum  vc_management_t {
  BUBBLE_MANAGEMENT, DALLY_MANAGEMENT, DOUBLE_MANAGEMENT, TREE_MANAGEMENT,
  ICUBE_MANAGEMENT
}
enum  traffic_pattern_t {
  UNIFORM, LOCAL, SEMI, HOTREGION,
  DISTRIBUTE, RSDIST, TRANSPOSE, TORNADO,
  COMPLEMENT, BUTTERFLY, SHUFFLE, REVERSAL,
  TRACE, POPULATION, HISTOGRAM, HOTSPOT
}
enum  cons_mode_t { SINGLE_CONS, MULTIPLE_CONS }
enum  routing_t {
  DIMENSION_ORDER_ROUTING, DIRECTION_ORDER_ROUTING, CUBE_ROUTING, STATIC_ROUTING,
  ADAPTIVE_ROUTING, IC_1M_ROUTING, IC_4M_ROUTING, MULTISTAGE_ROUTING
}
enum  req_mode_t {
  ONE_OR_MORE_REQUIRED, BUBBLE_OBLIVIOUS_REQ, DOUBLE_OBLIVIOUS_REQ, TREE_REQ,
  ICUBE_REQ, TWO_OR_MORE_REQUIRED, BUBBLE_ADAPTIVE_RANDOM_REQ, BUBBLE_ADAPTIVE_SHORTEST_REQ,
  BUBBLE_ADAPTIVE_SMART_REQ, DOUBLE_ADAPTIVE_REQ, BIMODAL_REQ, DALLY_TRC_REQ,
  DALLY_BASIC_REQ, DALLY_IMPROVED_REQ, THREE_OR_MORE_REQUIRED, DALLY_ADAPTIVE_REQ,
  SIX_REQUIRED, HEXA_ADAPTIVE_REQ, HEXA_OBLIVIOUS_REQ
}
enum  arb_mode_t {
  ROUNDROBIN_ARB, FIFO_ARB, LONGEST_ARB, RANDOM_ARB,
  AGE_ARB
}
enum  inj_mode_t {
  SHORTEST_INJ, DOR_INJ, DOR_SHORTEST_INJ, SHORTEST_PROFITABLE_INJ,
  LONGEST_PATH_INJ
}
enum  placement_t {
  CONSECUTIVE_PLACE, SHUFFLE_PLACE, RANDOM_PLACE, SHIFT_PLACE,
  ROW_PLACE, COLUMN_PLACE, QUADRANT_PLACE, ICUBE_PLACE,
  DIAGONAL_PLACE, FILE_PLACE
}
enum  source_t { NO_SOURCE, INDEPENDENT_SOURCE, OTHER_SOURCE }

Functions

void * alloc (long)
void panic (char *mes)

Detailed Description

Some miscellaneus tools & definitions.

Tools for memory allocation & error printing. Definition of some useful macros. Definition of some enumerations.


Define Documentation

#define abs (   m)    ((m<0) ? (-m) : (m))

Return the absolute value

Parameters:
mThe number.
Returns:
The absolute value of m.
#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition of the maximum chooser

Parameters:
aOne number.
bAnother One.
Returns:
The maximum of both.
#define min (   a,
 
)    (((a) > (b)) ? (b) : (a))

Definition of the minimum chooser

Parameters:
aOne number.
bAnother One.
Returns:
The minimum of both.
#define mod (   a,
 
)    ((((a)%(b)) < 0 ) ? ((a)%(b)) + (b) : ((a)%(b)) )

Definition of the module of a division

Parameters:
aOne number.
bAnother One.
Returns:
a mod b.
#define sign (   x)    (x<0 ? -1 : 1)

The sign of a numeric value.

For zero, the return value is 1

#define ztm (   m)    (long) (m * ( (1.0*rand() ) / (RAND_MAX+1.0)))

Choose a random number in [ 0, m ).

Parameters:
mmaximum.
Returns:
A random number.

Typedef Documentation

typedef enum arb_mode_t arb_mode_t

Definition of arbitration mechanism.

typedef enum bool_t bool_t

Definition of boolean values.

typedef enum cons_mode_t cons_mode_t

Definition of consumption modes.

typedef enum inj_mode_t inj_mode_t

Definition of injection techniques.

typedef enum placement_t placement_t

Definition of task placement types for trace driven.

typedef enum req_mode_t req_mode_t

Definition of all request port modes.

typedef enum routing_t routing_t

Definition of DOR classes.

typedef enum source_t source_t

Definition of the source type for trace driven.

typedef enum topo_t topo_t

Definition of all accepted topologies.

Classes of traffic sources.

Classes of VC management.


Enumeration Type Documentation

enum arb_mode_t

Definition of arbitration mechanism.

enum bool_t

Definition of boolean values.

Definition of consumption modes.

enum inj_mode_t

Definition of injection techniques.

Definition of task placement types for trace driven.

enum req_mode_t

Definition of all request port modes.

enum routing_t

Definition of DOR classes.

enum source_t

Definition of the source type for trace driven.

enum topo_t

Definition of all accepted topologies.

Classes of traffic sources.

Classes of VC management.


Function Documentation

void* alloc ( long  size)

Allocates memory.

Parameters:
sizeThe size in bytes of the memory allocation.
void panic ( char *  msg)

Stops the simulation & prints an error message.

When the simulation ends here the return code is -1.

Parameters:
msgA string containing the error message