• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/core/techModels/libHotSpot/shape.h

00001 #ifndef __SHAPE_H_
00002 #define __SHAPE_H_
00003 
00004 #include "flp.h"
00005 #include "npe.h"
00006 
00007 #define MAX_STACK               128
00008 
00009 /* piecewise linear shape curve */
00010 typedef struct shape_t_st
00011 {
00012   double *x;    /* width        */
00013   double *y;    /* height       */
00014   /* 
00015    * if this is not a leaf in an flp,
00016    * the position of the orientations
00017    * in the contributing shape curve
00018    */
00019   int *left_pos;
00020   int *right_pos;
00021   /*
00022    * the position of the demarcation
00023    * in the combined shape curve
00024    */
00025   double *median;
00026   int size;
00027 }shape_t;
00028 
00029 /* slicing tree node    */
00030 typedef struct tree_node_t_st
00031 {
00032         shape_t *curve;
00033         union {
00034                 int cut_type;
00035                 int unit;
00036         }label; 
00037         struct tree_node_t_st *left;
00038         struct tree_node_t_st *right;
00039 }tree_node_t;
00040 
00041 /* tree node stack      */
00042 typedef struct tree_node_stack_t_st
00043 {
00044         tree_node_t *array[MAX_STACK];
00045         int top;
00046 }tree_node_stack_t;
00047 
00048 /* 
00049  * make a shape curve from area and aspect ratios
00050  * - allocates memory internally
00051  */
00052 shape_t *shape_from_aspect(double area, double min, 
00053                            double max, int rotable,
00054                                                    int n_orients);
00055 /* shape curve arithmetic       */
00056 shape_t *shape_add(shape_t *shape1, shape_t *shape2, int cut_type);
00057 /* uninitialization     */
00058 void free_shape(shape_t *shape); 
00059 /* position in the shape curve with minimum area        */
00060 int min_area_pos(shape_t *curve);
00061 /* debug print  */
00062 void print_shape(shape_t *shape);
00063 
00064 /* stack operations     */
00065 tree_node_stack_t *new_tree_node_stack(void);
00066 void tree_node_stack_push(tree_node_stack_t *stack, tree_node_t *node);
00067 tree_node_t *tree_node_stack_pop(tree_node_stack_t *stack);
00068 int tree_node_stack_isfull(tree_node_stack_t *stack);
00069 int tree_node_stack_isempty(tree_node_stack_t *stack);
00070 void free_tree_node_stack(tree_node_stack_t *stack);
00071 void tree_node_stack_clear(tree_node_stack_t *stack);
00072 
00073 /* tree operations      */
00074 /* construct floorplan slicing tree from NPE    */
00075 tree_node_t *tree_from_NPE(flp_desc_t *flp_desc, 
00076                                                    tree_node_stack_t *stack, 
00077                                                    NPE_t *expr);
00078 void free_tree(tree_node_t *root);
00079 void print_tree(tree_node_t *root, flp_desc_t *flp_desc);
00080 /* 
00081  * print only the portion of the shape curves 
00082  * corresponding to the `pos'th entry of root->curve
00083  */
00084 void print_tree_relevant(tree_node_t *root, int pos, flp_desc_t *flp_desc);
00085 /* 
00086  * convert slicing tree into actual floorplan
00087  * returns the number of dead blocks compacted
00088  */
00089 int tree_to_flp(tree_node_t *root, flp_t *flp, int compact_dead, 
00090                                 double compact_ratio);
00091 #endif

Generated on Fri Oct 22 2010 11:02:14 for SST by  doxygen 1.7.1