aa = Signal(i_fields['AA'][0:-1].shape())
comb += aa.eq(i_fields['AA'][0:-1])
+ branch_imm_addr = Signal(64, reset_less=True)
branch_addr = Signal(64, reset_less=True)
branch_taken = Signal(reset_less=True)
comb += branch_taken.eq(0)
+
+ with m.If(aa):
+ comb += branch_addr.eq(branch_imm_addr)
+ with m.Else():
+ comb += branch_addr.eq(branch_imm_addr + self.i.nia)
+
##########################
with m.Case(InternalOp.OP_B):
li = Signal(i_fields['LI'][0:-1].shape())
comb += li.eq(i_fields['LI'][0:-1])
- with m.If(aa):
- comb += branch_addr.eq(Cat(Const(0, 2), li))
- comb += branch_taken.eq(1)
- with m.Else():
- comb += branch_addr.eq(Cat(Const(0, 2), li) + self.i.nia)
- comb += branch_taken.eq(1)
+ comb += branch_imm_addr.eq(Cat(Const(0, 2), li))
+ comb += branch_taken.eq(1)
comb += self.o.nia_out.data.eq(branch_addr)
comb += self.o.nia_out.ok.eq(branch_taken)
class BranchOutputData(IntegerData):
def __init__(self, pspec):
super().__init__(pspec)
- self.lr = Signal(64, reset_less=True)
- self.spr = Signal(64, reset_less=True)
+ self.lr = Data(64, name="lr")
+ self.spr = Data(64, name="spr")
self.nia_out = Data(64, name="nia_out")
def __iter__(self):
yield from super().__iter__()
- yield self.lr
- yield self.spr
+ yield from self.lr
+ yield from self.spr
yield from self.nia_out
def eq(self, i):