SPR = 3
+@unique
+class LdstLen(Enum):
+ NONE = 0
+ is1B = 1
+ is2B = 2
+ is4B = 3
+
+
+@unique
+class RC(Enum):
+ NONE = 0
+ ONE = 1
+ RC = 2
+
+
# names of the fields in major.csv that don't correspond to an enum
single_bit_flags = ['CR in', 'CR out', 'inv A', 'inv out', 'cry in',
'cry out', 'BR', 'sgn ext', 'upd', 'rsrv', '32b',
self.in2_sel = Signal(In2Sel, reset_less=True)
self.in3_sel = Signal(In3Sel, reset_less=True)
self.out_sel = Signal(OutSel, reset_less=True)
+ self.ldst_len = Signal(LdstLen, reset_less=True)
+ self.rc_sel = Signal(RC, reset_less=True)
for bit in single_bit_flags:
name = get_signal_name(bit)
setattr(self, name,
comb += self.in2_sel.eq(In2Sel[row['in2']])
comb += self.in3_sel.eq(In3Sel[row['in3']])
comb += self.out_sel.eq(OutSel[row['out']])
+ comb += self.ldst_len.eq(LdstLen[row['ldst len']])
+ comb += self.rc_sel.eq(RC[row['rc']])
for bit in single_bit_flags:
sig = getattr(self, get_signal_name(bit))
comb += sig.eq(int(row[bit]))
self.in2_sel,
self.in3_sel,
self.out_sel,
+ self.ldst_len,
+ self.rc_sel,
self.internal_op]
single_bit_ports = [getattr(self, get_signal_name(x))
for x in single_bit_flags]
sys.path.append("../")
from power_major_decoder import (PowerMajorDecoder, Function,
In1Sel, In2Sel, In3Sel, OutSel,
+ LdstLen, RC,
single_bit_flags, get_signal_name,
InternalOp, major_opcodes)
in2_sel = Signal(In2Sel)
in3_sel = Signal(In3Sel)
out_sel = Signal(OutSel)
+ rc_sel = Signal(RC)
+ ldst_len = Signal(LdstLen)
m.submodules.dut = dut = PowerMajorDecoder()
comb += [dut.opcode_in.eq(opcode),
in2_sel.eq(dut.in2_sel),
in3_sel.eq(dut.in3_sel),
out_sel.eq(dut.out_sel),
+ rc_sel.eq(dut.rc_sel),
+ ldst_len.eq(dut.ldst_len),
internal_op.eq(dut.internal_op)]
sim = Simulator(m)
expected = OutSel[row['out']].value
self.assertEqual(expected, result)
+ result = yield rc_sel
+ expected = RC[row['rc']].value
+ self.assertEqual(expected, result)
+
+ result = yield ldst_len
+ expected = LdstLen[row['ldst len']].value
+ self.assertEqual(expected, result)
+
for bit in single_bit_flags:
sig = getattr(dut, get_signal_name(bit))
result = yield sig