Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

Node.h

Go to the documentation of this file.
00001 /**************************************************************************
00002 ***    
00003 *** Copyright (c) 1995-2000 Regents of the University of California,
00004 ***               Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan,
00006 ***               Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov
00007 ***
00008 ***  Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
00009 ***  Original Affiliation:   UCLA, Computer Science Department,
00010 ***                          Los Angeles, CA 90095-1596 USA
00011 ***
00012 ***  Permission is hereby granted, free of charge, to any person obtaining 
00013 ***  a copy of this software and associated documentation files (the
00014 ***  "Software"), to deal in the Software without restriction, including
00015 ***  without limitation 
00016 ***  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00017 ***  and/or sell copies of the Software, and to permit persons to whom the 
00018 ***  Software is furnished to do so, subject to the following conditions:
00019 ***
00020 ***  The above copyright notice and this permission notice shall be included
00021 ***  in all copies or substantial portions of the Software.
00022 ***
00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00030 ***
00031 ***
00032 ***************************************************************************/
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 #ifndef NODE_H
00046 #define NODE_H
00047 
00048 #include <vector>
00049 #include <algorithm>
00050 #include <math.h>
00051 #include <stdlib.h>
00052 
00053 using namespace std;
00054 
00055 namespace parquetfp
00056 {
00057    class Nets;
00058 
00059    struct NodePin
00060    {
00061       unsigned netIndex;
00062       unsigned pinOffset;
00063    };
00064 
00065    typedef std::vector<NodePin>::iterator itNodePin;
00066 
00067    class Node
00068    {
00069    private:
00070       string _name;
00071       double _area;
00072       double _minAr;
00073       double _maxAr;
00074       double _origWidth;
00075       double _origHeight;
00076       double _width;
00077       double _height;
00078       ORIENT _orient;          //N,E,S,W,FN.FE,FS or FW. N on initialization
00079       bool _isOrientFixed;
00080       double _slackX;
00081       double _slackY;
00082       int _index;
00083       bool _type;              //0 normal node,1 pad
00084       bool _isMacro;           //is Node Macro(used only during clustering)
00085       Point _placement;
00086       vector<NodePin> _pins;       //all the pins of this node
00087       vector<int> _subBlockIndices; //indices of subBlocks
00088       int _voltage;
00089 
00090    public:
00091       bool allPinsAtCenter;   //helps for HPWL evaluation. made public member for speed. be carefull in modifying this.
00092       bool calcAllPinsAtCenter(Nets& nets); //use this only for initialization. else use above variable
00093 
00094       //ctors
00095       Node(const char* block_name,double block_area,double minAr,double maxAr,
00096            int index,bool type);
00097       Node();
00098 
00099       void addVoltage(int voltage)
00100          { _voltage = voltage;}
00101       int getVoltage()
00102         {  return _voltage;}
00103 
00104       bool getType() const
00105          { return _type;}
00106       float getIndex(void) const 
00107          {return _index;} 
00108       ORIENT getOrient(void) const
00109          {return _orient;}
00110       bool isOrientFixed(void) const
00111         {return _isOrientFixed;}
00112       double getHeight(void) const
00113          {return _height;}
00114       double getWidth(void) const
00115          {return _width;}
00116       double getOrigHeight(void) const
00117          {return _origHeight;}
00118       double getOrigWidth(void) const
00119          {return _origWidth;}
00120       char* getName(void) 
00121          {return const_cast<char*>(_name.c_str());}
00122       double getX(void) const
00123          {return _placement.x;}
00124       double getY(void) const
00125          {return _placement.y;}
00126       double getslackX(void) const 
00127          {return _slackX;}
00128       double getslackY(void) const
00129          {return _slackY;}
00130       double getminAR(void) const
00131          {return _minAr;}
00132       double getmaxAR(void) const
00133          {return _maxAr;}
00134       double getArea(void) const
00135          {return _area;}
00136       bool isMacro(void) const
00137          {return _isMacro;}
00138       void updateMacroInfo(bool isMacro)
00139          {_isMacro = isMacro;}
00140 
00141       itNodePin pinsBegin()
00142          {return _pins.begin(); }
00143       itNodePin pinsEnd()
00144          {return _pins.end(); }
00145       unsigned getDegree() const
00146          { return _pins.size(); }
00147       void clearPins()
00148          { _pins.clear(); }
00149 
00150       vector<int>::iterator subBlocksBegin()
00151          {return _subBlockIndices.begin();}
00152       vector<int>::iterator subBlocksEnd()
00153          {return _subBlockIndices.end();}
00154       unsigned numSubBlocks()
00155          {return _subBlockIndices.size();}
00156       vector<int>& getSubBlocks()
00157          { return _subBlockIndices; }
00158 
00159 
00160       void putArea(double area)
00161          {_area=area;}
00162       void putWidth(double w)
00163          {_width=w;}
00164       void putHeight(double h)
00165          {_height=h;}
00166       void putX(double x)
00167          {_placement.x=x;}
00168       void putY(double y)
00169          {_placement.y=y;}
00170       void putslackX(double x)
00171          {_slackX=x;}
00172       void putslackY(double y)
00173          {_slackY=y;}
00174       void addPin(NodePin& pinTemp)
00175          {_pins.push_back(pinTemp);}
00176       
00177       void putOrient(ORIENT newOrient)    //to be used only during initialization
00178          { _orient = newOrient; }          //else use changeOrient
00179       void putmaxAR(double newMaxAR) { _maxAr = newMaxAR; }
00180       void putminAR(double newMinAR) { _minAr = newMinAR; }
00181       
00182       void putIsOrientFixed(bool value)
00183         { _isOrientFixed = value;}
00184       void addSubBlockIndex(int index)
00185          { _subBlockIndices.push_back(index); }
00186 
00187       void changeOrient(ORIENT newOrient, Nets& nets);
00188       void syncOrient(Nets& nets);
00189       bool needSyncOrient;  //during parsing if DIMS found then no need to change
00190       //H & W. If orient found and no DIMS then need change
00191       //in H & W
00192 
00193    };
00194 
00195 }
00196 //using namespace parquetfp;
00197 
00198 #endif

Generated on Mon Apr 25 01:09:24 2005 for Parquete by doxygen 1.3.2