mirror of
https://github.com/The-OpenROAD-Project/OpenDB.git
synced 2026-03-06 17:31:17 +08:00
add support for SOFT & PARTIAL on blockages
This commit is contained in:
@@ -4022,6 +4022,26 @@ class dbBlockage : public dbObject
|
||||
///
|
||||
bool isPushedDown();
|
||||
|
||||
///
|
||||
/// Declare this blockage is soft.
|
||||
///
|
||||
void setSoft();
|
||||
|
||||
///
|
||||
/// Returns true if this blockage is soft.
|
||||
///
|
||||
bool isSoft();
|
||||
|
||||
///
|
||||
/// Set the max placement density percentage in [0,100]
|
||||
///
|
||||
void setMaxDensity(float max_density);
|
||||
|
||||
///
|
||||
/// Returns the max placement density percentage
|
||||
///
|
||||
float getMaxDensity();
|
||||
|
||||
///
|
||||
/// Get the block this obstruction belongs too.
|
||||
///
|
||||
|
||||
@@ -30,10 +30,9 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "dbBlockage.h"
|
||||
|
||||
#include "db.h"
|
||||
#include "dbBlock.h"
|
||||
#include "dbBlockage.h"
|
||||
#include "dbBox.h"
|
||||
#include "dbDatabase.h"
|
||||
#include "dbDiff.h"
|
||||
@@ -67,12 +66,18 @@ bool _dbBlockage::operator==(const _dbBlockage& rhs) const
|
||||
if (_flags._pushed_down != rhs._flags._pushed_down)
|
||||
return false;
|
||||
|
||||
if (_flags._soft != rhs._flags._soft)
|
||||
return false;
|
||||
|
||||
if (_inst != rhs._inst)
|
||||
return false;
|
||||
|
||||
if (_bbox != rhs._bbox)
|
||||
return false;
|
||||
|
||||
if (_max_density != rhs._max_density)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,6 +113,18 @@ bool _dbBlockage::operator<(const _dbBlockage& rhs) const
|
||||
|
||||
if (_flags._pushed_down > rhs._flags._pushed_down)
|
||||
return false;
|
||||
|
||||
if (_flags._soft < rhs._flags._soft)
|
||||
return true;
|
||||
|
||||
if (_flags._soft > rhs._flags._soft)
|
||||
return false;
|
||||
|
||||
if (_max_density < rhs._max_density)
|
||||
return true;
|
||||
|
||||
if (_max_density > rhs._max_density)
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -144,6 +161,8 @@ void _dbBlockage::differences(dbDiff& diff,
|
||||
}
|
||||
|
||||
DIFF_FIELD(_flags._pushed_down);
|
||||
DIFF_FIELD(_flags._soft);
|
||||
DIFF_FIELD(_max_density);
|
||||
DIFF_END
|
||||
}
|
||||
|
||||
@@ -167,6 +186,8 @@ void _dbBlockage::out(dbDiff& diff, char side, const char* field) const
|
||||
}
|
||||
|
||||
DIFF_OUT_FIELD(_flags._pushed_down);
|
||||
DIFF_OUT_FIELD(_flags._soft);
|
||||
DIFF_OUT_FIELD(_max_density);
|
||||
DIFF_END
|
||||
}
|
||||
|
||||
@@ -200,6 +221,30 @@ bool dbBlockage::isPushedDown()
|
||||
return bkg->_flags._pushed_down == 1;
|
||||
}
|
||||
|
||||
void dbBlockage::setSoft()
|
||||
{
|
||||
_dbBlockage* bkg = (_dbBlockage*) this;
|
||||
bkg->_flags._soft = 1;
|
||||
}
|
||||
|
||||
bool dbBlockage::isSoft()
|
||||
{
|
||||
_dbBlockage* bkg = (_dbBlockage*) this;
|
||||
return bkg->_flags._soft == 1;
|
||||
}
|
||||
|
||||
void dbBlockage::setMaxDensity(float max_density)
|
||||
{
|
||||
_dbBlockage* bkg = (_dbBlockage*) this;
|
||||
bkg->_max_density = max_density;
|
||||
}
|
||||
|
||||
float dbBlockage::getMaxDensity()
|
||||
{
|
||||
_dbBlockage* bkg = (_dbBlockage*) this;
|
||||
return bkg->_max_density;
|
||||
}
|
||||
|
||||
dbBlock* dbBlockage::getBlock()
|
||||
{
|
||||
return (dbBlock*) getImpl()->getOwner();
|
||||
|
||||
@@ -48,7 +48,8 @@ class dbDiff;
|
||||
struct _dbBlockageFlags
|
||||
{
|
||||
uint _pushed_down : 1;
|
||||
uint _spare_bits : 31;
|
||||
uint _soft : 1;
|
||||
uint _spare_bits : 30;
|
||||
};
|
||||
|
||||
class _dbBlockage : public _dbObject
|
||||
@@ -57,6 +58,7 @@ class _dbBlockage : public _dbObject
|
||||
_dbBlockageFlags _flags;
|
||||
dbId<_dbInst> _inst;
|
||||
dbId<_dbBox> _bbox;
|
||||
float _max_density;
|
||||
|
||||
_dbBlockage(_dbDatabase* db);
|
||||
_dbBlockage(_dbDatabase* db, const _dbBlockage& b);
|
||||
@@ -78,10 +80,15 @@ inline _dbBlockage::_dbBlockage(_dbDatabase*)
|
||||
{
|
||||
_flags._pushed_down = 0;
|
||||
_flags._spare_bits = 0;
|
||||
_flags._soft = 0;
|
||||
_max_density = 100.0;
|
||||
}
|
||||
|
||||
inline _dbBlockage::_dbBlockage(_dbDatabase*, const _dbBlockage& b)
|
||||
: _flags(b._flags), _inst(b._inst), _bbox(b._bbox)
|
||||
: _flags(b._flags),
|
||||
_inst(b._inst),
|
||||
_bbox(b._bbox),
|
||||
_max_density(b._max_density)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -95,6 +102,7 @@ inline dbOStream& operator<<(dbOStream& stream, const _dbBlockage& blockage)
|
||||
stream << *bit_field;
|
||||
stream << blockage._inst;
|
||||
stream << blockage._bbox;
|
||||
stream << blockage._max_density;
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -104,6 +112,7 @@ inline dbIStream& operator>>(dbIStream& stream, _dbBlockage& blockage)
|
||||
stream >> *bit_field;
|
||||
stream >> blockage._inst;
|
||||
stream >> blockage._bbox;
|
||||
stream >> blockage._max_density;
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "definBlockage.h"
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "dbShape.h"
|
||||
#include "definBlockage.h"
|
||||
#include "definPolygon.h"
|
||||
|
||||
namespace odb {
|
||||
@@ -142,7 +143,7 @@ void definBlockage::blockageRoutingPolygon(const std::vector<Point>& points)
|
||||
if (_layer == NULL)
|
||||
return;
|
||||
|
||||
definPolygon polygon(points);
|
||||
definPolygon polygon(points);
|
||||
std::vector<Rect> R;
|
||||
polygon.decompose(R);
|
||||
|
||||
@@ -175,11 +176,13 @@ void definBlockage::blockageRoutingEnd()
|
||||
|
||||
void definBlockage::blockagePlacementBegin()
|
||||
{
|
||||
_layer = NULL;
|
||||
_inst = NULL;
|
||||
_slots = false;
|
||||
_fills = false;
|
||||
_pushdown = false;
|
||||
_layer = NULL;
|
||||
_inst = NULL;
|
||||
_slots = false;
|
||||
_fills = false;
|
||||
_pushdown = false;
|
||||
_soft = false;
|
||||
_max_density = 100.0;
|
||||
}
|
||||
|
||||
void definBlockage::blockagePlacementComponent(const char* comp)
|
||||
@@ -197,6 +200,22 @@ void definBlockage::blockagePlacementPushdown()
|
||||
_pushdown = true;
|
||||
}
|
||||
|
||||
void definBlockage::blockagePlacementSoft()
|
||||
{
|
||||
_soft = true;
|
||||
}
|
||||
|
||||
void definBlockage::blockagePlacementMaxDensity(double max_density)
|
||||
{
|
||||
if (max_density >= 0 && max_density <= 100) {
|
||||
_max_density = max_density;
|
||||
} else {
|
||||
notice(0,
|
||||
"warning: Blockage max density %f not in [0, 100] will be ignored\n",
|
||||
max_density);
|
||||
}
|
||||
}
|
||||
|
||||
void definBlockage::blockagePlacementRect(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
x1 = dbdist(x1);
|
||||
@@ -205,8 +224,17 @@ void definBlockage::blockagePlacementRect(int x1, int y1, int x2, int y2)
|
||||
y2 = dbdist(y2);
|
||||
dbBlockage* b = dbBlockage::create(_block, x1, y1, x2, y2, _inst);
|
||||
|
||||
if (_pushdown)
|
||||
if (_pushdown) {
|
||||
b->setPushedDown();
|
||||
}
|
||||
|
||||
if (_soft) {
|
||||
b->setSoft();
|
||||
}
|
||||
|
||||
if (_max_density < 100) {
|
||||
b->setMaxDensity(_max_density);
|
||||
}
|
||||
}
|
||||
|
||||
void definBlockage::blockagePlacementEnd()
|
||||
|
||||
@@ -47,10 +47,12 @@ class definBlockage : public definBase
|
||||
bool _slots;
|
||||
bool _fills;
|
||||
bool _pushdown;
|
||||
bool _soft;
|
||||
bool _has_min_spacing;
|
||||
bool _has_effective_width;
|
||||
int _min_spacing;
|
||||
int _effective_width;
|
||||
float _max_density;
|
||||
|
||||
public:
|
||||
// Routing Blockage interface methods
|
||||
@@ -69,6 +71,8 @@ class definBlockage : public definBase
|
||||
virtual void blockagePlacementBegin();
|
||||
virtual void blockagePlacementComponent(const char* comp);
|
||||
virtual void blockagePlacementPushdown();
|
||||
virtual void blockagePlacementSoft();
|
||||
virtual void blockagePlacementMaxDensity(double max_density);
|
||||
virtual void blockagePlacementRect(int x1, int y1, int x2, int y2);
|
||||
virtual void blockagePlacementEnd();
|
||||
|
||||
|
||||
@@ -283,14 +283,6 @@ int definReader::blockageCallback(defrCallbackType_e /* unused: type */,
|
||||
UNSUPPORTED("MASK on blockage is unsupported");
|
||||
}
|
||||
|
||||
if (blockage->hasSoft()) {
|
||||
UNSUPPORTED("SOFT on blockage is unsupported");
|
||||
}
|
||||
|
||||
if (blockage->hasPartial()) {
|
||||
UNSUPPORTED("PARTIAL on blockage is unsupported");
|
||||
}
|
||||
|
||||
if (blockage->hasLayer()) {
|
||||
// routing blockage
|
||||
blockageR->blockageRoutingBegin(blockage->layerName());
|
||||
@@ -344,6 +336,14 @@ int definReader::blockageCallback(defrCallbackType_e /* unused: type */,
|
||||
blockageR->blockagePlacementPushdown();
|
||||
}
|
||||
|
||||
if (blockage->hasSoft()) {
|
||||
blockageR->blockagePlacementSoft();
|
||||
}
|
||||
|
||||
if (blockage->hasPartial()) {
|
||||
blockageR->blockagePlacementMaxDensity(blockage->placementMaxDensity());
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockage->numRectangles(); ++i) {
|
||||
blockageR->blockagePlacementRect(
|
||||
blockage->xl(i), blockage->yl(i), blockage->xh(i), blockage->yh(i));
|
||||
|
||||
@@ -1120,6 +1120,12 @@ void defout_impl::writeBlockages(dbBlock* block)
|
||||
|
||||
fprintf(_out, " - PLACEMENT");
|
||||
|
||||
if (blk->isSoft())
|
||||
fprintf(_out, " + SOFT");
|
||||
|
||||
if (blk->getMaxDensity() < 100)
|
||||
fprintf(_out, " + PARTIAL %f", blk->getMaxDensity());
|
||||
|
||||
if (inst) {
|
||||
if (_use_net_inst_ids)
|
||||
fprintf(_out, " + COMPONENT I%u", inst->getId());
|
||||
|
||||
@@ -166,8 +166,10 @@ BLOCKAGES 4 ;
|
||||
- PLACEMENT
|
||||
+ COMPONENT _d0_ RECT ( 1 2 ) ( 3 4 ) ;
|
||||
- PLACEMENT
|
||||
+ PARTIAL 12.34
|
||||
+ PUSHDOWN RECT ( 1 2 ) ( 3 4 ) ;
|
||||
- PLACEMENT
|
||||
+ SOFT
|
||||
RECT ( 1 2 ) ( 3 4 ) ;
|
||||
END BLOCKAGES
|
||||
|
||||
|
||||
Reference in New Issue
Block a user