Add isFixed, isPlaced, isBlock, isCore, isPad, isEndCap predicates

This commit is contained in:
Matt Liberty
2020-05-06 09:24:45 -07:00
parent 97169007cf
commit c43a25f3d0
5 changed files with 285 additions and 11 deletions

View File

@@ -2775,6 +2775,16 @@ class dbInst : public dbObject
///
dbPlacementStatus getPlacementStatus();
///
/// Is the placement status of this instance fixed
///
bool isFixed() { return getPlacementStatus().isFixed(); }
///
/// Is the placement status of this instance placed
///
bool isPlaced() { return getPlacementStatus().isPlaced(); }
///
/// Set the placement status of this instance.
///
@@ -2877,7 +2887,7 @@ class dbInst : public dbObject
///
/// Get the Master of this instance.
///
dbMaster* getMaster();
dbMaster* getMaster() const;
///
/// Get the instance-terminals of this instance.
@@ -3041,6 +3051,26 @@ class dbInst : public dbObject
///
void setLevel(uint v, bool fromPI);
///
/// Is the master's type BLOCK or any of its subtypes
///
bool isBlock() const;
///
/// Is the master's type CORE or any of its subtypes
///
bool isCore() const;
///
/// Is the master's type PAD or any of its subtypes
///
bool isPad() const;
///
/// Is the master's type ENDCAP or any of its subtypes
///
bool isEndCap() const;
///
/// Create a new instance.
/// Returns NULL if an instance with this name already exists.
@@ -5149,7 +5179,27 @@ class dbMaster : public dbObject
///
/// Get the type of this master cell
///
dbMasterType getType();
dbMasterType getType() const;
///
/// Is the type BLOCK or any of its subtypes
///
bool isBlock() const { return getType().isBlock(); }
///
/// Is the type CORE or any of its subtypes
///
bool isCore() const { return getType().isCore(); }
///
/// Is the type PAD or any of its subtypes
///
bool isPad() const { return getType().isPad(); }
///
/// Is the type ENDCAP or any of its subtypes
///
bool isEndCap() const { return getType().isEndCap(); }
///
/// This master can be placed automatically in the core.

View File

@@ -273,10 +273,15 @@ class dbPlacementStatus
operator Value() const { return _value; }
///
/// True Iff value corresponds to a definite (not suggested) placement.
/// True Iff value corresponds to a PLACED, LOCKED, FIRM, or COVER
///
bool isPlaced() const;
///
/// True Iff value corresponds to LOCKED, FIRM, or COVER
///
bool isFixed() const;
private:
Value _value;
};
@@ -364,6 +369,26 @@ class dbMasterType
///
operator Value() const { return _value; }
///
/// Is the type BLOCK or any of its subtypes
///
bool isBlock() const;
///
/// Is the type CORE or any of its subtypes
///
bool isCore() const;
///
/// Is the type PAD or any of its subtypes
///
bool isPad() const;
///
/// Is the type ENDCAP or any of its subtypes
///
bool isEndCap() const;
private:
Value _value;
};

View File

@@ -30,8 +30,6 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "dbInst.h"
#include <algorithm>
#include "db.h"
@@ -47,6 +45,7 @@
#include "dbHier.h"
#include "dbITerm.h"
#include "dbITermItr.h"
#include "dbInst.h"
#include "dbInstHdr.h"
#include "dbJournal.h"
#include "dbLib.h"
@@ -786,7 +785,7 @@ dbBlock* dbInst::getBlock()
return (dbBlock*) getImpl()->getOwner();
}
dbMaster* dbInst::getMaster()
dbMaster* dbInst::getMaster() const
{
_dbInst* inst = (_dbInst*) this;
_dbBlock* block = (_dbBlock*) inst->getOwner();
@@ -795,6 +794,27 @@ dbMaster* dbInst::getMaster()
_dbLib* lib = db->_lib_tbl->getPtr(inst_hdr->_lib);
return (dbMaster*) lib->_master_tbl->getPtr(inst_hdr->_master);
}
bool dbInst::isBlock() const
{
return getMaster()->isBlock();
}
bool dbInst::isCore() const
{
return getMaster()->isCore();
}
bool dbInst::isPad() const
{
return getMaster()->isPad();
}
bool dbInst::isEndCap() const
{
return getMaster()->isEndCap();
}
dbITerm* dbInst::getClockedTerm()
{
dbMaster* m = getMaster();

View File

@@ -462,7 +462,7 @@ void dbMaster::setHeight(uint h)
master->_height = h;
}
dbMasterType dbMaster::getType()
dbMasterType dbMaster::getType() const
{
_dbMaster* master = (_dbMaster*) this;
return dbMasterType(master->_flags._type);

View File

@@ -30,12 +30,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "dbTypes.h"
#include <ctype.h>
#include <string.h>
#include "dbId.h"
#include "dbTypes.h"
namespace odb {
@@ -369,8 +368,36 @@ const char* dbPlacementStatus::getString() const
bool dbPlacementStatus::isPlaced() const
{
return ((_value == PLACED) || (_value == LOCKED) || (_value == FIRM)
|| (_value == COVER));
switch (_value) {
case NONE:
case UNPLACED:
case SUGGESTED:
return false;
case PLACED:
case LOCKED:
case FIRM:
case COVER:
return true;
}
assert(false);
return false;
}
bool dbPlacementStatus::isFixed() const
{
switch (_value) {
case NONE:
case UNPLACED:
case SUGGESTED:
case PLACED:
return false;
case LOCKED:
case FIRM:
case COVER:
return true;
}
assert(false);
return false;
}
dbMasterType::dbMasterType(const char* value)
@@ -598,6 +625,158 @@ const char* dbMasterType::getString() const
return value;
}
bool dbMasterType::isBlock() const
{
switch (_value) {
case BLOCK:
case BLOCK_BLACKBOX:
case BLOCK_SOFT:
return true;
case NONE:
case COVER:
case COVER_BUMP:
case RING:
case PAD:
case PAD_INPUT:
case PAD_OUTPUT:
case PAD_INOUT:
case PAD_POWER:
case PAD_SPACER:
case PAD_AREAIO:
case CORE:
case CORE_FEEDTHRU:
case CORE_TIEHIGH:
case CORE_TIELOW:
case CORE_SPACER:
case CORE_ANTENNACELL:
case CORE_WELLTAP:
case ENDCAP:
case ENDCAP_PRE:
case ENDCAP_POST:
case ENDCAP_TOPLEFT:
case ENDCAP_TOPRIGHT:
case ENDCAP_BOTTOMLEFT:
case ENDCAP_BOTTOMRIGHT:
return false;
}
assert(false);
return false;
}
bool dbMasterType::isCore() const
{
switch (_value) {
case CORE:
case CORE_FEEDTHRU:
case CORE_TIEHIGH:
case CORE_TIELOW:
case CORE_SPACER:
case CORE_ANTENNACELL:
case CORE_WELLTAP:
return true;
case NONE:
case COVER:
case COVER_BUMP:
case RING:
case BLOCK:
case BLOCK_BLACKBOX:
case BLOCK_SOFT:
case PAD:
case PAD_INPUT:
case PAD_OUTPUT:
case PAD_INOUT:
case PAD_POWER:
case PAD_SPACER:
case PAD_AREAIO:
case ENDCAP:
case ENDCAP_PRE:
case ENDCAP_POST:
case ENDCAP_TOPLEFT:
case ENDCAP_TOPRIGHT:
case ENDCAP_BOTTOMLEFT:
case ENDCAP_BOTTOMRIGHT:
return false;
}
assert(false);
return false;
}
bool dbMasterType::isPad() const
{
switch (_value) {
case PAD:
case PAD_INPUT:
case PAD_OUTPUT:
case PAD_INOUT:
case PAD_POWER:
case PAD_SPACER:
case PAD_AREAIO:
return true;
case NONE:
case COVER:
case COVER_BUMP:
case RING:
case BLOCK:
case BLOCK_BLACKBOX:
case BLOCK_SOFT:
case CORE:
case CORE_FEEDTHRU:
case CORE_TIEHIGH:
case CORE_TIELOW:
case CORE_SPACER:
case CORE_ANTENNACELL:
case CORE_WELLTAP:
case ENDCAP:
case ENDCAP_PRE:
case ENDCAP_POST:
case ENDCAP_TOPLEFT:
case ENDCAP_TOPRIGHT:
case ENDCAP_BOTTOMLEFT:
case ENDCAP_BOTTOMRIGHT:
return false;
}
assert(false);
return false;
}
bool dbMasterType::isEndCap() const
{
switch (_value) {
case ENDCAP:
case ENDCAP_PRE:
case ENDCAP_POST:
case ENDCAP_TOPLEFT:
case ENDCAP_TOPRIGHT:
case ENDCAP_BOTTOMLEFT:
case ENDCAP_BOTTOMRIGHT:
return true;
case NONE:
case COVER:
case COVER_BUMP:
case RING:
case BLOCK:
case BLOCK_BLACKBOX:
case BLOCK_SOFT:
case PAD:
case PAD_INPUT:
case PAD_OUTPUT:
case PAD_INOUT:
case PAD_POWER:
case PAD_SPACER:
case PAD_AREAIO:
case CORE:
case CORE_FEEDTHRU:
case CORE_TIEHIGH:
case CORE_TIELOW:
case CORE_SPACER:
case CORE_ANTENNACELL:
case CORE_WELLTAP:
return false;
}
assert(false);
return false;
}
dbTechLayerType::dbTechLayerType(const char* value)
{
if (strcasecmp(value, "ROUTING") == 0)