Go to the documentation of this file.00001
00035 #ifndef RZ_H
00036 #define RZ_H
00037
00038 #include <iostream>
00039 #include <string>
00040 #include <vector>
00041 #include <map>
00042 using namespace std;
00043
00044 #include "device.h"
00045 #include "coordinates.h"
00046 #include "interface_location.h"
00047 #include "utils.h"
00048
00056 enum ResourceConstraint{UNUSED, USED, STATIC, NOT_RECONFIGURABLE};
00057
00064 enum RZExtensionReturnValue {SUCCESS, END_OF_LINE, RESTRICTED_COLUMN};
00065
00066 class RZ {
00067
00068 private:
00069
00071 static double VERTEX_COST;
00072 static double TASK_CORRELATION_COST;
00073 static double INTERNAL_FRAGMENTATION_COST;
00074 static int MINIMUM_DISTANCE_BETWEEN_RZ;
00075
00076
00077 static int static_rz_id;
00078 int x0, y0, height;
00079
00080 string id;
00081 double cost;
00082 Device *device;
00083 bool reverse;
00084
00085
00086 vector<vector<pair<RBType, ResourceConstraint> > > resourcesArray;
00087 map<RBType, int> constrainedResourcesCount;
00088
00089
00090 vector<string> compatibleTasks;
00091 int nbIncompatibleTasks;
00092
00093 double resourceWastage;
00094
00095
00096 public:
00097 RZ(int _x0, int _y0, int _height, Device *dev, bool rev) : x0(_x0), y0(_y0), height(_height), device(dev), reverse(rev) {
00098 id = Utils::itoa(static_rz_id);
00099 static_rz_id++;
00100 nbIncompatibleTasks = 0;
00101 resourceWastage = 0;
00102 }
00103
00104 RZ(string rz_id, int _x0, int _y0, int _height, Device *dev, bool rev) : x0(_x0), y0(_y0), height(_height), device(dev), reverse(rev) {
00105 id = rz_id;
00106 static_rz_id++;
00107 nbIncompatibleTasks = 0;
00108 resourceWastage = 0;
00109 }
00110
00112 RZ(const RZ &rz) {
00113 x0 = rz.x0;
00114 y0 = rz.y0;
00115 id = Utils::itoa(static_rz_id);
00116
00117 static_rz_id++;
00118 height = rz.height;
00119 device = rz.device;
00120 resourcesArray = rz.resourcesArray;
00121 constrainedResourcesCount = rz.constrainedResourcesCount;
00122 cost = rz.cost;
00123 resourcesArray = rz.resourcesArray;
00124 reverse = rz.reverse;
00125 nbIncompatibleTasks = rz.nbIncompatibleTasks;
00126 resourceWastage = rz.resourceWastage;
00127 }
00128
00129
00130 int getX0(void);
00131 int getY0(void);
00132 int getHeight(void);
00133 map<RBType, int> getConstrainedResourcesCount(void);
00134 vector<vector<pair<RBType, ResourceConstraint> > > * getResourcesArrayPtr(void);
00135 int getRZCost(void) const;
00136 bool isReversed(void);
00137 string getID(void) const;
00138 Device * getDevicePtr(void);
00139
00140
00141 RZExtensionReturnValue extendRZ(void);
00142 void updateConstrainedResources();
00143
00144
00145 void printRZ(void);
00146 void info(void) const;
00147 int computeBitstreamSize(void);
00148 bool constrainsColumn(Coordinates c);
00149
00150
00151 void computeCost(void);
00152
00153
00154 void generateUCF(string taskname);
00155 void generateUCF(string taskname, string pblock_name, ofstream& file);
00156
00157
00158
00159
00160
00161
00162 bool operator==(const RZ &rz) const;
00163 bool operator!=(const RZ &rz) const;
00164
00165
00166 int horizontalDistance(const RZ &other);
00167 int verticalDistance(const RZ &other);
00168 bool isOverlappingRZ(const RZ &other);
00169 bool overlapsRZInSet(vector<RZ> &rzs);
00170
00171
00172 void addCompatibleTask(string task);
00173 void setNbIncompatibleTasks(int nbTasks);
00174 int getNbIncompatibleTasks(void);
00175 vector<string> getCompatibleTaskVector(void);
00176 void clearCompatibleTasks(void);
00177
00178
00179 static void setTaskCorrelationCost(double c);
00180 static void setRZShapeCost(double c);
00181 static void setInternalFragmentationCost(double c);
00182 static void setMinimumDistanceBetweenRZs(int val);
00183
00184 void setResourceWastage(double val);
00185
00186 bool isResourcePositionOK(InterfaceLocation loc);
00187
00188 void setResourcesArray(vector<vector<pair<RBType, ResourceConstraint> > > &vec);
00189
00190
00191 bool areColumnsIdentical(int col1, int col2);
00192 bool isColumnIdenticallyConstrained(int col);
00193
00194 void setID(string);
00195
00196 };
00197
00198 #endif