Parallelize instruction verification tasks
This commit is contained in:
parent
283d8531e0
commit
b0a914b48e
|
@ -27,7 +27,7 @@ This should run the tests (cache, multiplier, divider) provided by Minerva itsel
|
||||||
$ python -m rvfi.cores.minerva.verify
|
$ python -m rvfi.cores.minerva.verify
|
||||||
```
|
```
|
||||||
|
|
||||||
This should run in the order of a few hours.
|
This should complete within 2 hours.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ The RV32I, RV32M, RV64I and RV64M ISAs are currently implemented but only RV32IM
|
||||||
In no particular order:
|
In no particular order:
|
||||||
|
|
||||||
- Combine individual instruction checks into single ISA check (currently, doing so takes forever even when depth is set to only `20`)
|
- Combine individual instruction checks into single ISA check (currently, doing so takes forever even when depth is set to only `20`)
|
||||||
- Parallelize execution of verification tasks to reduce the total time required to run all verification tasks on a multi-core system
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ from ...insns.insn_divu import *
|
||||||
from ...insns.insn_rem import *
|
from ...insns.insn_rem import *
|
||||||
from ...insns.insn_remu import *
|
from ...insns.insn_remu import *
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from multiprocessing import Process
|
||||||
|
|
||||||
RISCVFormalParameters = namedtuple('RISCVFormalParameters',
|
RISCVFormalParameters = namedtuple('RISCVFormalParameters',
|
||||||
['ilen', 'xlen', 'csr_misa', 'compressed', 'aligned_mem', 'altops'])
|
['ilen', 'xlen', 'csr_misa', 'compressed', 'aligned_mem', 'altops'])
|
||||||
|
@ -124,141 +125,64 @@ class InsnSpec(Elaboratable):
|
||||||
|
|
||||||
class InsnTestCase(FHDLTestCase):
|
class InsnTestCase(FHDLTestCase):
|
||||||
def verify(self):
|
def verify(self):
|
||||||
print("- Verifying LUI instruction ...")
|
def verify_insn(insn_spec, spec_name):
|
||||||
self.assertFormal(InsnSpec(InsnLui), mode="cover", depth=20)
|
self.assertFormal(InsnSpec(insn_spec), mode="cover", depth=20, spec_name=spec_name)
|
||||||
self.assertFormal(InsnSpec(InsnLui), mode="bmc", depth=20)
|
self.assertFormal(InsnSpec(insn_spec), mode="bmc", depth=20, spec_name=spec_name)
|
||||||
print("- Verifying AUIPC instruction ...")
|
print("%s PASS" % spec_name)
|
||||||
self.assertFormal(InsnSpec(InsnAuipc), mode="cover", depth=20)
|
insns = [
|
||||||
self.assertFormal(InsnSpec(InsnAuipc), mode="bmc", depth=20)
|
(InsnLui, "verify_lui"),
|
||||||
print("- Verifying JAL instruction ...")
|
(InsnAuipc, "verify_auipc"),
|
||||||
self.assertFormal(InsnSpec(InsnJal), mode="cover", depth=20)
|
(InsnJal, "verify_jal"),
|
||||||
self.assertFormal(InsnSpec(InsnJal), mode="bmc", depth=20)
|
(InsnJalr, "verify_jalr"),
|
||||||
print("- Verifying JALR instruction ...")
|
(InsnBeq, "verify_beq"),
|
||||||
self.assertFormal(InsnSpec(InsnJalr), mode="cover", depth=20)
|
(InsnBne, "verify_bne"),
|
||||||
self.assertFormal(InsnSpec(InsnJalr), mode="bmc", depth=20)
|
(InsnBlt, "verify_blt"),
|
||||||
print("- Verifying BEQ instruction ...")
|
(InsnBge, "verify_bge"),
|
||||||
self.assertFormal(InsnSpec(InsnBeq), mode="cover", depth=20)
|
(InsnBltu, "verify_bltu"),
|
||||||
self.assertFormal(InsnSpec(InsnBeq), mode="bmc", depth=20)
|
(InsnBgeu, "verify_bgeu"),
|
||||||
print("- Verifying BNE instruction ...")
|
(InsnLb, "verify_lb"),
|
||||||
self.assertFormal(InsnSpec(InsnBne), mode="cover", depth=20)
|
(InsnLh, "verify_lh"),
|
||||||
self.assertFormal(InsnSpec(InsnBne), mode="bmc", depth=20)
|
(InsnLw, "verify_lw"),
|
||||||
print("- Verifying BLT instruction ...")
|
(InsnLbu, "verify_lbu"),
|
||||||
self.assertFormal(InsnSpec(InsnBlt), mode="cover", depth=20)
|
(InsnLhu, "verify_lhu"),
|
||||||
self.assertFormal(InsnSpec(InsnBlt), mode="bmc", depth=20)
|
(InsnSb, "verify_sb"),
|
||||||
print("- Verifying BGE instruction ...")
|
(InsnSh, "verify_sh"),
|
||||||
self.assertFormal(InsnSpec(InsnBge), mode="cover", depth=20)
|
(InsnSw, "verify_sw"),
|
||||||
self.assertFormal(InsnSpec(InsnBge), mode="bmc", depth=20)
|
(InsnAddi, "verify_addi"),
|
||||||
print("- Verifying BLTU instruction ...")
|
(InsnSlti, "verify_slti"),
|
||||||
self.assertFormal(InsnSpec(InsnBltu), mode="cover", depth=20)
|
(InsnSltiu, "verify_sltiu"),
|
||||||
self.assertFormal(InsnSpec(InsnBltu), mode="bmc", depth=20)
|
(InsnXori, "verify_xori"),
|
||||||
print("- Verifying BGEU instruction ...")
|
(InsnOri, "verify_ori"),
|
||||||
self.assertFormal(InsnSpec(InsnBgeu), mode="cover", depth=20)
|
(InsnAndi, "verify_andi"),
|
||||||
self.assertFormal(InsnSpec(InsnBgeu), mode="bmc", depth=20)
|
(InsnSlli, "verify_slli"),
|
||||||
print("- Verifying LB instruction ...")
|
(InsnSrli, "verify_srli"),
|
||||||
self.assertFormal(InsnSpec(InsnLb), mode="cover", depth=20)
|
(InsnSrai, "verify_srai"),
|
||||||
self.assertFormal(InsnSpec(InsnLb), mode="bmc", depth=20)
|
(InsnAdd, "verify_add"),
|
||||||
print("- Verifying LH instruction ...")
|
(InsnSub, "verify_sub"),
|
||||||
self.assertFormal(InsnSpec(InsnLh), mode="cover", depth=20)
|
(InsnSll, "verify_sll"),
|
||||||
self.assertFormal(InsnSpec(InsnLh), mode="bmc", depth=20)
|
(InsnSlt, "verify_slt"),
|
||||||
print("- Verifying LW instruction ...")
|
(InsnSltu, "verify_sltu"),
|
||||||
self.assertFormal(InsnSpec(InsnLw), mode="cover", depth=20)
|
(InsnXor, "verify_xor"),
|
||||||
self.assertFormal(InsnSpec(InsnLw), mode="bmc", depth=20)
|
(InsnSrl, "verify_srl"),
|
||||||
print("- Verifying LBU instruction ...")
|
(InsnSra, "verify_sra"),
|
||||||
self.assertFormal(InsnSpec(InsnLbu), mode="cover", depth=20)
|
(InsnOr, "verify_or"),
|
||||||
self.assertFormal(InsnSpec(InsnLbu), mode="bmc", depth=20)
|
(InsnAnd, "verify_and"),
|
||||||
print("- Verifying LHU instruction ...")
|
(InsnMul, "verify_mul"),
|
||||||
self.assertFormal(InsnSpec(InsnLhu), mode="cover", depth=20)
|
(InsnMulh, "verify_mulh"),
|
||||||
self.assertFormal(InsnSpec(InsnLhu), mode="bmc", depth=20)
|
(InsnMulhsu, "verify_mulhsu"),
|
||||||
print("- Verifying SB instruction ...")
|
(InsnMulhu, "verify_mulhu"),
|
||||||
self.assertFormal(InsnSpec(InsnSb), mode="cover", depth=20)
|
(InsnDiv, "verify_div"),
|
||||||
self.assertFormal(InsnSpec(InsnSb), mode="bmc", depth=20)
|
(InsnDivu, "verify_divu"),
|
||||||
print("- Verifying SH instruction ...")
|
(InsnRem, "verify_rem"),
|
||||||
self.assertFormal(InsnSpec(InsnSh), mode="cover", depth=20)
|
(InsnRemu, "verify_remu")
|
||||||
self.assertFormal(InsnSpec(InsnSh), mode="bmc", depth=20)
|
]
|
||||||
print("- Verifying SW instruction ...")
|
ps = []
|
||||||
self.assertFormal(InsnSpec(InsnSw), mode="cover", depth=20)
|
for insn_spec, spec_name in insns:
|
||||||
self.assertFormal(InsnSpec(InsnSw), mode="bmc", depth=20)
|
p = Process(target=verify_insn, args=(insn_spec,spec_name))
|
||||||
print("- Verifying ADDI instruction ...")
|
ps.append(p)
|
||||||
self.assertFormal(InsnSpec(InsnAddi), mode="cover", depth=20)
|
p.start()
|
||||||
self.assertFormal(InsnSpec(InsnAddi), mode="bmc", depth=20)
|
for p in ps:
|
||||||
print("- Verifying SLTI instruction ...")
|
p.join()
|
||||||
self.assertFormal(InsnSpec(InsnSlti), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSlti), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SLTIU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSltiu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSltiu), mode="bmc", depth=20)
|
|
||||||
print("- Verifying XORI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnXori), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnXori), mode="bmc", depth=20)
|
|
||||||
print("- Verifying ORI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnOri), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnOri), mode="bmc", depth=20)
|
|
||||||
print("- Verifying ANDI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnAndi), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnAndi), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SLLI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSlli), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSlli), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SRLI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSrli), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSrli), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SRAI instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSrai), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSrai), mode="bmc", depth=20)
|
|
||||||
print("- Verifying ADD instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnAdd), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnAdd), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SUB instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSub), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSub), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SLL instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSll), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSll), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SLT instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSlt), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSlt), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SLTU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSltu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSltu), mode="bmc", depth=20)
|
|
||||||
print("- Verifying XOR instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnXor), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnXor), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SRL instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSrl), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSrl), mode="bmc", depth=20)
|
|
||||||
print("- Verifying SRA instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnSra), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnSra), mode="bmc", depth=20)
|
|
||||||
print("- Verifying OR instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnOr), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnOr), mode="bmc", depth=20)
|
|
||||||
print("- Verifying AND instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnAnd), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnAnd), mode="bmc", depth=20)
|
|
||||||
print("- Verifying MUL instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnMul), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnMul), mode="bmc", depth=20)
|
|
||||||
print("- Verifying MULH instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnMulh), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnMulh), mode="bmc", depth=20)
|
|
||||||
print("- Verifying MULHSU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnMulhsu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnMulhsu), mode="bmc", depth=20)
|
|
||||||
print("- Verifying MULHU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnMulhu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnMulhu), mode="bmc", depth=20)
|
|
||||||
print("- Verifying DIV instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnDiv), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnDiv), mode="bmc", depth=20)
|
|
||||||
print("- Verifying DIVU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnDivu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnDivu), mode="bmc", depth=20)
|
|
||||||
print("- Verifying REM instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnRem), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnRem), mode="bmc", depth=20)
|
|
||||||
print("- Verifying REMU instruction ...")
|
|
||||||
self.assertFormal(InsnSpec(InsnRemu), mode="cover", depth=20)
|
|
||||||
self.assertFormal(InsnSpec(InsnRemu), mode="bmc", depth=20)
|
|
||||||
|
|
||||||
class PcFwdSpec(Elaboratable):
|
class PcFwdSpec(Elaboratable):
|
||||||
def elaborate(self, platform):
|
def elaborate(self, platform):
|
||||||
|
|
|
@ -2,10 +2,10 @@ let
|
||||||
pkgs = import <nixpkgs> { };
|
pkgs = import <nixpkgs> { };
|
||||||
nmigen-latest = pkgs.python3Packages.nmigen.overrideAttrs(oa: {
|
nmigen-latest = pkgs.python3Packages.nmigen.overrideAttrs(oa: {
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "m-labs";
|
owner = "DonaldKellett";
|
||||||
repo = "nmigen";
|
repo = "nmigen";
|
||||||
rev = "1ad6e3207f02e913407867dddddb8f50fad0ced4";
|
rev = "03726c7e3f307f27626bcc7dffe75abe17b2a390";
|
||||||
sha256 = "14vvw1lcfmcf3374wpn3sslgvgcfg18rkbs8x45vycqag6a5zy0b";
|
sha256 = "1b0rjbb6is6nzbcnxrwh5iv4k9xcac0ijq5kp47wdg9rhbnaa5w0";
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
minerva-latest = pkgs.python3Packages.buildPythonPackage {
|
minerva-latest = pkgs.python3Packages.buildPythonPackage {
|
||||||
|
|
Loading…
Reference in New Issue