from nmigen import Module, Signal
from nmigen.back.pysim import Simulator, Delay, Settle
-from nmigen.test.utils import FHDLTestCase
+from nmutil.formaltest import FHDLTestCase
import unittest
from soc.decoder.power_decoder import (create_pdecode)
-from soc.decoder.power_enums import (Function, InternalOp,
+from soc.decoder.power_enums import (Function, MicrOp,
In1Sel, In2Sel, In3Sel,
OutSel, RC, LdstLen, CryIn,
single_bit_flags, Form, SPR,
with Program(lst) as program:
self.run_tst_program(program, [1, 2, 3])
+ def test_1_divw_(self):
+ lst = ["addi 1, 0, 0x5678",
+ "addi 2, 0, 0x1234",
+ "divw. 3, 1, 2",
+ ]
+ with Program(lst) as program:
+ self.run_tst_program(program, [1, 2, 3])
+
+ def test_2_divw_(self):
+ lst = ["addi 1, 0, 0x1234",
+ "addi 2, 0, 0x5678",
+ "divw. 3, 1, 2",
+ ]
+ with Program(lst) as program:
+ self.run_tst_program(program, [1, 2, 3])
+
def test_1_divwe(self):
lst = ["addi 1, 0, 0x5678",
"addi 2, 0, 0x1234",
with Program(lst) as program:
self.run_tst_program(program, [1, 2, 3])
+ def test_5_div_regression(self):
+ lst = ["addi 1, 0, 0x4",
+ "addi 2, 0, 0x2",
+ "neg 2, 2",
+ "neg 1, 1",
+ "divwo 3, 1, 2",
+ ]
+ with Program(lst) as program:
+ self.run_tst_program(program, [1, 2, 3])
+
def run_tst_program(self, prog, initial_regs=None, initial_sprs=None,
initial_mem=None):
initial_regs = [0] * 32