from nmutil.sim_tmp_alternative import (Simulator, nmigen_sim_top_module,
is_engine_pysim)
+from soc.decoder.decode2execute1 import Data
from soc.decoder.power_enums import MicrOp, Function, CryIn
from soc.fu.alu.alu_input_record import CompALUOpSubset
i.append(Signal(width, name="i2"))
self.i = Array(i)
self.a, self.b = i[0], i[1]
- self.out = Array([Signal(width, name="alu_o")])
+ self.out = Array([Data(width, name="alu_o")])
self.o = self.out[0]
self.width = width
# more "look like nmutil pipeline API"
# hold the ALU result until ready_o is asserted
alu_r = Signal(self.width)
+ # NOP doesn't output anything
+ with m.If(self.op.insn_type != MicrOp.OP_NOP):
+ m.d.comb += self.o.ok.eq(1)
with m.If(alu_idle):
with m.If(self.p.valid_i):
# choose between zero-delay output, or registered
with m.If(go_now):
- m.d.comb += self.o.eq(sub.o)
+ m.d.comb += self.o.data.eq(sub.o)
# only present the result at the last computation cycle
with m.Elif(alu_done):
- m.d.comb += self.o.eq(alu_r)
+ m.d.comb += self.o.data.eq(alu_r)
return m
yield from self.op.ports()
yield self.a
yield self.b
- yield self.o
+ yield from self.o.ports()
yield self.p.valid_i
yield self.p.ready_o
yield self.n.valid_o
yield
# latch the result and lower read_i
- result = yield dut.o
+ result = yield dut.o.data
yield dut.n.ready_i.eq(0)
return result
while not (yield dut.n.valid_o):
yield
# read result
- result = yield dut.o
+ result = yield dut.o.data
# negate ready_i
# if receive is called again immediately afterwards, there will be no
# visible transition (it will not be negated, after all)
yield from op.issue([2, 0x80], MicrOp.OP_EXTSWSLI, [0xFF80],
rdmaskn=[1, 0],
src_delays=[1, 2], dest_delays=[1])
- # 0 (masked) + 0 (masked) = 0
- yield from op.issue([5, 2], MicrOp.OP_ADD, [0],
- rdmaskn=[1, 1],
+ # NOP does not make any request nor response
+ yield from op.issue([5, 2], MicrOp.OP_NOP, [0],
+ rdmaskn=[1, 1], wrmask=[1],
src_delays=[1, 2], dest_delays=[1])
- # note: the current test ALU down not have any masked write operations
def test_compunit_fsm():