error/warn IDs

This commit is contained in:
James Cherry 2020-12-13 18:21:35 -07:00
parent e0c4799a56
commit 78d29c8f90
52 changed files with 510 additions and 475 deletions

View File

@ -604,7 +604,7 @@ void arnoldi1::calculate_poles_res(delay_work *D,double rdrive)
dsave = d[0];
d[0] += rdrive*ctot;
if (!tridiagEV(order,d,e,p,v))
internalError("arnoldi delay calc failed.\n");
criticalError(204, "arnoldi delay calc failed.");
d[0] = dsave;
for (h=0;h<order;h++) {

View File

@ -1586,7 +1586,7 @@ DmpCeffDelayCalc::gateDelay(const LibertyCell *drvr_cell,
if (drvr_parasitic
&& !unsuppored_model_warned_) {
unsuppored_model_warned_ = true;
report_->warn("cell %s delay model not supported on SPF parasitics by DMP delay calculator\n",
report_->warn(1, "cell %s delay model not supported on SPF parasitics by DMP delay calculator",
drvr_cell->name());
}
}

View File

@ -743,7 +743,7 @@ GraphDelayCalc1::findPortIndex(LibertyCell *cell,
return index;
index++;
}
internalError("port not found in cell");
report_->critical(207, "port not found in cell");
return 0;
}

View File

@ -16,6 +16,10 @@
This file summarizes STA API changes for each release.
Release 2.1.1 2020/12/13
Report::error, Report::warn functions now take a unique message ID as a first argument.
InternalError has been renamed Report::cricical.
Release 2.1.0 2020/04/05
All public headers files have been moved to include/sta.

View File

@ -741,7 +741,7 @@ Graph::arcDelayAnnotated(Edge *edge,
if (arc_delay_annotated_.size()) {
size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded");
report_->critical(208, "arc_delay_annotated array bounds exceeded");
return arc_delay_annotated_[index];
}
else
@ -756,7 +756,7 @@ Graph::setArcDelayAnnotated(Edge *edge,
{
size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded");
report_->critical(209, "arc_delay_annotated array bounds exceeded");
arc_delay_annotated_[index] = annotated;
}
@ -768,7 +768,7 @@ Graph::wireDelayAnnotated(Edge *edge,
size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(rf)) * ap_count_
+ ap_index;
if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded");
report_->critical(210, "arc_delay_annotated array bounds exceeded");
return arc_delay_annotated_[index];
}
@ -781,7 +781,7 @@ Graph::setWireDelayAnnotated(Edge *edge,
size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(rf)) * ap_count_
+ ap_index;
if (index >= arc_delay_annotated_.size())
internalError("arc_delay_annotated array bounds exceeded");
report_->critical(228, "arc_delay_annotated array bounds exceeded");
arc_delay_annotated_[index] = annotated;
}

View File

@ -131,7 +131,7 @@ ArrayTable<TYPE>::pushBlock(ArrayBlock<TYPE> *block)
{
blocks_[blocks_size_++] = block;
if (blocks_size_ >= block_id_max)
internalError("max array table block count exceeded.");
criticalError(223, "max array table block count exceeded.");
if (blocks_size_ == blocks_capacity_) {
size_t new_capacity = blocks_capacity_ * 1.5;
ArrayBlock<TYPE>** new_blocks = new ArrayBlock<TYPE>*[new_capacity];
@ -177,12 +177,11 @@ TYPE &
ArrayTable<TYPE>::ref(ObjectId id) const
{
if (id == object_id_null)
internalError("null ObjectId reference is undefined.");
else {
BlockIdx blk_idx = id >> idx_bits;
ObjectIdx obj_idx = id & idx_mask_;
return blocks_[blk_idx]->ref(obj_idx);
}
criticalError(222, "null ObjectId reference is undefined.");
BlockIdx blk_idx = id >> idx_bits;
ObjectIdx obj_idx = id & idx_mask_;
return blocks_[blk_idx]->ref(obj_idx);
}
template <class TYPE>

View File

@ -18,6 +18,7 @@
#include <exception>
#include "DisallowCopyAssign.hh"
#include "Report.hh"
namespace sta {
@ -41,28 +42,6 @@ protected:
int line_;
};
class InternalError : public ExceptionLine
{
public:
InternalError(const char *filename,
int line,
const char *msg);
virtual const char *what() const noexcept;
protected:
const char *msg_;
};
// Report an error condition that should not be possible.
// The default handler prints msg to stderr and exits.
// The msg should NOT include a period or return, as these
// are added by InternalError::asString().
#define internalError(msg) \
throw sta::InternalError(__FILE__, __LINE__, msg)
#define internalErrorNoThrow(msg) \
printf("Internal Error: %s:%d %s\n", __FILE__, __LINE__, msg)
// Failure opening filename for reading.
class FileNotReadable : public Exception
{
@ -85,4 +64,11 @@ protected:
const char *filename_;
};
// Report an error condition that should not be possible.
// The default handler prints msg to stderr and exits.
// The msg should NOT include a period or return.
// For only in those cases where a Report object is not available.
#define criticalError(id,msg) \
Report::defaultReport()->fileCritical(id, __FILE__, __LINE__, msg)
} // namespace

View File

@ -111,7 +111,7 @@ public:
if (exists)
return values_[mm_index];
else
internalError("uninitialized value reference");
criticalError(226, "uninitialized value reference");
}
void

View File

@ -106,7 +106,7 @@ ObjectTable<TYPE>::makeBlock()
TableBlock<TYPE> *block = new TableBlock<TYPE>(block_index, this);
blocks_.push_back(block);
if (blocks_.size() >= block_id_max)
internalError("max object table block count exceeded.");
criticalError(224, "max object table block count exceeded.");
// ObjectId zero is reserved for object_id_null.
int last = (block_index > 0) ? 0 : 1;
for (int i = block_object_count - 1; i >= last; i--) {
@ -134,7 +134,7 @@ TYPE &
ObjectTable<TYPE>::ref(ObjectId id) const
{
if (id == object_id_null)
internalError("null ObjectId reference is undefined.");
criticalError(225, "null ObjectId reference is undefined.");
else {
BlockIdx blk_idx = id >> idx_bits;
ObjectIdx obj_idx = id & idx_mask_;

View File

@ -58,30 +58,35 @@ public:
__attribute__((format (printf, 2, 3)));
virtual void vprintError(const char *fmt, va_list args);
// Report error.
virtual void error(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void verror(const char *fmt, va_list args);
// Report error in a file.
virtual void fileError(const char *filename, int line, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
virtual void vfileError(const char *filename, int line, const char *fmt,
va_list args);
// Print to warning stream (same as error stream).
virtual void printWarn(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void vprintWarn(const char *fmt, va_list args);
// Report warning.
virtual void warn(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void vwarn(const char *fmt, va_list args);
virtual void warn(int id, const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
// Report warning in a file.
virtual void fileWarn(const char *filename, int line, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
virtual void vfileWarn(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)));
virtual void vfileWarn(int id, const char *filename, int line, const char *fmt,
va_list args);
// Critical.
// Report error condition that should not be possible or that prevents execution.
// The default handler prints msg to stderr and exits.
virtual void critical(int id, const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
virtual void fileCritical(int id, const char *filename, int line, const char *fmt, ...)
__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.
virtual void logBegin(const char *filename);
virtual void logEnd();
@ -96,6 +101,8 @@ public:
virtual const char *redirectStringEnd();
virtual void setTclInterp(Tcl_Interp *) {}
static Report *defaultReport() { return default_; }
protected:
// Primitive to print output on the console.
// Return the number of characters written.
@ -116,6 +123,7 @@ protected:
// Length of string in buffer.
size_t buffer_length_;
std::mutex buffer_lock_;
static Report *default_;
private:
DISALLOW_COPY_AND_ASSIGN(Report);

View File

@ -186,7 +186,7 @@ InternalPowerModel::findAxisValues(float in_slew,
axis_value3 = axisValue(model_->axis3(), in_slew, load_cap);
break;
default:
internalError("unsupported table order");
criticalError(229, "unsupported table order");
}
}
@ -201,7 +201,7 @@ InternalPowerModel::axisValue(TableAxis *axis,
else if (var == TableAxisVariable::total_output_net_capacitance)
return load_cap;
else {
internalError("unsupported table axes");
criticalError(230, "unsupported table axes");
return 0.0;
}
}

View File

@ -325,7 +325,7 @@ LibertyLibrary::degradeWireSlew(const LibertyCell *cell,
else if (var1 == TableAxisVariable::connect_delay)
return model->findValue(this, cell, pvt, wire_delay, 0.0, 0.0);
else {
internalError("unsupported slew degradation table axes");
criticalError(231, "unsupported slew degradation table axes");
return 0.0;
}
}
@ -341,12 +341,12 @@ LibertyLibrary::degradeWireSlew(const LibertyCell *cell,
&& var2 == TableAxisVariable::output_pin_transition)
return model->findValue(this, cell, pvt, wire_delay, in_slew, 0.0);
else {
internalError("unsupported slew degradation table axes");
criticalError(232, "unsupported slew degradation table axes");
return 0.0;
}
}
default:
internalError("unsupported slew degradation table order");
criticalError(233, "unsupported slew degradation table order");
return 0.0;
}
}
@ -376,7 +376,7 @@ LibertyLibrary::checkSlewDegradationAxes(Table *table)
&& var2 == TableAxisVariable::output_pin_transition);
}
default:
internalError("unsupported slew degradation table axes");
criticalError(234, "unsupported slew degradation table axes");
return 0.0;
}
}
@ -726,7 +726,7 @@ LibertyLibrary::makeCornerMap(LibertyCell *cell1,
port1->setCornerPort(port2, ap_index);
}
else
report->warn("cell %s/%s port %s not found in cell %s/%s.\n",
report->warn(2, "cell %s/%s port %s not found in cell %s/%s.",
cell1->library()->name(),
cell1->name(),
port_name,
@ -749,7 +749,7 @@ LibertyLibrary::makeCornerMap(LibertyCell *cell1,
}
}
else
report->warn("cell %s/%s %s -> %s timing group %s not found in cell %s/%s.\n",
report->warn(3, "cell %s/%s %s -> %s timing group %s not found in cell %s/%s.",
cell1->library()->name(),
cell1->name(),
arc_set1->from()->name(),
@ -1126,7 +1126,7 @@ LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
{
int set_index = timing_arc_sets_.size();
if (set_index > timing_arc_set_index_max)
internalError("timing arc set max index exceeded");
criticalError(235, "timing arc set max index exceeded");
timing_arc_sets_.push_back(arc_set);
LibertyPort *from = arc_set->from();
@ -1277,7 +1277,7 @@ LibertyCell::makeTimingArcMap(Report *)
if (match != arc_set) {
// Unfortunately these errors are common in some brain damaged
// libraries.
// report->warn("cell %s/%s has duplicate %s -> %s %s timing groups.\n",
// report->warn("cell %s/%s has duplicate %s -> %s %s timing groups.",
// library_->name(),
// name_,
// match->from()->name(),
@ -1292,7 +1292,7 @@ LibertyCell::makeTimingArcMap(Report *)
timing_arc_sets_.resize(j);
if (timing_arc_set_map_.size() != timing_arc_sets_.size())
internalError("timing arc count mismatch\n");
criticalError(205, "timing arc count mismatch");
}
void
@ -1638,7 +1638,7 @@ LibertyCell::makeLatchEnables(Report *report,
RiseFall *en_rf = latch_enable->enableTransition();
RiseFall *check_rf = check_arc->fromTrans()->asRiseFall();
if (check_rf == en_rf) {
report->warn("cell %s/%s %s -> %s latch enable %s_edge timing arc is inconsistent with %s -> %s setup_%s check.\n",
report->warn(4, "cell %s/%s %s -> %s latch enable %s_edge timing arc is inconsistent with %s -> %s setup_%s check.",
library_->name(),
name_,
en->name(),
@ -1653,7 +1653,7 @@ LibertyCell::makeLatchEnables(Report *report,
TimingSense en_sense = en_func->portTimingSense(en);
if (en_sense == TimingSense::positive_unate
&& en_rf != RiseFall::rise())
report->warn("cell %s/%s %s -> %s latch enable %s_edge is inconsistent with latch group enable function positive sense.\n",
report->warn(5, "cell %s/%s %s -> %s latch enable %s_edge is inconsistent with latch group enable function positive sense.",
library_->name(),
name_,
en->name(),
@ -1661,7 +1661,7 @@ LibertyCell::makeLatchEnables(Report *report,
en_rf == RiseFall::rise()?"rising":"falling");
else if (en_sense == TimingSense::negative_unate
&& en_rf != RiseFall::fall())
report->warn("cell %s/%s %s -> %s latch enable %s_edge is inconsistent with latch group enable function negative sense.\n",
report->warn(6, "cell %s/%s %s -> %s latch enable %s_edge is inconsistent with latch group enable function negative sense.",
library_->name(),
name_,
en->name(),

View File

@ -73,7 +73,7 @@ LibExprParser::makeFuncExprPort(const char *port_name)
if (port)
expr = FuncExpr::makePort(port);
else
report_->error("%s references unknown port %s.\n",
report_->error(7, "%s references unknown port %s.",
error_msg_, port_name);
stringDelete(port_name);
return expr;
@ -166,7 +166,7 @@ LibExprParser::tokenAppend(char ch)
void
LibExprParser::parseError(const char *msg)
{
report_->printError("%s %s.\n", error_msg_, msg);
report_->error(206, "%s %s.", error_msg_, msg);
}
} // namespace

View File

@ -283,7 +283,7 @@ LibertySimpleAttr::~LibertySimpleAttr()
LibertyAttrValueSeq *
LibertySimpleAttr::values() const
{
internalError("valueIterator called for LibertySimpleAttribute");
criticalError(236, "valueIterator called for LibertySimpleAttribute");
return nullptr;
}
@ -364,7 +364,7 @@ LibertyStringAttrValue::~LibertyStringAttrValue()
float
LibertyStringAttrValue::floatValue()
{
internalError("LibertyStringAttrValue called for float value");
criticalError(237, "LibertyStringAttrValue called for float value");
return 0.0;
}
@ -394,7 +394,7 @@ LibertyFloatAttrValue::floatValue()
const char *
LibertyFloatAttrValue::stringValue()
{
internalError("LibertyStringAttrValue called for float value");
criticalError(238, "LibertyStringAttrValue called for float value");
return nullptr;
}
@ -417,8 +417,8 @@ makeLibertyDefine(LibertyAttrValueSeq *values,
group->addDefine(define);
}
else
liberty_report->fileWarn(liberty_filename, line,
"define does not have three arguments.\n");
liberty_report->fileWarn(24, liberty_filename, line,
"define does not have three arguments.");
return define;
}
@ -515,7 +515,7 @@ libertyIncludeBegin(const char *filename)
{
FILE *stream = fopen(filename, "r" );
if (stream == nullptr)
libertyParseError("cannot open include file %s.\n", filename);
libertyParseError("cannot open include file %s.", filename);
else {
liberty_filename_prev = liberty_filename;
liberty_line_prev = liberty_line;
@ -555,7 +555,7 @@ libertyParseError(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
sta::liberty_report->vfileError(sta::liberty_filename, sta::liberty_line,
sta::liberty_report->vfileError(25, sta::liberty_filename, sta::liberty_line,
fmt, args);
va_end(args);
}
@ -570,8 +570,8 @@ void libertyParseFlushBuffer();
int
LibertyParse_error(const char *msg)
{
sta::liberty_report->fileError(sta::liberty_filename, sta::liberty_line,
"%s.\n", msg);
sta::liberty_report->fileError(26, sta::liberty_filename, sta::liberty_line,
"%s.", msg);
libertyParseFlushBuffer();
return 0;
}

View File

@ -530,7 +530,7 @@ LibertyReader::beginLibrary(LibertyGroup *group)
if (name) {
LibertyLibrary *library = network_->findLiberty(name);
if (library)
libWarn(group, "library %s already exists.\n", name);
libWarn(53, group, "library %s already exists.", name);
// Make a new library even if a library with the same name exists.
// Both libraries may be accessed by min/max analysis points.
library_ = network_->makeLibertyLibrary(name, filename_);
@ -564,7 +564,7 @@ LibertyReader::beginLibrary(LibertyGroup *group)
library_->setScaleFactors(scale_factors_);
}
else
libError(group, "library does not have a name.\n");
libError(30, group, "library does not have a name.");
}
// Energy scale is derived.
@ -596,7 +596,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
if (wireload)
library_->setDefaultWireload(wireload);
else
libWarn(group, "default_wire_load %s not found.\n", default_wireload_);
libWarn(31, group, "default_wire_load %s not found.", default_wireload_);
stringDelete(default_wireload_);
}
@ -606,7 +606,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
if (selection)
library_->setDefaultWireloadSelection(selection);
else
libWarn(group, "default_wire_selection %s not found.\n",
libWarn(32, group, "default_wire_selection %s not found.",
default_wireload_selection_);
stringDelete(default_wireload_selection_);
}
@ -615,24 +615,24 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
for (auto tr : RiseFall::range()) {
int tr_index = tr->index();
if (!have_input_threshold_[tr_index]) {
libWarn(group, "input_threshold_pct_%s not found.\n", tr->name());
libWarn(33, group, "input_threshold_pct_%s not found.", tr->name());
missing_threshold = true;
}
if (!have_output_threshold_[tr_index]) {
libWarn(group, "output_threshold_pct_%s not found.\n", tr->name());
libWarn(34, group, "output_threshold_pct_%s not found.", tr->name());
missing_threshold = true;
}
if (!have_slew_lower_threshold_[tr_index]) {
libWarn(group, "slew_lower_threshold_pct_%s not found.\n", tr->name());
libWarn(35, group, "slew_lower_threshold_pct_%s not found.", tr->name());
missing_threshold = true;
}
if (!have_slew_upper_threshold_[tr_index]) {
libWarn(group, "slew_upper_threshold_pct_%s not found.\n", tr->name());
libWarn(36, group, "slew_upper_threshold_pct_%s not found.", tr->name());
missing_threshold = true;
}
}
if (missing_threshold)
libError(group, "Library %s is missing one or more thresholds.\n",
libError(37, group, "Library %s is missing one or more thresholds.",
library_->name());
}
@ -721,7 +721,7 @@ LibertyReader::parseUnits(LibertyAttr *attr,
else if (stringEq(mult_str, "100"))
mult = 100.0F;
else
libWarn(attr, "unknown unit multiplier %s.\n", mult_str);
libWarn(38, attr, "unknown unit multiplier %s.", mult_str);
}
float scale_mult = 1.0F;
@ -740,10 +740,10 @@ LibertyReader::parseUnits(LibertyAttr *attr,
else if (scale_char == 'f')
scale_mult = 1E-15F;
else
libWarn(attr, "unknown unit scale %c.\n", scale_char);
libWarn(39, attr, "unknown unit scale %c.", scale_char);
}
else if (!stringEqual(s, unit_suffix))
libWarn(attr, "unknown unit suffix %s.\n", s + 1);
libWarn(40, attr, "unknown unit suffix %s.", s + 1);
scale_var = scale_mult * mult;
unit->setScale(scale_var);
@ -768,22 +768,22 @@ LibertyReader::visitCapacitiveLoadUnit(LibertyAttr *attr)
else if (stringEqual(suffix, "pf"))
cap_scale_ = scale * 1E-12F;
else
libWarn(attr, "capacitive_load_units are not ff or pf.\n");
libWarn(41, attr, "capacitive_load_units are not ff or pf.");
}
else
libWarn(attr, "capacitive_load_units are not a string.\n");
libWarn(42, attr, "capacitive_load_units are not a string.");
}
else
libWarn(attr, "capacitive_load_units missing suffix.\n");
libWarn(43, attr, "capacitive_load_units missing suffix.");
}
else
libWarn(attr, "capacitive_load_units scale is not a float.\n");
libWarn(44, attr, "capacitive_load_units scale is not a float.");
}
else
libWarn(attr, "capacitive_load_units missing scale and suffix.\n");
libWarn(45, attr, "capacitive_load_units missing scale and suffix.");
}
else
libWarn(attr, "capacitive_load_unit missing values suffix.\n");
libWarn(46, attr, "capacitive_load_unit missing values suffix.");
library_->units()->capacitanceUnit()->setScale(cap_scale_);
setEnergyScale();
}
@ -801,23 +801,23 @@ LibertyReader::visitDelayModel(LibertyAttr *attr)
library_->setDelayModelType(DelayModelType::cmos_linear);
else if (stringEq(type_name, "piecewise_cmos")) {
library_->setDelayModelType(DelayModelType::cmos_pwl);
libWarn(attr, "delay_model %s not supported.\n.", type_name);
libWarn(47, attr, "delay_model %s not supported.", type_name);
}
else if (stringEq(type_name, "cmos2")) {
library_->setDelayModelType(DelayModelType::cmos2);
libWarn(attr, "delay_model %s not supported.\n.", type_name);
libWarn(48, attr, "delay_model %s not supported.", type_name);
}
else if (stringEq(type_name, "polynomial")) {
library_->setDelayModelType(DelayModelType::polynomial);
libWarn(attr, "delay_model %s not supported.\n.", type_name);
libWarn(49, attr, "delay_model %s not supported.", type_name);
}
// Evil IBM garbage.
else if (stringEq(type_name, "dcm")) {
library_->setDelayModelType(DelayModelType::dcm);
libWarn(attr, "delay_model %s not supported.\n.", type_name);
libWarn(50, attr, "delay_model %s not supported.\n.", type_name);
}
else
libWarn(attr, "unknown delay_model %s\n.", type_name);
libWarn(51, attr, "unknown delay_model %s\n.", type_name);
}
}
}
@ -836,7 +836,7 @@ LibertyReader::visitBusStyle(LibertyAttr *attr)
&& bus_style[4] == 'd')
library_->setBusBrkts(bus_style[2], bus_style[5]);
else
libWarn(attr, "unknown bus_naming_style format.\n");
libWarn(52, attr, "unknown bus_naming_style format.");
}
}
@ -857,19 +857,19 @@ LibertyReader::visitVoltageMap(LibertyAttr *attr)
library_->addSupplyVoltage(supply_name, voltage);
}
else
libWarn(attr, "voltage_map voltage is not a float.\n");
libWarn(54, attr, "voltage_map voltage is not a float.");
}
else
libWarn(attr, "voltage_map missing voltage.\n");
libWarn(55, attr, "voltage_map missing voltage.");
}
else
libWarn(attr, "voltage_map supply name is not a string.\n");
libWarn(56, attr, "voltage_map supply name is not a string.");
}
else
libWarn(attr, "voltage_map missing supply name and voltage.\n");
libWarn(57, attr, "voltage_map missing supply name and voltage.");
}
else
libWarn(attr, "voltage_map missing values suffix.\n");
libWarn(58, attr, "voltage_map missing values suffix.");
}
}
@ -1076,7 +1076,7 @@ LibertyReader::visitDefaultWireLoadMode(LibertyAttr *attr)
if (mode != WireloadMode::unknown)
library_->setDefaultWireloadMode(mode);
else
libWarn(attr, "default_wire_load_mode %s not found.\n",
libWarn(59, attr, "default_wire_load_mode %s not found.",
wire_load_mode);
}
}
@ -1102,7 +1102,7 @@ LibertyReader::visitDefaultOperatingConditions(LibertyAttr *attr)
if (op_cond)
library_->setDefaultOperatingConditions(op_cond);
else
libWarn(attr, "default_operating_condition %s not found.\n",
libWarn(60, attr, "default_operating_condition %s not found.",
op_cond_name);
}
}
@ -1248,7 +1248,7 @@ LibertyReader::beginTableTemplate(LibertyGroup *group,
library_->addTableTemplate(tbl_template_, type);
}
else
libWarn(group, "table template does not have a name.\n");
libWarn(61, group, "table template does not have a name.");
axis_var_[0] = axis_var_[1] = axis_var_[2] = TableAxisVariable::unknown;
clearAxisValues();
}
@ -1293,7 +1293,7 @@ LibertyReader::makeAxis(int index,
axis = new TableAxis(axis_var, axis_values);
}
else if (axis_var == TableAxisVariable::unknown && axis_values) {
libWarn(group, "missing variable_%d attribute.\n", index + 1);
libWarn(62, group, "missing variable_%d attribute.", index + 1);
delete axis_values;
axis_values_[index] = nullptr;
}
@ -1335,7 +1335,7 @@ LibertyReader::visitVariable(int index,
const char *type = getAttrString(attr);
TableAxisVariable var = stringTableAxisVariable(type);
if (var == TableAxisVariable::unknown)
libWarn(attr, "axis type %s not supported.\n", type);
libWarn(63, attr, "axis type %s not supported.", type);
else
axis_var_[index] = var;
}
@ -1395,13 +1395,13 @@ LibertyReader::endType(LibertyGroup *group)
}
else {
if (!type_bit_from_exists_)
libWarn(group, "bus type %s missing bit_from.\n", name);
libWarn(64, group, "bus type %s missing bit_from.", name);
if (!type_bit_to_exists_)
libWarn(group, "bus type %s missing bit_to.\n", name);
libWarn(65, group, "bus type %s missing bit_to.", name);
}
}
else
libWarn(group, "type does not have a name.\n");
libWarn(66, group, "type does not have a name.");
}
void
@ -1428,7 +1428,7 @@ LibertyReader::beginScalingFactors(LibertyGroup *group)
library_->addScaleFactors(scale_factors_);
}
else
libWarn(group, "scaling_factors do not have a name.\n");
libWarn(67, group, "scaling_factors do not have a name.");
}
void
@ -1596,7 +1596,7 @@ LibertyReader::beginOpCond(LibertyGroup *group)
library_->addOperatingConditions(op_cond_);
}
else
libWarn(group, "operating_conditions does not have a name.\n");
libWarn(68, group, "operating_conditions does not have a name.");
}
void
@ -1666,7 +1666,7 @@ LibertyReader::beginWireload(LibertyGroup *group)
}
}
else
libWarn(group, "wire_load does not have a name.\n");
libWarn(69, group, "wire_load does not have a name.");
}
void
@ -1709,7 +1709,7 @@ LibertyReader::visitFanoutLength(LibertyAttr *attr)
if (exists)
wireload_->addFanoutLength(fanout, length);
else
libWarn(attr, "fanout_length is missing length and fanout.\n");
libWarn(70, attr, "fanout_length is missing length and fanout.");
}
}
@ -1724,7 +1724,7 @@ LibertyReader::beginWireloadSelection(LibertyGroup *group)
}
}
else
libWarn(group, "wire_load_selection does not have a name.\n");
libWarn(71, group, "wire_load_selection does not have a name.");
}
void
@ -1755,23 +1755,23 @@ LibertyReader::visitWireloadFromArea(LibertyAttr *attr)
wireload_selection_->addWireloadFromArea(min_area, max_area,
wireload);
else
libWarn(attr, "wireload %s not found.\n", wireload_name);
libWarn(72, attr, "wireload %s not found.", wireload_name);
}
else
libWarn(attr,
"wire_load_from_area wireload name not a string.\n");
libWarn(73, attr,
"wire_load_from_area wireload name not a string.");
}
else
libWarn(attr, "wire_load_from_area min not a float.\n");
libWarn(74, attr, "wire_load_from_area min not a float.");
}
else
libWarn(attr, "wire_load_from_area max not a float.\n");
libWarn(75, attr, "wire_load_from_area max not a float.");
}
else
libWarn(attr, "wire_load_from_area missing parameters.\n");
libWarn(76, attr, "wire_load_from_area missing parameters.");
}
else
libWarn(attr, "wire_load_from_area missing parameters.\n");
libWarn(77, attr, "wire_load_from_area missing parameters.");
}
}
@ -1788,7 +1788,7 @@ LibertyReader::beginCell(LibertyGroup *group)
in_bundle_ = false;
}
else
libWarn(group, "cell does not have a name.\n");
libWarn(78, group, "cell does not have a name.");
}
void
@ -1811,7 +1811,7 @@ LibertyReader::endCell(LibertyGroup *group)
if (derate)
cell_->setOcvDerate(derate);
else
libWarn(group, "cell %s ocv_derate_group %s not found.\n",
libWarn(79, group, "cell %s ocv_derate_group %s not found.",
cell_->name(), ocv_derate_name_);
stringDelete(ocv_derate_name_);
ocv_derate_name_ = nullptr;
@ -1847,7 +1847,7 @@ LibertyReader::checkPort(LibertyPort *port,
FuncExpr *func_expr = port->function();
if (func_expr) {
if (func_expr->checkSize(port)) {
libWarn(line, "port %s function size does not match port size.\n",
libWarn(80, line, "port %s function size does not match port size.",
port->name());
}
}
@ -1916,7 +1916,7 @@ LibertyReader::makeCellSequential(SequentialGroup *seq)
const char *clk_attr = is_register ? "clocked_on" : "enable";
clk_expr = parseFunc(clk, clk_attr, line);
if (clk_expr && clk_expr->checkSize(size)) {
libWarn(line, "%s %s bus width mismatch.\n", type, clk_attr);
libWarn(81, line, "%s %s bus width mismatch.", type, clk_attr);
clk_expr->deleteSubexprs();
clk_expr = nullptr;
}
@ -1927,7 +1927,7 @@ LibertyReader::makeCellSequential(SequentialGroup *seq)
const char *data_attr = is_register ? "next_state" : "data_in";
data_expr = parseFunc(data, data_attr, line);
if (data_expr && data_expr->checkSize(size)) {
libWarn(line, "%s %s bus width mismatch.\n", type, data_attr);
libWarn(82, line, "%s %s bus width mismatch.", type, data_attr);
data_expr->deleteSubexprs();
data_expr = nullptr;
}
@ -1937,7 +1937,7 @@ LibertyReader::makeCellSequential(SequentialGroup *seq)
if (clr) {
clr_expr = parseFunc(clr, "clear", line);
if (clr_expr && clr_expr->checkSize(size)) {
libWarn(line, "%s %s bus width mismatch.\n", type, "clear");
libWarn(83, line, "%s %s bus width mismatch.", type, "clear");
clr_expr->deleteSubexprs();
clr_expr = nullptr;
}
@ -1947,7 +1947,7 @@ LibertyReader::makeCellSequential(SequentialGroup *seq)
if (preset) {
preset_expr = parseFunc(preset, "preset", line);
if (preset_expr && preset_expr->checkSize(size)) {
libWarn(line, "%s %s bus width mismatch.\n", type, "preset");
libWarn(84, line, "%s %s bus width mismatch.", type, "preset");
preset_expr->deleteSubexprs();
preset_expr = nullptr;
}
@ -1983,12 +1983,12 @@ LibertyReader::checkLatchEnableSense(FuncExpr *enable_func,
case TimingSense::negative_unate:
break;
case TimingSense::non_unate:
libWarn(line, "latch enable function is non-unate for port %s.\n",
libWarn(85, line, "latch enable function is non-unate for port %s.",
enable_port->name());
break;
case TimingSense::none:
case TimingSense::unknown:
libWarn(line, "latch enable function is unknown for port %s.\n",
libWarn(86, line, "latch enable function is unknown for port %s.",
enable_port->name());
break;
}
@ -2064,16 +2064,16 @@ LibertyReader::beginScaledCell(LibertyGroup *group)
cell_ = library_->makeScaledCell(name, filename_);
}
else
libWarn(group, "operating conditions %s not found.\n", op_cond_name);
libWarn(87, group, "operating conditions %s not found.", op_cond_name);
}
else
libWarn(group, "scaled_cell does not have an operating condition.\n");
libWarn(88, group, "scaled_cell does not have an operating condition.");
}
else
libWarn(group, "scaled_cell cell %s has not been defined.\n", name);
libWarn(89, group, "scaled_cell cell %s has not been defined.", name);
}
else
libWarn(group, "scaled_cell does not have a name.\n");
libWarn(90, group, "scaled_cell does not have a name.");
}
void
@ -2099,14 +2099,14 @@ LibertyReader::checkScaledCell(LibertyGroup *group)
{
if (equivCellPorts(cell_, scaled_cell_owner_)) {
if (!equivCellPortsAndFuncs(cell_, scaled_cell_owner_))
libWarn(group, "scaled_cell %s, %s port functions do not match cell port functions.\n",
libWarn(91, group, "scaled_cell %s, %s port functions do not match cell port functions.",
cell_->name(),
op_cond_->name());
}
else
libWarn(group, "scaled_cell ports do not match cell ports.\n");
libWarn(92, group, "scaled_cell ports do not match cell ports.");
if (!equivCellTimingArcSets(cell_, scaled_cell_owner_))
libWarn(group, "scaled_cell %s, %s timing does not match cell timing.\n",
libWarn(93, group, "scaled_cell %s, %s timing does not match cell timing.",
cell_->name(),
op_cond_->name());
}
@ -2125,7 +2125,7 @@ LibertyReader::makeTimingArcs(LibertyPort *to_port,
TimingType type = timing->timingType();
if (type == TimingType::combinational &&
to_port_dir->isInput())
libWarn(line, "combinational timing to an input port.\n");
libWarn(94, line, "combinational timing to an input port.");
StringSeq::Iterator related_port_iter(timing->relatedPortNames());
while (related_port_iter.hasNext()) {
const char *from_port_name = related_port_iter.next();
@ -2212,9 +2212,9 @@ TimingGroup::makeTableModels(LibertyReader *visitor)
|| timing_type_ == TimingType::three_state_enable_fall
|| timing_type_ == TimingType::three_state_enable_rise) {
if (transition == nullptr)
visitor->libWarn(line_, "missing %s_transition.\n", tr->name());
visitor->libWarn(95, line_, "missing %s_transition.", tr->name());
if (cell == nullptr)
visitor->libWarn(line_, "missing cell_%s.\n", tr->name());
visitor->libWarn(96, line_, "missing cell_%s.", tr->name());
}
}
if (constraint)
@ -2271,8 +2271,8 @@ LibertyReader::makeTimingArcs(const char *from_port_name,
}
}
else
libWarn(timing->line(),
"timing port %s and related port %s are different sizes.\n",
libWarn(97, timing->line(),
"timing port %s and related port %s are different sizes.",
from_port_name,
to_port->name());
}
@ -2366,8 +2366,8 @@ LibertyReader::makeInternalPowers(LibertyPort *port,
}
}
else
libWarn(power_group->line(),
"internal_power port %s and related port %s are different sizes.\n",
libWarn(98, power_group->line(),
"internal_power port %s and related port %s are different sizes.",
related_port_name,
port->name());
}
@ -2469,7 +2469,7 @@ LibertyReader::visitScalingFactors(LibertyAttr *attr)
if (scales)
cell_->setScaleFactors(scales);
else
libWarn(attr, "scaling_factors %s not found.\n", scale_factors_name);
libWarn(99, attr, "scaling_factors %s not found.", scale_factors_name);
}
}
@ -2512,7 +2512,7 @@ LibertyReader::beginPin(LibertyGroup *group)
}
}
else
libWarn(group, "pin name is not a string.\n");
libWarn(100, group, "pin name is not a string.");
}
}
else if (in_bundle_) {
@ -2531,7 +2531,7 @@ LibertyReader::beginPin(LibertyGroup *group)
ports_->push_back(port);
}
else
libWarn(group, "pin name is not a string.\n");
libWarn(101, group, "pin name is not a string.");
}
}
else {
@ -2553,7 +2553,7 @@ LibertyReader::beginPin(LibertyGroup *group)
ports_->push_back(port);
}
else
libWarn(group, "pin name is not a string.\n");
libWarn(102, group, "pin name is not a string.");
}
}
port_group_ = new PortGroup(ports_, group->line());
@ -2631,7 +2631,7 @@ LibertyReader::endBus(LibertyGroup *group)
{
if (cell_) {
if (ports_->empty())
libWarn(group, "bus %s bus_type not found.\n", group->firstName());
libWarn(103, group, "bus %s bus_type not found.", group->firstName());
endBusOrBundle();
in_bus_ = false;
}
@ -2688,10 +2688,10 @@ LibertyReader::visitBusType(LibertyAttr *attr)
}
}
else
libWarn(attr, "bus_type %s not found.\n", bus_type);
libWarn(104, attr, "bus_type %s not found.", bus_type);
}
else
libWarn(attr, "bus_type is not a string.\n");
libWarn(105, attr, "bus_type is not a string.");
}
}
@ -2709,7 +2709,7 @@ LibertyReader::endBundle(LibertyGroup *group)
{
if (cell_) {
if (ports_->empty())
libWarn(group, "bundle %s member not found.\n", group->firstName());
libWarn(106, group, "bundle %s member not found.", group->firstName());
endBusOrBundle();
in_bundle_ = false;
}
@ -2736,14 +2736,14 @@ LibertyReader::visitMembers(LibertyAttr *attr)
members->push_back(port);
}
else
libWarn(attr, "member is not a string.\n");
libWarn(107, attr, "member is not a string.");
}
LibertyPort *port = builder_->makeBundlePort(cell_, name, members);
ports_->push_back(port);
}
}
else
libWarn(attr,"members attribute is missing values.\n");
libWarn(108, attr,"members attribute is missing values.");
}
}
@ -2786,7 +2786,7 @@ LibertyReader::visitDirection(LibertyAttr *attr)
else if (stringEq(dir, "internal"))
port_dir = PortDirection::internal();
else
libWarn(attr, "unknown port direction.\n");
libWarn(109, attr, "unknown port direction.");
LibertyPortSeq::Iterator port_iter(ports_);
while (port_iter.hasNext()) {
@ -3154,7 +3154,7 @@ LibertyReader::visitPulseClock(LibertyAttr *attr)
sense = RiseFall::fall();
}
else
libWarn(attr, "pulse_latch unknown pulse type.\n");
libWarn(110,attr, "pulse_latch unknown pulse type.");
if (trigger) {
LibertyPortSeq::Iterator port_iter(ports_);
while (port_iter.hasNext()) {
@ -3531,7 +3531,7 @@ LibertyReader::visitTimingType(LibertyAttr *attr)
if (type_name) {
TimingType type = findTimingType(type_name);
if (type == TimingType::unknown)
libWarn(attr, "unknown timing_type %s.\n", type_name);
libWarn(111, attr, "unknown timing_type %s.", type_name);
else
timing_->setTimingType(type);
}
@ -3551,7 +3551,7 @@ LibertyReader::visitTimingSense(LibertyAttr *attr)
else if (stringEq(sense_name, "negative_unate"))
timing_->setTimingSense(TimingSense::negative_unate);
else
libWarn(attr, "unknown timing_sense %s.\n", sense_name);
libWarn(112, attr, "unknown timing_sense %s.", sense_name);
}
}
}
@ -3591,19 +3591,19 @@ LibertyReader::visitMode(LibertyAttr *attr)
if (value->isString())
timing_->setModeValue(value->stringValue());
else
libWarn(attr, "mode value is not a string.\n");
libWarn(113, attr, "mode value is not a string.");
}
else
libWarn(attr, "missing mode value.\n");
libWarn(114, attr, "missing mode value.");
}
else
libWarn(attr, "mode name is not a string.\n");
libWarn(115, attr, "mode name is not a string.");
}
else
libWarn(attr, "mode missing values.\n");
libWarn(116, attr, "mode missing values.");
}
else
libWarn(attr, "mode missing mode name and value.\n");
libWarn(117, attr, "mode missing mode name and value.");
}
}
@ -3678,7 +3678,7 @@ LibertyReader::endCellRiseFall(LibertyGroup *group)
timing_->setCell(rf_, table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(118, group, "unsupported model axis.");
delete table_;
}
}
@ -3706,7 +3706,7 @@ LibertyReader::endRiseFallTransition(LibertyGroup *group)
timing_->setTransition(rf_, table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(119, group, "unsupported model axis.");
delete table_;
}
}
@ -3736,7 +3736,7 @@ LibertyReader::endRiseFallConstraint(LibertyGroup *group)
timing_->setConstraint(rf_, table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(120, group, "unsupported model axis.");
delete table_;
}
}
@ -3772,7 +3772,7 @@ LibertyReader::endRiseFallTransitionDegredation(LibertyGroup *group)
library_->setWireSlewDegradationTable(table_model, rf_);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(121, group, "unsupported model axis.");
delete table_;
}
}
@ -3824,7 +3824,7 @@ LibertyReader::beginTable(LibertyGroup *group,
axis_[2] = tbl_template_->axis3();
}
else {
libWarn(group, "table template %s not found.\n", template_name);
libWarn(122, group, "table template %s not found.", template_name);
axis_[0] = axis_[1] = axis_[2] = nullptr;
}
clearAxisValues();
@ -3911,7 +3911,7 @@ LibertyReader::makeTable(LibertyAttr *attr,
}
}
else
libWarn(attr, "%s is missing values.\n", attr->name());
libWarn(123, attr, "%s is missing values.", attr->name());
}
FloatTable *
@ -3936,9 +3936,9 @@ LibertyReader::makeFloatTable(LibertyAttr *attr,
// Scalar value.
row->push_back(value->floatValue() * scale);
else
libWarn(attr, "%s is not a list of floats.\n", attr->name());
libWarn(124, attr, "%s is not a list of floats.", attr->name());
if (row->size() != cols) {
libWarn(attr, "table row has %u columns but axis has %d.\n",
libWarn(125, attr, "table row has %u columns but axis has %d.",
// size_t is long on 64 bit ports.
static_cast<unsigned>(row->size()),
static_cast<unsigned>(cols));
@ -3948,7 +3948,7 @@ LibertyReader::makeFloatTable(LibertyAttr *attr,
}
}
if (table->size() != rows) {
libWarn(attr, "table has %u rows but axis has %d.\n",
libWarn(126, attr, "table has %u rows but axis has %d.",
// size_t is long on 64 bit ports.
static_cast<unsigned>(table->size()),
static_cast<unsigned>(rows));
@ -4002,7 +4002,7 @@ LibertyReader::beginLut(LibertyGroup *group)
}
}
else
libWarn(group, "lut output is not a string.\n");
libWarn(127, group, "lut output is not a string.");
}
}
}
@ -4040,7 +4040,7 @@ LibertyReader::beginModeDef(LibertyGroup *group)
if (name)
mode_def_ = cell_->makeModeDef(name);
else
libWarn(group, "mode definition does not have a name.\n");
libWarn(128, group, "mode definition does not have a name.");
}
void
@ -4057,7 +4057,7 @@ LibertyReader::beginModeValue(LibertyGroup *group)
if (name)
mode_value_ = mode_def_->defineValue(name, nullptr, nullptr);
else
libWarn(group, "mode value does not have a name.\n");
libWarn(129, group, "mode value does not have a name.");
}
}
@ -4071,7 +4071,7 @@ void
LibertyReader::visitWhen(LibertyAttr *attr)
{
if (tbl_template_)
libWarn(attr, "when attribute inside table model.\n");
libWarn(130, attr, "when attribute inside table model.");
if (mode_value_) {
const char *func = getAttrString(attr);
if (func)
@ -4120,10 +4120,10 @@ LibertyReader::getAttrString(LibertyAttr *attr)
if (value->isString())
return value->stringValue();
else
libWarn(attr, "%s attribute is not a string.\n", attr->name());
libWarn(131, attr, "%s attribute is not a string.", attr->name());
}
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
libWarn(132, attr, "%s is not a simple attribute.", attr->name());
return nullptr;
}
@ -4143,10 +4143,10 @@ LibertyReader::getAttrInt(LibertyAttr *attr,
exists = true;
}
else
libWarn(attr, "%s attribute is not an integer.\n",attr->name());
libWarn(132, attr, "%s attribute is not an integer.",attr->name());
}
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
libWarn(133, attr, "%s is not a simple attribute.", attr->name());
}
void
@ -4159,7 +4159,7 @@ LibertyReader::getAttrFloat(LibertyAttr *attr,
if (attr->isSimple())
getAttrFloat(attr, attr->firstValue(), value, valid);
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
libWarn(134, attr, "%s is not a simple attribute.", attr->name());
}
void
@ -4183,7 +4183,7 @@ LibertyReader::getAttrFloat(LibertyAttr *attr,
char *end;
value = strtof(string, &end);
if (*end && !isspace(*end))
libWarn(attr, "%s value %s is not a float.\n",
libWarn(135, attr, "%s value %s is not a float.",
attr->name(),
string);
valid = true;
@ -4212,14 +4212,14 @@ LibertyReader::getAttrFloat2(LibertyAttr *attr,
getAttrFloat(attr, value, value2, exists);
}
else
libWarn(attr, "%s missing values.\n", attr->name());
libWarn(136, attr, "%s missing values.", attr->name());
}
}
else
libWarn(attr, "%s missing values.\n", attr->name());
libWarn(137, attr, "%s missing values.", attr->name());
}
else
libWarn(attr, "%s is not a complex attribute.\n", attr->name());
libWarn(138, attr, "%s is not a complex attribute.", attr->name());
}
// Parse string of comma separated floats.
@ -4245,7 +4245,7 @@ LibertyReader::parseStringFloatList(const char *float_list,
|| isspace(*end)
|| strchr(delimiters, *end) != nullptr
|| *end == '}')))
libWarn(attr, "%s is not a float.\n", token);
libWarn(139, attr, "%s is not a float.", token);
values->push_back(value);
}
}
@ -4264,10 +4264,10 @@ LibertyReader::readFloatSeq(LibertyAttr *attr,
parseStringFloatList(value->stringValue(), scale, values, attr);
}
else
libWarn(attr, "%s is missing values.\n", attr->name());
libWarn(140, attr, "%s is missing values.", attr->name());
}
if (value_iter.hasNext())
libWarn(attr, "%s has more than one string.\n", attr->name());
libWarn(141, attr, "%s has more than one string.", attr->name());
}
else {
LibertyAttrValue *value = attr->firstValue();
@ -4276,7 +4276,7 @@ LibertyReader::readFloatSeq(LibertyAttr *attr,
parseStringFloatList(value->stringValue(), scale, values, attr);
}
else
libWarn(attr, "%s is missing values.\n", attr->name());
libWarn(142, attr, "%s is missing values.", attr->name());
}
return values;
}
@ -4301,13 +4301,13 @@ LibertyReader::getAttrBool(LibertyAttr *attr,
exists = true;
}
else
libWarn(attr, "%s attribute is not boolean.\n", attr->name());
libWarn(143, attr, "%s attribute is not boolean.", attr->name());
}
else
libWarn(attr, "%s attribute is not boolean.\n", attr->name());
libWarn(144, attr, "%s attribute is not boolean.", attr->name());
}
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
libWarn(145, attr, "%s is not a simple attribute.", attr->name());
}
// Read L/H/X string attribute values as bool.
@ -4323,7 +4323,7 @@ LibertyReader::getAttrLogicValue(LibertyAttr *attr)
else if (stringEq(str, "X"))
return LogicValue::unknown;
else
libWarn(attr, "attribute %s value %s not recognized.\n",
libWarn(146, attr, "attribute %s value %s not recognized.",
attr->name(), str);
// fall thru
}
@ -4353,7 +4353,7 @@ LibertyReader::getAttrEarlyLate(LibertyAttr *attr)
else if (stringEq(value, "early_and_late"))
return EarlyLateAll::all();
else {
libWarn(attr, "unknown early/late value.\n");
libWarn(147, attr, "unknown early/late value.");
return EarlyLateAll::all();
}
}
@ -4392,35 +4392,38 @@ LibertyReader::variableValue(const char *var,
////////////////////////////////////////////////////////////////
void
LibertyReader::libWarn(LibertyStmt *stmt,
LibertyReader::libWarn(int id,
LibertyStmt *stmt,
const char *fmt,
...)
{
va_list args;
va_start(args, fmt);
report_->vfileWarn(filename_, stmt->line(), fmt, args);
report_->vfileWarn(id, filename_, stmt->line(), fmt, args);
va_end(args);
}
void
LibertyReader::libWarn(int line,
LibertyReader::libWarn(int id,
int line,
const char *fmt,
...)
{
va_list args;
va_start(args, fmt);
report_->vfileWarn(filename_, line, fmt, args);
report_->vfileWarn(id, filename_, line, fmt, args);
va_end(args);
}
void
LibertyReader::libError(LibertyStmt *stmt,
LibertyReader::libError(int id,
LibertyStmt *stmt,
const char *fmt,
...)
{
va_list args;
va_start(args, fmt);
report_->vfileError(filename_, stmt->line(), fmt, args);
report_->vfileError(id, filename_, stmt->line(), fmt, args);
va_end(args);
}
@ -4561,7 +4564,7 @@ LibertyReader::visitDefaultOcvDerateGroup(LibertyAttr *attr)
if (derate)
library_->setDefaultOcvDerate(derate);
else
libWarn(attr, "OCV derate group named %s not found.\n", derate_name);
libWarn(148, attr, "OCV derate group named %s not found.", derate_name);
}
void
@ -4577,7 +4580,7 @@ LibertyReader::beginOcvDerate(LibertyGroup *group)
if (name)
ocv_derate_ = new OcvDerate(stringCopy(name));
else
libWarn(group, "ocv_derate does not have a name.\n");
libWarn(149, group, "ocv_derate does not have a name.");
}
void
@ -4630,7 +4633,7 @@ LibertyReader::visitRfType(LibertyAttr *attr)
else if (stringEq(rf_name, "rise_and_fall"))
rf_type_ = RiseFallBoth::riseFall();
else
libError(attr, "unknown rf_type.\n");
libError(150, attr, "unknown rf_type.");
}
void
@ -4650,7 +4653,7 @@ LibertyReader::visitPathType(LibertyAttr *attr)
else if (stringEq(path_type, "clock_and_data"))
path_type_ = PathType::clk_and_data;
else
libWarn(attr, "unknown derate type.\n");
libWarn(151, attr, "unknown derate type.");
}
////////////////////////////////////////////////////////////////
@ -4681,7 +4684,7 @@ LibertyReader::endOcvSigmaCell(LibertyGroup *group)
timing_->setDelaySigma(rf_, sigma_type_->asMinMax(), table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(152, group, "unsupported model axis.");
delete table_;
}
}
@ -4714,7 +4717,7 @@ LibertyReader::endOcvSigmaTransition(LibertyGroup *group)
timing_->setSlewSigma(rf_, sigma_type_->asMinMax(), table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(153, group, "unsupported model axis.");
delete table_;
}
}
@ -4747,7 +4750,7 @@ LibertyReader::endOcvSigmaConstraint(LibertyGroup *group)
timing_->setConstraintSigma(rf_, sigma_type_->asMinMax(), table_model);
}
else {
libWarn(group, "unsupported model axis.\n");
libWarn(154, group, "unsupported model axis.");
delete table_;
}
}
@ -4820,7 +4823,7 @@ LibertyReader::visitPgType(LibertyAttr *attr)
type = LibertyPgPort::PgType::deeppwell;
else
libError(attr, "unknown pg_type.\n");
libError(155, attr, "unknown pg_type.");
pg_port_->setPgType(type);
}
}
@ -5197,11 +5200,11 @@ PortNameBitIterator::init(const char *port_name)
delete [] bus_name;
}
else
visitor_->libWarn(line_, "port %s subscript out of range.\n",
visitor_->libWarn(156, line_, "port %s subscript out of range.",
port_name);
}
else
visitor_->libWarn(line_, "port range %s of non-bus port %s.\n",
visitor_->libWarn(157, line_, "port range %s of non-bus port %s.",
port_name,
bus_name);
}
@ -5215,7 +5218,7 @@ PortNameBitIterator::init(const char *port_name)
size_ = abs(from - to) + 1;
}
else
visitor_->libWarn(line_, "port %s not found.\n", port_name);
visitor_->libWarn(158, line_, "port %s not found.", port_name);
}
}
@ -5285,7 +5288,7 @@ PortNameBitIterator::findRangeBusNameNext()
range_bit_++;
}
else
visitor_->libWarn(line_, "port %s not found.\n", bus_bit_name);
visitor_->libWarn(159, line_, "port %s not found.", bus_bit_name);
}
else
range_name_next_ = nullptr;

View File

@ -492,17 +492,20 @@ protected:
FuncExpr *parseFunc(const char *func,
const char *attr_name,
int line);
void libWarn(LibertyStmt *stmt,
void libWarn(int id,
LibertyStmt *stmt,
const char *fmt,
...)
__attribute__((format (printf, 3, 4)));
void libWarn(int line,
__attribute__((format (printf, 4, 5)));
void libWarn(int id,
int line,
const char *fmt,
...)
__attribute__((format (printf, 3, 4)));
void libError(LibertyStmt *stmt,
__attribute__((format (printf, 4, 5)));
void libError(int id,
LibertyStmt *stmt,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
__attribute__((format (printf, 4, 5)));
const char *filename_;
bool infer_latches_;

View File

@ -239,7 +239,7 @@ GateTableModel::findAxisValues(const TableModel *model,
related_out_cap);
break;
default:
internalError("unsupported table order");
criticalError(239, "unsupported table order");
}
}
@ -308,7 +308,7 @@ GateTableModel::axisValue(TableAxis *axis,
else if (var == TableAxisVariable::related_out_total_output_net_capacitance)
return related_out_cap;
else {
internalError("unsupported table axes");
criticalError(240, "unsupported table axes");
return 0.0;
}
}
@ -499,7 +499,7 @@ CheckTableModel::findAxisValues(float from_slew,
related_out_cap);
break;
default:
internalError("unsupported table order");
criticalError(241, "unsupported table order");
}
}
@ -517,7 +517,7 @@ CheckTableModel::axisValue(TableAxis *axis,
else if (var == TableAxisVariable::related_out_total_output_net_capacitance)
return related_out_cap;
else {
internalError("unsupported table axes");
criticalError(242, "unsupported table axes");
return 0.0;
}
}

View File

@ -248,7 +248,7 @@ TimingArcSet::addTimingArc(TimingArc *arc)
{
TimingArcIndex arc_index = arcs_.size();
if (arc_index > timing_arc_index_max)
internalError("timing arc max index exceeded\n");
criticalError(243, "timing arc max index exceeded\n");
arcs_.push_back(arc);
int from_rf_index = arc->fromTrans()->asRiseFall()->index();

View File

@ -1864,7 +1864,7 @@ ConcreteNetwork::linkNetwork(const char *top_cell_name,
return top_instance_ != nullptr;
}
else {
report->error("cell type %s can not be linked.\n", top_cell_name);
report->error(8, "cell type %s can not be linked.", top_cell_name);
return false;
}
}

View File

@ -1023,7 +1023,7 @@ SdcNetwork::parsePath(const char *path,
else
*p++ = ch;
if (p - inst_path + 1 > inst_path_length)
internalError("inst path string lenth estimate busted");
report_->critical(211, "inst path string lenth estimate busted");
}
*p = '\0';
stringDelete(inst_path);
@ -1095,7 +1095,7 @@ SdcNetwork::visitMatches(const Instance *parent,
*p++ = ch;
}
if (p - inst_path + 1 > inst_path_length)
internalError("inst path string lenth estimate busted");
report_->critical(212, "inst path string lenth estimate exceeded");
}
*p = '\0';
if (!found_match) {

View File

@ -163,6 +163,7 @@ EstimateParasitics::estimatePiElmoreBalanced(const Pin *drvr_pin,
else {
Sdc *sdc = sta->sdc();
Network *network = sta->network();
Report *report = sta->report();
double res_fanout = wireload_res / fanout;
double cap_fanout = wireload_cap / fanout;
// Find admittance moments.
@ -184,7 +185,7 @@ EstimateParasitics::estimatePiElmoreBalanced(const Pin *drvr_pin,
else if (network->isTopLevelPort(load_pin))
load_cap = sdc->portExtCap(port, rf, min_max);
else
internalError("load pin not leaf or top level");
report->critical(212, "load pin not leaf or top level");
double cap = load_cap + cap_fanout;
double y2_ = res_fanout * cap * cap;
y1 += cap;

View File

@ -66,10 +66,10 @@ Parasitics::check(Parasitic *) const
res_count++;
}
if (res_count == 0)
report->warn("sub node %s has no resistor connections\n",
report->warn("sub node %s has no resistor connections",
node->name(network));
else if (res_count == 1)
report->warn("sub node %s has one resistor connection\n",
report->warn("sub node %s has one resistor connection",
node->name(network));
}
#endif

View File

@ -802,7 +802,7 @@ pos_integer:
INTEGER
{ int value = $1;
if (value < 0)
sta::spef_reader->warn("%d is not positive.\n", value);
sta::spef_reader->warn(21, "%d is not positive.", value);
$$ = value;
}
;
@ -811,13 +811,13 @@ pos_number:
INTEGER
{ float value = static_cast<float>($1);
if (value < 0)
sta::spef_reader->warn("%.4f is not positive.\n", value);
sta::spef_reader->warn(22, "%.4f is not positive.", value);
$$ = value;
}
| FLOAT
{ float value = static_cast<float>($1);
if (value < 0)
sta::spef_reader->warn("%.4f is not positive.\n", value);
sta::spef_reader->warn(23, "%.4f is not positive.", value);
$$ = value;
}
;

View File

@ -164,7 +164,7 @@ SpefReader::setBusBrackets(char left, char right)
|| (left == '<' && right == '>')
|| (left == ':' && right == '\0')
|| (left == '.' && right == '\0')))
warn("illegal bus delimiters.\n");
warn(167, "illegal bus delimiters.");
bus_brkt_left_ = left;
bus_brkt_right_ = right;
}
@ -231,11 +231,11 @@ SpefReader::incrLine()
}
void
SpefReader::warn(const char *fmt, ...)
SpefReader::warn(int id, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
report_->vfileWarn(filename_, line_, fmt, args);
report_->vfileWarn(id, filename_, line_, fmt, args);
va_end(args);
}
@ -248,7 +248,7 @@ SpefReader::setTimeScale(float scale,
else if (stringEq(units, "PS"))
time_scale_ = scale * 1E-12F;
else
warn("unknown units %s.\n", units);
warn(168, "unknown units %s.", units);
stringDelete(units);
}
@ -261,7 +261,7 @@ SpefReader::setCapScale(float scale,
else if (stringEq(units, "FF"))
cap_scale_ = scale * 1E-15F;
else
warn("unknown units %s.\n", units);
warn(168, "unknown units %s.", units);
stringDelete(units);
}
@ -274,7 +274,7 @@ SpefReader::setResScale(float scale,
else if (stringEq(units, "KOHM"))
res_scale_ = scale * 1E+3F;
else
warn("unknown units %s.\n", units);
warn(170, "unknown units %s.", units);
stringDelete(units);
}
@ -289,7 +289,7 @@ SpefReader::setInductScale(float scale,
else if (stringEq(units, "UH"))
induct_scale_ = scale * 1E-6F;
else
warn("unknown units %s.\n", units);
warn(168, "unknown units %s.", units);
stringDelete(units);
}
@ -312,7 +312,7 @@ SpefReader::nameMapLookup(char *name)
if (exists)
return mapped_name;
else {
warn("no name map entry for %d.\n", index);
warn(169, "no name map entry for %d.", index);
return 0;
}
}
@ -331,7 +331,7 @@ SpefReader::portDirection(char *spef_dir)
else if (stringEq(spef_dir, "B"))
direction = PortDirection::bidirect();
else
warn("unknown port direction %s.\n", spef_dir);
warn(170, "unknown port direction %s.", spef_dir);
return direction;
}
@ -357,15 +357,15 @@ SpefReader::findPin(char *name)
if (inst) {
pin = network_->findPin(inst, port_name);
if (pin == nullptr)
warn("pin %s not found.\n", name);
warn(171, "pin %s not found.", name);
}
else
warn("instance %s not found.\n", name);
warn(172, "instance %s not found.", name);
}
else {
pin = findPortPinRelative(name);
if (pin == nullptr)
warn("pin %s not found.\n", name);
warn(173, "pin %s not found.", name);
}
}
return pin;
@ -379,7 +379,7 @@ SpefReader::findNet(char *name)
if (name) {
net = findNetRelative(name);
if (net == nullptr)
warn("net %s not found.\n", name);
warn(174, "net %s not found.", name);
}
return net;
}
@ -489,7 +489,7 @@ SpefReader::findParasiticNode(char *name)
findParasiticNode(name, node, ext_net, ext_node_id, ext_pin);
if (node == nullptr
&& (ext_net || ext_pin))
warn("%s not connected to net %s.\n", name, network_->pathName(net_));
warn(175, "%s not connected to net %s.", name, network_->pathName(net_));
return node;
}
@ -524,7 +524,7 @@ SpefReader::findParasiticNode(char *name,
else {
// Replace delimiter for error message.
*delim = delimiter_;
warn("pin %s not found.\n", name);
warn(176, "pin %s not found.", name);
}
}
else {
@ -544,7 +544,7 @@ SpefReader::findParasiticNode(char *name,
}
}
else
warn("node %s not a pin or net:number\n", name);
warn(177, "node %s not a pin or net:number", name);
}
}
}
@ -559,7 +559,7 @@ SpefReader::findParasiticNode(char *name,
ext_pin = pin;
}
else
warn("pin %s not found.\n", name);
warn(178, "pin %s not found.", name);
}
}
}
@ -720,7 +720,7 @@ void spefFlushBuffer();
int
SpefParse_error(const char *msg)
{
sta::spef_reader->warn("%s.\n", msg);
sta::spef_reader->warn(179, "%s.", msg);
spefFlushBuffer();
return 0;
}

View File

@ -81,8 +81,10 @@ public:
size_t max_size);
// Translate from spf/spef namespace to sta namespace.
char *translated(const char *token);
void warn(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
void warn(int id,
const char *fmt,
...)
__attribute__((format (printf, 3, 4)));
void setBusBrackets(char left,
char right);
void setTimeScale(float scale,

View File

@ -474,7 +474,7 @@ Clock::generateEdgesClk(const Clock *src_clk)
period_ += (*edge_shifts_)[2];
}
else
internalError("generated clock edges size is not three.");
criticalError(244, "generated clock edges size is not three.");
}
static bool

View File

@ -2462,7 +2462,7 @@ Sdc::reportClkToClkMaxCycleWarnings()
sort(clk_warnings2, ClockPairLess());
for (auto pair : clk_warnings2) {
report_->warn("No common period was found between clocks %s and %s.\n",
report_->warn(9, "No common period was found between clocks %s and %s.",
pair.first->name(),
pair.second->name());
}
@ -4178,7 +4178,7 @@ Sdc::makeGroupPath(const char *name,
{
checkFromThrusTo(from, thrus, to);
if (name && is_default)
internalError("group path name and is_default are mutually exclusive.");
report_->critical(213, "group path name and is_default are mutually exclusive.");
else if (name) {
GroupPath *group_path = new GroupPath(name, is_default, from, thrus, to,
true, comment);

View File

@ -1329,7 +1329,7 @@ WriteSdc::writeExceptionCmd(ExceptionPath *exception) const
fprintf(stream_, "group_path -name %s", exception->name());
}
else
internalError("unknown exception type");
report_->critical(214, "unknown exception type");
}
void
@ -1900,7 +1900,8 @@ WriteSdc::setConstantCmd(Pin *pin) const
case LogicValue::rise:
case LogicValue::fall:
default:
internalError("illegal set_logic value");
report_->critical(215, "illegal set_logic value");
return nullptr;
}
}
@ -1943,7 +1944,8 @@ WriteSdc::caseAnalysisValueStr(Pin *pin) const
return "falling";
case LogicValue::unknown:
default:
internalError("invalid set_case_analysis value");
report_->critical(216, "invalid set_case_analysis value");
return nullptr;
}
}
@ -2966,53 +2968,31 @@ transRiseFallFlag(const RiseFallBoth *rf)
return " -rise";
else if (rf == RiseFallBoth::fall())
return " -fall";
else if (rf == RiseFallBoth::riseFall())
else
return "";
else {
internalError("unknown transition");
}
return nullptr;
}
static const char *
minMaxFlag(const MinMaxAll *min_max)
{
if (min_max == MinMaxAll::all())
return "";
else if (min_max == MinMaxAll::min())
if (min_max == MinMaxAll::min())
return " -min";
else if (min_max == MinMaxAll::max())
return " -max";
else {
internalError("unknown MinMaxAll");
return nullptr;
}
else
return "";
}
static const char *
minMaxFlag(const MinMax *min_max)
{
if (min_max == MinMax::min())
return " -min";
else if (min_max == MinMax::max())
return " -max";
else {
internalError("unknown MinMax");
return nullptr;
}
return (min_max == MinMax::min()) ? " -min" : " -max";
}
static const char *
earlyLateFlag(const MinMax *early_late)
{
if (early_late == MinMax::min())
return "-early";
else if (early_late == MinMax::max())
return "-late";
else {
internalError("unknown EarlyLate");
return nullptr;
}
return (early_late == MinMax::min()) ? "-early" : "-late";
}
void
@ -3027,14 +3007,7 @@ WriteSdc::writeSetupHoldFlag(const MinMaxAll *min_max) const
static const char *
setupHoldFlag(const MinMax *min_max)
{
if (min_max == MinMax::min())
return " -hold";
else if (min_max == MinMax::max())
return " -setup";
else {
internalError("unknown MinMax");
return nullptr;
}
return (min_max == MinMax::min()) ? " -hold" : " -setup";
}
void

View File

@ -153,7 +153,9 @@ public:
void incrLine();
const char *filename() { return filename_; }
int line() { return line_; }
void sdfError(const char *fmt, ...);
void sdfError(int id,
const char *fmt,
...);
void notSupported(const char *feature);
private:

View File

@ -196,10 +196,10 @@ SdfReader::setTimescale(float multiplier,
else if (stringEq(units, "ps"))
timescale_ = multiplier * 1E-12F;
else
sdfError("TIMESCALE units not us, ns, or ps.\n");
sdfError(180, "TIMESCALE units not us, ns, or ps.");
}
else
sdfError("TIMESCALE multiplier not 1, 10, or 100.\n");
sdfError(181, "TIMESCALE multiplier not 1, 10, or 100.");
stringDelete(units);
}
@ -222,20 +222,20 @@ SdfReader::interconnect(const char *from_pin_name,
bool to_is_hier = network_->isHierarchical(to_pin);
if (from_is_hier || to_is_hier) {
if (from_is_hier)
sdfError("pin %s is a hierarchical pin.\n", from_pin_name);
sdfError(182, "pin %s is a hierarchical pin.", from_pin_name);
if (to_is_hier)
sdfError("pin %s is a hierarchical pin.\n", to_pin_name);
sdfError(183, "pin %s is a hierarchical pin.", to_pin_name);
}
else
sdfError("INTERCONNECT from %s to %s not found.\n",
sdfError(184, "INTERCONNECT from %s to %s not found.",
from_pin_name, to_pin_name);
}
}
else {
if (from_pin == nullptr)
sdfError("pin %s not found.\n", from_pin_name);
sdfError(185, "pin %s not found.", from_pin_name);
if (to_pin == nullptr)
sdfError("pin %s not found.\n", to_pin_name);
sdfError(186, "pin %s not found.", to_pin_name);
}
}
stringDelete(from_pin_name);
@ -253,7 +253,7 @@ SdfReader::port(const char *to_pin_name,
? network_->findPinRelative(instance_, to_pin_name)
: network_->findPin(to_pin_name);
if (to_pin == nullptr)
sdfError("pin %s not found.\n", to_pin_name);
sdfError(187, "pin %s not found.", to_pin_name);
else {
Vertex *vertex = graph_->pinLoadVertex(to_pin);
VertexInEdgeIterator edge_iter(vertex, graph_);
@ -309,9 +309,9 @@ SdfReader::setEdgeDelays(Edge *edge,
}
}
else if (triple_count == 0)
sdfError("%s with no triples.\n", sdf_cmd);
sdfError(188, "%s with no triples.", sdf_cmd);
else
sdfError("%s with more than 2 triples.\n", sdf_cmd);
sdfError(189, "%s with more than 2 triples.", sdf_cmd);
}
void
@ -334,7 +334,7 @@ SdfReader::setInstance(const char *instance_name)
Cell *inst_cell = network_->cell(instance_);
const char *inst_cell_name = network_->name(inst_cell);
if (cell_name_ && !stringEqual(inst_cell_name, cell_name_))
sdfError("instance %s cell %s does not match enclosing cell %s.\n",
sdfError(190, "instance %s cell %s does not match enclosing cell %s.",
instance_name,
inst_cell_name,
cell_name_);
@ -428,7 +428,7 @@ SdfReader::iopath(SdfPortSpec *from_edge,
}
}
if (!matched)
sdfError("cell %s IOPATH %s -> %s not found.\n",
sdfError(191, "cell %s IOPATH %s -> %s not found.",
network_->cellName(instance_),
from_port_name,
to_port_name);
@ -509,7 +509,7 @@ SdfReader::timingCheck1(TimingRole *role,
if (!matched
// Only warn when non-null values are present.
&& triple->hasValue())
sdfError("cell %s %s -> %s %s check not found.\n",
sdfError(192, "cell %s %s -> %s %s check not found.",
network_->cellName(instance_),
data_port_name,
clk_port_name,
@ -1021,23 +1021,24 @@ SdfReader::getChars(char *buf,
void
SdfReader::notSupported(const char *feature)
{
sdfError("%s not supported.\n", feature);
sdfError(193, "%s not supported.", feature);
}
void
SdfReader::portNotFound(const char *port_name)
{
sdfError("instance %s port %s not found.\n",
sdfError(194, "instance %s port %s not found.",
network_->pathName(instance_),
port_name);
}
void
SdfReader::sdfError(const char *fmt, ...)
SdfReader::sdfError(int id,
const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
report_->vfileError(filename_, line_, fmt, args);
report_->vfileError(id, filename_, line_, fmt, args);
va_end(args);
}
@ -1062,7 +1063,7 @@ SdfReader::findInstance(const char *name)
stringPrint(inst_name, "%s%c%s", path_, divider_, name);
Instance *inst = network_->findInstance(inst_name.c_str());
if (inst == nullptr)
sdfError("instance %s not found.\n", inst_name.c_str());
sdfError(195, "instance %s not found.", inst_name.c_str());
return inst;
}
@ -1103,7 +1104,7 @@ void sdfFlushBuffer();
int
SdfParse_error(const char *msg)
{
sta::sdf_reader->sdfError("%s.\n", msg);
sta::sdf_reader->sdfError(196, "%s.\n", msg);
sdfFlushBuffer();
return 0;
}

View File

@ -430,7 +430,7 @@ CheckTiming::errorMsgSubst(const char *msg,
s++;
}
else
internalError("unknown print flag");
criticalError(245, "unknown print flag");
}
else
error_msg += ch;

View File

@ -353,7 +353,7 @@ Corner::findParasiticAnalysisPt(const MinMax *min_max) const
else if (ap_count == 2)
return parasitic_analysis_pts_[min_max->index()];
else {
internalError("unknown parasitic analysis point count");
criticalError(246, "unknown parasitic analysis point count");
return nullptr;
}
}
@ -399,7 +399,7 @@ Corner::findDcalcAnalysisPt(const MinMax *min_max) const
else if (ap_count == 2)
return dcalc_analysis_pts_[min_max->index()];
else {
internalError("unknown analysis point count");
criticalError(247, "unknown analysis point count");
return nullptr;
}
}

View File

@ -70,7 +70,7 @@ CheckCrpr::clkPathPrev(Vertex *vertex,
if (prevs)
return PathVertex(prevs[arrival_index], this);
else {
internalError("missing prev paths");
criticalError(248, "missing prev paths");
return PathVertex();
}
}

View File

@ -244,7 +244,7 @@ GatedClk::gatedClkActiveTrans(LogicValue active_value,
leading_rf = RiseFall::fall();
break;
default:
internalError("illegal gated clock active value");
criticalError(249, "illegal gated clock active value");
leading_rf = RiseFall::rise();
break;
}

View File

@ -286,7 +286,7 @@ Genclks::checkMaster(Clock *gclk)
{
ensureMaster(gclk);
if (gclk->masterClk() == nullptr)
report_->warn("no master clock found for generated clock %s.\n",
report_->warn(10, "no master clock found for generated clock %s.",
gclk->name());
}
@ -328,7 +328,7 @@ Genclks::ensureMaster(Clock *gclk)
iter.enqueueAdjacentVertices(vertex);
}
if (master_clk_count > 1)
report_->error("generated clock %s is in the fanout of multiple clocks.\n",
report_->error(11, "generated clock %s is in the fanout of multiple clocks.",
gclk->name());
}
else {
@ -379,7 +379,8 @@ Genclks::ensureMaster(Clock *gclk)
}
}
if (master_clk_count > 1)
report_->error("generated clock %s pin %s is in the fanout of multiple clocks.\n",
report_->error(12,
"generated clock %s pin %s is in the fanout of multiple clocks.",
gclk->name(),
network_->pathName(src_pin));
}
@ -986,7 +987,7 @@ Genclks::recordSrcPaths(Clock *gclk)
// Don't warn if the master clock is ideal.
&& gclk->masterClk()
&& gclk->masterClk()->isPropagated())
report_->warn("generated clock %s source pin %s missing paths from master clock %s.\n",
report_->warn(13, "generated clock %s source pin %s missing paths from master clock %s.",
gclk->name(),
network_->pathName(gclk_pin),
gclk->masterClk()->name());

View File

@ -571,7 +571,7 @@ PathEnum::makeDivertedPath(Path *path,
is_latch_data = true;
}
if (!found_div)
internalError("diversion path not found");
criticalError(250, "diversion path not found");
}
void

View File

@ -120,18 +120,18 @@ PathEnumed::setArrival(Arrival arrival,
}
const Required &
PathEnumed::required(const StaState *) const
PathEnumed::required(const StaState *sta) const
{
// Required times are never needed for enumerated paths.
internalError("enumerated path required time\n");
sta->report()->critical(251, "enumerated path required time\n");
}
void
PathEnumed::setRequired(const Required &,
const StaState *)
const StaState *sta)
{
// Required times are never needed for enumerated paths.
internalError("enumerated path required time\n");
sta->report()->critical(252, "enumerated path required time\n");
}
Path *

View File

@ -399,7 +399,7 @@ PathGroups::pathGroup(const PathEnd *path_end) const
else if (path_end->isUnconstrained())
return unconstrained_[mm_index];
else {
internalError("unknown path end type");
report_->critical(253, "unknown path end type");
return nullptr;
}
}

View File

@ -141,7 +141,7 @@ PathVertexRep::arrival(const StaState *sta) const
bool arrival_exists;
tag_group->arrivalIndex(tag, arrival_index, arrival_exists);
if (!arrival_exists)
internalError("tag group missing tag");
sta->report()->critical(254, "tag group missing tag");
Arrival *arrivals = graph->arrivals(vertex);
return arrivals[arrival_index];
}

View File

@ -287,7 +287,7 @@ ReportPath::reportPathEndHeader()
report_->print(header);
break;
default:
internalError("unsupported path type");
report_->critical(255, "unsupported path type");
break;
}
}
@ -308,7 +308,7 @@ ReportPath::reportPathEndFooter()
report_->print("\n");
break;
default:
internalError("unsupported path type");
report_->critical(256, "unsupported path type");
break;
}
}
@ -351,7 +351,7 @@ ReportPath::reportPathEnd(PathEnd *end,
report_->print(result);
break;
default:
internalError("unsupported path type");
report_->critical(257, "unsupported path type");
break;
}
}
@ -2351,7 +2351,7 @@ ReportPath::reportGenClkSrcPath1(Clock *clk,
Arrival pll_delay = search_->genclks()->pllDelay(clk, clk_rf, pll_ap);
size_t path_length = src_expanded.size();
if (path_length < 2)
internalError("generated clock pll source path too short.\n");
report_->critical(258, "generated clock pll source path too short.\n");
PathRef *path0 = src_expanded.path(path_length - 2);
Arrival time0 = path0->arrival(this) + gclk_time;
PathRef *path1 = src_expanded.path(path_length - 1);
@ -2529,7 +2529,7 @@ ReportPath::reportPath(const Path *path,
case ReportPathFormat::summary:
case ReportPathFormat::slack_only:
default:
internalError("unsupported path type");
report_->critical(259, "unsupported path type");
break;
}
}

View File

@ -2656,7 +2656,7 @@ Search::findTagGroup(TagGroupBldr *tag_bldr)
tag_group_set_->reserve(new_capacity);
}
if (tag_group_next_ > tag_group_index_max)
internalError("max tag group index exceeded");
report_->critical(260, "max tag group index exceeded");
}
}
return tag_group;
@ -2882,7 +2882,7 @@ Search::findTag(const RiseFall *rf,
tag_set_->reserve(new_capacity);
}
if (tag_next_ > tag_index_max)
internalError("max tag index exceeded");
report_->critical(261, "max tag index exceeded");
}
}
if (own_states)
@ -3567,7 +3567,7 @@ Search::matchesFilter(Path *path,
// -to
return matchesFilterTo(path, to_clk_edge);
else
internalError("unexpected filter path");
report_->critical(262, "unexpected filter path");
}
// Similar to Constraints::exceptionMatchesTo.
@ -3733,7 +3733,7 @@ Search::tnsIncr(Vertex *vertex,
vertex->name(sdc_network_));
tns_[path_ap_index] += slack;
if (tns_slacks_[path_ap_index].hasKey(vertex))
internalError("tns incr existing vertex");
report_->critical(263, "tns incr existing vertex");
tns_slacks_[path_ap_index][vertex] = slack;
}
}

View File

@ -860,7 +860,7 @@ Sim::setPinValue(const Pin *pin,
if (exists
&& value != constraint_value) {
if (value != LogicValue::unknown)
report_->warn("propagated logic value %c differs from constraint value of %c on pin %s.\n",
report_->warn(15, "propagated logic value %c differs from constraint value of %c on pin %s.",
logicValueString(value),
logicValueString(constraint_value),
sdc_network_->pathName(pin));

View File

@ -2004,10 +2004,10 @@ Sta::checkExceptionFromPins(ExceptionFrom *from,
const Pin *pin = pin_iter.next();
if (exceptionFromInvalid(pin)) {
if (line)
report_->fileWarn(file, line, "'%s' is not a valid startpoint.\n",
report_->fileWarn(160, file, line, "'%s' is not a valid startpoint.",
cmd_network_->pathName(pin));
else
report_->warn("'%s' is not a valid startoint.\n",
report_->warn(16, "'%s' is not a valid startoint.",
cmd_network_->pathName(pin));
}
}
@ -2079,10 +2079,10 @@ Sta::checkExceptionToPins(ExceptionTo *to,
const Pin *pin = pin_iter.next();
if (sdc_->exceptionToInvalid(pin)) {
if (line)
report_->fileWarn(file, line, "'%s' is not a valid endpoint.\n",
report_->fileWarn(161, file, line, "'%s' is not a valid endpoint.",
cmd_network_->pathName(pin));
else
report_->warn("'%s' is not a valid endpoint.\n",
report_->warn(17, "'%s' is not a valid endpoint.",
cmd_network_->pathName(pin));
}
}
@ -3874,7 +3874,7 @@ Sta::replaceEquivCellBefore(Instance *inst,
if (to_set)
edge->setTimingArcSet(to_set);
else
internalError("corresponding timing arc set not found in equiv cells");
report_->critical(264, "corresponding timing arc set not found in equiv cells");
}
}
}

View File

@ -327,7 +327,7 @@ TagGroupBldr::copyArrivals(TagGroup *tag_group,
bool exists2;
tag_group->arrivalIndex(tag1, arrival_index2, exists2);
if (!exists2)
internalError("tag group missing tag");
sta_->report()->critical(265, "tag group missing tag");
arrivals[arrival_index2] = arrivals_[arrival_index1];
if (prev_paths) {
PathVertexRep *prev_path = &prev_paths_[arrival_index1];

View File

@ -29,7 +29,7 @@ VertexPinCollector::VertexPinCollector(PinSet *pins) :
VertexVisitor *
VertexPinCollector::copy()
{
internalError("VertexPinCollector::copy not supported.");
criticalError(266, "VertexPinCollector::copy not supported.");
return nullptr;
}

View File

@ -422,14 +422,14 @@ WritePathSpice::pgPortVoltage(LibertyPgPort *pg_port)
else if (stringEqual(voltage_name, gnd_name_))
voltage = gnd_voltage_;
else
report_->error("pg_pin %s/%s voltage %s not found,\n",
report_->error(24, "pg_pin %s/%s voltage %s not found,",
pg_port->cell()->name(),
pg_port->name(),
voltage_name);
}
}
else
report_->error("Liberty pg_port %s/%s missing voltage_name attribute,\n",
report_->error(25, "Liberty pg_port %s/%s missing voltage_name attribute,",
pg_port->cell()->name(),
pg_port->name());
return voltage;
@ -959,7 +959,7 @@ WritePathSpice::writeVoltageSource(LibertyCell *cell,
if (pg_port)
voltage = pgPortVoltage(pg_port);
else
report_->error("%s pg_port %s not found,\n",
report_->error(26, "%s pg_port %s not found,",
cell->name(),
pg_port_name);
@ -1013,7 +1013,7 @@ WritePathSpice::regPortValues(Stage stage,
dcalc_ap_index = drvr_path->dcalcAnalysisPt(this)->index();
}
else
report_->error("no register/latch found for path from %s to %s,\n",
report_->error(27, "no register/latch found for path from %s to %s,",
stageGateInputPort(stage)->name(),
stageDrvrPort(stage)->name());
}
@ -1380,7 +1380,7 @@ WritePathSpice::writeSubckts()
lib_subckts_stream.close();
if (!path_cell_names.empty()) {
report_->error("The following subkcts are missing from %s\n",
report_->error(28, "The following subkcts are missing from %s",
lib_subckt_filename_);
for (const char *cell_name : path_cell_names)
report_->printError(" %s\n", cell_name);
@ -1438,7 +1438,7 @@ WritePathSpice::recordSpicePortNames(const char *cell_name,
&& pg_port == nullptr
&& !stringEqual(port_name, power_name_)
&& !stringEqual(port_name, gnd_name_))
report_->error("subckt %s port %s has no corresponding liberty port, pg_port and is not power or ground.\n",
report_->error(29, "subckt %s port %s has no corresponding liberty port, pg_port and is not power or ground.",
cell_name, port_name);
spice_port_names->push_back(port_name);
}
@ -1623,7 +1623,7 @@ streamPrint(ofstream &stream,
va_start(args, fmt);
char *result;
if (vasprintf(&result, fmt, args) == -1)
internalError("out of memory");
criticalError(267, "out of memory");
stream << result;
free(result);
va_end(args);

View File

@ -2230,7 +2230,7 @@ set_cmd_namespace_cmd(const char *namespc)
else if (stringEq(namespc, "sta"))
Sta::sta()->setCmdNamespace(CmdNamespace::sta);
else
internalError("unknown namespace");
criticalError(269, "unknown namespace");
}
bool
@ -2748,7 +2748,7 @@ set_analysis_type_cmd(const char *analysis_type)
else if (stringEq(analysis_type, "on_chip_variation"))
type = AnalysisType::ocv;
else {
internalError("unknown analysis type");
criticalError(270, "unknown analysis type");
type = AnalysisType::single;
}
Sta::sta()->setAnalysisType(type);
@ -2885,7 +2885,7 @@ set_wire_load_mode_cmd(const char *mode_name)
{
WireloadMode mode = stringWireloadMode(mode_name);
if (mode == WireloadMode::unknown)
internalError("unknown wire load mode");
criticalError(271, "unknown wire load mode");
else
Sta::sta()->setWireloadMode(mode);
}
@ -4101,7 +4101,7 @@ set_crpr_mode(const char *mode)
else if (stringEq(mode, "same_transition"))
Sta::sta()->setCrprMode(CrprMode::same_transition);
else
internalError("unknown common clk pessimism mode.");
criticalError(272, "unknown common clk pessimism mode.");
}
bool
@ -4115,7 +4115,7 @@ set_pocv_enabled(bool enabled)
{
#if !SSTA
if (enabled)
Sta::sta()->report()->error("POCV support requires compilation with SSTA=1.\n");
Sta::sta()->report()->error(204, "POCV support requires compilation with SSTA=1.");
#endif
return Sta::sta()->setPocvEnabled(enabled);
}
@ -5013,7 +5013,7 @@ set_clock_sense_cmd(PinSet *pins,
else if (stop_propagation)
sense = ClockSense::stop;
else
internalError("unknown clock sense");
criticalError(273, "unknown clock sense");
Sta::sta()->setClockSense(pins, clks, sense);
}

View File

@ -36,21 +36,6 @@ ExceptionLine::ExceptionLine(const char *filename,
{
}
InternalError::InternalError(const char *filename,
int line,
const char *msg) :
ExceptionLine(filename, line),
msg_(msg)
{
}
const char *
InternalError::what() const noexcept
{
return stringPrintTmp("Internal error in %s:%d %s.",
filename_, line_, msg_);
}
FileNotReadable::FileNotReadable(const char *filename) :
filename_(filename)
{

View File

@ -24,6 +24,8 @@ namespace sta {
using std::min;
Report *Report::default_ = nullptr;
Report::Report() :
log_stream_(nullptr),
redirect_stream_(nullptr),
@ -32,6 +34,7 @@ Report::Report() :
buffer_(new char[buffer_size_]),
buffer_length_(0)
{
default_ = this;
}
Report::~Report()
@ -145,45 +148,13 @@ Report::printDebug(const char *fmt, ...)
}
void
Report::vprintDebug(const char *fmt, va_list args)
Report::vprintDebug(const char *fmt,
va_list args)
{
vprint(fmt, args);
}
void
Report::error(const char *fmt, ...)
{
printError("Error: ");
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
va_end(args);
}
void
Report::verror(const char *fmt, va_list args)
{
printError("Error: ");
vprintError(fmt, args);
}
void
Report::fileError(const char *filename, int line, const char *fmt, ...)
{
printError("Error: %s, line %d ", filename, line);
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
va_end(args);
}
void
Report::vfileError(const char *filename, int line, const char *fmt,
va_list args)
{
printError("Error: %s, line %d ", filename, line);
vprintError(fmt, args);
}
////////////////////////////////////////////////////////////////
void
Report::printWarn(const char *fmt, ...)
@ -195,46 +166,127 @@ Report::printWarn(const char *fmt, ...)
}
void
Report::vprintWarn(const char *fmt, va_list args)
Report::vprintWarn(const char *fmt,
va_list args)
{
vprintError(fmt, args);
}
void
Report::warn(const char *fmt, ...)
Report::warn(int /* id */,
const char *fmt,
...)
{
printWarn("Warning: ");
va_list args;
va_start(args, fmt);
vprintWarn(fmt, args);
printWarn("\n");
va_end(args);
}
void
Report::vwarn(const char *fmt, va_list args)
{
printWarn("Warning: ");
vprintWarn(fmt, args);
}
void
Report::fileWarn(const char *filename, int line, const char *fmt, ...)
Report::fileWarn(int /* id */,
const char *filename,
int line,
const char *fmt,
...)
{
printWarn("Warning: %s, line %d ", filename, line);
va_list args;
va_start(args, fmt);
vprintWarn(fmt, args);
printWarn("\n");
va_end(args);
}
void
Report::vfileWarn(const char *filename, int line, const char *fmt,
Report::vfileWarn(int /* id */,
const char *filename,
int line,
const char *fmt,
va_list args)
{
printWarn("Warning: %s, line %d ", filename, line);
vprintWarn(fmt, args);
printWarn("\n");
}
////////////////////////////////////////////////////////////////
void
Report::error(int /* id */,
const char *fmt, ...)
{
printError("Error: ");
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
printWarn("\n");
va_end(args);
}
void
Report::fileError(int /* id */,
const char *filename,
int line,
const char *fmt,
...)
{
printError("Error: %s, line %d ", filename, line);
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
printWarn("\n");
va_end(args);
}
void
Report::vfileError(int /* id */,
const char *filename,
int line,
const char *fmt,
va_list args)
{
printError("Error: %s, line %d ", filename, line);
vprintError(fmt, args);
printWarn("\n");
}
////////////////////////////////////////////////////////////////
void
Report::critical(int /* id */,
const char *fmt,
...)
{
printError("Critical: ");
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
printWarn("\n");
va_end(args);
exit(1);
}
void
Report::fileCritical(int /* id */,
const char *filename,
int line,
const char *fmt,
...)
{
printError("Critical: %s, line %d ", filename, line);
va_list args;
va_start(args, fmt);
vprintError(fmt, args);
printWarn("\n");
va_end(args);
exit(1);
}
////////////////////////////////////////////////////////////////
void
Report::logBegin(const char *filename)
{

View File

@ -74,7 +74,8 @@ deleteVerilogReader()
class VerilogError
{
public:
VerilogError(const char *filename,
VerilogError(int id,
const char *filename,
int line,
const char *msg,
bool warn);
@ -85,6 +86,7 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(VerilogError);
int id_;
const char *filename_;
int line_;
const char *msg_;
@ -93,10 +95,12 @@ private:
friend class VerilogErrorCmp;
};
VerilogError::VerilogError(const char *filename,
VerilogError::VerilogError(int id,
const char *filename,
int line,
const char *msg,
bool warn) :
id_(id),
filename_(filename),
line_(line),
msg_(msg),
@ -114,9 +118,9 @@ void
VerilogError::report(Report *report)
{
if (warn_)
report->fileWarn(filename_, line_, "%s", msg_);
report->fileWarn(id_, filename_, line_, "%s", msg_);
else
report->fileError(filename_, line_, "%s", msg_);
report->fileError(id_, filename_, line_, "%s", msg_);
}
class VerilogErrorCmp
@ -320,8 +324,8 @@ VerilogReader::makeCellPorts(Cell *cell,
}
}
else
warn(module->filename(), module->line(),
"module %s repeated port name %s.\n",
warn(165, module->filename(), module->line(),
"module %s repeated port name %s.",
module->name(),
port_name);
}
@ -346,8 +350,8 @@ VerilogReader::makeCellPort(Cell *cell,
return port;
}
else {
warn(module->filename(), module->line(),
"module %s missing declaration for port %s.\n",
warn(166, module->filename(), module->line(),
"module %s missing declaration for port %s.",
module->name(),
port_name);
return network_->makePort(cell, port_name);
@ -388,8 +392,8 @@ VerilogReader::checkModuleDcls(VerilogModule *module,
|| dir->isOutput()
|| dir->isBidirect()) {
if (port_names.findKey(port_name) == nullptr)
linkWarn(module->filename(), module->line(),
"module %s declared signal %s is not in the port list.\n",
linkWarn(197, module->filename(), module->line(),
"module %s declared signal %s is not in the port list.",
module->name(),
port_name);
}
@ -723,24 +727,26 @@ VerilogReader::reportStmtCounts()
}
void
VerilogReader::error(const char *filename,
VerilogReader::error(int id,
const char *filename,
int line,
const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
report()->vfileError(filename, line, fmt, args);
report()->vfileError(id, filename, line, fmt, args);
va_end(args);
}
void
VerilogReader::warn(const char *filename,
VerilogReader::warn(int id,
const char *filename,
int line,
const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
report()->vfileWarn(filename, line, fmt, args);
report()->vfileWarn(id, filename, line, fmt, args);
va_end(args);
}
@ -830,8 +836,8 @@ VerilogModule::parseDcl(VerilogDcl *dcl,
// input/output/inout dcls.
dcl_map_[net_name] = dcl;
else if (!dcl->direction()->isInternal())
reader->warn(filename_, dcl->line(),
"signal %s previously declared on line %d.\n",
reader->warn(18, filename_, dcl->line(),
"signal %s previously declared on line %d.",
reader->netVerilogName(net_name),
existing_dcl->line());
}
@ -856,8 +862,8 @@ VerilogModule::checkInstanceName(VerilogInst *inst,
stringDelete(replacement_name);
replacement_name = stringPrint("%s_%d", inst_name, i);
} while (inst_names.findKey(replacement_name));
reader->warn(filename_, inst->line(),
"instance name %s duplicated - renamed to %s.\n",
reader->warn(19, filename_, inst->line(),
"instance name %s duplicated - renamed to %s.",
reader->instanceVerilogName(inst_name),
replacement_name);
inst_name = replacement_name;
@ -1497,8 +1503,8 @@ VerilogNetConstant::parseConstant10(const char *constant_str,
if (length > max_length
|| (length == max_length
&& strcmp(tmp, reader->constant10Max()) > 0))
reader->warn(reader->filename(), reader->line(),
"base 10 constant greater than %s not supported.\n",
reader->warn(20, reader->filename(), reader->line(),
"base 10 constant greater than %s not supported.",
reader->constant10Max());
else {
char *end;
@ -1741,12 +1747,12 @@ VerilogReader::linkNetwork(const char *top_cell_name,
return top_instance;
}
else {
report->error("%s is not a verilog module.\n", top_cell_name);
report->error(162, "%s is not a verilog module.", top_cell_name);
return nullptr;
}
}
else {
report->error("%s is not a verilog module.\n", top_cell_name);
report->error(163, "%s is not a verilog module.", top_cell_name);
return nullptr;
}
}
@ -1803,14 +1809,14 @@ VerilogReader::makeModuleInstNetwork(VerilogModuleInst *mod_inst,
if (cell == nullptr) {
if (make_black_boxes) {
cell = makeBlackBox(mod_inst, parent_module);
linkWarn(filename_, mod_inst->line(),
"module %s not found. Creating black box for %s.\n",
linkWarn(198, filename_, mod_inst->line(),
"module %s not found. Creating black box for %s.",
mod_inst->moduleName(),
verilogName(mod_inst));
}
else
linkError(filename_, mod_inst->line(),
"module %s not found for instance %s.\n",
linkError(199, filename_, mod_inst->line(),
"module %s not found for instance %s.",
mod_inst->moduleName(),
verilogName(mod_inst));
}
@ -1863,8 +1869,8 @@ VerilogReader::makeNamedInstPins(Cell *cell,
if (port) {
if (vpin->hasNet()
&& network_->size(port) != vpin->size(parent_module))
linkWarn(parent_module->filename(), mod_inst->line(),
"instance %s port %s size %d does not match net size %d.\n",
linkWarn(200, parent_module->filename(), mod_inst->line(),
"instance %s port %s size %d does not match net size %d.",
verilogName(mod_inst),
network_->name(port),
network_->size(port),
@ -1889,8 +1895,8 @@ VerilogReader::makeNamedInstPins(Cell *cell,
}
}
else {
linkWarn(parent_module->filename(), mod_inst->line(),
"instance %s port %s not found.\n",
linkWarn(201, parent_module->filename(), mod_inst->line(),
"instance %s port %s not found.",
verilogName(mod_inst),
port_name);
}
@ -1913,8 +1919,8 @@ VerilogReader::makeOrderedInstPins(Cell *cell,
VerilogNet *net = pin_iter.next();
Port *port = port_iter->next();
if (network_->size(port) != net->size(parent_module))
linkWarn(parent_module->filename(), mod_inst->line(),
"instance %s port %s size %d does not match net size %d.\n",
linkWarn(202, parent_module->filename(), mod_inst->line(),
"instance %s port %s size %d does not match net size %d.",
verilogName(mod_inst),
network_->name(port),
network_->size(port),
@ -2114,8 +2120,8 @@ VerilogReader::mergeAssignNet(VerilogAssign *assign,
delete rhs_iter;
}
else
linkWarn(module->filename(), assign->line(),
"assign left hand side size %d not equal right hand size %d.\n",
linkWarn(203, module->filename(), assign->line(),
"assign left hand side size %d not equal right hand size %d.",
lhs->size(module),
rhs->size(module));
}
@ -2181,27 +2187,29 @@ VerilogBindingTbl::ensureNetBinding(const char *net_name,
////////////////////////////////////////////////////////////////
void
VerilogReader::linkWarn(const char *filename,
VerilogReader::linkWarn(int id,
const char *filename,
int line,
const char *msg, ...)
{
va_list args;
va_start(args, msg);
char *msg_str = stringPrintArgs(msg, args);
VerilogError *error = new VerilogError(filename, line, msg_str, true);
VerilogError *error = new VerilogError(id, filename, line, msg_str, true);
link_errors_.push_back(error);
va_end(args);
}
void
VerilogReader::linkError(const char *filename,
VerilogReader::linkError(int id,
const char *filename,
int line,
const char *msg, ...)
{
va_list args;
va_start(args, msg);
char *msg_str = stringPrintArgs(msg, args);
VerilogError *error = new VerilogError(filename, line, msg_str, false);
VerilogError *error = new VerilogError(id, filename, line, msg_str, false);
link_errors_.push_back(error);
va_end(args);
}
@ -2234,7 +2242,8 @@ void verilogFlushBuffer();
int
VerilogParse_error(const char *msg)
{
sta::verilog_reader->report()->fileError(sta::verilog_reader->filename(),
sta::verilog_reader->report()->fileError(164,
sta::verilog_reader->filename(),
sta::verilog_reader->line(),
"%s.\n", msg);
verilogFlushBuffer();

View File

@ -147,10 +147,12 @@ public:
const char *filename() const { return filename_; }
void incrLine();
Report *report() const { return report_; }
void error(const char *filename,
void error(int id,
const char *filename,
int line,
const char *fmt, ...);
void warn(const char *filename,
void warn(int id,
const char *filename,
int line,
const char *fmt, ...);
const char *zeroNetName() const { return zero_net_name_; }
@ -236,12 +238,16 @@ protected:
Instance *parent,
VerilogBindingTbl *parent_bindings,
bool is_leaf);
void linkWarn(const char *filename,
void linkWarn(int id,
const char *filename,
int line,
const char *msg, ...);
void linkError(const char *filename,
const char *msg, ...)
__attribute__((format (printf, 5, 6)));
void linkError(int id,
const char *filename,
int line,
const char *msg, ...);
const char *msg, ...)
__attribute__((format (printf, 5, 6)));
bool reportLinkErrors(Report *report);
bool haveLinkErrors();
Cell *makeBlackBox(VerilogModuleInst *mod_inst,

View File

@ -190,7 +190,7 @@ VerilogWriter::verilogPortDir(PortDirection *dir)
else if (dir == PortDirection::internal())
return nullptr;
else {
internalError("unknown port direction");
criticalError(268, "unknown port direction");
return nullptr;
}
}