avl-riscv-coverage 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ import avl
2
+ from avl_riscv_coverage._coverage import COVERPACKAGES, CoverPackage
3
+ from avl_riscv_coverage._isa import ISA
4
+ from avl_riscv_coverage._trace import Trace
5
+
6
+
7
+ class Opcodes(CoverPackage):
8
+
9
+ def __init__(self) -> None:
10
+ super().__init__("Opcodes")
11
+
12
+ self.mnemonic = None
13
+ self.cg = avl.Covergroup("opcodes", None)
14
+ cp = self.cg.add_coverpoint("opcode", lambda: self.mnemonic)
15
+
16
+ for k in ISA.keys():
17
+ if k is not None:
18
+ cp.add_bin(k, lambda x,k=k: x == k)
19
+
20
+ def sample(self, trace : Trace) -> None:
21
+ self.mnemonic = trace.instr.encoding.mnemonic
22
+ if self.mnemonic is not None:
23
+ self.cg.sample()
24
+
25
+ COVERPACKAGES.append(Opcodes())