863710c5879c91f958b6bfcbef5bb3aa26658684
[soc.git] / src / soc / fu / trap / pipe_data.py
1 from soc.fu.pipe_data import IntegerData, CommonPipeSpec
2 from soc.fu.trap.trap_input_record import CompTrapOpSubset
3
4
5 class TrapInputData(IntegerData):
6 regspec = [('INT', 'ra', '0:63'), # RA
7 ('INT', 'rb', '0:63'), # RB/immediate
8 ('FAST', 'fast1', '0:63'), # SRR0
9 ('FAST', 'fast2', '0:63'), # SRR1
10 # note here that neither MSR nor CIA are read as regs: they are
11 # passed in as incoming "State", via the CompTrapOpSubset
12 ]
13 def __init__(self, pspec):
14 super().__init__(pspec, False)
15 # convenience
16 self.srr0, self.srr1 = self.fast1, self.fast2
17 self.a, self.b = self.ra, self.rb
18
19
20 class TrapOutputData(IntegerData):
21 regspec = [('INT', 'o', '0:63'), # RA
22 ('FAST', 'fast1', '0:63'), # SRR0 SPR
23 ('FAST', 'fast2', '0:63'), # SRR1 SPR
24 ('STATE', 'nia', '0:63'), # NIA (Next PC)
25 ('STATE', 'msr', '0:63')] # MSR
26 def __init__(self, pspec):
27 super().__init__(pspec, True)
28 # convenience
29 self.srr0, self.srr1 = self.fast1, self.fast2
30
31
32
33 class TrapPipeSpec(CommonPipeSpec):
34 regspec = (TrapInputData.regspec, TrapOutputData.regspec)
35 opsubsetkls = CompTrapOpSubset