comb += self.o.o.eq(self.i.a | self.i.b)
with m.Case(InternalOp.OP_XOR):
comb += self.o.o.eq(self.i.a ^ self.i.b)
+ with m.Case(InternalOp.OP_SHL):
+ comb += self.o.o.eq(self.i.a << self.i.b)
###### sticky overflow and context, both pass-through #####
- comb += so.eq(self.i.so)
+ comb += self.o.so.eq(self.i.so)
comb += self.o.ctx.eq(self.i.ctx)
return m
# This stage is intended to handle the gating of carry and overflow
# out, summary overflow generation, and updating the condition
# register
-from nmigen import (Module, Signal, Cat)
+from nmigen import (Module, Signal, Cat, Repl)
from nmutil.pipemodbase import PipeModBase
from soc.alu.pipe_data import ALUInputData, ALUOutputData
from ieee754.part.partsig import PartitionedSignal
comb = m.d.comb
o = Signal.like(self.i.o)
+ o2 = Signal.like(self.i.o)
with m.If(self.i.ctx.op.invert_out):
- comb += o.eq(~self.i.o)
+ comb += o2.eq(~self.i.o)
with m.Else():
- comb += o.eq(self.i.o)
+ comb += o2.eq(self.i.o)
+
+ with m.If(self.i.ctx.op.is_32bit):
+ comb += o.eq(Cat(o2[0:32], Repl(0, 32)))
+ with m.Else():
+ comb += o.eq(o2)
is_zero = Signal(reset_less=True)
is_positive = Signal(reset_less=True)
vld = yield alu.n.valid_o
yield
alu_out = yield alu.n.data_o.o
- self.assertEqual(simulator.gpr(3), SelectableInt(alu_out, 64))
+ self.assertEqual(simulator.gpr(3).value, alu_out)
sim.add_sync_process(process)
with sim.write_vcd("simulator.vcd", "simulator.gtkw",
with Program(lst) as program:
sim = self.run_tst_program(program, initial_regs)
+ def test_rlwinm(self):
+ for i in range(0, 10):
+
+ lst = ["slw 3, 1, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = random.randint(0, (1<<64)-1)
+ initial_regs[2] = random.randint(0, 63)
+ with Program(lst) as program:
+ sim = self.run_tst_program(program, initial_regs)
+
def test_ilang(self):
rec = CompALUOpSubset()