Skip to content

Commit

Permalink
report_tns/wns
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Jun 5, 2019
1 parent 94f3e7f commit de34f8b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 14 deletions.
17 changes: 11 additions & 6 deletions app/StaMain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ staTclAppInit(Tcl_Interp *interp)
Tcl_Eval(interp, "namespace import sta::*");

if (!findCmdLineFlag(argc, argv, "-no_init"))
sourceTclFileEchoVerbose(init_filename, interp);
sourceTclFile(init_filename, true, true, interp);

// "-x cmd" is evaled before -f file is sourced.
char *cmd = findCmdLineKey(argc, argv, "-x");
Expand All @@ -129,7 +129,7 @@ staTclAppInit(Tcl_Interp *interp)
// "-f cmd_file" is evaled as "source -echo -verbose file".
char *file = findCmdLineKey(argc, argv, "-f");
if (file)
sourceTclFileEchoVerbose(file, interp);
sourceTclFile(file, true, true, interp);

return TCL_OK;
}
Expand Down Expand Up @@ -157,16 +157,21 @@ findCmdLineKey(int argc,
if (stringEq(arg, key) && argi + 1 < argc)
return argv[argi + 1];
}
return 0;
return nullptr;
}

// Use overridden version of source to echo cmds and results.
void
sourceTclFileEchoVerbose(const char *filename,
Tcl_Interp *interp)
sourceTclFile(const char *filename,
bool echo,
bool verbose,
Tcl_Interp *interp)
{
string cmd;
stringPrint(cmd, "source -echo -verbose %s", filename);
stringPrint(cmd, "source %s%s%s",
echo ? "-echo " : "",
verbose ? "-verbose " : "",
filename);
Tcl_Eval(interp, cmd.c_str());
}

Expand Down
6 changes: 4 additions & 2 deletions app/StaMain.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ parseCmdsArg(int argc,
bool &compatibility_cmds);

void
sourceTclFileEchoVerbose(const char *filename,
Tcl_Interp *interp);
sourceTclFile(const char *filename,
bool echo,
bool verbose,
Tcl_Interp *interp);

} // namespace
#endif
6 changes: 6 additions & 0 deletions doc/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ single pin.

disconnect_pin net pin

The report_tns and report_wns commands print the value returned by
total_negative_slack and worst_negative_slack respectively.

report_tns
report_wns

Release 1.11.0 2017/08/18
-------------------------

Expand Down
36 changes: 36 additions & 0 deletions tcl/Sta.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,42 @@ proc_redirect report_check_types {

################################################################

define_sta_cmd_args "report_tns" { [-digits digits]}

proc_redirect report_tns {
global sta_report_default_digits

parse_key_args "report_tns" args keys {-digits} flags {}
if [info exists keys(-digits)] {
set digits $keys(-digits)
check_positive_integer "-digits" $digits
} else {
set digits $sta_report_default_digits
}

puts "tns [format %.${digits}f [total_negative_slack]]"
}

################################################################

define_sta_cmd_args "report_wns" { [-digits digits]}

proc_redirect report_wns {
global sta_report_default_digits

parse_key_args "report_wns" args keys {-digits} flags {}
if [info exists keys(-digits)] {
set digits $keys(-digits)
check_positive_integer "-digits" $digits
} else {
set digits $sta_report_default_digits
}

puts "wns [format %.${digits}f [worst_negative_slack]]"
}

################################################################

define_sta_cmd_args "report_dcalc" \
{[-from from_pin] [-to to_pin] [-corner corner_name] [-min] [-max] [-digits digits]}

Expand Down
6 changes: 0 additions & 6 deletions tcl/StaTcl.i
Original file line number Diff line number Diff line change
Expand Up @@ -2960,12 +2960,6 @@ set_wire_load_mode_cmd(const char *mode_name)
Sta::sta()->setWireloadMode(mode);
}

Wireload *
wireload_defaulted(MinMax *min_max)
{
return Sta::sta()->sdc()->wireloadDefaulted(min_max);
}

void
set_net_resistance(Net *net,
const MinMaxAll *min_max,
Expand Down

0 comments on commit de34f8b

Please sign in to comment.