Skip to content

Commit c6ba9ff

Browse files
tcal-xQuantamHD
authored andcommitted
Collect more metrics using synth.tcl: flops, ltp, runtime.
Signed-off-by: tcal-x <[email protected]>
1 parent 085ae76 commit c6ba9ff

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

synthesis/build_defs.bzl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def _synthesize_design_impl(ctx):
9191
args.add("-q") # quiet mode only errors printed to stderr
9292
args.add("-q") # second q don't print warnings
9393
args.add("-Q") # Don't print header
94-
args.add("-T") # Don't print footer
9594
args.add_all("-l", [log_file]) # put output in log file
9695
args.add_all("-c", [synth_tcl]) # run synthesis tcl script
9796

@@ -170,9 +169,11 @@ def _benchmark_synth_impl(ctx):
170169

171170
synth_log = synth_info.log_file.short_path
172171
grep = "zgrep" if ("log.gz" in synth_log) else "grep"
173-
cmd = "{grep} Chip.area {log}".format(grep = grep, log = synth_log)
174-
175-
info = "echo 'Using {info}'".format(info = synth_info.standard_cell_info.default_corner.liberty.short_path)
172+
cmd1 = "{grep} Chip.area {log}".format(grep = grep, log = synth_log)
173+
cmd2 = "{grep} Longest.topological.path {log}".format(grep = grep, log = synth_log)
174+
cmd3 = "{grep} Flop.count {log}".format(grep = grep, log = synth_log)
175+
cmd4 = "{grep} ^Liberty: {log}".format(grep = grep, log = synth_log)
176+
cmd5 = "{grep} CPU:.user {log}".format(grep = grep, log = synth_log)
176177

177178
executable_file = ctx.actions.declare_file(ctx.label.name + ".sh")
178179

@@ -185,8 +186,11 @@ def _benchmark_synth_impl(ctx):
185186
content = "\n".join([
186187
"#!/bin/bash",
187188
"set -e",
188-
info,
189-
cmd,
189+
cmd1,
190+
cmd2,
191+
cmd3,
192+
cmd4,
193+
cmd5,
190194
"exit 0",
191195
]),
192196
is_executable = True,

synthesis/synth.tcl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,13 @@ if { [info exists ::env(CLOCK_PERIOD) ] } {
5555
set output $::env(OUTPUT)
5656
write_verilog $output
5757

58-
# print stats
58+
# ====== print stats / info ======
5959
stat -liberty $liberty
60+
read_liberty -lib -ignore_miss_func $liberty
61+
ltp -noff $top
62+
63+
yosys log -n Flop count:\
64+
yosys select -count t:*__df* t:DFF* t:*_DFF* t:*_SDFF* t:*_ADFF* t:*dff
65+
66+
set base_liberty [file tail $liberty]
67+
yosys log Liberty: $base_liberty

0 commit comments

Comments
 (0)