13179c8f13572205dfee7a953efdc17671abeab8
2 Optional Register allocation listed below. mandatory input
3 (CompBROpSubset, CIA) not included.
5 * CR is Condition Register (not an SPR)
6 * SPR1 and SPR2 are all from the SPR regfile. 2 ports are needed
23 op_bctarl CR, TAR, CTR
26 from nmigen
import Signal
, Const
27 from ieee754
.fpcommon
.getop
import FPPipeContext
28 from soc
.decoder
.power_decoder2
import Data
29 from soc
.fu
.alu
.pipe_data
import IntegerData
30 from nmutil
.dynamicpipe
import SimpleHandshakeRedir
31 from soc
.fu
.alu
.alu_input_record
import CompALUOpSubset
# TODO: replace
34 class BranchInputData(IntegerData
):
35 regspec
= [('SPR', 'spr1', '0:63'),
36 ('SPR', 'spr2', '0:63'),
38 ('PC', 'cia', '0:63')]
39 def __init__(self
, pspec
):
40 super().__init
__(pspec
)
41 # Note: for OP_BCREG, SPR1 will either be CTR, LR, or TAR
42 # this involves the *decode* unit selecting the register, based
43 # on detecting the operand being bcctr, bclr or bctar
45 self
.spr1
= Signal(64, reset_less
=True) # see table above, SPR1
46 self
.spr2
= Signal(64, reset_less
=True) # see table above, SPR2
47 self
.cr
= Signal(32, reset_less
=True) # Condition Register(s) CR0-7
48 self
.cia
= Signal(64, reset_less
=True) # Current Instruction Address
50 # convenience variables. not all of these are used at once
51 self
.ctr
= self
.srr0
= self
.hsrr0
= self
.spr2
52 self
.lr
= self
.tar
= self
.srr1
= self
.hsrr1
= self
.spr1
55 yield from super().__iter
__()
63 return lst
+ [self
.spr1
.eq(i
.spr1
), self
.spr2
.eq(i
.spr2
),
64 self
.cr
.eq(i
.cr
), self
.cia
.eq(i
.cia
)]
67 class BranchOutputData(IntegerData
):
68 regspec
= [('SPR', 'spr1', '0:63'),
69 ('SPR', 'spr2', '0:63'),
70 ('PC', 'nia', '0:63')]
71 def __init__(self
, pspec
):
72 super().__init
__(pspec
)
73 self
.spr1
= Data(64, name
="spr1")
74 self
.spr2
= Data(64, name
="spr2")
75 self
.nia
= Data(64, name
="nia")
77 # convenience variables.
78 self
.lr
= self
.tar
= self
.spr1
82 yield from super().__iter
__()
89 return lst
+ [self
.spr1
.eq(i
.spr1
), self
.spr2
.eq(i
.spr2
),
93 # TODO: replace CompALUOpSubset with CompBranchOpSubset
95 regspec
= (BranchInputData
.regspec
, BranchOutputData
.regspec
)
96 opsubsetkls
= CompALUOpSubset
97 def __init__(self
, id_wid
, op_wid
):
100 self
.opkls
= lambda _
: self
.opsubsetkls(name
="op")
102 self
.pipekls
= SimpleHandshakeRedir