Skip to content

Commit 0a19e3a

Browse files
authored
Merge pull request #8179 from Pinata-Consulting/power-per-instance-reporting
Power per instance with .vcd test
2 parents 646a606 + e59d993 commit 0a19e3a

File tree

4 files changed

+58
-38
lines changed

4 files changed

+58
-38
lines changed

test/orfs/mock-array/BUILD

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,46 +367,52 @@ SPEFS_AND_NETLISTS = [
367367
]
368368
]
369369

370-
orfs_run(
371-
name = "MockArray_power",
370+
POWER_TESTS = [
371+
"power",
372+
"power_instances",
373+
]
374+
375+
[orfs_run(
376+
name = "MockArray_{name}".format(name = name),
372377
src = ":MockArray_{stage}".format(stage = POWER_STAGE_NAME),
373378
outs = [
374-
"power.txt",
379+
"{name}.txt".format(name = name),
375380
],
376381
arguments = {
377-
"OUTPUT": "$(location :power.txt)",
382+
"OUTPUT": "$(location :{name}.txt)".format(name = name),
378383
"VCD_STIMULI": "$(location :vcd)",
379384
"OPENROAD_EXE": "$(location //src/sta:opensta)",
380385
"POWER_STAGE_NAME": POWER_STAGE_NAME,
381386
"POWER_STAGE_STEM": POWER_STAGE_STEM,
387+
"LOAD_POWER_TCL": "$(location :load_power.tcl)",
382388
},
383389
data = [
384390
# FIXME this is a workaround to ensure that the OpenSTA runfiles are available
385391
":opensta_runfiles",
386392
":vcd",
393+
":load_power.tcl",
387394
] + ["{macro}_{stage}".format(
388395
macro = macro,
389396
stage = POWER_STAGE_NAME,
390397
) for macro in MACROS] +
391398
(["{macro}_parasitics".format(macro = macro) for macro in MACROS] if POWER_STAGE_NAME != "final" else []),
392-
script = ":power.tcl",
399+
script = ":{name}.tcl".format(name = name),
393400
tags = ["manual"],
394401
tools = ["//src/sta:opensta"],
395402
visibility = ["//visibility:public"],
396-
)
403+
) for name in POWER_TESTS]
397404

398-
# FIXME an orfs_run_test() rule would be nicer
399-
sh_test(
400-
name = "MockArray_power_test",
405+
[sh_test(
406+
name = "MockArray_{name}_test".format(name = name),
401407
srcs = ["ok.sh"],
402408
args = [
403-
"$(location :MockArray_power)",
409+
"$(location :MockArray_{name})".format(name = name),
404410
],
405411
data = [
406-
":MockArray_power",
412+
":MockArray_{name}".format(name = name),
407413
],
408-
tags = ["manual"],
409-
)
414+
tags = ["manual"] if name == "power_instances" else [],
415+
) for name in POWER_TESTS]
410416

411417
# FIXME why is this needed to ensure that cfg=exec of OpenSTA has runfiles?
412418
genrule(
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
source $::env(SCRIPTS_DIR)/util.tcl
2+
3+
foreach libFile $::env(LIB_FILES) {
4+
if { [lsearch -exact $::env(ADDITIONAL_LIBS) $libFile] == -1 } {
5+
read_liberty $libFile
6+
}
7+
}
8+
9+
log_cmd read_verilog $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).v
10+
log_cmd read_verilog $::env(RESULTS_DIR)/../../Element/base/$::env(POWER_STAGE_STEM).v
11+
log_cmd read_verilog $::env(PLATFORM_DIR)/verilog/stdcell/empty.v
12+
log_cmd link_design MockArray
13+
14+
log_cmd read_sdc $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).sdc
15+
log_cmd read_spef $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).spef
16+
puts "read_spef for ces_*_* macros"
17+
for { set x 0 } { $x < 8 } { incr x } {
18+
for { set y 0 } { $y < 8 } { incr y } {
19+
log_cmd read_spef -path ces_${x}_${y} \
20+
$::env(RESULTS_DIR)/../../Element/base/$::env(POWER_STAGE_STEM).spef
21+
}
22+
}
23+
24+
set vcd_file $::env(VCD_STIMULI)
25+
log_cmd read_vcd -scope TOP/MockArray $vcd_file

test/orfs/mock-array/power.tcl

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,4 @@
1-
source $::env(SCRIPTS_DIR)/util.tcl
2-
3-
foreach libFile $::env(LIB_FILES) {
4-
if { [lsearch -exact $::env(ADDITIONAL_LIBS) $libFile] == -1 } {
5-
read_liberty $libFile
6-
}
7-
}
8-
9-
log_cmd read_verilog $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).v
10-
log_cmd read_verilog $::env(RESULTS_DIR)/../../Element/base/$::env(POWER_STAGE_STEM).v
11-
log_cmd read_verilog $::env(PLATFORM_DIR)/verilog/stdcell/empty.v
12-
log_cmd link_design MockArray
13-
14-
log_cmd read_sdc $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).sdc
15-
log_cmd read_spef $::env(RESULTS_DIR)/$::env(POWER_STAGE_STEM).spef
16-
puts "read_spef for ces_*_* macros"
17-
for { set x 0 } { $x < 8 } { incr x } {
18-
for { set y 0 } { $y < 8 } { incr y } {
19-
log_cmd read_spef -path ces_${x}_${y} \
20-
$::env(RESULTS_DIR)/../../Element/base/$::env(POWER_STAGE_STEM).spef
21-
}
22-
}
1+
source $::env(LOAD_POWER_TCL)
232

243
# OpenSTA reports reg2reg paths inside macros,
254
# whereas these paths are hidden to OpenROAD that
@@ -28,9 +7,6 @@ log_cmd report_checks
287

298
log_cmd report_power
309

31-
set vcd_file $::env(VCD_STIMULI)
32-
log_cmd read_vcd -scope TOP/MockArray $vcd_file
33-
3410
set fp [open $::env(RESULTS_DIR)/activity.tcl w]
3511
set pins [get_pins -hierarchical *]
3612
set clock_period [expr [get_property [get_clocks] period] * 1e-12]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
source $::env(LOAD_POWER_TCL)
2+
3+
set instances [get_cells ces*/Multiplier*]
4+
if { [llength $instances] != 64 } {
5+
puts "Error: Expected to find 64 Multiplier instances, found [llength $instances]"
6+
exit 1
7+
}
8+
9+
report_power -instances $instances
10+
11+
set f [open $::env(OUTPUT) w]
12+
puts $f OK
13+
close $f

0 commit comments

Comments
 (0)