Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 16ddd43

Browse files
authored
Merge branch 'master' into master
2 parents a0b076c + ba72cb7 commit 16ddd43

File tree

13 files changed

+4526
-4208
lines changed

13 files changed

+4526
-4208
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## [0.15.0] - 2022-08-25
6+
- Added support for instruction aliases
7+
8+
## [0.14.0] - 2022-08-08
9+
- Add fields to instruction object
10+
- Enable generic coverage evaluation mechanisms for floating point instructions
11+
- Fix coverpoint generation to account for nan boxing of fp instructions.
12+
- Add fields(frm, fcsr, nan_prefix) for fp instructions
13+
14+
## [0.13.2] - 2022-05-23
15+
- Error reporting for missing coverlabel in cgf file
16+
517
## [0.13.1] - 2022-05-07
618
- Fix mistune version for doc builds.
719

docs/source/cgf.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,16 @@ A covergroup contains the following nodes:
376376
This string is divided into three parts - opcode list, assign list and condition list separated by :: symbol. It is parsed and all the three lists are obtained separately. The variables available for use in the expression are as follows:
377377

378378
* ``instr_name`` : The instruction names in the opcode list
379+
380+
* ``instruction_alias``: The instruction alias for a set of instructions as defined in ``/riscv_isac/data/instr_alias.yaml``
379381

380382
* ``rs1`` : The register number of source register 1 of the current instruction in the assign list.
381383

382384
* ``rs2`` : The register number of source register 2 of the current instruction in the assign list.
383385

384386
* ``rd`` : The register number of destination register of the current instruction in the assign list.
385387

388+
Instruction aliases when used will be expanded into a tuple of instruction under the given alias.
386389
Along with the above mentioned variable any valid python comparison operators can be used in the condition list.
387390

388391

@@ -401,7 +404,7 @@ A covergroup contains the following nodes:
401404

402405
.. code-block:: python
403406
404-
[(add,sub) : ? : (add,sub) ] :: [a=rd : ? : ? ] :: [rd==x10 : rd!=a and rs1!=a and rs2!=a : rs1==a or rs2==a ]
407+
[(add,sub) : rv32i_arith : (add,sub) ] :: [a=rd : ? : ? ] :: [rd==x10 : rd!=a and rs1!=a and rs2!=a : rs1==a or rs2==a ]
405408
406409
3. WAW for an add instruction followed by a subtract instruction with 3 non-consuming instructions in between.
407410

riscv_isac/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
__author__ = """InCore Semiconductors Pvt Ltd"""
66
__email__ = '[email protected]'
7-
__version__ = '0.13.1'
7+
__version__ = '0.15.0'

riscv_isac/cgf_normalize.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# See LICENSE.incore for details
22
from math import *
3+
import pprint
34
import riscv_isac.utils as utils
45
import itertools
56
import random
@@ -548,24 +549,26 @@ def alternate(var, size, signed=True, fltr_func=None,scale_func=None):
548549
#return [(coverpoint,"Alternate") for coverpoint in coverpoints]
549550

550551

551-
def expand_cgf(cgf_files, xlen):
552+
def expand_cgf(cgf_files, xlen,flen):
552553
'''
553554
This function will replace all the abstract functions with their unrolled
554555
coverpoints. It replaces node
555556
556557
:param cgf_files: list of yaml file paths which together define the coverpoints
557-
:param xlen: XLEN of the riscv-trace
558+
:param xlen: XLEN of the DUT/Configuration
559+
:param flen: FLEN of the DUT/Configuration
558560
559561
:type cgf: list
560562
:type xlen: int
563+
:type flen: int
561564
'''
562565
cgf = utils.load_cgf(cgf_files)
563566
for labels, cats in cgf.items():
564567
if labels != 'datasets':
565568
# If 'opcode' found, rename it to 'mnemonics'
566569
if 'opcode' in cats:
567570
logger.warning("Deprecated node used: 'opcode'. Use 'mnemonics' instead")
568-
571+
569572
temp = cgf[labels]['opcode']
570573
del cgf[labels]['opcode']
571574
cgf[labels].insert(1, 'mnemonics', temp)
@@ -577,20 +580,43 @@ def expand_cgf(cgf_files, xlen):
577580
if len(cgf[labels]['mnemonics'].keys()) > 1:
578581
logger.error(f'Multiple instruction mnemonics found when base_op label defined in {labels} label.')
579582

583+
# Substitute instruction aliases with equivalent tuple of instructions
584+
if 'cross_comb' in cats:
585+
temp = cats['cross_comb']
586+
587+
for covp, covge in dict(temp).items():
588+
data = covp.split('::')
589+
ops = data[0].replace(' ', '')[1:-1].split(':')
590+
# Substitute with tuple of instructions
591+
for i in range(len(ops)):
592+
exp_alias = utils.import_instr_alias(ops[i])
593+
if exp_alias != None:
594+
ops[i] = tuple(exp_alias).__str__().replace("'", '').replace(" ", '')
595+
596+
data[0] = '[' + ':'.join(ops) + ']'
597+
data = '::'.join(data)
598+
del temp[covp]
599+
temp[data] = covge
600+
601+
cgf[labels].insert(1, 'cross_comb', temp)
602+
603+
l = len(cats.items())
604+
i = 0
580605
for label,node in cats.items():
581606
if isinstance(node,dict):
582607
if 'abstract_comb' in node:
583608
temp = node['abstract_comb']
584609
del node['abstract_comb']
585-
586610
for coverpoints, coverage in temp.items():
587611
i = 0
588612
try:
589613
exp_cp = eval(coverpoints)
590614
except Exception as e:
591-
pass
615+
logger.error("Error evaluating abstract comb: "+(coverpoints)\
616+
+" in "+labels+": "+str(e) )
592617
else:
593618
for cp,comment in exp_cp:
594-
cgf[labels][label].insert(1,cp,coverage,comment=comment)
619+
cgf[labels][label].insert(l+i,cp,coverage,comment=comment)
620+
i += 1
595621
return dict(cgf)
596622

0 commit comments

Comments
 (0)