('XER', 'xer_so', '32'), # XER bit 32: SO
('XER', 'xer_ca', '34,45')] # XER bit 34/45: CA/CA32
def __init__(self, pspec):
- super().__init__(pspec, False)
+ super().__init__(pspec, False) # still input style
self.neg_res = Signal(reset_less=True)
self.neg_res32 = Signal(reset_less=True)
comb += is_32bit.eq(op.is_32bit)
# check negate: select signed/unsigned
- o_s = Signal(signed(o.data.width * 2), reset_less=True)
- mul_o = Signal(o.data.width * 2, reset_less=True)
- comb += o_s.eq(-o_i)
- comb += mul_o.eq(Mux(self.i.neg_res, o_s, o_i))
+ mul_o = Signal(o_i.width, reset_less=True)
+ comb += mul_o.eq(Mux(self.i.neg_res, -o_i, o_i))
comb += o.ok.eq(1)
with m.Switch(op.insn_type):
# https://bugs.libre-soc.org/show_bug.cgi?id=319#c5
ca = Signal(2, reset_less=True)
- comb += ca[0].eq(mul_o[-1]) # XER.CA
- comb += ca[1].eq(mul_o[33] ^ (self.i.neg_res32)) # XER.CA32
+ comb += ca[0].eq(mul_o[-1]) # XER.CA - XXX more?
+ comb += ca[1].eq(mul_o[32] ^ (self.i.neg_res32)) # XER.CA32
comb += cry_o.data.eq(ca)
comb += cry_o.ok.eq(1)
-# This stage is intended to do most of the work of executing multiply
+# This stage is intended to prepare the multiplication operands
+
from nmigen import (Module, Signal, Mux)
from nmutil.pipemodbase import PipeModBase
from soc.fu.alu.pipe_data import ALUInputData
tc = TestCase(prog, self.test_name, initial_regs, initial_sprs)
self.test_data.append(tc)
- def test_rand_mullw(self):
+ def test_mullw(self):
+ lst = [f"mullw 3, 1, 2"]
+ initial_regs = [0] * 32
+ #initial_regs[1] = 0xffffffffffffffff
+ #initial_regs[2] = 0xffffffffffffffff
+ initial_regs[1] = 0x2ffffffff
+ initial_regs[2] = 0x2
+ self.run_tst_program(Program(lst), initial_regs)
+
+ def tst_rand_mullw(self):
insns = ["mullw", "mullw.", "mullwo", "mullwo."]
for i in range(40):
choice = random.choice(insns)