bullet proof for missing tcl unknown proc

This commit is contained in:
James Cherry 2019-05-03 21:23:12 -07:00
parent 895c4c97c1
commit a8e15ae64f
4 changed files with 20 additions and 8 deletions

View File

@ -117,8 +117,7 @@ staTclAppInit(Tcl_Interp *interp)
// Import exported commands from sta namespace to global namespace.
Tcl_Eval(interp, "sta::define_sta_cmds");
const char *export_cmds = "namespace import sta::*";
Tcl_Eval(interp, export_cmds);
Tcl_Eval(interp, "namespace import sta::*");
if (!findCmdLineFlag(argc, argv, "-no_init"))
sourceTclFileEchoVerbose(init_filename, interp);

View File

@ -146,7 +146,8 @@ Graph::vertexAndEdgeCounts(const Instance *inst,
while (set_iter.hasNext()) {
TimingArcSet *arc_set = set_iter.next();
LibertyPort *to_port = arc_set->to();
if (network_->findPin(inst, to_port)) {
if (network_->findPin(inst, to_port)
&& filterEdge(arc_set)) {
if (dir->isBidirect()) {
// Internal path from bidirect output back into the instance.
edge_count += 2;
@ -285,9 +286,10 @@ Graph::makePortInstanceEdges(const Instance *inst,
TimingArcSet *arc_set = timing_iter.next();
LibertyPort *from_port = arc_set->from();
LibertyPort *to_port = arc_set->to();
if (from_to_port == nullptr
|| from_port == from_to_port
|| to_port == from_to_port) {
if ((from_to_port == nullptr
|| from_port == from_to_port
|| to_port == from_to_port)
&& filterEdge(arc_set)) {
Pin *from_pin = network_->findPin(inst, from_port);
Pin *to_pin = network_->findPin(inst, to_port);
if (from_pin && to_pin) {

View File

@ -220,6 +220,8 @@ protected:
void deleteFloats(float *floats,
ObjectIndex count);
void removeDelayAnnotated(Edge *edge);
// User defined predicate to filter graph edges for liberty timing arcs.
virtual bool filterEdge(TimingArcSet *) const { return true; }
VertexPool *vertices_;
EdgePool *edges_;

View File

@ -391,10 +391,19 @@ proc check_percent { cmd_arg arg } {
################################################################
# The builtin Tcl "source" and "unknown" commands are redefined by sta.
# This rename provices a mechanism to refer to the original TCL
# This rename provides a mechanism to refer to the original TCL
# command.
rename source builtin_source
rename unknown builtin_unknown
# This seems to be a common build problem.
# It happens with incomplete installs of libtcl that can't find the
# corresponding init.tcl file.
if { [info procs unknown] == {} } {
puts "TCL installation problem. proc unknown not defined. Check tcl_libraries $tcl_libraries for init.tcl"
proc unknown { args } { return -code error "invalid command name" }
} else {
rename unknown builtin_unknown
}
# Numeric expressions eval to themselves so braces aren't required
# around bus names like foo[2] or foo[*].