This commit is contained in:
James Cherry 2020-12-19 17:27:29 -07:00
parent d42f791da2
commit 9a0790d15e
7 changed files with 113 additions and 52 deletions

View File

@ -40,53 +40,82 @@ public:
// Primitives to print output. // Primitives to print output.
// Return the number of characters written. // Return the number of characters written.
virtual size_t printString(const char *buffer, size_t length); virtual size_t printString(const char *buffer,
size_t length);
virtual void print(const char *fmt, ...); virtual void print(const char *fmt, ...);
virtual void vprint(const char *fmt, va_list args); virtual void vprint(const char *fmt,
va_list args);
void print(const string *str); void print(const string *str);
void print(const string &str); void print(const string &str);
// Print to debug stream (same as output stream). // Print to debug stream (same as output stream).
virtual void printDebug(const char *fmt, ...) virtual void printDebug(const char *fmt, ...)
__attribute__((format (printf, 2, 3))); __attribute__((format (printf, 2, 3)));
virtual void vprintDebug(const char *fmt, va_list args); virtual void vprintDebug(const char *fmt,
va_list args);
// Print to error stream. // Print to error stream.
// Return the number of characters written. // Return the number of characters written.
virtual size_t printError(const char *buffer, size_t length); virtual size_t printError(const char *buffer,
size_t length);
virtual void printError(const char *fmt, ...) virtual void printError(const char *fmt, ...)
__attribute__((format (printf, 2, 3))); __attribute__((format (printf, 2, 3)));
virtual void vprintError(const char *fmt, va_list args); virtual void vprintError(const char *fmt,
va_list args);
// Print to warning stream (same as error stream). // Print to warning stream (same as error stream).
virtual void printWarn(const char *fmt, ...) virtual void printWarn(const char *fmt, ...)
__attribute__((format (printf, 2, 3))); __attribute__((format (printf, 2, 3)));
virtual void vprintWarn(const char *fmt, va_list args); virtual void vprintWarn(const char *fmt,
va_list args);
////////////////////////////////////////////////////////////////
// Report warning. // Report warning.
virtual void warn(int id, const char *fmt, ...) virtual void warn(int id,
const char *fmt, ...)
__attribute__((format (printf, 3, 4))); __attribute__((format (printf, 3, 4)));
// Report warning in a file. // Report warning in a file.
virtual void fileWarn(int id, const char *filename, int line, const char *fmt, ...) virtual void fileWarn(int id,
const char *filename,
int line,
const char *fmt, ...)
__attribute__((format (printf, 5, 6))); __attribute__((format (printf, 5, 6)));
virtual void vfileWarn(int id, const char *filename, int line, const char *fmt, virtual void vfileWarn(int id,
const char *filename,
int line,
const char *fmt,
va_list args); va_list args);
virtual void error(int id,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
// Report error in a file.
virtual void fileError(int id,
const char *filename,
int line,
const char *fmt, ...)
__attribute__((format (printf, 5, 6)));
virtual void vfileError(int id,
const char *filename,
int line,
const char *fmt,
va_list args);
// Critical. // Critical.
// Report error condition that should not be possible or that prevents execution. // Report error condition that should not be possible or that prevents execution.
// The default handler prints msg to stderr and exits. // The default handler prints msg to stderr and exits.
virtual void critical(int id, const char *fmt, ...) virtual void critical(int id,
const char *fmt,
...)
__attribute__((format (printf, 3, 4))); __attribute__((format (printf, 3, 4)));
virtual void fileCritical(int id, const char *filename, int line, const char *fmt, ...) virtual void fileCritical(int id,
const char *filename,
int line,
const char *fmt,
...)
__attribute__((format (printf, 5, 6))); __attribute__((format (printf, 5, 6)));
virtual void error(int id, const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
// Report error in a file.
virtual void fileError(int id, const char *filename, int line, const char *fmt, ...)
__attribute__((format (printf, 5, 6)));
virtual void vfileError(int id, const char *filename, int line, const char *fmt,
va_list args);
// Log output to filename until logEnd is called. // Log output to filename until logEnd is called.
virtual void logBegin(const char *filename); virtual void logBegin(const char *filename);
virtual void logEnd(); virtual void logEnd();
@ -106,12 +135,16 @@ public:
protected: protected:
// Primitive to print output on the console. // Primitive to print output on the console.
// Return the number of characters written. // Return the number of characters written.
virtual size_t printConsole(const char *buffer, size_t length) = 0; virtual size_t printConsole(const char *buffer,
// Primitive to print error, warning and debug output. size_t length) = 0;
// Primitive to print warning, error, critical and debug output.
// Return the number of characters written. // Return the number of characters written.
virtual size_t printErrorConsole(const char *buffer, size_t length) = 0; virtual size_t printErrorConsole(const char *buffer,
void printToBuffer(const char *fmt, va_list args); size_t length) = 0;
void redirectStringPrint(const char *buffer, size_t length); void printToBuffer(const char *fmt,
va_list args);
void redirectStringPrint(const char *buffer,
size_t length);
FILE *log_stream_; FILE *log_stream_;
FILE *redirect_stream_; FILE *redirect_stream_;

View File

@ -192,29 +192,28 @@ CheckCapacitanceLimits::findLimit(const Pin *pin,
void void
CheckCapacitanceLimits::checkCapacitance(const Pin *pin, CheckCapacitanceLimits::checkCapacitance(const Pin *pin,
const Corner *corner, const Corner *corner1,
const MinMax *min_max, const MinMax *min_max,
const RiseFall *rf1, const RiseFall *rf1,
float limit1, float limit1,
// Return values. // Return values.
const Corner *&corner1, const Corner *&corner,
const RiseFall *&rf, const RiseFall *&rf,
float &capacitance, float &capacitance,
float &slack, float &slack,
float &limit) const float &limit) const
{ {
const DcalcAnalysisPt *dcalc_ap = corner->findDcalcAnalysisPt(min_max); const DcalcAnalysisPt *dcalc_ap = corner1->findDcalcAnalysisPt(min_max);
GraphDelayCalc *dcalc = sta_->graphDelayCalc(); GraphDelayCalc *dcalc = sta_->graphDelayCalc();
float cap = dcalc->loadCap(pin, dcalc_ap); float cap = dcalc->loadCap(pin, dcalc_ap);
float slack1 = (min_max == MinMax::max()) float slack1 = (min_max == MinMax::max())
? limit1 - cap : cap - limit1; ? limit1 - cap : cap - limit1;
if (corner == nullptr if (slack1 < slack
|| (slack1 < slack // Break ties for the sake of regression stability.
// Break ties for the sake of regression stability. || (fuzzyEqual(slack1, slack)
|| (fuzzyEqual(slack1, slack) && rf1->index() < rf->index())) {
&& rf1->index() < rf->index()))) { corner = corner1;
corner1 = corner;
rf = rf1; rf = rf1;
capacitance = cap; capacitance = cap;
slack = slack1; slack = slack1;

View File

@ -124,6 +124,7 @@ PathEnumed::required(const StaState *sta) const
{ {
// Required times are never needed for enumerated paths. // Required times are never needed for enumerated paths.
sta->report()->critical(251, "enumerated path required time\n"); sta->report()->critical(251, "enumerated path required time\n");
return delay_zero;
} }
void void

View File

@ -5026,7 +5026,7 @@ Sta::checkCapacitanceLimitPreamble()
Pin * Pin *
Sta::pinMinCapacitanceLimitSlack(const Corner *corner, Sta::pinMinCapacitanceLimitSlack(const Corner *corner,
const MinMax *min_max) const MinMax *min_max)
{ {
checkCapacitanceLimitPreamble(); checkCapacitanceLimitPreamble();
return check_capacitance_limits_->pinMinCapacitanceLimitSlack(corner, min_max); return check_capacitance_limits_->pinMinCapacitanceLimitSlack(corner, min_max);

View File

@ -479,7 +479,7 @@ proc report_capacitance_limits { corner min_max all_violators verbose nosplit }
puts "${min_max} capacitance" puts "${min_max} capacitance"
puts "" puts ""
if { $verbose } { if { $verbose } {
report_capacitance_limit_verbose $pin $corner $min_max report_capacitance_limit_verbose $pin $corner $min_max
puts "" puts ""
} else { } else {
report_capacitance_limit_short_header report_capacitance_limit_short_header

View File

@ -43,7 +43,8 @@ Report::~Report()
} }
void void
Report::printToBuffer(const char *fmt, va_list args) Report::printToBuffer(const char *fmt,
va_list args)
{ {
// Copy args in case we need to grow the buffer. // Copy args in case we need to grow the buffer.
va_list args_copy; va_list args_copy;
@ -59,7 +60,8 @@ Report::printToBuffer(const char *fmt, va_list args)
} }
size_t size_t
Report::printString(const char *buffer, size_t length) Report::printString(const char *buffer,
size_t length)
{ {
size_t ret = length; size_t ret = length;
if (redirect_to_string_) if (redirect_to_string_)
@ -88,7 +90,8 @@ Report::print(const string &str)
} }
void void
Report::vprint(const char *fmt, va_list args) Report::vprint(const char *fmt,
va_list args)
{ {
std::unique_lock<std::mutex> lock(buffer_lock_); std::unique_lock<std::mutex> lock(buffer_lock_);
printToBuffer(fmt, args); printToBuffer(fmt, args);
@ -105,7 +108,8 @@ Report::print(const char *fmt, ...)
} }
size_t size_t
Report::printError(const char *buffer, size_t length) Report::printError(const char *buffer,
size_t length)
{ {
size_t ret = length; size_t ret = length;
if (redirect_to_string_) if (redirect_to_string_)
@ -122,7 +126,8 @@ Report::printError(const char *buffer, size_t length)
} }
void void
Report::vprintError(const char *fmt, va_list args) Report::vprintError(const char *fmt,
va_list args)
{ {
std::unique_lock<std::mutex> lock(buffer_lock_); std::unique_lock<std::mutex> lock(buffer_lock_);
printToBuffer(fmt, args); printToBuffer(fmt, args);
@ -342,7 +347,8 @@ Report::redirectStringEnd()
} }
void void
Report::redirectStringPrint(const char *buffer, size_t length) Report::redirectStringPrint(const char *buffer,
size_t length)
{ {
redirect_string_.append(buffer, length); redirect_string_.append(buffer, length);
} }

View File

@ -312,19 +312,23 @@ ReportTcl::setTclInterp(Tcl_Interp *interp)
} }
size_t size_t
ReportTcl::printConsole(const char *buffer, size_t length) ReportTcl::printConsole(const char *buffer,
size_t length)
{ {
return printTcl(tcl_stdout_, buffer, length); return printTcl(tcl_stdout_, buffer, length);
} }
size_t size_t
ReportTcl::printErrorConsole(const char *buffer, size_t length) ReportTcl::printErrorConsole(const char *buffer,
size_t length)
{ {
return printTcl(tcl_stderr_, buffer, length); return printTcl(tcl_stderr_, buffer, length);
} }
size_t size_t
ReportTcl::printTcl(Tcl_Channel channel, const char *buffer, size_t length) ReportTcl::printTcl(Tcl_Channel channel,
const char *buffer,
size_t length)
{ {
const Tcl_ChannelType *ch_type = Tcl_GetChannelType(channel); const Tcl_ChannelType *ch_type = Tcl_GetChannelType(channel);
Tcl_DriverOutputProc *output_proc = Tcl_ChannelOutputProc(ch_type); Tcl_DriverOutputProc *output_proc = Tcl_ChannelOutputProc(ch_type);
@ -405,7 +409,9 @@ ReportTcl::redirectStringEnd()
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
static int static int
encapOutputProc(ClientData instanceData, CONST84 char *buf, int toWrite, int *) encapOutputProc(ClientData instanceData,
CONST84 char *buf,
int toWrite, int *)
{ {
ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData); ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData);
return report->printString(buf, toWrite); return report->printString(buf, toWrite);
@ -422,13 +428,17 @@ encapErrorOutputProc(ClientData instanceData,
} }
static int static int
encapInputProc(ClientData, char *, int, int *) encapInputProc(ClientData,
char *,
int,
int *)
{ {
return -1; return -1;
} }
static int static int
encapCloseProc(ClientData instanceData, Tcl_Interp *) encapCloseProc(ClientData instanceData,
Tcl_Interp *)
{ {
ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData); ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData);
report->logEnd(); report->logEnd();
@ -438,19 +448,28 @@ encapCloseProc(ClientData instanceData, Tcl_Interp *)
} }
static int static int
encapSetOptionProc(ClientData, Tcl_Interp *, CONST84 char *, CONST84 char *) encapSetOptionProc(ClientData,
Tcl_Interp *,
CONST84 char *,
CONST84 char *)
{ {
return 0; return 0;
} }
static int static int
encapGetOptionProc(ClientData, Tcl_Interp *, CONST84 char *, Tcl_DString *) encapGetOptionProc(ClientData,
Tcl_Interp *,
CONST84 char *,
Tcl_DString *)
{ {
return 0; return 0;
} }
static int static int
encapSeekProc(ClientData, long, int, int *) encapSeekProc(ClientData,
long,
int,
int *)
{ {
return -1; return -1;
} }
@ -461,13 +480,16 @@ encapWatchProc(ClientData, int)
} }
static int static int
encapGetHandleProc(ClientData, int, ClientData *) encapGetHandleProc(ClientData,
int,
ClientData *)
{ {
return TCL_ERROR; return TCL_ERROR;
} }
static int static int
encapBlockModeProc(ClientData, int) encapBlockModeProc(ClientData,
int)
{ {
return 0; return 0;
} }