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

Node.cxx

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 #include "FPcommon.h"
00034 #include "Nets.h"
00035 #include "Node.h"
00036 using namespace parquetfp;
00037 
00038 Node::Node(const char* block_name,double block_area,double minAr,double maxAr,
00039             int index,bool type)
00040    : _area(block_area),_minAr(minAr),_maxAr(maxAr),_orient(N), 
00041      _isOrientFixed(false),_slackX(0), _slackY(0),_index(index),_type(type),
00042      _isMacro(false),allPinsAtCenter(false),needSyncOrient(true)
00043    {
00044      //strncpy(_name,block_name,199);
00045      //_name[199] = '\0';
00046      _name = block_name;
00047      _placement.x=0;
00048      _placement.y=0;
00049      _width = sqrt(_area*_minAr);   //by default orientation is N
00050      _height = _width/_minAr;
00051      _origWidth = _width;
00052      _origHeight = _height;
00053    }
00054 
00055 //default ctor 
00056 Node::Node()
00057   : _area(0),_minAr(0),_maxAr(0),_orient(N),_isOrientFixed(false),_slackX(0),
00058     _slackY(0),_index(0),_type(true),_isMacro(false),allPinsAtCenter(false)
00059 {
00060   //strcpy(_name,"");
00061   _name = "";
00062   _placement.x=0;
00063   _placement.y=0;
00064   _height = 0;
00065   _width = 0;
00066 }
00067 
00068 void Node::changeOrient(ORIENT newOrient, Nets& nets)
00069 {
00070   if(_orient == newOrient)
00071     return;
00072   
00073   if(_orient%2 != newOrient%2)
00074     {
00075       double tempHeight = _height;
00076       _height = _width;
00077       _width = tempHeight;
00078     }
00079 
00080   //update the pinoffsets of the netlist now
00081   itNodePin itP;
00082   for(itP = _pins.begin(); itP != _pins.end(); ++itP)
00083     {
00084       pin& netPin = nets.getNet(itP->netIndex).getPin(itP->pinOffset);
00085       netPin.changeOrient(newOrient);
00086     }
00087   _orient = newOrient;
00088 
00089 }
00090 
00091 void Node::syncOrient(Nets& nets)
00092 {
00093   //update the heights and widths only if not updated earlier in parsePl
00094   if(needSyncOrient)
00095     {
00096      if(int(_orient)%2 == 1)  //needs swap of height and width
00097       {
00098         double tempHeight = _height;
00099         _height = _width;
00100         _width = tempHeight;
00101       }
00102     }
00103     
00104   //update the pinoffsets of the netlist now
00105   itNodePin itP;
00106   for(itP = _pins.begin(); itP != _pins.end(); ++itP)
00107     {
00108       pin& netPin = nets.getNet(itP->netIndex).getPin(itP->pinOffset);
00109       netPin.changeOrient(_orient);
00110     }
00111 }
00112 
00113 bool Node::calcAllPinsAtCenter(Nets& nets)
00114 {
00115   itNodePin itP;
00116   bool localAllPinsAtCenter=true;
00117   for(itP = _pins.begin(); itP != _pins.end(); ++itP)
00118     {
00119       pin& netPin = nets.getNet(itP->netIndex).getPin(itP->pinOffset);
00120       if(netPin.getXOffset() != 0 || netPin.getYOffset() != 0)
00121         {
00122           localAllPinsAtCenter = false;
00123           break;
00124         }
00125     }
00126   return(localAllPinsAtCenter);
00127 }

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