From 0c86a218fd245bab6833ed269d0d90126ad5d2d8 Mon Sep 17 00:00:00 2001 From: Frans Skarman Date: Wed, 25 Jun 2025 11:39:25 +0200 Subject: [PATCH] Add sources to detailed timing report (#1502) --- common/kernel/report.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/common/kernel/report.cc b/common/kernel/report.cc index d8c78881..08d48e82 100644 --- a/common/kernel/report.cc +++ b/common/kernel/report.cc @@ -51,6 +51,24 @@ static std::string clock_event_name(const Context *ctx, const ClockEvent &e) return value; }; +static std::vector net_sources(const NetInfo *net, const Context *ctx) { + auto sources = net->attrs.find(ctx->id("src")); + std::vector source_entries; + if (sources != net->attrs.end()) { + // Sources are separated by pipe characters. + // There is no guaranteed ordering on sources, so we just print all + auto sourcelist = sources->second.as_string(); + size_t current = 0, prev = 0; + while ((current = sourcelist.find("|", prev)) != std::string::npos) { + source_entries.emplace_back(sourcelist.substr(prev, current - prev)); + prev = current + 1; + } + // Ensure we emplace the final entry + source_entries.emplace_back(sourcelist.substr(prev, current - prev)); + } + return source_entries; +} + static Json::array json_report_critical_paths(const Context *ctx) { @@ -82,6 +100,8 @@ static Json::array json_report_critical_paths(const Context *ctx) segmentJson["type"] = CriticalPath::Segment::type_to_str(segment.type); if (segment.type == CriticalPath::Segment::Type::ROUTING) { segmentJson["net"] = segment.net.c_str(ctx); + const NetInfo *net = ctx->nets.at(segment.net).get(); + segmentJson["sources"] = net_sources(net, ctx); } pathJson.push_back(segmentJson); @@ -133,6 +153,7 @@ static Json::array json_report_detailed_net_timings(const Context *ctx) } auto netTimingJson = Json::object({{"net", net->name.c_str(ctx)}, + {"sources", net_sources(net, ctx)}, {"driver", net->driver.cell->name.c_str(ctx)}, {"port", net->driver.port.c_str(ctx)}, {"event", clock_event_name(ctx, start)}, @@ -186,6 +207,7 @@ Report JSON structure: }, "type": , "net": , + "sources": "delay": , } ... @@ -199,6 +221,7 @@ Report JSON structure: "port": , "event": , "net": , + "sources": [] "endpoints": [ { "cell": ,