forked from hushenwei2000/rvv-atg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_all.py
40 lines (39 loc) · 1.51 KB
/
check_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Check all generated folders. Find out if test file FAIL and statistics of COVERAGE.
# Output will in 'check_all.out'
from datetime import date
import os
out = open('check_all.out', 'w+')
dirs = os.listdir('.')
for d in dirs:
if d.startswith(str(date.today())[5:]):
print("------------------", file=out)
instr = d.split('-')[2]
vlen = d.split('-')[3]
vsew = d.split('-')[4]
lmul = d.split('-')[5]
log = "%s/%s"%(d, 'spike_%s_final.log'%instr)
if os.system("grep FAIL %s"%(log)) == 0:
print("Generated file is WRONG! : %s"%d)
report = "%s/coverage_final.rpt"%d
try:
f = open(report, 'r')
lines = f.readlines()
# Collect instruction's coverages
flag = False
for line in lines:
if flag:
print(line, file=out)
if 'coverage' in line:
Flag = False
break
if 'mnemonics' in line:
flag = True
# Collect other coverage
for line in lines:
if ('rd:' in line) or ('rs1:' in line) or ('rs2:' in line) or ('val_comb:' in line) or ('coverage' in line):
print(line, file = out)
# Collect configuration information
print("{}, {}, {}".format(vlen, vsew, lmul), file = out)
f.close()
except FileNotFoundError:
print ("File is not found: %s."%report, file=out)