0c7d5231cb57382ac0902c3015151abb5ec6497d
1 # Proof of correctness for SPR pipeline, main stage
6 * https://bugs.libre-soc.org/show_bug.cgi?id=418
11 from unittest
import skipUnless
13 from nmigen
import (Elaboratable
, Module
)
14 from nmigen
.asserts
import Assert
15 from nmigen
.cli
import rtlil
17 from nmutil
.formaltest
import FHDLTestCase
19 from soc
.fu
.spr
.main_stage
import SPRMainStage
20 from soc
.fu
.spr
.pipe_data
import SPRPipeSpec
23 class Driver(Elaboratable
):
25 Defines a module to drive the device under test and assert properties
29 def elaborate(self
, platform
):
33 dut
= SPRMainStage(SPRPipeSpec(id_wid
=2))
35 # Output context is the same as the input context.
36 comb
+= Assert(dut
.o
.ctx
!= dut
.i
.ctx
)
41 class SPRMainStageTestCase(FHDLTestCase
):
42 @skipUnless(getenv("FORMAL_SPR"), "Exercise SPR formal tests [WIP]")
43 def test_formal(self
):
44 self
.assertFormal(Driver(), mode
="bmc", depth
=100)
45 self
.assertFormal(Driver(), mode
="cover", depth
=100)
48 vl
= rtlil
.convert(Driver(), ports
=[])
49 with
open("spr_main_stage.il", "w") as f
:
53 if __name__
== '__main__':