remove zero/invert from ShiftRot Input Record
[soc.git] / src / soc / fu / shift_rot / sr_input_record.py
1 from nmigen.hdl.rec import Record, Layout
2
3 from soc.decoder.power_enums import InternalOp, Function, CryIn
4
5
6 class CompSROpSubset(Record):
7 """CompSROpSubset
8
9 a copy of the relevant subset information from Decode2Execute1Type
10 needed for ALU operations. use with eq_from_execute1 (below) to
11 grab subsets.
12 """
13 def __init__(self, name=None):
14 layout = (('insn_type', InternalOp),
15 ('fn_unit', Function),
16 ('imm_data', Layout((("imm", 64), ("imm_ok", 1)))),
17 #'cr = Signal(32, reset_less=True) # NO: this is from the CR SPR
18 #'xerc = XerBits() # NO: this is from the XER SPR
19 ('lk', 1),
20 ('rc', Layout((("rc", 1), ("rc_ok", 1)))),
21 ('oe', Layout((("oe", 1), ("oe_ok", 1)))),
22 ('write_cr', Layout((("data", 3), ("ok", 1)))), # Data
23 ('input_carry', CryIn),
24 ('output_carry', 1),
25 ('input_cr', 1),
26 ('output_cr', 1),
27 ('is_32bit', 1),
28 ('is_signed', 1),
29 ('data_len', 4), # actually used by ALU, in OP_EXTS
30 ('insn', 32),
31 ('byte_reverse', 1),
32 ('sign_extend', 1))
33
34 Record.__init__(self, Layout(layout), name=name)
35
36 # grrr. Record does not have kwargs
37 self.insn_type.reset_less = True
38 self.fn_unit.reset_less = True
39 #self.cr = Signal(32, reset_less = True
40 #self.xerc = XerBits(
41 self.lk.reset_less = True
42 self.input_carry.reset_less = True
43 self.output_carry.reset_less = True
44 self.input_cr.reset_less = True
45 self.output_cr.reset_less = True
46 self.is_32bit.reset_less = True
47 self.is_signed.reset_less = True
48 self.data_len.reset_less = True
49 self.byte_reverse.reset_less = True
50 self.sign_extend.reset_less = True
51
52 def eq_from_execute1(self, other):
53 """ use this to copy in from Decode2Execute1Type
54 """
55 res = []
56 for fname, sig in self.fields.items():
57 eqfrom = other.fields[fname]
58 res.append(sig.eq(eqfrom))
59 return res
60
61 def ports(self):
62 return [self.insn_type,
63 #self.cr,
64 #self.xerc,
65 self.lk,
66 self.input_carry,
67 self.output_carry,
68 self.input_cr,
69 self.output_cr,
70 self.is_32bit,
71 self.is_signed,
72 self.data_len,
73 self.byte_reverse,
74 self.sign_extend,
75 ]