Skip to content

Commit

Permalink
Add a regex to find overall cell count from design stats.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588557432
  • Loading branch information
JoshVarga authored and copybara-github committed Dec 6, 2023
1 parent ad72689 commit 418c65d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xls/tools/gather_design_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def scrape_yosys(model: design_stats_pb2.DesignStats, f):
flop_regex = re.compile(r"Flop count p(\d+)mod: (\d+) objects.")
flop_total_regex = re.compile(r"Flop count: (\d+) objects.")
cell_count_regex = re.compile(r"Cell count in p(\d+)mod: (\d+)")
total_cell_count_regex = re.compile(r"Number of cells:\s+(\d+)")
longest_path_regex = re.compile(
r"Longest topological path in p(\d+)mod \(length=(\d+)\)"
)
Expand Down Expand Up @@ -100,6 +101,12 @@ def scrape_yosys(model: design_stats_pb2.DesignStats, f):
ensure_stage(model, stage)
model.per_stage[stage].cells = cells

# Number of cells: 189
if not model.overall.cells:
if m := re.search(total_cell_count_regex, line):
cells = int(m.group(1))
model.overall.cells = cells

# Longest topological path in p0mod (length=1):
if m := re.search(longest_path_regex, line):
stage = int(m.group(1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
overall {
area_um2: 740.7104
flops: 27
cells: 63
crit_path_delay_ps: 471.97
}
per_stage {
Expand Down

0 comments on commit 418c65d

Please sign in to comment.