@@ -25,9 +25,24 @@ log_cmd report_power
2525set vcd_file $::env(RESULTS_DIR) /MockArrayTestbench.vcd
2626log_cmd read_vcd -scope TOP/MockArray $vcd_file
2727
28- puts " Total number of pins to be annotated: [ llength [get_pins -hierarchical *] ]"
29- set no_vcd_activity {}
28+ set fp [open $::env(RESULTS_DIR) /activity.tcl w]
3029set pins [get_pins -hierarchical *]
30+ set clock_period [expr [get_property [get_clocks] period] * 1e-12]
31+ foreach pin $pins {
32+ set activity [get_property $pin activity]
33+ set activity_origin [lindex $activity 2]
34+ if {$activity_origin != " vcd" } {
35+ continue
36+ }
37+ puts $fp " set_power_activity \
38+ -pin \[ get_pins \{ [ get_property $pin full_name] \}\] \
39+ -activity [ expr [lindex $activity 0] * $clock_period ] \
40+ -duty [ lindex $activity 1] "
41+ }
42+ close $fp
43+
44+ puts " Total number of pins: [ llength [get_pins -hierarchical *] ]"
45+ set no_vcd_activity {}
3146foreach pin $pins {
3247 set activity [get_property $pin activity]
3348 set activity_origin [lindex $activity 2]
@@ -73,7 +88,30 @@ for {set x 0} {$x < 8} {incr x} {
7388
7489puts {report_power -instances [get_cells $ces ]}
7590report_power -instances [get_cells $ces ]
91+
92+ proc total_power {} {
93+ return [lindex [sta::design_power [sta::corners]] 3]
94+ }
95+
96+ set total_power_vcd [total_power]
97+ log_cmd report_power
98+
99+ source $::env(RESULTS_DIR) /activity.tcl
76100log_cmd report_power
101+ set total_power_user_activity [total_power]
102+
103+ puts " Total power from VCD: $total_power_vcd "
104+ puts " Total power from user activity: $total_power_user_activity "
105+
106+ if {$total_power_vcd == $total_power_user_activity } {
107+ puts " Error: settting user power activity had no effect, expected some loss in accuracy"
108+ exit 1
109+ }
110+
111+ if {abs($total_power_vcd - $total_power_user_activity ) > 1e-3} {
112+ puts " Error: Total power mismatch between VCD and user activity: $total_power_vcd vs $total_power_user_activity "
113+ exit 1
114+ }
77115
78116log_cmd report_parasitic_annotation
79117log_cmd report_activity_annotation -report_unannotated
0 commit comments