1 /************************************************************************** 2 *** 3 *** Copyright (c) 2000-2006 Regents of the University of Michigan, 4 *** Saurabh N. Adya, Hayward Chan, Jarrod A. Roy 5 *** and Igor L. Markov 6 *** 7 *** Contact author(s): sadya@umich.edu, imarkov@umich.edu 8 *** Original Affiliation: University of Michigan, EECS Dept. 9 *** Ann Arbor, MI 48109-2122 USA 10 *** 11 *** Permission is hereby granted, free of charge, to any person obtaining 12 *** a copy of this software and associated documentation files (the 13 *** "Software"), to deal in the Software without restriction, including 14 *** without limitation 15 *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 16 *** and/or sell copies of the Software, and to permit persons to whom the 17 *** Software is furnished to do so, subject to the following conditions: 18 *** 19 *** The above copyright notice and this permission notice shall be included 20 *** in all copies or substantial portions of the Software. 21 *** 22 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 26 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 27 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 28 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 *** 30 *** 31 ***************************************************************************/ 32 33 #ifndef NODE_H 34 #define NODE_H 35 36 #include <algorithm> 37 #include <cmath> 38 #include <cstdlib> 39 40 #include "FPcommon.h" 41 42 namespace parquetfp { 43 class Nets; 44 45 struct NodePin 46 { 47 unsigned netIndex; 48 unsigned pinOffset; 49 }; 50 51 typedef std::vector<NodePin>::iterator itNodePin; 52 53 class Node 54 { 55 private: 56 float _area; 57 float _minAr; 58 float _maxAr; 59 float _width; 60 float _height; 61 62 float _snapX; 63 float _snapY; 64 float _haloX; 65 float _haloY; 66 float _channelX; 67 float _channelY; 68 69 ORIENT _orient; // N,E,S,W,FN.FE,FS or FW. N on initialization 70 bool _isOrientFixed; 71 float _slackX; 72 float _slackY; 73 int _index; 74 bool _type; // 0 normal node,1 pad 75 bool _isMacro; // is Node Macro(used only during clustering) 76 bool _needsFP; //<aaronnn> if node needs FP (e.g., if this node triggered FP) 77 Point _placement; 78 std::vector<NodePin> _pins; // all the pins of this node 79 std::vector<int> _subBlockIndices; // indices of subBlocks 80 81 std::string _name; 82 float _origWidth; 83 float _origHeight; 84 85 public: 86 bool allPinsAtCenter; // helps for HPWL evaluation. made public member for 87 // speed. be carefull in modifying this. 88 bool calcAllPinsAtCenter( 89 Nets& nets); // use this only for initialization. else use above variable 90 91 // ctors 92 Node(const std::string block_name, 93 float block_area, 94 float minAr, 95 float maxAr, 96 int index, 97 bool type); 98 Node(const Node& orig); 99 getType()100 bool getType() const { return _type; } getIndex(void)101 int getIndex(void) const { return _index; } getOrient(void)102 ORIENT getOrient(void) const { return _orient; } isOrientFixed(void)103 bool isOrientFixed(void) const { return _isOrientFixed; } getHeight(void)104 float getHeight(void) const { return _height; } getWidth(void)105 float getWidth(void) const { return _width; } getOrigHeight(void)106 float getOrigHeight(void) const { return _origHeight; } getOrigWidth(void)107 float getOrigWidth(void) const { return _origWidth; } getName(void)108 std::string getName(void) const { return _name; } getX(void)109 float getX(void) const { return _placement.x; } getY(void)110 float getY(void) const { return _placement.y; } getslackX(void)111 float getslackX(void) const { return _slackX; } getslackY(void)112 float getslackY(void) const { return _slackY; } getminAR(void)113 float getminAR(void) const { return _minAr; } getmaxAR(void)114 float getmaxAR(void) const { return _maxAr; } getArea(void)115 float getArea(void) const { return _area; } 116 getSnapX(void)117 float getSnapX(void) const { return _snapX; } getSnapY(void)118 float getSnapY(void) const { return _snapY; } getHaloX(void)119 float getHaloX(void) const { return _haloX; } getHaloY(void)120 float getHaloY(void) const { return _haloY; } getChannelX(void)121 float getChannelX(void) const { return _channelX; } getChannelY(void)122 float getChannelY(void) const { return _channelY; } 123 isMacro(void)124 bool isMacro(void) const { return _isMacro; } needsFP(void)125 bool needsFP(void) const { return _needsFP; } // <aaronnn> isHard(void)126 bool isHard(void) const { return equalFloat(_maxAr, _minAr); } updateMacroInfo(bool isMacro)127 void updateMacroInfo(bool isMacro) { _isMacro = isMacro; } 128 pinsBegin()129 itNodePin pinsBegin() { return _pins.begin(); } pinsEnd()130 itNodePin pinsEnd() { return _pins.end(); } getDegree()131 unsigned getDegree() const { return _pins.size(); } clearPins()132 void clearPins() { _pins.clear(); } subBlocksBegin()133 std::vector<int>::iterator subBlocksBegin() 134 { 135 return _subBlockIndices.begin(); 136 } subBlocksEnd()137 std::vector<int>::iterator subBlocksEnd() { return _subBlockIndices.end(); } numSubBlocks()138 unsigned numSubBlocks() { return _subBlockIndices.size(); } getSubBlocks()139 std::vector<int>& getSubBlocks() { return _subBlockIndices; } 140 putArea(float area)141 void putArea(float area) { _area = area; } 142 putWidth(float w)143 void putWidth(float w) { _width = w; } putHeight(float h)144 void putHeight(float h) { _height = h; } putHaloX(float hx)145 void putHaloX(float hx) { _haloX = hx; } putHaloY(float hy)146 void putHaloY(float hy) { _haloY = hy; } putSnapX(float sx)147 void putSnapX(float sx) { _snapX = sx; } putSnapY(float sy)148 void putSnapY(float sy) { _snapY = sy; } putChannelX(float cx)149 void putChannelX(float cx) { _channelX = cx; } putChannelY(float cy)150 void putChannelY(float cy) { _channelY = cy; } 151 putX(float x)152 void putX(float x) { _placement.x = x; } putY(float y)153 void putY(float y) { _placement.y = y; } putslackX(float x)154 void putslackX(float x) { _slackX = x; } putslackY(float y)155 void putslackY(float y) { _slackY = y; } putNeedsFP(bool needFP)156 void putNeedsFP(bool needFP) { _needsFP = needFP; } // <aaronnn> addPin(NodePin & pinTemp)157 void addPin(NodePin& pinTemp) { _pins.push_back(pinTemp); } 158 159 // to be used only during initialization else use changeOrient putOrient(ORIENT newOrient)160 void putOrient(ORIENT newOrient) { _orient = newOrient; } putmaxAR(float newMaxAR)161 void putmaxAR(float newMaxAR) { _maxAr = newMaxAR; } putminAR(float newMinAR)162 void putminAR(float newMinAR) { _minAr = newMinAR; } 163 putIsOrientFixed(bool value)164 void putIsOrientFixed(bool value) { _isOrientFixed = value; } addSubBlockIndex(int index)165 void addSubBlockIndex(int index) { _subBlockIndices.push_back(index); } 166 167 void changeOrient(ORIENT newOrient, Nets& nets); 168 void syncOrient(Nets& nets); 169 bool needSyncOrient; // during parsing if DIMS found then no need to change 170 // H & W. If orient found and no DIMS then need change 171 // in H & W 172 }; 173 174 } // namespace parquetfp 175 // using namespace parquetfp; 176 177 #endif 178