mv code out of StaTcl.i

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2024-07-22 10:54:57 -07:00
parent 8178eeeb77
commit faded478a8
5 changed files with 249 additions and 252 deletions

View File

@ -82,6 +82,24 @@ private:
%inline %{
int
graph_vertex_count()
{
return cmdGraph()->vertexCount();
}
int
graph_edge_count()
{
return cmdGraph()->edgeCount();
}
int
graph_arc_count()
{
return cmdGraph()->arcCount();
}
VertexIterator *
vertex_iterator()
{

View File

@ -17,6 +17,7 @@
%module liberty
%{
#include "PortDirection.hh"
#include "Liberty.hh"
#include "EquivCells.hh"
#include "LibertyWriter.hh"

View File

@ -173,6 +173,42 @@ set_current_instance(Instance *inst)
Sta::sta()->setCurrentInstance(inst);
}
// Includes top instance.
int
network_instance_count()
{
Network *network = cmdNetwork();
return network->instanceCount();
}
int
network_pin_count()
{
Network *network = cmdNetwork();
return network->pinCount();
}
int
network_net_count()
{
Network *network = cmdNetwork();
return network->netCount();
}
int
network_leaf_instance_count()
{
Network *network = cmdNetwork();
return network->leafInstanceCount();
}
int
network_leaf_pin_count()
{
Network *network = cmdNetwork();
return network->leafPinCount();
}
Library *
find_library(const char *name)
{
@ -490,6 +526,36 @@ find_nets_hier_matching(const char *pattern,
return matches;
}
PinSet
net_driver_pins(Net *net)
{
Network *network = cmdLinkedNetwork();
PinSet pins(network);
NetConnectedPinIterator *pin_iter = network->connectedPinIterator(net);
while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
if (network->isDriver(pin))
pins.insert(pin);
}
delete pin_iter;
return pins;
}
PinSet
net_load_pins(Net *net)
{
Network *network = cmdLinkedNetwork();
PinSet pins(network);
NetConnectedPinIterator *pin_iter = network->connectedPinIterator(net);
while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
if (network->isLoad(pin))
pins.insert(pin);
}
delete pin_iter;
return pins;
}
%} // inline
////////////////////////////////////////////////////////////////

View File

@ -18,6 +18,7 @@
%{
#include "Sdc.hh"
#include "Wireload.hh"
#include "Clock.hh"
#include "PortDelay.hh"
#include "Sta.hh"

View File

@ -40,16 +40,9 @@
#include "FuncExpr.hh"
#include "Units.hh"
#include "Transition.hh"
#include "TimingRole.hh"
#include "TimingArc.hh"
#include "TableModel.hh"
#include "Liberty.hh"
#include "Wireload.hh"
#include "PortDirection.hh"
#include "Network.hh"
#include "ExceptionPath.hh"
#include "Sdc.hh"
#include "Graph.hh"
#include "DelayCalc.hh"
#include "DcalcAnalysisPt.hh"
#include "Corner.hh"
@ -369,167 +362,6 @@ is_object_list(const char *list,
return true;
}
const char *
rise_short_name()
{
return RiseFall::rise()->shortName();
}
const char *
fall_short_name()
{
return RiseFall::fall()->shortName();
}
////////////////////////////////////////////////////////////////
PropertyValue
pin_property(const Pin *pin,
const char *property)
{
cmdLinkedNetwork();
return getProperty(pin, property, Sta::sta());
}
PropertyValue
instance_property(const Instance *inst,
const char *property)
{
cmdLinkedNetwork();
return getProperty(inst, property, Sta::sta());
}
PropertyValue
net_property(const Net *net,
const char *property)
{
cmdLinkedNetwork();
return getProperty(net, property, Sta::sta());
}
PropertyValue
port_property(const Port *port,
const char *property)
{
return getProperty(port, property, Sta::sta());
}
PropertyValue
liberty_cell_property(const LibertyCell *cell,
const char *property)
{
return getProperty(cell, property, Sta::sta());
}
PropertyValue
cell_property(const Cell *cell,
const char *property)
{
return getProperty(cell, property, Sta::sta());
}
PropertyValue
liberty_port_property(const LibertyPort *port,
const char *property)
{
return getProperty(port, property, Sta::sta());
}
PropertyValue
library_property(const Library *lib,
const char *property)
{
return getProperty(lib, property, Sta::sta());
}
PropertyValue
liberty_library_property(const LibertyLibrary *lib,
const char *property)
{
return getProperty(lib, property, Sta::sta());
}
PropertyValue
edge_property(Edge *edge,
const char *property)
{
cmdGraph();
return getProperty(edge, property, Sta::sta());
}
PropertyValue
clock_property(Clock *clk,
const char *property)
{
cmdLinkedNetwork();
return getProperty(clk, property, Sta::sta());
}
PropertyValue
path_end_property(PathEnd *end,
const char *property)
{
cmdLinkedNetwork();
return getProperty(end, property, Sta::sta());
}
PropertyValue
path_ref_property(PathRef *path,
const char *property)
{
cmdLinkedNetwork();
return getProperty(path, property, Sta::sta());
}
PropertyValue
timing_arc_set_property(TimingArcSet *arc_set,
const char *property)
{
cmdLinkedNetwork();
return getProperty(arc_set, property, Sta::sta());
}
////////////////////////////////////////////////////////////////
void
define_corners_cmd(StringSet *corner_names)
{
Sta *sta = Sta::sta();
sta->makeCorners(corner_names);
delete corner_names;
}
Corner *
cmd_corner()
{
return Sta::sta()->cmdCorner();
}
void
set_cmd_corner(Corner *corner)
{
Sta::sta()->setCmdCorner(corner);
}
Corner *
find_corner(const char *corner_name)
{
return Sta::sta()->findCorner(corner_name);
}
Corners *
corners()
{
return Sta::sta()->corners();
}
bool
multi_corner()
{
return Sta::sta()->multiCorner();
}
////////////////////////////////////////////////////////////////
// format_unit functions print with fixed digits and suffix.
@ -765,6 +597,169 @@ unit_scaled_suffix(const char *unit_name)
////////////////////////////////////////////////////////////////
const char *
rise_short_name()
{
return RiseFall::rise()->shortName();
}
const char *
fall_short_name()
{
return RiseFall::fall()->shortName();
}
////////////////////////////////////////////////////////////////
PropertyValue
pin_property(const Pin *pin,
const char *property)
{
cmdLinkedNetwork();
return getProperty(pin, property, Sta::sta());
}
PropertyValue
instance_property(const Instance *inst,
const char *property)
{
cmdLinkedNetwork();
return getProperty(inst, property, Sta::sta());
}
PropertyValue
net_property(const Net *net,
const char *property)
{
cmdLinkedNetwork();
return getProperty(net, property, Sta::sta());
}
PropertyValue
port_property(const Port *port,
const char *property)
{
return getProperty(port, property, Sta::sta());
}
PropertyValue
liberty_cell_property(const LibertyCell *cell,
const char *property)
{
return getProperty(cell, property, Sta::sta());
}
PropertyValue
cell_property(const Cell *cell,
const char *property)
{
return getProperty(cell, property, Sta::sta());
}
PropertyValue
liberty_port_property(const LibertyPort *port,
const char *property)
{
return getProperty(port, property, Sta::sta());
}
PropertyValue
library_property(const Library *lib,
const char *property)
{
return getProperty(lib, property, Sta::sta());
}
PropertyValue
liberty_library_property(const LibertyLibrary *lib,
const char *property)
{
return getProperty(lib, property, Sta::sta());
}
PropertyValue
edge_property(Edge *edge,
const char *property)
{
cmdGraph();
return getProperty(edge, property, Sta::sta());
}
PropertyValue
clock_property(Clock *clk,
const char *property)
{
cmdLinkedNetwork();
return getProperty(clk, property, Sta::sta());
}
PropertyValue
path_end_property(PathEnd *end,
const char *property)
{
cmdLinkedNetwork();
return getProperty(end, property, Sta::sta());
}
PropertyValue
path_ref_property(PathRef *path,
const char *property)
{
cmdLinkedNetwork();
return getProperty(path, property, Sta::sta());
}
PropertyValue
timing_arc_set_property(TimingArcSet *arc_set,
const char *property)
{
cmdLinkedNetwork();
return getProperty(arc_set, property, Sta::sta());
}
////////////////////////////////////////////////////////////////
void
define_corners_cmd(StringSet *corner_names)
{
Sta *sta = Sta::sta();
sta->makeCorners(corner_names);
delete corner_names;
}
Corner *
cmd_corner()
{
return Sta::sta()->cmdCorner();
}
void
set_cmd_corner(Corner *corner)
{
Sta::sta()->setCmdCorner(corner);
}
Corner *
find_corner(const char *corner_name)
{
return Sta::sta()->findCorner(corner_name);
}
Corners *
corners()
{
return Sta::sta()->corners();
}
bool
multi_corner()
{
return Sta::sta()->multiCorner();
}
////////////////////////////////////////////////////////////////
CheckErrorSeq &
check_timing_cmd(bool no_input_delay,
bool no_output_delay,
@ -1745,36 +1740,6 @@ find_fanout_insts(PinSeq *from,
return fanout;
}
PinSet
net_load_pins(Net *net)
{
Network *network = cmdLinkedNetwork();
PinSet pins(network);
NetConnectedPinIterator *pin_iter = network->connectedPinIterator(net);
while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
if (network->isLoad(pin))
pins.insert(pin);
}
delete pin_iter;
return pins;
}
PinSet
net_driver_pins(Net *net)
{
Network *network = cmdLinkedNetwork();
PinSet pins(network);
NetConnectedPinIterator *pin_iter = network->connectedPinIterator(net);
while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
if (network->isDriver(pin))
pins.insert(pin);
}
delete pin_iter;
return pins;
}
////////////////////////////////////////////////////////////////
void
@ -1790,60 +1755,6 @@ report_loops()
}
}
// Includes top instance.
int
network_instance_count()
{
Network *network = cmdNetwork();
return network->instanceCount();
}
int
network_pin_count()
{
Network *network = cmdNetwork();
return network->pinCount();
}
int
network_net_count()
{
Network *network = cmdNetwork();
return network->netCount();
}
int
network_leaf_instance_count()
{
Network *network = cmdNetwork();
return network->leafInstanceCount();
}
int
network_leaf_pin_count()
{
Network *network = cmdNetwork();
return network->leafPinCount();
}
int
graph_vertex_count()
{
return cmdGraph()->vertexCount();
}
int
graph_edge_count()
{
return cmdGraph()->edgeCount();
}
int
graph_arc_count()
{
return cmdGraph()->arcCount();
}
int
tag_group_count()
{