89a0ebbb2c44069ea65f0c2faf91f1f5351ab983
1 # Proof of correctness for trap pipeline, main stage
6 * https://bugs.libre-soc.org/show_bug.cgi?id=421
12 from nmigen
import Elaboratable
, Module
13 from nmigen
.asserts
import Assert
, AnyConst
14 from nmigen
.cli
import rtlil
16 from nmutil
.formaltest
import FHDLTestCase
18 from soc
.fu
.trap
.main_stage
import TrapMainStage
19 from soc
.fu
.trap
.pipe_data
import TrapPipeSpec
22 class Driver(Elaboratable
):
26 def elaborate(self
, platform
):
30 pspec
= TrapPipeSpec(id_wid
=2)
32 m
.submodules
.dut
= dut
= TrapMainStage(pspec
)
34 comb
+= dut
.i
.ctx
.matches(dut
.o
.ctx
)
39 class TrapMainStageTestCase(FHDLTestCase
):
40 def test_formal(self
):
41 self
.assertFormal(Driver(), mode
="bmc", depth
=10)
42 self
.assertFormal(Driver(), mode
="cover", depth
=10)
45 vl
= rtlil
.convert(Driver(), ports
=[])
46 with
open("trap_main_stage.il", "w") as f
:
50 if __name__
== '__main__':