5cc7835e6c0e7c432ac4fc98abb943d530a05827
[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 FUBaseData
14 from soc.fu.spr.spr_input_record import CompSPROpSubset
15 from soc.fu.alu.pipe_data import CommonPipeSpec
16
17
18 class SPRInputData(FUBaseData):
19 regspec = [('INT', 'ra', '0:63'), # RA
20 ('SPR', 'spr1', '0:63'), # SPR (slow)
21 ('FAST', 'fast1', '0:63'), # SPR (fast: LR, CTR etc)
22 ('STATE', 'state1', '0:63'), # SPR (DEC/TB)
23 ('XER', 'xer_so', '32'), # XER bit 32: SO
24 ('XER', 'xer_ov', '33,44'), # XER bit 34/45: CA/CA32
25 ('XER', 'xer_ca', '34,45')] # bit0: ov, bit1: ov32
26 def __init__(self, pspec):
27 super().__init__(pspec, False)
28 # convenience
29 self.a = self.ra
30
31
32 class SPROutputData(FUBaseData):
33 regspec = [('INT', 'o', '0:63'), # RT
34 ('SPR', 'spr1', '0:63'), # SPR (slow)
35 ('FAST', 'fast1', '0:63'), # SPR (fast: LR, CTR etc)
36 ('STATE', 'state1', '0:63'), # SPR (DEC/TB)
37 ('XER', 'xer_so', '32'), # XER bit 32: SO
38 ('XER', 'xer_ov', '33,44'), # XER bit 34/45: CA/CA32
39 ('XER', 'xer_ca', '34,45')] # bit0: ov, bit1: ov32
40 def __init__(self, pspec):
41 super().__init__(pspec, True)
42
43
44 class SPRPipeSpec(CommonPipeSpec):
45 regspecklses = (SPRInputData, SPROutputData)
46 opsubsetkls = CompSPROpSubset