📄 oadefincomponent.cpp
字号:
// *****************************************************************************// *****************************************************************************// DefInComponent.cpp//// Functions to handle DEF COMPONENTS constructs for the 'def2oa' translator.//// *****************************************************************************// Except as specified in the OpenAccess terms of use of Cadence or Silicon// Integration Initiative, this material may not be copied, modified,// re-published, uploaded, executed, or distributed in any way, in any medium,// in whole or in part, without prior written permission from Cadence.//// Copyright 2002-2005 Cadence Design Systems, Inc.// All Rights Reserved.//// $Author: nitters $// $Revision: 1.85 $// $Date: 2005/07/29 13:50:59 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefInComponent::DefInComponent()// DefInComponent::~DefInComponent()//// This is the constructor for the DefInComponent class.// *****************************************************************************DefInComponent::DefInComponent(DefIn &translator): defIn(translator){ translator.defInComponent = this;}DefInComponent::~DefInComponent(){}// *****************************************************************************// DefInComponent::parse()//// This function handles the DEF COMPONENT construct.//// It searches a master design for the component, creates a new instance and// stores the optional attributes on the instance.// *****************************************************************************oaBooleanDefInComponent::parse(defiComponent *data){ defComponent = data; createInst(); parsePlacement(); parseWeight(); parseSource(); parseEEQMaster(); parseRegion(); parseHalo(); parseProperties(); return master.design != NULL;}// *****************************************************************************// DefInComponent::parsePlacement()//// This function handles the PLACEMENT attribute of the current instance.// *****************************************************************************voidDefInComponent::parsePlacement(){ if (defComponent->isPlaced() || defComponent->isFixed() || defComponent->isCover() || defComponent->isUnplaced()) { if (!defComponent->isUnplaced()) { oaInt4 x(defIn.scaleToDBU(defComponent->placementX())); oaInt4 y(defIn.scaleToDBU(defComponent->placementY())); oaOrient orient(defIn.getOrient(defComponent->placementOrient())); // To determine the location of the origin of the instance : // - Get the bbox of the boundary of the master cell // - Rotate or flip the bbox with the specified DEF orientation // - Snap the new lower left corner of the bbox onto the DEF x y // coordinates (ie instance origin coordinates = // distance bbox lowerLeft to 0 0 + DEF x y coordinates) oaBox bbox; master.bBox.transform(oaTransform(orient), bbox); oaPoint origin(x - bbox.left(), y - bbox.bottom()); inst->setOrigin(origin); inst->setOrient(orient); } // Set the placement status of the instance if (defComponent->isPlaced()) { inst->setPlacementStatus(oacPlacedPlacementStatus); } else if (defComponent->isFixed()) { inst->setPlacementStatus(oacFixedPlacementStatus); } else if (defComponent->isCover()) { inst->setPlacementStatus(oacLockedPlacementStatus); } else if (defComponent->isUnplaced()) { inst->setPlacementStatus(oacUnplacedPlacementStatus); } } else { inst->setPlacementStatus(oacNonePlacementStatus); }}// *****************************************************************************// DefInComponent::parseWeight()//// This function handles the WEIGHT attribute of the current instance.// *****************************************************************************voidDefInComponent::parseWeight(){ if (defComponent->hasWeight()) { inst->setPriority(defComponent->weight()); }}// *****************************************************************************// DefInComponent::parseSource()//// This function handles the SOURCE attribute of the current instance.// *****************************************************************************voidDefInComponent::parseSource(){ if (defComponent->hasSource()) { oaString source = defComponent->source(); if (source == "DIST") { inst->setSource(oacDistSource); } else if (source == "NETLIST") { inst->setSource(oacNetlistSource); } else if (source == "TIMING") { inst->setSource(oacTimingSource); } else if (source == "USER") { inst->setSource(oacUserSource); } }}// *****************************************************************************// DefInComponent::parseEEQMaster()//// This function handles the EEQ attribute of the current instance.// *****************************************************************************voidDefInComponent::parseEEQMaster(){ if (defComponent->hasEEQ()) { // Check it matches its master's EEQ oaDesign *eeqMaster = inst->getMaster(); if (eeqMaster) { oaString masterEEQMaster; eeqMaster->getTopBlock()->getEEQMaster(masterEEQMaster); if (strcmp(defComponent->EEQ(), masterEEQMaster)) { defIn.error(cInstInvalidEEQ, defComponent->id(), defComponent->EEQ()); } } }}// *****************************************************************************// DefInComponent::parseRegion()//// This function handles the REGION attribute for the current instance.// *****************************************************************************voidDefInComponent::parseRegion(){ oaCluster *region = NULL; if (defComponent->hasRegionName()) { region = oaCluster::find(defIn.topBlock(), defComponent->regionName()); if (!region || (region->getBoundaries().getCount() == 0)) { defIn.error(cInstCannotFindRegion, defComponent->id(), defComponent->regionName()); return; } inst->addToCluster(region); } else if (defComponent->hasRegionBounds()) { // Create an anonymous region region = defIn.getDefInRegion()->create("", NULL, defComponent, false, true); inst->addToCluster(region); }}// *****************************************************************************// DefInComponent::parseHalo()//// This function handles the HALO attribute for the current instance.// *****************************************************************************voidDefInComponent::parseHalo(){ if (defComponent->hasHalo()) { int left; int bottom; int right; int top; defComponent->haloEdges(&left, &bottom, &right, &top); oaAreaHalo::create(inst, defIn.scaleToDBU(left), defIn.scaleToDBU(bottom), defIn.scaleToDBU(right), defIn.scaleToDBU(top)); }}// *****************************************************************************// DefInComponent::parseProperties()//// This function handles the properties on the current instance.// *****************************************************************************voidDefInComponent::parseProperties(){ LefDefProp *propDef; for (int i = 0; i < defComponent->numProps(); i++) { propDef = defIn.getProp(defComponent->propName(i), cLefDefComponent); defIn.createProp(propDef, inst, defComponent->propValue(i)); }}// *****************************************************************************// DefInComponent::isPhysicalOnly()//// This function returns true if this object should be added in case of// doing an update of an existing logical design. This is the case for://// - Any cells marked with + SOURCE DIST. This includes filler cells and// tieHigh/tieLow cells// - CLASS COVER (including BUMP) cells that have only +USE POWER/GROUND// terminals // - CLASS PAD cells (such as power or ground pads) that have only +USE// POWER/GROUND terminals // *****************************************************************************oaBooleanDefInComponent::isPhysicalOnly(){ if (defComponent->hasSource() && !strcmp(defComponent->source(), "DIST")) { return true; } return master.physicalOnly;}// *****************************************************************************// DefInComponent::createInst()//// This function handles the attributes of the current instance.// *****************************************************************************voidDefInComponent::createInst(){ getMaster(); defIn.getSimpleName(defComponent->id(), simpleInstName); if (inst = oaInst::find(defIn.topBlock(), simpleInstName)) { return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -