def elaborate(self, platform):
m = Module()
comb = m.d.comb
+ op = self.i.ctx.op
##### operand A #####
# operand a to be as-is or inverted
a = Signal.like(self.i.a)
- with m.If(self.i.ctx.op.invert_a):
- comb += a.eq(~self.i.a)
- with m.Else():
+ if hasattr(op, "invert_a"):
+ with m.If(op.invert_a):
+ comb += a.eq(~self.i.a)
+ with m.Else():
+ comb += a.eq(self.i.a)
+ else:
comb += a.eq(self.i.a)
comb += self.o.a.eq(a)
# either copy incoming carry or set to 1/0 as defined by op
if hasattr(self.i, "xer_ca"): # hack (for now - for LogicalInputData)
- with m.Switch(self.i.ctx.op.input_carry):
+ with m.Switch(op.input_carry):
with m.Case(CryIn.ZERO):
comb += self.o.xer_ca.eq(0b00)
with m.Case(CryIn.ONE):
# op requests inversion of the output
o = Signal.like(self.i.o)
- with m.If(op.invert_out):
- comb += o.eq(~self.i.o.data)
- with m.Else():
- comb += o.eq(self.i.o.data)
+ if hasattr(op, "invert_out"):
+ with m.If(op.invert_out):
+ comb += o.eq(~self.i.o.data)
+ with m.Else():
+ comb += o.eq(self.i.o.data)
+ else:
+ comb += o.eq(self.i.o.data)
# target register if 32-bit is only the 32 LSBs
target = Signal(64, reset_less=True)
('lk', 1),
('rc', Layout((("rc", 1), ("rc_ok", 1)))),
('oe', Layout((("oe", 1), ("oe_ok", 1)))),
- ('invert_a', 1),
- ('zero_a', 1),
('write_cr', Layout((("data", 3), ("ok", 1)))), # Data
- ('invert_out', 1),
('input_carry', CryIn),
('output_carry', 1),
('input_cr', 1),
#self.cr = Signal(32, reset_less = True
#self.xerc = XerBits(
self.lk.reset_less = True
- self.zero_a.reset_less = True
- self.invert_a.reset_less = True
- self.invert_out.reset_less = True
self.input_carry.reset_less = True
self.output_carry.reset_less = True
self.input_cr.reset_less = True
#self.cr,
#self.xerc,
self.lk,
- self.invert_a,
- self.invert_out,
self.input_carry,
self.output_carry,
self.input_cr,