clear out DEC in core.cur_state.dec due to spurious interrupt.
[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 # note that state1 gets a corresponding "state1" write port created
32 # by core.py which is "monitored" by TestIssuerBase (hack-job, sigh).
33 # when writes are spotted then the DEC/TB FSM resets and re-reads
34 # DEC/TB.
35
36 class SPROutputData(FUBaseData):
37 regspec = [('INT', 'o', '0:63'), # RT
38 ('SPR', 'spr1', '0:63'), # SPR (slow)
39 ('FAST', 'fast1', '0:63'), # SPR (fast: LR, CTR etc)
40 ('STATE', 'state1', '0:63'), # SPR (DEC/TB)
41 ('XER', 'xer_so', '32'), # XER bit 32: SO
42 ('XER', 'xer_ov', '33,44'), # XER bit 34/45: CA/CA32
43 ('XER', 'xer_ca', '34,45')] # bit0: ov, bit1: ov32
44 def __init__(self, pspec):
45 super().__init__(pspec, True)
46
47
48 class SPRPipeSpec(CommonPipeSpec):
49 regspecklses = (SPRInputData, SPROutputData)
50 opsubsetkls = CompSPROpSubset