1 from nmigen
.hdl
.rec
import Record
, Layout
2 from nmigen
import Signal
5 class CompOpSubsetBase(Record
):
8 base class of subset Operation information
10 def __init__(self
, layout
, name
):
12 name
= self
.__class
__.__name
__
13 print ("Subset name", name
)
14 assert name
.startswith("Comp")
15 assert name
.endswith("OpSubset")
16 name
= name
[4:-8].lower() + "_op"
18 Record
.__init
__(self
, Layout(layout
), name
=name
)
20 # grrr. Record does not have kwargs
21 for fname
, sig
in self
.fields
.items():
24 def eq_from(self
, other
):
25 """ use this to copy in from another CompRecord
28 print ("eq_from self", self
, self
.fields
)
29 print (" other", other
, other
.fields
)
30 for fname
, sig
in self
.fields
.items():
31 eqfrom
= other
.fields
[fname
]
32 res
.append(sig
.eq(eqfrom
))
35 def eq_from_execute1(self
, other
):
36 """ use this to copy in from Decode2Execute1Type
38 return self
.eq_from(other
)
42 for fname
, sig
in self
.fields
.items():
43 if isinstance(sig
, Signal
):