self.lk = Signal(reset_less=True)
self.rc = Data(1, "rc")
self.oe = Data(1, "oe")
- self.invert_a = Signal(reset_less=True)
+ self.invert_in = Signal(reset_less=True)
self.zero_a = Signal(reset_less=True)
self.input_carry = Signal(CryIn, reset_less=True)
self.output_carry = Signal(reset_less=True)
pdecode2 = m.submodules.pdecode2
dec = pdecode2.dec
e = pdecode2.e
- comb += Assert(e.invert_a == dec.op.inv_a)
+ comb += Assert(e.invert_in == dec.op.inv_a)
comb += Assert(e.invert_out == dec.op.inv_out)
comb += Assert(e.input_carry == dec.op.cry_in)
comb += Assert(e.output_carry == dec.op.cry_out)
self.namespace['CA32'] = self.spr['XER'][XER_bits['CA32']].value
def handle_carry_(self, inputs, outputs, already_done):
- inv_a = yield self.dec2.e.do.invert_a
+ inv_a = yield self.dec2.e.do.invert_in
if inv_a:
inputs[0] = ~inputs[0]
self.spr['XER'][XER_bits['CA32']] = cy32
def handle_overflow(self, inputs, outputs, div_overflow):
- inv_a = yield self.dec2.e.do.invert_a
+ inv_a = yield self.dec2.e.do.invert_in
if inv_a:
inputs[0] = ~inputs[0]
# decoded/selected instruction flags
comb += do.data_len.eq(op.ldst_len)
- comb += do.invert_a.eq(op.inv_a)
+ comb += do.invert_in.eq(op.inv_a)
comb += do.invert_out.eq(op.inv_out)
comb += do.input_carry.eq(op.cry_in) # carry comes in
comb += do.output_carry.eq(op.cry_out) # carry goes out
class Adder(Elaboratable):
def __init__(self, width):
- self.invert_a = Signal()
+ self.invert_in = Signal()
self.a = Signal(width)
self.b = Signal(width)
self.o = Signal(width, name="add_o")
def elaborate(self, platform):
m = Module()
- with m.If(self.invert_a):
+ with m.If(self.invert_in):
m.d.comb += self.o.eq((~self.a) + self.b)
with m.Else():
m.d.comb += self.o.eq(self.a + self.b)
]
# pass invert (and carry later)
- m.d.comb += add.invert_a.eq(self.op.invert_a)
+ m.d.comb += add.invert_in.eq(self.op.invert_in)
go_now = Signal(reset_less=True) # testing no-delay ALU
yield dut.a.eq(a)
yield dut.b.eq(b)
yield dut.op.insn_type.eq(op)
- yield dut.op.invert_a.eq(inv_a)
+ yield dut.op.invert_in.eq(inv_a)
yield dut.n.ready_i.eq(0)
yield dut.p.valid_i.eq(1)
yield dut.n.ready_i.eq(1)
yield dut.a.eq(0)
yield dut.b.eq(0)
yield dut.op.insn_type.eq(0)
- yield dut.op.invert_a.eq(0)
+ yield dut.op.invert_in.eq(0)
# wait for the ALU to present the output data
while not (yield dut.n.valid_o):
yield dut.a.eq(a)
yield dut.b.eq(b)
yield dut.op.insn_type.eq(op)
- yield dut.op.invert_a.eq(inv_a)
+ yield dut.op.invert_in.eq(inv_a)
yield dut.p.valid_i.eq(1)
yield
# wait for ready_o to be asserted
yield dut.a.eq(0)
yield dut.b.eq(0)
yield dut.op.insn_type.eq(0)
- yield dut.op.invert_a.eq(0)
+ yield dut.op.invert_in.eq(0)
def receive():
# signal readiness to receive data
yield dut.src1_i.eq(a)
yield dut.src2_i.eq(b)
yield dut.oper_i.insn_type.eq(op)
- yield dut.oper_i.invert_a.eq(inv_a)
+ yield dut.oper_i.invert_in.eq(inv_a)
yield dut.oper_i.imm_data.imm.eq(imm)
yield dut.oper_i.imm_data.imm_ok.eq(imm_ok)
yield dut.issue_i.eq(1)
yield dut.src_i[0].eq(a)
yield dut.src_i[1].eq(b)
yield dut.oper_i.insn_type.eq(op)
- yield dut.oper_i.invert_a.eq(inv_a)
+ yield dut.oper_i.invert_in.eq(inv_a)
yield dut.oper_i.imm_data.imm.eq(imm)
yield dut.oper_i.imm_data.imm_ok.eq(imm_ok)
yield dut.oper_i.zero_a.eq(zero_a)
# at the same time, present the operation
yield self.dut.oper_i.insn_type.eq(self.op)
- yield self.dut.oper_i.invert_a.eq(self.inv_a)
+ yield self.dut.oper_i.invert_in.eq(self.inv_a)
yield self.dut.oper_i.imm_data.imm.eq(self.imm)
yield self.dut.oper_i.imm_data.imm_ok.eq(self.imm_ok)
yield self.dut.oper_i.zero_a.eq(self.zero_a)
# note: rdmaskn must be held, while busy_o is active
# TODO: deactivate rdmaskn when the busy_o cycle ends
yield self.dut.oper_i.insn_type.eq(0)
- yield self.dut.oper_i.invert_a.eq(0)
+ yield self.dut.oper_i.invert_in.eq(0)
yield self.dut.oper_i.imm_data.imm.eq(0)
yield self.dut.oper_i.imm_data.imm_ok.eq(0)
yield self.dut.oper_i.zero_a.eq(0)
('imm_data', Layout((("imm", 64), ("imm_ok", 1)))),
('rc', Layout((("rc", 1), ("rc_ok", 1)))), # Data
('oe', Layout((("oe", 1), ("oe_ok", 1)))), # Data
- ('invert_a', 1),
+ ('invert_in', 1),
('zero_a', 1),
('invert_out', 1),
('write_cr0', 1),
dut_sig = getattr(dut.o.ctx.op, name)
comb += Assert(dut_sig == rec_sig)
- with m.If(rec.invert_a):
+ with m.If(rec.invert_in):
comb += Assert(dut.o.a == ~a)
with m.Else():
comb += Assert(dut.o.a == a)
dut_sig = getattr(dut.o.ctx.op, name)
comb += Assert(dut_sig == rec_sig)
- with m.If(rec.invert_a):
+ with m.If(rec.invert_in):
comb += Assert(dut.o.a == ~a)
with m.Else():
comb += Assert(dut.o.a == a)
if hasattr(self, "invert_op"):
op_to_invert = self.invert_op
- if hasattr(op, "invert_a") and op_to_invert == 'ra':
- with m.If(op.invert_a):
+ if hasattr(op, "invert_in") and op_to_invert == 'ra':
+ with m.If(op.invert_in):
comb += a.eq(~self.i.a)
with m.Else():
comb += a.eq(self.i.a)
# operand b to be as-is or inverted
b = Signal.like(self.i.b)
- if hasattr(op, "invert_a") and op_to_invert == 'rb':
- with m.If(op.invert_a):
+ if hasattr(op, "invert_in") and op_to_invert == 'rb':
+ with m.If(op.invert_in):
comb += b.eq(~self.i.b)
with m.Else():
comb += b.eq(self.i.b)
dut_sig = getattr(dut.o.ctx.op, name)
comb += Assert(dut_sig == rec_sig)
- with m.If(rec.invert_a):
+ with m.If(rec.invert_in):
comb += Assert(dut.o.a == ~a)
with m.Else():
comb += Assert(dut.o.a == a)
('imm_data', Layout((("imm", 64), ("imm_ok", 1)))),
('rc', Layout((("rc", 1), ("rc_ok", 1)))),
('oe', Layout((("oe", 1), ("oe_ok", 1)))),
- ('invert_a', 1),
+ ('invert_in', 1),
('zero_a', 1),
('input_carry', CryIn),
('invert_out', 1),
('imm_data', Layout((("imm", 64), ("imm_ok", 1)))),
('rc', Layout((("rc", 1), ("rc_ok", 1)))), # Data
('oe', Layout((("oe", 1), ("oe_ok", 1)))), # Data
- ('invert_a', 1),
+ ('invert_in', 1),
('zero_a', 1),
('invert_out', 1),
('write_cr0', 1),