LibertyCell::isBuffer()
This commit is contained in:
parent
6a194ef6ee
commit
8242035b22
|
|
@ -1020,6 +1020,49 @@ LibertyCell::setClockGateType(ClockGateType type)
|
|||
clock_gate_type_ = type;
|
||||
}
|
||||
|
||||
bool
|
||||
LibertyCell::isBuffer() const
|
||||
{
|
||||
LibertyPort *input, *output;
|
||||
return isBuffer(input, output);
|
||||
}
|
||||
|
||||
bool
|
||||
LibertyCell::isBuffer(// Return values.
|
||||
LibertyPort *&input,
|
||||
LibertyPort *&output) const
|
||||
{
|
||||
if (ports_.size() == 2) {
|
||||
LibertyPort *port1 = static_cast<LibertyPort*>(ports_[0]);
|
||||
LibertyPort *port2 = static_cast<LibertyPort*>(ports_[1]);
|
||||
if (port1->direction()->isInput()
|
||||
&& port2->direction()->isOutput()
|
||||
&& hasBufferFunc(port1, port2)) {
|
||||
input = port1;
|
||||
output = port2;
|
||||
return true;
|
||||
}
|
||||
else if (port2->direction()->isInput()
|
||||
&& port1->direction()->isOutput()
|
||||
&& hasBufferFunc(port2, port1)) {
|
||||
input = port2;
|
||||
output = port1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
LibertyCell::hasBufferFunc(const LibertyPort *input,
|
||||
const LibertyPort *output) const
|
||||
{
|
||||
FuncExpr *func = output->function();
|
||||
return func
|
||||
&& func->op() == FuncExpr::op_port
|
||||
&& func->port() == input;
|
||||
}
|
||||
|
||||
unsigned
|
||||
LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -487,6 +487,10 @@ public:
|
|||
Debug *debug);
|
||||
void setHigherDrive(LibertyCell *cell);
|
||||
void setLowerDrive(LibertyCell *cell);
|
||||
bool isBuffer() const;
|
||||
bool isBuffer(// Return values.
|
||||
LibertyPort *&input,
|
||||
LibertyPort *&output) const;
|
||||
|
||||
protected:
|
||||
virtual void addPort(ConcretePort *port);
|
||||
|
|
@ -510,6 +514,8 @@ protected:
|
|||
void deleteInternalPowerAttrs();
|
||||
void makeTimingArcMap(Report *report);
|
||||
void makeTimingArcPortMaps();
|
||||
bool hasBufferFunc(const LibertyPort *input,
|
||||
const LibertyPort *output) const;
|
||||
|
||||
LibertyLibrary *liberty_library_;
|
||||
float area_;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,12 @@ PropertyValue::PropertyValue(float value) :
|
|||
{
|
||||
}
|
||||
|
||||
PropertyValue::PropertyValue(bool value) :
|
||||
type_(type_bool),
|
||||
bool_(value)
|
||||
{
|
||||
}
|
||||
|
||||
PropertyValue::PropertyValue(LibertyLibrary *value) :
|
||||
type_(type_liberty_library),
|
||||
liberty_library_(value)
|
||||
|
|
@ -226,6 +232,9 @@ PropertyValue::PropertyValue(const PropertyValue &value) :
|
|||
case Type::type_float:
|
||||
float_ = value.float_;
|
||||
break;
|
||||
case Type::type_bool:
|
||||
bool_ = value.bool_;
|
||||
break;
|
||||
case Type::type_liberty_library:
|
||||
liberty_library_ = value.liberty_library_;
|
||||
break;
|
||||
|
|
@ -278,6 +287,9 @@ PropertyValue::PropertyValue(PropertyValue &&value) :
|
|||
case Type::type_float:
|
||||
float_ = value.float_;
|
||||
break;
|
||||
case Type::type_bool:
|
||||
bool_ = value.bool_;
|
||||
break;
|
||||
case Type::type_liberty_library:
|
||||
liberty_library_ = value.liberty_library_;
|
||||
break;
|
||||
|
|
@ -355,6 +367,9 @@ PropertyValue::operator=(const PropertyValue &value)
|
|||
case Type::type_float:
|
||||
float_ = value.float_;
|
||||
break;
|
||||
case Type::type_bool:
|
||||
bool_ = value.bool_;
|
||||
break;
|
||||
case Type::type_liberty_library:
|
||||
liberty_library_ = value.liberty_library_;
|
||||
break;
|
||||
|
|
@ -409,6 +424,9 @@ PropertyValue::operator=(PropertyValue &&value)
|
|||
case Type::type_float:
|
||||
float_ = value.float_;
|
||||
break;
|
||||
case Type::type_bool:
|
||||
bool_ = value.bool_;
|
||||
break;
|
||||
case Type::type_liberty_library:
|
||||
liberty_library_ = value.liberty_library_;
|
||||
break;
|
||||
|
|
@ -513,6 +531,8 @@ getProperty(const LibertyCell *cell,
|
|||
return PropertyValue(cell->higherDrive());
|
||||
else if (stringEqual(property, "lower_drive"))
|
||||
return PropertyValue(cell->lowerDrive());
|
||||
else if (stringEqual(property, "is_buffer"))
|
||||
return PropertyValue(cell->isBuffer());
|
||||
else
|
||||
throw PropertyUnknown("liberty cell", property);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class PwrActivity;
|
|||
class PropertyValue
|
||||
{
|
||||
public:
|
||||
enum Type { type_none, type_string, type_float,
|
||||
enum Type { type_none, type_string, type_float, type_bool,
|
||||
type_liberty_library, type_liberty_cell,
|
||||
type_library, type_cell,
|
||||
type_instance, type_pin, type_pins, type_net,
|
||||
|
|
@ -42,6 +42,7 @@ public:
|
|||
PropertyValue(const char *value);
|
||||
PropertyValue(string &value);
|
||||
PropertyValue(float value);
|
||||
PropertyValue(bool value);
|
||||
PropertyValue(LibertyLibrary *value);
|
||||
PropertyValue(LibertyCell *value);
|
||||
PropertyValue(Cell *value);
|
||||
|
|
@ -64,6 +65,7 @@ public:
|
|||
Type type() const { return type_; }
|
||||
const char *stringValue() const { return string_; }
|
||||
float floatValue() const { return float_; }
|
||||
bool boolValue() const { return bool_; }
|
||||
LibertyLibrary *libertyLibrary() const { return liberty_library_; }
|
||||
LibertyCell *libertyCell() const { return liberty_cell_; }
|
||||
Library *library() const { return library_; }
|
||||
|
|
@ -86,6 +88,7 @@ private:
|
|||
union {
|
||||
const char *string_;
|
||||
float float_;
|
||||
bool bool_;
|
||||
LibertyLibrary *liberty_library_;
|
||||
LibertyCell *liberty_cell_;
|
||||
Library *library_;
|
||||
|
|
|
|||
|
|
@ -1538,6 +1538,11 @@ using namespace sta;
|
|||
stringDelete(float_string);
|
||||
}
|
||||
break;
|
||||
case PropertyValue::Type::type_bool: {
|
||||
const char *bool_string = value.boolValue() ? "1" : "0";
|
||||
Tcl_SetResult(interp, const_cast<char*>(bool_string), TCL_STATIC);
|
||||
}
|
||||
break;
|
||||
case PropertyValue::Type::type_instance: {
|
||||
Tcl_Obj *obj = SWIG_NewInstanceObj(value.instance(),
|
||||
SWIGTYPE_p_Instance, false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue