1 from soc
.fu
.pipe_data
import FUBaseData
, CommonPipeSpec
2 from soc
.fu
.trap
.trap_input_record
import CompTrapOpSubset
5 class TrapInputData(FUBaseData
):
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
13 def __init__(self
, pspec
):
14 super().__init
__(pspec
, False)
16 self
.srr0
, self
.srr1
= self
.fast1
, self
.fast2
17 self
.a
, self
.b
= self
.ra
, self
.rb
20 class TrapOutputData(FUBaseData
):
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)
29 self
.srr0
, self
.srr1
= self
.fast1
, self
.fast2
33 class TrapPipeSpec(CommonPipeSpec
):
34 regspec
= (TrapInputData
.regspec
, TrapOutputData
.regspec
)
35 opsubsetkls
= CompTrapOpSubset