make_port
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
ab0055afff
commit
ef43ee9a45
|
|
@ -44,6 +44,7 @@ typedef Map<const char *, ConcreteInstance*,
|
|||
CharPtrLess> ConcreteInstanceChildMap;
|
||||
typedef Map<const char *, ConcreteNet*, CharPtrLess> ConcreteInstanceNetMap;
|
||||
typedef Vector<ConcreteNet*> ConcreteNetSeq;
|
||||
typedef Vector<ConcretePin*> ConcretePinSeq;
|
||||
typedef Map<Cell*, Instance*> CellNetworkViewMap;
|
||||
typedef Set<const ConcreteNet*> ConcreteNetSet;
|
||||
|
||||
|
|
@ -306,7 +307,7 @@ protected:
|
|||
ConcreteCell *cell_;
|
||||
ConcreteInstance *parent_;
|
||||
// Array of pins indexed by pin->port->index().
|
||||
ConcretePin **pins_;
|
||||
ConcretePinSeq pins_;
|
||||
ConcreteInstanceChildMap *children_;
|
||||
ConcreteInstanceNetMap *nets_;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public:
|
|||
static PortDirection *ground() { return ground_; }
|
||||
static PortDirection *power() { return power_; }
|
||||
static PortDirection *unknown() { return unknown_; }
|
||||
static PortDirection *find(const char *dir_name);
|
||||
const char *name() const { return name_; }
|
||||
int index() const { return index_; }
|
||||
bool isInput() const { return this == input_; }
|
||||
|
|
|
|||
|
|
@ -1179,6 +1179,8 @@ public:
|
|||
Net *net);
|
||||
// disconnect_net
|
||||
virtual void disconnectPin(Pin *pin);
|
||||
virtual void makePortPin(const char *port_name,
|
||||
const char *direction);
|
||||
// Notify STA of network change.
|
||||
void networkChanged();
|
||||
void deleteLeafInstanceBefore(const Instance *inst);
|
||||
|
|
@ -1196,6 +1198,7 @@ public:
|
|||
virtual void replaceCellBefore(const Instance *inst,
|
||||
const LibertyCell *to_cell);
|
||||
virtual void replaceCellAfter(const Instance *inst);
|
||||
virtual void makePortPinAfter(Pin *pin);
|
||||
virtual void connectPinAfter(const Pin *pin);
|
||||
virtual void disconnectPinBefore(const Pin *pin);
|
||||
virtual void deleteNetBefore(const Net *net);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public:
|
|||
private:
|
||||
void findNext();
|
||||
|
||||
ConcretePin **pins_;
|
||||
const ConcretePinSeq &pins_;
|
||||
int pin_count_;
|
||||
int pin_index_;
|
||||
ConcretePin *next_;
|
||||
|
|
@ -1211,8 +1211,8 @@ ConcreteNetwork::replaceCell(Instance *inst,
|
|||
ConcreteCell *ccell = reinterpret_cast<ConcreteCell*>(cell);
|
||||
int port_count = ccell->portBitCount();
|
||||
ConcreteInstance *cinst = reinterpret_cast<ConcreteInstance*>(inst);
|
||||
ConcretePin **pins = cinst->pins_;
|
||||
ConcretePin **rpins = new ConcretePin*[port_count];
|
||||
ConcretePinSeq &pins = cinst->pins_;
|
||||
ConcretePinSeq rpins(port_count);
|
||||
for (int i = 0; i < port_count; i++)
|
||||
rpins[i] = nullptr;
|
||||
for (int i = 0; i < port_count; i++) {
|
||||
|
|
@ -1227,7 +1227,6 @@ ConcreteNetwork::replaceCell(Instance *inst,
|
|||
}
|
||||
}
|
||||
}
|
||||
delete [] pins;
|
||||
cinst->pins_ = rpins;
|
||||
cinst->setCell(ccell);
|
||||
}
|
||||
|
|
@ -1333,7 +1332,8 @@ ConcreteNetwork::connect(Instance *inst,
|
|||
if (inst == top_instance_) {
|
||||
// makeTerm
|
||||
ConcreteTerm *cterm = new ConcreteTerm(cpin, cnet);
|
||||
cnet->addTerm(cterm);
|
||||
if (cnet)
|
||||
cnet->addTerm(cterm);
|
||||
cpin->term_ = cterm;
|
||||
cpin->net_ = nullptr;
|
||||
}
|
||||
|
|
@ -1541,20 +1541,13 @@ ConcreteInstance::ConcreteInstance(const char *name,
|
|||
void
|
||||
ConcreteInstance::initPins()
|
||||
{
|
||||
int pin_count = reinterpret_cast<ConcreteCell*>(cell_)->portBitCount();
|
||||
if (pin_count) {
|
||||
pins_ = new ConcretePin*[pin_count];
|
||||
for (int i = 0; i < pin_count; i++)
|
||||
pins_[i] = nullptr;
|
||||
}
|
||||
else
|
||||
pins_ = nullptr;
|
||||
ConcreteCell *ccell = reinterpret_cast<ConcreteCell*>(cell_);
|
||||
pins_.resize(ccell->portBitCount());
|
||||
}
|
||||
|
||||
ConcreteInstance::~ConcreteInstance()
|
||||
{
|
||||
stringDelete(name_);
|
||||
delete [] pins_;
|
||||
delete children_;
|
||||
delete nets_;
|
||||
}
|
||||
|
|
@ -1585,7 +1578,11 @@ ConcretePin *
|
|||
ConcreteInstance::findPin(const Port *port) const
|
||||
{
|
||||
const ConcretePort *cport = reinterpret_cast<const ConcretePort*>(port);
|
||||
return pins_[cport->pinIndex()];
|
||||
size_t port_index = cport->pinIndex();
|
||||
if (port_index < pins_.size())
|
||||
return pins_[port_index];
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ConcreteNet *
|
||||
|
|
@ -1655,7 +1652,10 @@ void
|
|||
ConcreteInstance::addPin(ConcretePin *pin)
|
||||
{
|
||||
ConcretePort *cport = reinterpret_cast<ConcretePort *>(pin->port());
|
||||
pins_[cport->pinIndex()] = pin;
|
||||
size_t pin_index = cport->pinIndex();
|
||||
if (pin_index >= pins_.size())
|
||||
pins_.resize(pin_index + 1);
|
||||
pins_[pin_index] = pin;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "PortDirection.hh"
|
||||
|
||||
#include "StringUtil.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
PortDirection *PortDirection::input_;
|
||||
|
|
@ -68,6 +70,27 @@ PortDirection::PortDirection(const char *name,
|
|||
{
|
||||
}
|
||||
|
||||
PortDirection *
|
||||
PortDirection::find(const char *dir_name)
|
||||
{
|
||||
if (stringEqual(dir_name, "input"))
|
||||
return input_;
|
||||
else if (stringEqual(dir_name, "output"))
|
||||
return output_;
|
||||
else if (stringEqual(dir_name, "tristate"))
|
||||
return tristate_;
|
||||
else if (stringEqual(dir_name, "bidirect"))
|
||||
return bidirect_;
|
||||
else if (stringEqual(dir_name, "internal"))
|
||||
return internal_;
|
||||
else if (stringEqual(dir_name, "ground"))
|
||||
return ground_;
|
||||
else if (stringEqual(dir_name, "power"))
|
||||
return power_;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
PortDirection::isAnyInput() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4133,6 +4133,21 @@ Sta::disconnectPin(Pin *pin)
|
|||
network->disconnectPin(pin);
|
||||
}
|
||||
|
||||
void
|
||||
Sta::makePortPin(const char *port_name,
|
||||
const char *direction)
|
||||
{
|
||||
NetworkReader *network = dynamic_cast<NetworkReader*>(network_);
|
||||
Instance *top_inst = network->topInstance();
|
||||
Cell *top_cell = network->cell(top_inst);
|
||||
Port *port = network->makePort(top_cell, port_name);
|
||||
PortDirection *dir = PortDirection::find(direction);
|
||||
if (dir)
|
||||
network->setDirection(port, dir);
|
||||
Pin *pin = network->makePin(top_inst, port, nullptr);
|
||||
makePortPinAfter(pin);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Network edit before/after methods.
|
||||
|
|
@ -4161,6 +4176,15 @@ Sta::makeInstanceAfter(const Instance *inst)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Sta::makePortPinAfter(Pin *pin)
|
||||
{
|
||||
if (graph_) {
|
||||
Vertex *vertex, *bidir_drvr_vertex;
|
||||
graph_->makePinVertices(pin, vertex, bidir_drvr_vertex);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Sta::replaceEquivCellBefore(const Instance *inst,
|
||||
const LibertyCell *to_cell)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,13 @@ make_net_cmd(const char *name,
|
|||
return net;
|
||||
}
|
||||
|
||||
void
|
||||
make_port_pin_cmd(const char *port_name,
|
||||
const char *direction)
|
||||
{
|
||||
Sta::sta()->makePortPin(port_name, direction);
|
||||
}
|
||||
|
||||
void
|
||||
delete_net_cmd(Net *net)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ proc make_instance { inst_path lib_cell } {
|
|||
|
||||
################################################################
|
||||
|
||||
define_cmd_args "make_net" {}
|
||||
define_cmd_args "make_net" {net_path}
|
||||
|
||||
proc make_net { net_path } {
|
||||
# Copy backslashes that will be removed by foreach.
|
||||
|
|
@ -65,6 +65,14 @@ proc make_net { net_path } {
|
|||
|
||||
################################################################
|
||||
|
||||
define_cmd_args "make_port" {port_name direction}
|
||||
|
||||
proc make_port { port_name direction } {
|
||||
make_port_pin_cmd $port_name $direction
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
||||
define_cmd_args "connect_pin" {net pin}
|
||||
|
||||
proc connect_pin { net pin } {
|
||||
|
|
|
|||
Loading…
Reference in New Issue