convert branch pipeline to use msr/cia as immediates
[soc.git] / src / soc / fu / spr / pipe_data.py
1 """SPR Pipeline Data structures
2
3 Covers MFSPR and MTSPR. however given that the SPRs are split across
4 XER (which is 3 separate registers), Fast-SPR and Slow-SPR regfiles,
5 the data structures are slightly more involved than just "INT, SPR".
6
7 Links:
8 * https://bugs.libre-soc.org/show_bug.cgi?id=348
9 * https://libre-soc.org/openpower/isa/sprset/
10 * https://libre-soc.org/3d_gpu/architecture/regfile/
11 """
12
13 from soc.fu.pipe_data import IntegerData
14 from soc.fu.spr.spr_input_record import CompSPROpSubset
15 from soc.fu.alu.pipe_data import CommonPipeSpec
16
17
18 class SPRInputData(IntegerData):
19 regspec = [('INT', 'ra', '0:63'), # RA
20 ('SPR', 'spr1', '0:63'), # SPR (slow)
21 ('FAST', 'fast1', '0:63'), # SPR (fast: MSR, LR, CTR etc)
22 ('XER', 'xer_so', '32'), # XER bit 32: SO
23 ('XER', 'xer_ov', '33,44'), # XER bit 34/45: CA/CA32
24 ('XER', 'xer_ca', '34,45')] # bit0: ov, bit1: ov32
25 def __init__(self, pspec):
26 super().__init__(pspec, False)
27 # convenience
28 self.a = self.ra
29
30
31 class SPROutputData(IntegerData):
32 regspec = [('INT', 'o', '0:63'), # RT
33 ('SPR', 'spr1', '0:63'), # SPR (slow)
34 ('FAST', 'fast1', '0:63'), # SPR (fast: MSR, LR, CTR etc)
35 ('XER', 'xer_so', '32'), # XER bit 32: SO
36 ('XER', 'xer_ov', '33,44'), # XER bit 34/45: CA/CA32
37 ('XER', 'xer_ca', '34,45')] # bit0: ov, bit1: ov32
38 def __init__(self, pspec):
39 super().__init__(pspec, True)
40
41
42 class SPRPipeSpec(CommonPipeSpec):
43 regspec = (SPRInputData.regspec, SPROutputData.regspec)
44 opsubsetkls = CompSPROpSubset