ConcreteCell/Port pointers to corresponding liberty

This commit is contained in:
James Cherry
2019-06-15 22:20:54 -07:00
parent dd8153c7f9
commit 96fcf1d8b2
5 changed files with 34 additions and 7 deletions
+14
View File
@@ -112,6 +112,7 @@ ConcreteCell::ConcreteCell(ConcreteLibrary *library,
library_(library),
name_(stringCopy(name)),
filename_(stringCopy(filename)),
liberty_cell_(nullptr),
port_bit_count_(0),
is_leaf_(is_leaf)
{
@@ -134,6 +135,12 @@ ConcreteCell::setName(const char *name)
name_ = name_cpy;
}
void
ConcreteCell::setLibertyCell(LibertyCell *cell)
{
liberty_cell_ = cell;
}
ConcretePort *
ConcreteCell::makePort(const char *name)
{
@@ -422,6 +429,7 @@ ConcretePort::ConcretePort(ConcreteCell *cell,
name_(stringCopy(name)),
cell_(cell),
direction_(PortDirection::unknown()),
liberty_port_(nullptr),
pin_index_(-1),
is_bundle_(is_bundle),
is_bus_(is_bus),
@@ -447,6 +455,12 @@ ConcretePort::cell() const
return reinterpret_cast<Cell*>(cell_);
}
void
ConcretePort::setLibertyPort(LibertyPort *port)
{
liberty_port_ = port;
}
const char *
ConcretePort::busName() const
{
+8
View File
@@ -34,6 +34,8 @@ class ConcreteCell;
class ConcretePort;
class ConcreteCellPortBitIterator;
class PatternMatch;
class LibertyCell;
class LibertyPort;
typedef Map<const char*, ConcreteCell*, CharPtrLess> ConcreteCellMap;
typedef Vector<ConcretePort*> ConcretePortSeq;
@@ -89,6 +91,8 @@ public:
virtual ConcreteLibrary *library() const { return library_; }
virtual const char *name() const { return name_; }
virtual const char *filename() const { return filename_; }
LibertyCell *libertyCell() { return liberty_cell_; }
void setLibertyCell(LibertyCell *cell);
virtual int portBitCount() const { return port_bit_count_; }
virtual ConcretePort *findPort(const char *name) const;
virtual void findPortsMatching(const PatternMatch *pattern,
@@ -139,6 +143,7 @@ protected:
const char *name_;
// Filename is optional.
const char *filename_;
LibertyCell *liberty_cell_;
// Non-bus and bus ports (but no expanded bus bit ports).
ConcretePortSeq ports_;
ConcretePortMap port_map_;
@@ -162,6 +167,8 @@ public:
virtual Cell *cell() const;
virtual ConcreteLibrary *library() const { return cell_->library(); }
virtual PortDirection *direction() const { return direction_; }
LibertyPort *libertyPort() { return liberty_port_; }
void setLibertyPort(LibertyPort *port);
virtual void setDirection(PortDirection *dir);
// Bundles are groups of related ports that do not use
// bus notation.
@@ -209,6 +216,7 @@ protected:
const char *name_;
ConcreteCell *cell_;
PortDirection *direction_;
LibertyPort *liberty_port_;
int pin_index_;
bool is_bundle_;
bool is_bus_;
+2 -2
View File
@@ -550,7 +550,7 @@ LibertyCell *
ConcreteNetwork::libertyCell(Cell *cell) const
{
ConcreteCell *ccell = reinterpret_cast<ConcreteCell*>(cell);
return dynamic_cast<LibertyCell*>(ccell);
return ccell->libertyCell();
}
Cell *
@@ -743,7 +743,7 @@ LibertyPort *
ConcreteNetwork::libertyPort(Port *port) const
{
ConcretePort *cport = reinterpret_cast<ConcretePort*>(port);
return dynamic_cast<LibertyPort*>(cport);
return cport->libertyPort();
}
PortDirection *