mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-06-28 17:23:59 -04:00
Add the capability to add functional coverage results into the dashboard (#2183)
This commit is contained in:
parent
d89c5b6ba6
commit
8e2393db99
3 changed files with 43 additions and 20 deletions
|
@ -13,20 +13,31 @@ import yaml
|
|||
import report_builder as rb
|
||||
from pprint import pprint
|
||||
|
||||
log_path = str(sys.argv[1])
|
||||
with open(log_path, 'r') as f:
|
||||
log = f.read()
|
||||
log_cc_path = str(sys.argv[1])
|
||||
with open(log_cc_path, 'r') as f:
|
||||
cc_log = f.read()
|
||||
|
||||
log_fc_path = str(sys.argv[2])
|
||||
with open(log_fc_path, 'r') as f:
|
||||
fc_log = f.read()
|
||||
|
||||
pattern = re.compile(r'\S{2,}')
|
||||
|
||||
def get_scores(component):
|
||||
for l in log.splitlines():
|
||||
def get_cc_scores(component):
|
||||
for l in cc_log.splitlines():
|
||||
if re.search(r'\b'+component+r'\b', l):
|
||||
line = l
|
||||
scores = pattern.findall(line)
|
||||
return [float(score) for score in scores[0:4]]
|
||||
|
||||
components = [
|
||||
def get_fc_scores(component):
|
||||
for l in fc_log.splitlines():
|
||||
if re.search(r'\b'+component+r'\b', l):
|
||||
line = l
|
||||
scores = pattern.findall(line)
|
||||
return [float(scores[0])]
|
||||
|
||||
cc_components = [
|
||||
"i_cva6",
|
||||
"commit_stage_i",
|
||||
"controller_i",
|
||||
|
@ -38,16 +49,33 @@ components = [
|
|||
"issue_stage_i",
|
||||
]
|
||||
|
||||
score_metric = rb.TableMetric('Coverage results')
|
||||
score_metric.add_value("COMPONENT", "SCORE", "LINE", "COND", "TOGGLE")
|
||||
for component in components:
|
||||
scores = get_scores(component)
|
||||
score_metric.add_value(component, *scores)
|
||||
fc_components = [
|
||||
"ISA",
|
||||
"CSR access",
|
||||
"TRAPs",
|
||||
]
|
||||
|
||||
coverage_score = int(get_scores("i_cva6")[0])
|
||||
cc_score_metric = rb.TableMetric('Coverage results')
|
||||
cc_score_metric.add_value("COMPONENT", "SCORE", "LINE", "COND", "TOGGLE")
|
||||
for component in cc_components:
|
||||
cc_scores = get_cc_scores(component)
|
||||
cc_score_metric.add_value(component, *cc_scores)
|
||||
|
||||
fc_score_metric = rb.TableMetric('Functional results')
|
||||
fc_score_metric.add_value("FEATURE", "SCORE")
|
||||
for component in fc_components:
|
||||
fc_scores = get_fc_scores(component)
|
||||
fc_score_metric.add_value(component, *fc_scores)
|
||||
|
||||
coverage_score = int(get_cc_scores("i_cva6")[0])
|
||||
report = rb.Report(f'{coverage_score}%')
|
||||
report.add_metric(score_metric)
|
||||
report.add_metric(cc_score_metric)
|
||||
report.add_metric(fc_score_metric)
|
||||
|
||||
report.dump()
|
||||
|
||||
pprint(score_metric.values)
|
||||
print("Code Coverage Results :\n")
|
||||
pprint(cc_score_metric.values)
|
||||
print("\nFunctional Coverage Results :\n")
|
||||
for i in range(0, 4):
|
||||
pprint(fc_score_metric.values[i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue