File tree Expand file tree Collapse file tree 2 files changed +9
-24
lines changed Expand file tree Collapse file tree 2 files changed +9
-24
lines changed Original file line number Diff line number Diff line change 12
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
-
16
15
import json
17
16
18
17
from klayout .rdb import ReportDatabase
@@ -26,17 +25,18 @@ def cli(xml_file, json_file):
26
25
database = ReportDatabase ("Database" )
27
26
json_database = {}
28
27
database .load (xml_file )
28
+ total = 0
29
29
for category in database .each_category ():
30
30
num_items = category .num_items ()
31
31
category_name = category .name ()
32
32
json_database [category_name ] = num_items
33
+ total += num_items
34
+
35
+ json_database = dict (sorted (json_database .items (), key = lambda item : item [1 ]))
36
+ json_database ["total" ] = total
33
37
34
- with open (json_file , "w" ) as f :
35
- f .write (
36
- json .dumps (
37
- dict (sorted (json_database .items (), key = lambda item : item [1 ])), indent = 4
38
- )
39
- )
38
+ with open (json_file , "w" , encoding = "utf8" ) as f :
39
+ json .dump (json_database , f )
40
40
41
41
42
42
if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -387,24 +387,9 @@ proc quit_on_unconnected_pdn_nodes {args} {
387
387
}
388
388
}
389
389
390
- proc get_violations_count {report_file} {
391
- package require json
392
-
393
- set total_violations_count 0
394
-
395
- set fp [open $report_file r]
396
- set violations_json [read $fp ]
397
- close $fp
398
-
399
- set violations_dict [json::json2dict $violations_json ]
400
- foreach count [dict values $violations_dict ] {
401
- set total_violations_count [expr $total_violations_count + $count ]
402
- }
403
- return $total_violations_count
404
- }
405
-
406
390
proc quit_on_klayout_drc {report_file} {
407
- set violations_count [get_violations_count $report_file ]
391
+ set violations_dict [json::json2dict [cat $report_file ]]
392
+ set violations_count [dict get $violations_dict " total" ]
408
393
if { $::env(QUIT_ON_KLAYOUT_DRC) && $violations_count != 0} {
409
394
puts_err " There are violations in the design after KLayout DRC."
410
395
puts_err " Total Number of violations is $violations_count "
You can’t perform that action at this time.
0 commit comments