1 """simple core input data
5 from nmigen
import Signal
7 from openpower
.sv
.svp64
import SVP64Rec
9 from openpower
.decoder
.decode2execute1
import Decode2ToExecute1Type
10 from openpower
.decoder
.decode2execute1
import IssuerDecode2ToOperand
11 from soc
.config
.state
import CoreState
15 """FetchInput: the input to the Fetch Unit
17 * pc - the current Program Counter
19 pretty much it for now!
28 return [self
.pc
.eq(i
.pc
), self
.msr
.eq(i
.msr
),
33 """FetchOutput: the output from the fetch unit: one single instruction
35 * state. this contains PC, MSR, and SVSTATE. this is crucial information.
36 (TODO: bigendian_i should really be read from the relevant MSR bit)
38 * the raw instruction. no decoding has been done - at all.
40 (TODO: provide a *pair* of raw instructions so that packet
41 inspection can be done, and SVP64 decoding and future 64-bit
42 prefix analysis carried out. however right now that is *not*
45 def __init__(self
): #, svp64_en):
46 #self.svp64_en = svp64_en
48 # state and raw instruction (and SVP64 ReMap fields)
49 self
.state
= CoreState("core_fetched")
50 self
.raw_insn_i
= Signal(32) # one raw instruction
51 self
.bigendian_i
= Signal() # bigendian - TODO, set by MSR.BE
54 return [self
.state
.eq(i
.state
),
55 self
.raw_insn_i
.eq(i
.raw_insn_i
),
56 self
.bigendian_i
.eq(i
.bigendian_i
),
61 """CoreInput: this is the input specification for Signals coming into core.
63 * state. this contains PC, MSR, and SVSTATE. this is crucial information.
64 (TODO: bigendian_i should really be read from the relevant MSR bit)
66 * the previously-decoded instruction goes into the Decode2Execute1Type
67 data structure. no need for Core to re-decode that. however note
68 that *satellite* decoders *are* part of Core.
70 * the raw instruction. this is used by satellite decoders internal to
71 Core, to provide Function-Unit-specific information. really, they
72 should be part of the actual ALU itself (in order to reduce wires),
75 * other stuff is related to SVP64. the 24-bit SV REMAP field containing
78 def __init__(self
, pspec
, svp64_en
, regreduce_en
):
80 self
.svp64_en
= svp64_en
81 self
.e
= Decode2ToExecute1Type("core", opkls
=IssuerDecode2ToOperand
,
82 regreduce_en
=regreduce_en
)
84 # SVP64 RA_OR_ZERO needs to know if the relevant EXTRA2/3 field is zero
85 self
.sv_a_nz
= Signal()
87 # state and raw instruction (and SVP64 ReMap fields)
88 self
.state
= CoreState("core")
89 self
.raw_insn_i
= Signal(32) # raw instruction
90 self
.bigendian_i
= Signal() # bigendian - TODO, set by MSR.BE
92 self
.sv_rm
= SVP64Rec(name
="core_svp64_rm") # SVP64 RM field
93 self
.is_svp64_mode
= Signal() # set if SVP64 mode is enabled
94 self
.use_svp64_ldst_dec
= Signal() # use alternative LDST decoder
95 self
.sv_pred_sm
= Signal() # TODO: SIMD width
96 self
.sv_pred_dm
= Signal() # TODO: SIMD width
99 res
= [self
.e
.eq(i
.e
),
100 self
.sv_a_nz
.eq(i
.sv_a_nz
),
101 self
.state
.eq(i
.state
),
102 self
.raw_insn_i
.eq(i
.raw_insn_i
),
103 self
.bigendian_i
.eq(i
.bigendian_i
),
105 if not self
.svp64_en
:
107 res
+= [ self
.sv_rm
.eq(i
.sv_rm
),
108 self
.is_svp64_mode
.eq(i
.is_svp64_mode
),
109 self
.use_svp64_ldst_dec
.eq(i
.use_svp64_ldst_dec
),
110 self
.sv_pred_sm
.eq(i
.sv_pred_sm
),
111 self
.sv_pred_dm
.eq(i
.sv_pred_dm
),
118 # start/stop and terminated signalling
119 self
.core_terminate_o
= Signal() # indicates stopped
120 self
.busy_o
= Signal(name
="corebusy_o") # ALU is busy, no input
121 self
.any_busy_o
= Signal(name
="any_busy_o") # at least one ALU busy
122 self
.exc_happened
= Signal() # exception happened
125 return [self
.core_terminate_o
.eq(i
.core_terminate_o
),
126 self
.busy_o
.eq(i
.busy_o
),
127 self
.any_busy_o
.eq(i
.any_busy_o
),
128 self
.exc_happened
.eq(i
.exc_happened
),