report_path -format json
This commit is contained in:
parent
17b48a681b
commit
27cc8f1614
|
|
@ -323,6 +323,13 @@ public:
|
|||
virtual VertexId vertexId(const Pin *pin) const = 0;
|
||||
virtual void setVertexId(Pin *pin,
|
||||
VertexId id) = 0;
|
||||
// Return the physical X/Y coordinates of the pin.
|
||||
virtual void location(const Pin *pin,
|
||||
// Return values.
|
||||
double x,
|
||||
double y,
|
||||
bool exists) const;
|
||||
|
||||
int pinCount();
|
||||
int pinCount(Instance *inst);
|
||||
int leafPinCount();
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ enum class ReportPathFormat { full,
|
|||
shorter,
|
||||
endpoint,
|
||||
summary,
|
||||
slack_only
|
||||
slack_only,
|
||||
json
|
||||
};
|
||||
|
||||
static const int tag_index_bits = 24;
|
||||
|
|
|
|||
|
|
@ -935,6 +935,17 @@ Network::findInstPinsMatching(const Instance *instance,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Network::location(const Pin *pin,
|
||||
// Return values.
|
||||
double x,
|
||||
double y,
|
||||
bool exists) const
|
||||
{
|
||||
x = y = 0.0;
|
||||
exists = false;
|
||||
}
|
||||
|
||||
int
|
||||
Network::instanceCount(Instance *inst)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2503,6 +2503,27 @@ ReportPath::reportPath(const PathEnd *end,
|
|||
void
|
||||
ReportPath::reportPath(const Path *path,
|
||||
string &result)
|
||||
{
|
||||
switch (format_) {
|
||||
case ReportPathFormat::full:
|
||||
case ReportPathFormat::full_clock:
|
||||
case ReportPathFormat::full_clock_expanded:
|
||||
reportPathFull(path, result);
|
||||
break;
|
||||
case ReportPathFormat::json:
|
||||
reportPathJson(path, result);
|
||||
break;
|
||||
case ReportPathFormat::summary:
|
||||
case ReportPathFormat::slack_only:
|
||||
default:
|
||||
internalError("unsupported path type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ReportPath::reportPathFull(const Path *path,
|
||||
string &result)
|
||||
{
|
||||
reportPathHeader(result);
|
||||
PathExpanded expanded(path, this);
|
||||
|
|
@ -2510,6 +2531,47 @@ ReportPath::reportPath(const Path *path,
|
|||
false, result);
|
||||
}
|
||||
|
||||
void
|
||||
ReportPath::reportPathJson(const Path *path,
|
||||
string &result)
|
||||
{
|
||||
result += "{ \"path\": [\n";
|
||||
PathExpanded expanded(path, this);
|
||||
for (auto i = expanded.startIndex(); i < expanded.size(); i++) {
|
||||
PathRef *path = expanded.path(i);
|
||||
const Pin *pin = path->vertex(this)->pin();
|
||||
result += " {\n";
|
||||
result += " \"pin\": \"";
|
||||
result += network_->pathName(pin);
|
||||
result += "\",\n";
|
||||
|
||||
double x, y;
|
||||
bool exists;
|
||||
string tmp;
|
||||
network_->location(pin, x, y, exists);
|
||||
if (exists) {
|
||||
result += " \"x\": ";
|
||||
stringPrint(tmp, "%.3f", x);
|
||||
result += tmp + ",\n";
|
||||
result += " \"y\": ";
|
||||
stringPrint(tmp, "%.3f", y);
|
||||
result += tmp + "\n";
|
||||
}
|
||||
|
||||
result += " \"arrival\": ";
|
||||
stringPrint(tmp, "%.3e", path->arrival(this));
|
||||
result += tmp + ",\n";
|
||||
|
||||
result += " \"slew\": ";
|
||||
stringPrint(tmp, "%.3e", path->slew(this));
|
||||
result += tmp + ",\n";
|
||||
|
||||
result += " }\n";
|
||||
}
|
||||
result += " ]\n";
|
||||
result += "}\n";
|
||||
}
|
||||
|
||||
void
|
||||
ReportPath::reportPath1(const Path *path,
|
||||
PathExpanded &expanded,
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
void reportPathEnd(PathEnd *end,
|
||||
PathEnd *prev_end);
|
||||
void reportPathEnds(PathEndSeq *ends);
|
||||
// for debugging
|
||||
void reportPath(const Path *path);
|
||||
|
||||
void reportShort(const PathEndUnconstrained *end,
|
||||
|
|
@ -341,6 +342,10 @@ protected:
|
|||
string &result);
|
||||
void reportPath(const Path *path,
|
||||
string &result);
|
||||
void reportPathFull(const Path *path,
|
||||
string &result);
|
||||
void reportPathJson(const Path *path,
|
||||
string &result);
|
||||
void reportPathHeader(string &result);
|
||||
void reportPath1(const Path *path,
|
||||
PathExpanded &expanded,
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ proc parse_report_path_options { cmd args_var default_format
|
|||
if [info exists path_options(-format)] {
|
||||
set format $path_options(-format)
|
||||
set formats {full full_clock full_clock_expanded short \
|
||||
end slack_only summary}
|
||||
end slack_only summary json}
|
||||
if { [lsearch $formats $format] == -1 } {
|
||||
sta_error "-format $format not recognized."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1065,6 +1065,8 @@ using namespace sta;
|
|||
$1 = ReportPathFormat::summary;
|
||||
else if (stringEq(arg, "slack_only"))
|
||||
$1 = ReportPathFormat::slack_only;
|
||||
else if (stringEq(arg, "json"))
|
||||
$1 = ReportPathFormat::json;
|
||||
else {
|
||||
tclError(interp, "Error: unknown path type %s.", arg);
|
||||
return TCL_ERROR;
|
||||
|
|
|
|||
Loading…
Reference in New Issue