split out CompOpSubsetBase (meaning to do for a while)
[soc.git] / src / soc / fu / base_input_record.py
1 from nmigen.hdl.rec import Record, Layout
2 from nmigen import Signal
3
4
5 class CompOpSubsetBase(Record):
6 """CompOpSubsetBase
7
8 base class of subset Operation information
9 """
10 def __init__(self, layout, name):
11
12 Record.__init__(self, Layout(layout), name=name)
13
14 # grrr. Record does not have kwargs
15 for fname, sig in self.fields.items():
16 sig.reset_less = True
17
18 def eq_from_execute1(self, other):
19 """ use this to copy in from Decode2Execute1Type
20 """
21 res = []
22 for fname, sig in self.fields.items():
23 eqfrom = other.do.fields[fname]
24 res.append(sig.eq(eqfrom))
25 return res
26
27 def ports(self):
28 res = []
29 for fname, sig in self.fields.items():
30 if isinstance(sig, Signal):
31 res.append(sig)
32 return res