diff --git a/riscv-isac/riscv_isac/cgf_normalize.py b/riscv-isac/riscv_isac/cgf_normalize.py index 7202adb56..a1c71d968 100644 --- a/riscv-isac/riscv_isac/cgf_normalize.py +++ b/riscv-isac/riscv_isac/cgf_normalize.py @@ -580,10 +580,10 @@ def expand_cgf(cgf_files, xlen,flen, log_redundant=False): if len(cgf[labels]['mnemonics'].keys()) > 1: logger.error(f'Multiple instruction mnemonics found when base_op label defined in {labels} label.') - # Substitute instruction aliases with equivalent tuple of instructions + # Substitute instruction aliases with equivalent tuple of instructions if 'cross_comb' in cats: temp = cats['cross_comb'] - + for covp, covge in dict(temp).items(): data = covp.split('::') ops = data[0].replace(' ', '')[1:-1].split(':') @@ -592,14 +592,14 @@ def expand_cgf(cgf_files, xlen,flen, log_redundant=False): exp_alias = utils.import_instr_alias(ops[i]) if exp_alias != None: ops[i] = tuple(exp_alias).__str__().replace("'", '').replace(" ", '') - + data[0] = '[' + ':'.join(ops) + ']' data = '::'.join(data) del temp[covp] temp[data] = covge - - cgf[labels].insert(1, 'cross_comb', temp) - + + cgf[labels].insert(1, 'cross_comb', temp) + l = len(cats.items()) i = 0 for label,node in cats.items(): @@ -618,7 +618,13 @@ def expand_cgf(cgf_files, xlen,flen, log_redundant=False): for cp,comment in exp_cp: if log_redundant and cp in cgf[labels][label]: logger.warn(f'Redundant coverpoint during normalization: {cp}') - cgf[labels][label].insert(l+i,cp,coverage,comment=comment) + + # PyYAML has catastrophic performance adding comments + # so only do it for the first 100 entries. + if i < 100: + cgf[labels][label].yaml_add_eol_comment(comment, key=cp) + else: + cgf[labels][label][cp] = coverage + i += 1 return dict(cgf) -