Go to the documentation of this file.00001
00024 #ifndef RESOURCE_REQUIREMENTS_H
00025 #define RESOURCE_REQUIREMENTS_H
00026
00027 #include "RZ.h"
00028 #include "device.h"
00029 #include <iostream>
00030 #include <string>
00031 #include <vector>
00032 #include <map>
00033
00037 enum TailorRZState {Success, EndOfLine, ColumnNotUsed, LineNotUsed, HasSiblings, RestrictedColumn};
00038
00045 class ResourceRequirements {
00046
00047 private:
00048
00049 static double OVERSIZED_RZ_TRIGGER;
00050 static bool NON_RECTANGULAR_RZ;
00051 static int nbObjects;
00052
00053 std::map<RBType, int> physicalResources;
00054 Device *device;
00055 int objectID;
00056
00057 int rz_max_height;
00058
00059 std::vector<RZ> RZset;
00060
00061 public:
00067 ResourceRequirements(std::map<RBType, int> m, Device* dev) : physicalResources(m), device(dev) {
00068 objectID = ++nbObjects;
00069 rz_max_height = dev->getNbLines();
00070 }
00071
00072 ResourceRequirements() {
00073 device = 0;
00074 objectID = ++nbObjects;
00075 rz_max_height = 0;
00076 }
00077
00078 ~ResourceRequirements() {}
00079
00080
00081 Device* getDevicePtr(void);
00082 std::map<RBType, int> getPhysicalResources(void);
00083 std::vector<RZ> getRZSet(void);
00084 std::vector<RZ>* getRZSetPtr(void);
00085 int getTaskCost(void) const;
00086
00087
00088 void findRZs(void);
00089 TailorRZState createRectangularRZ(RZ *rz);
00090 TailorRZState tailorRZ(RZ *rz);
00091 bool fitsRZ(RZ *rz);
00092 void addRZToSet(RZ *rz);
00093
00094
00095 bool operator==(const ResourceRequirements &) const;
00096 bool operator<(const ResourceRequirements &) const;
00097 bool requiresResources(RBType rbtype) const;
00098 int computeInternalFragmentation(RZ &rz);
00099 bool isRZOversized(RZ *rz);
00100 void findStaticResources(RZ &rz) const;
00101
00102
00103 static void setEnableNonRectangularRZ(bool);
00104 static void setOversizedRZTrigger(double val);
00105
00106
00107 void info(void) const;
00108
00109 void setRZResourceWastage(RZ *rz);
00110
00111 private:
00112 bool RZHasEnoughResources(RZ *rz, RBType rbtype);
00113 };
00114
00115 #endif