1 |
2 |
mcafruni |
--------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- --
|
4 |
|
|
-- miniMIPS Superscalar Processor : miniMIPS Superscalar processor --
|
5 |
|
|
-- based on miniMIPS Processor --
|
6 |
|
|
-- --
|
7 |
|
|
-- --
|
8 |
|
|
-- Author : Miguel Cafruni --
|
9 |
|
|
-- miguel_cafruni@hotmail.com --
|
10 |
|
|
-- December 2018 --
|
11 |
|
|
--------------------------------------------------------------------------
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
library ieee;
|
15 |
|
|
use ieee.std_logic_1164.all;
|
16 |
|
|
|
17 |
|
|
library work;
|
18 |
|
|
use work.pack_mips.all;
|
19 |
|
|
|
20 |
|
|
entity minimips is
|
21 |
|
|
port (
|
22 |
|
|
clock : in std_logic;
|
23 |
|
|
clock2 : in std_logic;
|
24 |
|
|
reset : in std_logic;
|
25 |
|
|
|
26 |
|
|
-- Ram connexion
|
27 |
|
|
ram_req : out std_logic;
|
28 |
|
|
ram_adr : out bus32;
|
29 |
|
|
ram_r_w : out std_logic;
|
30 |
|
|
ram_data : inout bus32;
|
31 |
|
|
ram_ack : in std_logic;
|
32 |
|
|
|
33 |
|
|
ram_req2 : out std_logic;
|
34 |
|
|
ram_adr2 : out bus32;
|
35 |
|
|
ram_r_w2 : out std_logic;
|
36 |
|
|
ram_data2 : inout bus32;
|
37 |
|
|
ram_ack2 : in std_logic;
|
38 |
|
|
|
39 |
|
|
-- Hardware interruption
|
40 |
|
|
it_mat : in std_logic
|
41 |
|
|
);
|
42 |
|
|
end minimips;
|
43 |
|
|
|
44 |
|
|
architecture rtl of minimips is
|
45 |
|
|
|
46 |
|
|
-- General signals
|
47 |
|
|
signal stop_all : std_logic; -- Lock the pipeline evolution
|
48 |
|
|
signal stop_all2 : std_logic; -- Lock the pipeline evolution
|
49 |
|
|
|
50 |
|
|
signal it_mat_clk : std_logic; -- Synchronised hardware interruption
|
51 |
|
|
signal stop_pf : std_logic; -- Lock the pc
|
52 |
|
|
signal stop_pf2 : std_logic; -- Lock the pc
|
53 |
|
|
signal genop : std_logic; -- envoi de nops
|
54 |
|
|
signal genop2 : std_logic; -- envoi de nops
|
55 |
|
|
-- interface PF - EI
|
56 |
|
|
signal PF_pc : bus32; -- PC value
|
57 |
|
|
signal PF_pc_4 : bus32;
|
58 |
|
|
|
59 |
|
|
-- interface Controler - EI
|
60 |
|
|
signal CTE_instr : bus32; -- Instruction from the memory
|
61 |
|
|
signal ETC_adr : bus32; -- Address to read in memory
|
62 |
|
|
|
63 |
|
|
-- interface Controler - EI2
|
64 |
|
|
signal CTE_instr2 : bus32; -- Instruction from the memory
|
65 |
|
|
signal ETC_adr2 : bus32; -- Address to read in memory
|
66 |
|
|
|
67 |
|
|
-- interface EI - DI
|
68 |
|
|
signal EI_instr : bus32; -- Read interface
|
69 |
|
|
signal EI_adr : bus32; -- Address from the read instruction
|
70 |
|
|
signal EI_it_ok : std_logic; -- Allow hardware interruptions
|
71 |
|
|
|
72 |
|
|
-- interface EI2 - DI2
|
73 |
|
|
signal EI_instr2 : bus32; -- Read interface
|
74 |
|
|
signal EI_adr2 : bus32; -- Address from the read instruction
|
75 |
|
|
signal EI_it_ok2 : std_logic; -- Allow hardware interruptions
|
76 |
|
|
|
77 |
|
|
-- DI output
|
78 |
|
|
signal bra_detect : std_logic; -- Branch detection in the current instruction
|
79 |
|
|
|
80 |
|
|
-- DI2 output
|
81 |
|
|
signal bra_detect2 : std_logic; -- Branch detection in the current instruction
|
82 |
|
|
|
83 |
|
|
-- Asynchronous connexion with the bypass unit
|
84 |
|
|
signal adr_reg1 : adr_reg_type; -- Operand 1 address
|
85 |
|
|
signal adr_reg2 : adr_reg_type; -- Operand 2 address
|
86 |
|
|
signal use1 : std_logic; -- Operand 1 utilisation
|
87 |
|
|
signal use2 : std_logic; -- Operand 2 utilisation
|
88 |
|
|
signal data1 : bus32; -- First register value
|
89 |
|
|
signal data2 : bus32; -- Second register value
|
90 |
|
|
signal alea : std_logic; -- Unresolved hazards detected
|
91 |
|
|
|
92 |
|
|
-- Asynchronous connexion with the bypass unit
|
93 |
|
|
signal adr_reg3 : adr_reg_type; -- Operand 1 address
|
94 |
|
|
signal adr_reg4 : adr_reg_type; -- Operand 2 address
|
95 |
|
|
signal use3 : std_logic; -- Operand 3 utilisation
|
96 |
|
|
signal use4 : std_logic; -- Operand 4 utilisation
|
97 |
|
|
signal data3 : bus32; -- 3th register value
|
98 |
|
|
signal data4 : bus32; -- 4th register value
|
99 |
|
|
signal alea2 : std_logic; -- Unresolved hazards detected 2nd pipe
|
100 |
|
|
|
101 |
|
|
-- interface DI - EX
|
102 |
|
|
signal DI_bra : std_logic; -- Branch decoded
|
103 |
|
|
signal DI_link : std_logic; -- A link for that instruction
|
104 |
|
|
signal DI_op1 : bus32; -- operand 1 for alu
|
105 |
|
|
signal DI_op2 : bus32; -- operand 2 for alu
|
106 |
|
|
signal DI_code_ual : alu_ctrl_type; -- Alu operation
|
107 |
|
|
signal DI_offset : bus32; -- Offset for the address calculation
|
108 |
|
|
signal DI_adr_reg_dest : adr_reg_type; -- Address of the destination register of the result
|
109 |
|
|
signal DI_ecr_reg : std_logic; -- Effective writing of the result
|
110 |
|
|
signal DI_mode : std_logic; -- Address mode (relative to pc or indexed to a register)
|
111 |
|
|
signal DI_op_mem : std_logic; -- Memory operation request
|
112 |
|
|
signal DI_r_w : std_logic; -- Type of memory operation (reading or writing)
|
113 |
|
|
signal DI_adr : bus32; -- Address of the decoded instruction
|
114 |
|
|
signal DI_exc_cause : bus32; -- Potential exception detected
|
115 |
|
|
signal DI_level : level_type; -- Availability of the result for the data bypass
|
116 |
|
|
signal DI_it_ok : std_logic; -- Allow hardware interruptions
|
117 |
|
|
|
118 |
|
|
-- interface DI2 - EX2
|
119 |
|
|
signal DI_bra2 : std_logic; -- Branch decoded
|
120 |
|
|
signal DI_link2 : std_logic; -- A link for that instruction
|
121 |
|
|
signal DI_op3 : bus32; -- operand 1 for alu 2
|
122 |
|
|
signal DI_op4 : bus32; -- operand 2 for alu 2
|
123 |
|
|
signal DI_code_ual2 : alu_ctrl_type; -- Alu operation
|
124 |
|
|
signal DI_offset2 : bus32; -- Offset for the address calculation
|
125 |
|
|
signal DI_adr_reg_dest2 : adr_reg_type; -- Address of the destination register of the result
|
126 |
|
|
signal DI_ecr_reg2 : std_logic; -- Effective writing of the result
|
127 |
|
|
signal DI_mode2 : std_logic; -- Address mode (relative to pc or indexed to a register)
|
128 |
|
|
signal DI_op_mem2 : std_logic; -- Memory operation request
|
129 |
|
|
signal DI_r_w2 : std_logic; -- Type of memory operation (reading or writing)
|
130 |
|
|
signal DI_adr2 : bus32; -- Address of the decoded instruction
|
131 |
|
|
signal DI_exc_cause2 : bus32; -- Potential exception detected
|
132 |
|
|
signal DI_level2 : level_type; -- Availability of the result for the data bypass
|
133 |
|
|
signal DI_it_ok2 : std_logic; -- Allow hardware interruptions
|
134 |
|
|
|
135 |
|
|
-- interface EX - MEM
|
136 |
|
|
signal EX_adr : bus32; -- Instruction address
|
137 |
|
|
signal EX_bra_confirm : std_logic; -- Branch execution confirmation
|
138 |
|
|
signal EX_data_ual : bus32; -- Ual result
|
139 |
|
|
signal EX_adresse : bus32; -- Address calculation result
|
140 |
|
|
signal ex_adresse_p1p2_s : bus32; -- resultado do calculo do endereco do desvio + 4 para pipe 2
|
141 |
|
|
signal EX_adr_reg_dest : adr_reg_type; -- Destination register for the result
|
142 |
|
|
signal EX_ecr_reg : std_logic; -- Effective writing of the result
|
143 |
|
|
signal EX_op_mem : std_logic; -- Memory operation needed
|
144 |
|
|
signal EX_r_w : std_logic; -- Type of memory operation (read or write)
|
145 |
|
|
signal EX_exc_cause : bus32; -- Potential cause exception
|
146 |
|
|
signal EX_level : level_type; -- Availability stage of result for bypassing
|
147 |
|
|
signal EX_it_ok : std_logic; -- Allow hardware interruptions
|
148 |
|
|
|
149 |
|
|
-- interface EX2 - MEM
|
150 |
|
|
signal EX_adr2 : bus32; -- Instruction address
|
151 |
|
|
signal EX_bra_confirm2 : std_logic; -- Branch execution confirmation
|
152 |
|
|
signal EX_data_ual2 : bus32; -- Ual result
|
153 |
|
|
signal EX_adresse2 : bus32; -- Address calculation result
|
154 |
|
|
signal ex_adresse_p2p1_s : bus32; -- resultado do calculo do endereco do desvio + 4 para pipe 1
|
155 |
|
|
signal EX_adr_reg_dest2 : adr_reg_type; -- Destination register for the result
|
156 |
|
|
signal EX_ecr_reg2 : std_logic; -- Effective writing of the result
|
157 |
|
|
signal EX_op_mem2 : std_logic; -- Memory operation needed
|
158 |
|
|
signal EX_r_w2 : std_logic; -- Type of memory operation (read or write)
|
159 |
|
|
signal EX_exc_cause2 : bus32; -- Potential cause exception
|
160 |
|
|
signal EX_level2 : level_type; -- Availability stage of result for bypassing
|
161 |
|
|
signal EX_it_ok2 : std_logic; -- Allow hardware interruptions
|
162 |
|
|
|
163 |
|
|
-- interface Controler - MEM
|
164 |
|
|
signal MTC_data : bus32; -- Data to write in memory
|
165 |
|
|
signal MTC_adr : bus32; -- Address for memory
|
166 |
|
|
signal MTC_r_w : std_logic; -- Read/Write in memory
|
167 |
|
|
signal MTC_req : std_logic; -- Request access to memory
|
168 |
|
|
signal CTM_data : bus32; -- Data from memory
|
169 |
|
|
|
170 |
|
|
-- interface Controler2 - MEM
|
171 |
|
|
signal MTC_data2 : bus32; -- Data to write in memory
|
172 |
|
|
signal MTC_adr2 : bus32; -- Address for memory
|
173 |
|
|
signal MTC_r_w2 : std_logic; -- Read/Write in memory
|
174 |
|
|
signal MTC_req2 : std_logic; -- Request access to memory
|
175 |
|
|
signal CTM_data2 : bus32; -- Data from memory
|
176 |
|
|
|
177 |
|
|
-- interface MEM - REG
|
178 |
|
|
signal MEM_adr : bus32; -- Instruction address
|
179 |
|
|
signal MEM_adr_reg_dest : adr_reg_type; -- Destination register address
|
180 |
|
|
signal MEM_ecr_reg : std_logic; -- Writing of the destination register
|
181 |
|
|
signal MEM_data_ecr : bus32; -- Data to write (from alu or memory)
|
182 |
|
|
signal MEM_exc_cause : bus32; -- Potential exception cause
|
183 |
|
|
signal MEM_level : level_type; -- Availability stage for the result for bypassing
|
184 |
|
|
signal MEM_it_ok : std_logic; -- Allow hardware interruptions
|
185 |
|
|
|
186 |
|
|
-- connexion to the register banks
|
187 |
|
|
|
188 |
|
|
-- Writing commands in the register banks
|
189 |
|
|
signal write_data : bus32; -- Data to write
|
190 |
|
|
signal write_adr : bus5; -- Address of the register to write
|
191 |
|
|
signal write_GPR : std_logic; -- Selection in the internal registers
|
192 |
|
|
signal write_SCP : std_logic; -- Selection in the coprocessor system registers
|
193 |
|
|
|
194 |
|
|
-- Reading commands for Reading in the registers
|
195 |
|
|
signal read_adr1 : bus5; -- Address of the first register to read
|
196 |
|
|
signal read_adr2 : bus5; -- Address of the second register to read
|
197 |
|
|
signal read_data1_GPR : bus32; -- Value of operand 1 from the internal registers
|
198 |
|
|
signal read_data1_SCP : bus32; -- Value of operand 2 from the internal registers
|
199 |
|
|
signal read_data2_GPR : bus32; -- Value of operand 1 from the coprocessor system registers
|
200 |
|
|
signal read_data2_SCP : bus32; -- Value of operand 2 from the coprocessor system registers
|
201 |
|
|
|
202 |
|
|
-- interface MEM - REG duplicado as entradas e saidas do REG
|
203 |
|
|
signal MEM_adr2 : bus32; -- Instruction address
|
204 |
|
|
signal MEM_adr_reg_dest2 : adr_reg_type; -- Destination register address
|
205 |
|
|
signal MEM_ecr_reg2 : std_logic; -- Writing of the destination register
|
206 |
|
|
signal MEM_data_ecr2 : bus32; -- Data to write (from alu or memory)
|
207 |
|
|
signal MEM_exc_cause2 : bus32; -- Potential exception cause
|
208 |
|
|
signal MEM_level2 : level_type; -- Availability stage for the result for bypassing
|
209 |
|
|
signal MEM_it_ok2 : std_logic; -- Allow hardware interruptions
|
210 |
|
|
|
211 |
|
|
-- connexion to the register banks
|
212 |
|
|
|
213 |
|
|
-- Writing commands in the register banks
|
214 |
|
|
signal write_data2 : bus32; -- Data to write
|
215 |
|
|
signal write_adr2 : bus5; -- Address of the register to write
|
216 |
|
|
signal write_GPR2 : std_logic; -- Selection in the internal registers
|
217 |
|
|
--signal write_SCP2 : std_logic; -- Selection in the coprocessor system registers
|
218 |
|
|
|
219 |
|
|
-- Reading commands for Reading in the registers
|
220 |
|
|
signal read_adr3 : bus5; -- Address of the first register to read
|
221 |
|
|
signal read_adr4 : bus5; -- Address of the second register to read
|
222 |
|
|
signal read_data3_GPR : bus32; -- Value of operand 1 from the internal registers
|
223 |
|
|
signal read_data3_SCP : bus32; -- Value of operand 2 from the internal registers
|
224 |
|
|
signal read_data4_GPR : bus32; -- Value of operand 1 from the coprocessor system registers
|
225 |
|
|
signal read_data4_SCP : bus32; -- Value of operand 2 from the coprocessor system registers
|
226 |
|
|
-- Interruption controls
|
227 |
|
|
signal interrupt : std_logic; -- Interruption to take into account
|
228 |
|
|
signal vecteur_it : bus32; -- Interruption vector
|
229 |
|
|
|
230 |
|
|
-- Sinais atrasados meio ciclo
|
231 |
|
|
signal DI_bra_D : std_logic;
|
232 |
|
|
signal bra_detect_D : std_logic;
|
233 |
|
|
signal EX_bra_confirm_D : std_logic;
|
234 |
|
|
signal alea_D : std_logic;
|
235 |
|
|
signal alea2_D : std_logic;
|
236 |
|
|
signal EX_bra_confirm2_D : std_logic;
|
237 |
|
|
signal bra_detect2_D : std_logic;
|
238 |
|
|
signal DI_bra2_D : std_logic;
|
239 |
|
|
signal iload_D : bus1; -- sem uso atual
|
240 |
|
|
signal istore_D : bus1;
|
241 |
|
|
signal istore2_D : bus1;
|
242 |
|
|
--
|
243 |
|
|
signal istore : bus1;
|
244 |
|
|
signal iload : bus1; -- sem uso atual
|
245 |
|
|
signal istore2 : bus1;
|
246 |
|
|
signal branch1 : std_logic;
|
247 |
|
|
signal branch2 : std_logic;
|
248 |
|
|
signal bra_adr_s : bus32;
|
249 |
|
|
signal bra_adr2_s : bus32;
|
250 |
|
|
signal aleaEI : bus1;
|
251 |
|
|
signal aleaDI : bus1;
|
252 |
|
|
signal alea2EI2 : bus1;
|
253 |
|
|
signal alea2DI2 : bus1;
|
254 |
|
|
signal ex2_data_hilo : bus64;--resultado da multiplicacao do pieline2 14-12-18
|
255 |
|
|
signal ex_data_hilo : bus64;--resultado da multiplicacao do pieline1
|
256 |
|
|
begin
|
257 |
|
|
|
258 |
|
|
aleaEI <= alea or alea2_D;
|
259 |
|
|
aleaDI <= alea or alea2_D;
|
260 |
|
|
alea2EI2 <= alea2 or alea_D;
|
261 |
|
|
alea2DI2 <= alea2 or alea_D;
|
262 |
|
|
|
263 |
|
|
stop_pf <= DI_bra or DI_bra2_D or bra_detect or bra_detect2_D or alea or alea2_D or istore2 or istore2_D;
|
264 |
|
|
genop <= bra_detect or bra_detect2_D or EX_bra_confirm or EX_bra_confirm2_D or DI_bra or DI_bra2_D or istore2 or istore2_D;
|
265 |
|
|
|
266 |
|
|
stop_pf2 <= DI_bra2 or DI_bra_D or bra_detect2 or bra_detect_D or alea2 or alea_D or istore or istore_D;
|
267 |
|
|
genop2 <= bra_detect2 or bra_detect_D or EX_bra_confirm2 or EX_bra_confirm_D or DI_bra2 or DI_bra_D or istore or istore_D;
|
268 |
|
|
|
269 |
|
|
branch1 <= EX_bra_confirm or EX_bra_confirm2_D;
|
270 |
|
|
branch2 <= EX_bra_confirm2 or EX_bra_confirm_D;
|
271 |
|
|
|
272 |
|
|
-- muxes para selecionar o endereco do branh apropriado 12-08-2018
|
273 |
|
|
with EX_bra_confirm2_D select
|
274 |
|
|
bra_adr_s <= ex_adresse_p2p1_s when '1',
|
275 |
|
|
EX_adresse when others;
|
276 |
|
|
with EX_bra_confirm_D select
|
277 |
|
|
bra_adr2_s <= ex_adresse_p1p2_s when '1',
|
278 |
|
|
EX_adresse2 when others;
|
279 |
|
|
|
280 |
|
|
-- Take into account the hardware interruption on rising edge
|
281 |
|
|
process (clock)
|
282 |
|
|
begin
|
283 |
|
|
if clock='1' and clock'event then
|
284 |
|
|
it_mat_clk <= it_mat;
|
285 |
|
|
end if;
|
286 |
|
|
end process;
|
287 |
|
|
|
288 |
|
|
U1_pf : pps_pf port map (
|
289 |
|
|
clock => clock,
|
290 |
|
|
clock2 => clock2,
|
291 |
|
|
reset => reset,
|
292 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the pipeline stage
|
293 |
|
|
stop_all2 => stop_all2,
|
294 |
|
|
-- entrees asynchrones
|
295 |
|
|
bra_adr => bra_adr_s,--EX_adresse, -- Branch
|
296 |
|
|
bra_cmd => branch1, -- Address to load when an effective branch
|
297 |
|
|
exch_adr => vecteur_it, -- Exception branch
|
298 |
|
|
exch_cmd => interrupt, -- Exception vector
|
299 |
|
|
-- entrees asynchrones 24\03\18
|
300 |
|
|
bra_adr2 => bra_adr2_s,-- EX_adresse2, -- Branch
|
301 |
|
|
bra_cmd2 => branch2, -- Address to load when an effective branch
|
302 |
|
|
exch_adr2 => vecteur_it, -- Exception branch
|
303 |
|
|
exch_cmd2 => interrupt, -- Exception vector
|
304 |
|
|
-- Lock the stage
|
305 |
|
|
stop_pf => stop_pf,
|
306 |
|
|
stop_pf2 => stop_pf2,--estava errado 'stop_pf' corrigido em 03-04-18
|
307 |
|
|
-- Synchronous output to EI stage
|
308 |
|
|
PF_pc => PF_pc, -- PC value
|
309 |
|
|
PF_pc_4 => PF_pc_4
|
310 |
|
|
);
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
U2_ei : pps_ei port map (
|
314 |
|
|
clock => clock,
|
315 |
|
|
reset => reset,
|
316 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
317 |
|
|
stop_all => stop_all, -- Evolution locking signal
|
318 |
|
|
|
319 |
|
|
-- Asynchronous inputs
|
320 |
|
|
stop_ei => aleaEI, -- Lock the EI_adr and Ei_instr registers
|
321 |
|
|
genop => genop, -- Send nops
|
322 |
|
|
|
323 |
|
|
-- interface Controler - EI
|
324 |
|
|
CTE_instr => CTE_instr, -- Instruction from the memory
|
325 |
|
|
ETC_adr => ETC_adr, -- Address to read in memory
|
326 |
|
|
|
327 |
|
|
-- Synchronous inputs from PF stage
|
328 |
|
|
PF_pc => PF_pc, -- Current value of the pc
|
329 |
|
|
|
330 |
|
|
-- Synchronous outputs to DI stage
|
331 |
|
|
EI_instr => EI_instr, -- Read interface
|
332 |
|
|
EI_adr => EI_adr, -- Address from the read instruction
|
333 |
|
|
EI_it_ok => EI_it_ok -- Allow hardware interruptions
|
334 |
|
|
);
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
U3_di : pps_di port map (
|
338 |
|
|
clock => clock,
|
339 |
|
|
reset => reset,
|
340 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the outputs
|
341 |
|
|
clear => interrupt, -- Clear the pipeline stage (nop in the outputs)
|
342 |
|
|
|
343 |
|
|
-- Asynchronous outputs
|
344 |
|
|
bra_detect => bra_detect, -- Branch detection in the current instruction
|
345 |
|
|
|
346 |
|
|
-- Asynchronous connexion with the register management and data bypass unit
|
347 |
|
|
adr_reg1 => adr_reg1, -- Address of the first register operand
|
348 |
|
|
adr_reg2 => adr_reg2, -- Address of the second register operand
|
349 |
|
|
use1 => use1, -- Effective use of operand 1
|
350 |
|
|
use2 => use2, -- Effective use of operand 2
|
351 |
|
|
--iload => iload,
|
352 |
|
|
istore => istore,
|
353 |
|
|
stop_di => aleaDI, -- Unresolved detected : send nop in the pipeline
|
354 |
|
|
data1 => data1, -- Operand register 1
|
355 |
|
|
data2 => data2, -- Operand register 2
|
356 |
|
|
|
357 |
|
|
-- Datas from EI stage
|
358 |
|
|
EI_adr => EI_adr, -- Address of the instruction
|
359 |
|
|
EI_instr => EI_instr, -- The instruction to decode
|
360 |
|
|
EI_it_ok => EI_it_ok, -- Allow hardware interruptions
|
361 |
|
|
|
362 |
|
|
-- Synchronous output to EX stage
|
363 |
|
|
DI_bra => DI_bra, -- Branch decoded
|
364 |
|
|
DI_link => DI_link, -- A link for that instruction
|
365 |
|
|
DI_op1 => DI_op1, -- operand 1 for alu
|
366 |
|
|
DI_op2 => DI_op2, -- operand 2 for alu
|
367 |
|
|
DI_code_ual => DI_code_ual, -- Alu operation
|
368 |
|
|
DI_offset => DI_offset, -- Offset for the address calculation
|
369 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest, -- Address of the destination register of the result
|
370 |
|
|
DI_ecr_reg => DI_ecr_reg, -- Effective writing of the result
|
371 |
|
|
DI_mode => DI_mode, -- Address mode (relative to pc or indexed to a register)
|
372 |
|
|
DI_op_mem => DI_op_mem, -- Memory operation request
|
373 |
|
|
DI_r_w => DI_r_w, -- Type of memory operation (reading or writing)
|
374 |
|
|
DI_adr => DI_adr, -- Address of the decoded instruction
|
375 |
|
|
DI_exc_cause => DI_exc_cause, -- Potential exception detected
|
376 |
|
|
DI_level => DI_level, -- Availability of the result for the data bypass
|
377 |
|
|
DI_it_ok => DI_it_ok -- Allow hardware interruptions
|
378 |
|
|
);
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
U4_ex : pps_ex port map (
|
382 |
|
|
clock => clock,
|
383 |
18 |
mcafruni |
clock2 => clock2,
|
384 |
2 |
mcafruni |
reset => reset,
|
385 |
|
|
stop_all => stop_all,
|
386 |
|
|
stop_all2 => stop_all2, -- Unconditionnal locking of outputs
|
387 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
388 |
|
|
|
389 |
|
|
-- Datas from DI stage
|
390 |
|
|
DI_bra => DI_bra, -- Branch instruction
|
391 |
|
|
DI_link => DI_link, -- Branch with link
|
392 |
|
|
DI_op1 => DI_op1, -- Operand 1 for alu
|
393 |
|
|
DI_op2 => DI_op2, -- Operand 2 for alu
|
394 |
|
|
DI_code_ual => DI_code_ual, -- Alu operation
|
395 |
|
|
DI_offset => DI_offset, -- Offset for address calculation
|
396 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest, -- Destination register address for the result
|
397 |
|
|
DI_ecr_reg => DI_ecr_reg, -- Effective writing of the result
|
398 |
|
|
DI_mode => DI_mode, -- Address mode (relative to pc ou index by a register)
|
399 |
|
|
DI_op_mem => DI_op_mem, -- Memory operation
|
400 |
|
|
DI_r_w => DI_r_w, -- Type of memory operation (read or write)
|
401 |
|
|
DI_adr => DI_adr, -- Instruction address
|
402 |
|
|
DI_exc_cause => DI_exc_cause, -- Potential cause exception
|
403 |
|
|
DI_level => DI_level, -- Availability stage of the result for bypassing
|
404 |
|
|
DI_it_ok => DI_it_ok, -- Allow hardware interruptions
|
405 |
|
|
EX2_data_hilo => ex2_data_hilo, -- entrada p resultado do hilo p2
|
406 |
|
|
EX_data_hilo => ex_data_hilo, -- saida p resultado do hilo p1
|
407 |
|
|
-- Synchronous outputs to MEM stage
|
408 |
|
|
EX_adr => EX_adr, -- Instruction address
|
409 |
|
|
EX_bra_confirm => EX_bra_confirm, -- Branch execution confirmation
|
410 |
|
|
EX_data_ual => EX_data_ual, -- Ual result
|
411 |
|
|
EX_adresse => EX_adresse, -- Address calculation result
|
412 |
|
|
EX_adresse_p1p2 => ex_adresse_p1p2_s, --resultado do calculo do endereco do desvio + 4 para pipe 2. 12-08-2018
|
413 |
|
|
EX_adr_reg_dest => EX_adr_reg_dest, -- Destination register for the result
|
414 |
|
|
EX_ecr_reg => EX_ecr_reg, -- Effective writing of the result
|
415 |
|
|
EX_op_mem => EX_op_mem, -- Memory operation needed
|
416 |
|
|
EX_r_w => EX_r_w, -- Type of memory operation (read or write)
|
417 |
|
|
EX_exc_cause => EX_exc_cause, -- Potential cause exception
|
418 |
|
|
EX_level => EX_level, -- Availability stage of result for bypassing
|
419 |
|
|
EX_it_ok => EX_it_ok -- Allow hardware interruptions
|
420 |
|
|
);
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
U5_mem : pps_mem port map (
|
424 |
|
|
clock => clock,
|
425 |
|
|
clock2 => clock2,
|
426 |
|
|
reset => reset,
|
427 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the outputs
|
428 |
|
|
stop_all2 => stop_all2,
|
429 |
|
|
|
430 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
431 |
|
|
|
432 |
|
|
-- Interface with the control bus
|
433 |
|
|
MTC_data => MTC_data, -- Data to write in memory
|
434 |
|
|
MTC_adr => MTC_adr, -- Address for memory
|
435 |
|
|
MTC_r_w => MTC_r_w, -- Read/Write in memory
|
436 |
|
|
MTC_req => MTC_req, -- Request access to memory
|
437 |
|
|
CTM_data => CTM_data, -- Data from memory
|
438 |
|
|
|
439 |
|
|
-- Datas from Execution stage
|
440 |
|
|
EX_adr => EX_adr, -- Instruction address
|
441 |
|
|
EX_data_ual => EX_data_ual, -- Result of alu operation
|
442 |
|
|
EX_adresse => EX_adresse, -- Result of the calculation of the address
|
443 |
|
|
EX_adresse_p1p2 => ex_adresse_p1p2_s, --resultado do calculo do endereco do desvio + 4 para pipe 2. 12-08-2018
|
444 |
|
|
EX_bra_confirm => EX_bra_confirm, -- Confirmacao do branch no pipe 1 (26-07-18)
|
445 |
|
|
EX_adr_reg_dest => EX_adr_reg_dest, -- Destination register address for the result
|
446 |
|
|
EX_ecr_reg => EX_ecr_reg, -- Effective writing of the result
|
447 |
|
|
EX_op_mem => EX_op_mem, -- Memory operation needed
|
448 |
|
|
EX_r_w => EX_r_w, -- Type of memory operation (read or write)
|
449 |
|
|
EX_exc_cause => EX_exc_cause, -- Potential exception cause
|
450 |
|
|
EX_level => EX_level, -- Availability stage for the result for bypassing
|
451 |
|
|
EX_it_ok => EX_it_ok, -- Allow hardware interruptions
|
452 |
|
|
|
453 |
|
|
-- Synchronous outputs for bypass unit
|
454 |
|
|
MEM_adr => MEM_adr, -- Instruction address
|
455 |
|
|
MEM_adr_reg_dest=>MEM_adr_reg_dest, -- Destination register address
|
456 |
|
|
MEM_ecr_reg => MEM_ecr_reg, -- Writing of the destination register
|
457 |
|
|
MEM_data_ecr => MEM_data_ecr, -- Data to write (from alu or memory)
|
458 |
|
|
MEM_exc_cause => MEM_exc_cause, -- Potential exception cause
|
459 |
|
|
MEM_level => MEM_level, -- Availability stage for the result for bypassing
|
460 |
|
|
MEM_it_ok => MEM_it_ok, -- Allow hardware interruptions
|
461 |
|
|
-- duplicacao
|
462 |
|
|
-- Interface with the control bus
|
463 |
|
|
MTC_data2 => MTC_data2, -- Data to write in memory
|
464 |
|
|
MTC_adr2 => MTC_adr2, -- Address for memory
|
465 |
|
|
MTC_r_w2 => MTC_r_w2, -- Read/Write in memory
|
466 |
|
|
MTC_req2 => MTC_req2, -- Request access to memory
|
467 |
|
|
CTM_data2 => CTM_data2, -- Data from memory
|
468 |
|
|
|
469 |
|
|
-- Datas from Execution 2 stage
|
470 |
|
|
EX_adr2 => EX_adr2, -- Instruction address
|
471 |
|
|
EX_data_ual2 => EX_data_ual2, -- Result of alu operation
|
472 |
|
|
EX_adresse2 => EX_adresse2, -- Result of the calculation of the address
|
473 |
|
|
EX_adresse_p2p1 => ex_adresse_p2p1_s, --resultado do calculo do endereco do desvio + 4 para pipe 1. 12-08-2018
|
474 |
|
|
EX_bra_confirm2 => EX_bra_confirm2, -- Confirmacao do branch no pipe 2 (26-07-18)
|
475 |
|
|
EX_adr_reg_dest2 => EX_adr_reg_dest2, -- Destination register address for the result
|
476 |
|
|
EX_ecr_reg2 => EX_ecr_reg2, -- Effective writing of the result
|
477 |
|
|
EX_op_mem2 => EX_op_mem2, -- Memory operation needed
|
478 |
|
|
EX_r_w2 => EX_r_w2, -- Type of memory operation (read or write)
|
479 |
|
|
EX_exc_cause2 => EX_exc_cause2, -- Potential exception cause
|
480 |
|
|
EX_level2 => EX_level2, -- Availability stage for the result for bypassing
|
481 |
|
|
EX_it_ok2 => EX_it_ok2, -- Allow hardware interruptions
|
482 |
|
|
|
483 |
|
|
-- Synchronous outputs for bypass unit
|
484 |
|
|
MEM_adr2 => MEM_adr2, -- Instruction address
|
485 |
|
|
MEM_adr_reg_dest2=>MEM_adr_reg_dest2, -- Destination register address
|
486 |
|
|
MEM_ecr_reg2 => MEM_ecr_reg2, -- Writing of the destination register
|
487 |
|
|
MEM_data_ecr2 => MEM_data_ecr2, -- Data to write (from alu or memory)
|
488 |
|
|
MEM_exc_cause2 => MEM_exc_cause2, -- Potential exception cause
|
489 |
|
|
MEM_level2 => MEM_level2, -- Availability stage for the result for bypassing
|
490 |
|
|
MEM_it_ok2 => MEM_it_ok2 -- Allow hardware interruptions
|
491 |
|
|
);
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
U6_renvoi : renvoi port map (
|
495 |
|
|
-- Register access signals
|
496 |
|
|
adr1 => adr_reg1, -- Operand 1 address
|
497 |
|
|
adr2 => adr_reg2, -- Operand 2 address
|
498 |
|
|
use1 => use1, -- Operand 1 utilisation
|
499 |
|
|
use2 => use2, -- Operand 2 utilisation
|
500 |
|
|
|
501 |
|
|
data1 => data1, -- First register value
|
502 |
|
|
data2 => data2, -- Second register value
|
503 |
|
|
alea => alea, -- Unresolved hazards detected
|
504 |
|
|
|
505 |
|
|
-- Bypass signals of the intermediary datas
|
506 |
|
|
DI_level => DI_level, -- Availability level of the data
|
507 |
|
|
DI_adr => DI_adr_reg_dest, -- Register destination of the result
|
508 |
|
|
DI_ecr => DI_ecr_reg, -- Writing register request
|
509 |
|
|
DI_data => DI_op2, -- Data to used
|
510 |
|
|
|
511 |
|
|
EX_level => EX_level, -- Availability level of the data
|
512 |
|
|
EX_adr => EX_adr_reg_dest, -- Register destination of the result
|
513 |
|
|
EX_ecr => EX_ecr_reg, -- Writing register request
|
514 |
|
|
EX_data => EX_data_ual, -- Data to used
|
515 |
|
|
|
516 |
|
|
MEM_level => MEM_level, -- Availability level of the data
|
517 |
|
|
MEM_adr => MEM_adr_reg_dest, -- Register destination of the result
|
518 |
|
|
MEM_ecr => MEM_ecr_reg, -- Writing register request
|
519 |
|
|
MEM_data => MEM_data_ecr, -- Data to used
|
520 |
|
|
|
521 |
|
|
interrupt => interrupt, -- Exceptions or interruptions
|
522 |
|
|
|
523 |
|
|
-- Connexion to the differents bank of register
|
524 |
|
|
|
525 |
|
|
-- Writing commands for writing in the registers
|
526 |
|
|
write_data => write_data, -- Data to write
|
527 |
|
|
write_adr => write_adr, -- Address of the register to write
|
528 |
|
|
write_GPR => write_GPR, -- Selection in the internal registers
|
529 |
|
|
write_SCP => write_SCP, -- Selection in the coprocessor system registers
|
530 |
|
|
|
531 |
|
|
-- Reading commands for Reading in the registers
|
532 |
|
|
read_adr1 => read_adr1, -- Address of the first register to read
|
533 |
|
|
read_adr2 => read_adr2, -- Address of the second register to read
|
534 |
|
|
read_data1_GPR => read_data1_GPR, -- Value of operand 1 from the internal registers
|
535 |
|
|
read_data1_SCP => read_data1_SCP, -- Value of operand 2 from the internal registers
|
536 |
|
|
read_data2_GPR => read_data2_GPR, -- Value of operand 1 from the coprocessor system registers
|
537 |
|
|
read_data2_SCP => read_data2_SCP, -- Value of operand 2 from the coprocessor system registers
|
538 |
|
|
-- duplicacao
|
539 |
|
|
-- Register access signals
|
540 |
|
|
adr3 => adr_reg3, -- Operand 1 address
|
541 |
|
|
adr4 => adr_reg4, -- Operand 2 address
|
542 |
|
|
use12 => use3, -- Operand 1 utilisation
|
543 |
|
|
use22 => use4, -- Operand 2 utilisation
|
544 |
|
|
|
545 |
|
|
data3 => data3, -- First register value
|
546 |
|
|
data4 => data4, -- Second register value
|
547 |
|
|
alea2 => alea2, -- Unresolved hazards detected
|
548 |
|
|
|
549 |
|
|
-- Bypass signals of the intermediary datas
|
550 |
|
|
DI_level2 => DI_level2, -- Availability level of the data
|
551 |
|
|
DI_adr2 => DI_adr_reg_dest2, -- Register destination of the result
|
552 |
|
|
DI_ecr2 => DI_ecr_reg2, -- Writing register request
|
553 |
|
|
DI_data2 => DI_op4, -- Data to used
|
554 |
|
|
|
555 |
|
|
EX_level2 => EX_level2, -- Availability level of the data
|
556 |
|
|
EX_adr2 => EX_adr_reg_dest2, -- Register destination of the result
|
557 |
|
|
EX_ecr2 => EX_ecr_reg2, -- Writing register request
|
558 |
|
|
EX_data2 => EX_data_ual2, -- Data to used
|
559 |
|
|
|
560 |
|
|
MEM_level2 => MEM_level2, -- Availability level of the data
|
561 |
|
|
MEM_adr2 => MEM_adr_reg_dest2, -- Register destination of the result
|
562 |
|
|
MEM_ecr2 => MEM_ecr_reg2, -- Writing register request
|
563 |
|
|
MEM_data2 => MEM_data_ecr2, -- Data to used
|
564 |
|
|
|
565 |
|
|
-- Connexion to the differents bank of register
|
566 |
|
|
|
567 |
|
|
-- Writing commands for writing in the registers
|
568 |
|
|
write_data2 => write_data2, -- Data to write
|
569 |
|
|
write_adr2 => write_adr2, -- Address of the register to write
|
570 |
|
|
write_GPR2 => write_GPR2, -- Selection in the internal registers
|
571 |
|
|
--write_SCP2 => write_SCP, -- Selection in the coprocessor system registers
|
572 |
|
|
|
573 |
|
|
-- Reading commands for Reading in the registers
|
574 |
|
|
read_adr3 => read_adr3, -- Address of the first register to read
|
575 |
|
|
read_adr4 => read_adr4, -- Address of the second register to read
|
576 |
|
|
read_data3_GPR => read_data3_GPR, -- Value of operand 1 from the internal registers
|
577 |
|
|
read_data3_SCP => read_data3_SCP, -- Value of operand 2 from the internal registers
|
578 |
|
|
read_data4_GPR => read_data4_GPR, -- Value of operand 1 from the coprocessor system registers
|
579 |
|
|
read_data4_SCP => read_data4_SCP -- Value of operand 2 from the coprocessor system registers
|
580 |
|
|
);
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
U7_banc : banc port map(
|
584 |
|
|
clock => clock,
|
585 |
|
|
clock2 => clock2,
|
586 |
|
|
reset => reset,
|
587 |
|
|
|
588 |
|
|
-- Register addresses to read
|
589 |
|
|
reg_src1 => read_adr1,
|
590 |
|
|
reg_src2 => read_adr2,
|
591 |
|
|
|
592 |
|
|
-- Register address to write and its data
|
593 |
|
|
reg_dest => write_adr,
|
594 |
|
|
donnee => write_data,
|
595 |
|
|
|
596 |
|
|
-- Write signal
|
597 |
|
|
cmd_ecr => write_GPR,
|
598 |
|
|
|
599 |
|
|
-- Bank outputs
|
600 |
|
|
data_src1 => read_data1_GPR,
|
601 |
|
|
data_src2 => read_data2_GPR,
|
602 |
|
|
|
603 |
|
|
-- Register addresses to read
|
604 |
|
|
reg_src3 => read_adr3,
|
605 |
|
|
reg_src4 => read_adr4,
|
606 |
|
|
|
607 |
|
|
-- Register address to write and its data
|
608 |
|
|
reg_dest2 => write_adr2,
|
609 |
|
|
donnee2 => write_data2,
|
610 |
|
|
|
611 |
|
|
-- Write signal
|
612 |
|
|
cmd_ecr2 => write_GPR2,
|
613 |
|
|
|
614 |
|
|
-- Bank outputs
|
615 |
|
|
data_src3 => read_data3_GPR,
|
616 |
|
|
data_src4 => read_data4_GPR
|
617 |
|
|
);
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
U8_syscop : syscop port map (
|
621 |
|
|
clock => clock,
|
622 |
|
|
reset => reset,
|
623 |
|
|
|
624 |
|
|
-- Datas from the pipeline
|
625 |
|
|
MEM_adr => MEM_adr, -- Address (PC) of the current instruction in the pipeline end -> responsible of the exception
|
626 |
|
|
MEM_exc_cause => MEM_exc_cause, -- Potential cause exception of that instruction
|
627 |
|
|
MEM_it_ok => MEM_it_ok, -- Allow hardware interruptions
|
628 |
|
|
|
629 |
|
|
-- Hardware interruption
|
630 |
|
|
it_mat => it_mat_clk, -- Hardware interruption detected
|
631 |
|
|
|
632 |
|
|
-- Interruption controls
|
633 |
|
|
interrupt => interrupt, -- Interruption to take into account
|
634 |
|
|
vecteur_it => vecteur_it, -- Interruption vector
|
635 |
|
|
|
636 |
|
|
-- Writing request in register bank
|
637 |
|
|
write_data => write_data, -- Data to write
|
638 |
|
|
write_adr => write_adr, -- Address of the register to write
|
639 |
|
|
write_SCP => write_SCP, -- Writing request
|
640 |
|
|
|
641 |
|
|
-- Reading request in register bank
|
642 |
|
|
read_adr1 => read_adr1, -- Address of the first register
|
643 |
|
|
read_adr2 => read_adr2, -- Address of the second register
|
644 |
|
|
read_data1 => read_data1_SCP, -- Value of register 1
|
645 |
|
|
read_data2 => read_data2_SCP, -- Value of register 2
|
646 |
|
|
--mod
|
647 |
|
|
MEM_adr2 => MEM_adr2,
|
648 |
|
|
MEM_exc_cause2 => MEM_exc_cause2,
|
649 |
|
|
MEM_it_ok2 => MEM_it_ok2,
|
650 |
|
|
|
651 |
|
|
write_data2 => write_data2,
|
652 |
|
|
write_adr2 => write_adr2,
|
653 |
|
|
write_SCP2 => zero,
|
654 |
|
|
|
655 |
|
|
read_adr3 => read_adr3,
|
656 |
|
|
read_adr4 => read_adr4,
|
657 |
|
|
read_data3 => read_data3_SCP,
|
658 |
|
|
read_data4 => read_data4_SCP
|
659 |
|
|
);
|
660 |
|
|
|
661 |
|
|
|
662 |
|
|
U9_bus_ctrl01 : bus_ctrl01 port map (
|
663 |
|
|
clock => clock,
|
664 |
|
|
reset => reset,
|
665 |
|
|
|
666 |
|
|
-- Interruption in the pipeline
|
667 |
|
|
interrupt => interrupt,
|
668 |
|
|
|
669 |
|
|
-- Interface for the Instruction Extraction Stage
|
670 |
|
|
adr_from_ei => ETC_adr, -- The address of the data to read
|
671 |
|
|
instr_to_ei => CTE_instr, -- Instruction from the memory
|
672 |
|
|
-- Interface with the MEMory Stage
|
673 |
|
|
req_from_mem => MTC_req, -- Request to access the ram
|
674 |
|
|
r_w_from_mem => MTC_r_w, -- Read/Write request
|
675 |
|
|
adr_from_mem => MTC_adr, -- Address in ram
|
676 |
|
|
data_from_mem => MTC_data, -- Data to write in ram
|
677 |
|
|
data_to_mem => CTM_data, -- Data from the ram to the MEMory stage
|
678 |
|
|
|
679 |
|
|
-- RAM interface signals
|
680 |
|
|
req_to_ram => ram_req, -- Request to ram
|
681 |
|
|
adr_to_ram => ram_adr, -- Address of the data to read or write
|
682 |
|
|
r_w_to_ram => ram_r_w, -- Read/Write request
|
683 |
|
|
ack_from_ram => ram_ack, -- Acknowledge from the memory
|
684 |
|
|
data_inout_ram => ram_data, -- Data from/to the memory
|
685 |
|
|
|
686 |
|
|
-- Pipeline progress control signal
|
687 |
|
|
stop_all => stop_all
|
688 |
|
|
);
|
689 |
|
|
|
690 |
|
|
|
691 |
|
|
U10_ei_2 : pps_ei_2 port map (
|
692 |
|
|
clock => clock2,
|
693 |
|
|
reset => reset,
|
694 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
695 |
|
|
stop_all2 => stop_all2, -- Evolution locking signal
|
696 |
|
|
|
697 |
|
|
-- Asynchronous inputs
|
698 |
|
|
stop_ei => alea2EI2, -- Lock the EI_adr and Ei_instr registers
|
699 |
|
|
genop => genop2, -- Send nops
|
700 |
|
|
|
701 |
|
|
-- interface Controler - EI
|
702 |
|
|
CTE_instr => CTE_instr2, -- Instruction from the memory
|
703 |
|
|
ETC_adr => ETC_adr2, -- Address to read in memory (ja feito pelo EI)
|
704 |
|
|
|
705 |
|
|
-- Synchronous inputs from PF stage
|
706 |
|
|
PF_pc => PF_pc_4, -- Current value of the pc + 4
|
707 |
|
|
|
708 |
|
|
-- Synchronous outputs to DI stage
|
709 |
|
|
EI_instr => EI_instr2, -- Read interface
|
710 |
|
|
EI_adr => EI_adr2, -- Address from the read instruction
|
711 |
|
|
EI_it_ok => EI_it_ok2 -- Allow hardware interruptions
|
712 |
|
|
);
|
713 |
|
|
|
714 |
|
|
|
715 |
|
|
U11_di2 : pps_di_2 port map (
|
716 |
|
|
clock => clock2,
|
717 |
|
|
reset => reset,
|
718 |
|
|
stop_all2 => stop_all2, -- Unconditionnal locking of the outputs
|
719 |
|
|
clear => interrupt, -- Clear the pipeline stage (nop in the outputs)
|
720 |
|
|
|
721 |
|
|
-- Asynchronous outputs
|
722 |
|
|
bra_detect => bra_detect2, -- Branch detection in the current instruction
|
723 |
|
|
|
724 |
|
|
-- Asynchronous connexion with the register management and data bypass unit
|
725 |
|
|
adr_reg1 => adr_reg3, -- Address of the first register operand
|
726 |
|
|
adr_reg2 => adr_reg4, -- Address of the second register operand
|
727 |
|
|
use1 => use3, -- Effective use of operand 1
|
728 |
|
|
use2 => use4, -- Effective use of operand 2
|
729 |
|
|
--iload2 => iload2,
|
730 |
|
|
istore2 => istore2,
|
731 |
|
|
stop_di => alea2DI2, -- Unresolved detected : send nop in the pipeline
|
732 |
|
|
data1 => data3, -- Operand register 1
|
733 |
|
|
data2 => data4, -- Operand register 2
|
734 |
|
|
|
735 |
|
|
-- Datas from EI stage
|
736 |
|
|
EI_adr => EI_adr2, -- Address of the instruction
|
737 |
|
|
EI_instr => EI_instr2, -- The instruction to decode
|
738 |
|
|
EI_it_ok => EI_it_ok2, -- Allow hardware interruptions
|
739 |
|
|
|
740 |
|
|
-- Synchronous output to EX2 stage
|
741 |
|
|
DI_bra => DI_bra2, -- Branch decoded
|
742 |
|
|
DI_link => DI_link2, -- A link for that instruction
|
743 |
|
|
DI_op1 => DI_op3, -- operand 1 for alu
|
744 |
|
|
DI_op2 => DI_op4, -- operand 2 for alu
|
745 |
|
|
DI_code_ual => DI_code_ual2, -- Alu operation
|
746 |
|
|
DI_offset => DI_offset2, -- Offset for the address calculation
|
747 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest2, -- Address of the destination register of the result
|
748 |
|
|
DI_ecr_reg => DI_ecr_reg2, -- Effective writing of the result
|
749 |
|
|
DI_mode => DI_mode2, -- Address mode (relative to pc or indexed to a register)
|
750 |
|
|
DI_op_mem => DI_op_mem2, -- Memory operation request
|
751 |
|
|
DI_r_w => DI_r_w2, -- Type of memory operation (reading or writing)
|
752 |
|
|
DI_adr => DI_adr2, -- Address of the decoded instruction
|
753 |
|
|
DI_exc_cause => DI_exc_cause2, -- Potential exception detected
|
754 |
|
|
DI_level => DI_level2, -- Availability of the result for the data bypass
|
755 |
|
|
DI_it_ok => DI_it_ok2 -- Allow hardware interruptions
|
756 |
|
|
);
|
757 |
|
|
|
758 |
|
|
|
759 |
|
|
U12_ex2 : pps_ex_2 port map (
|
760 |
|
|
clock => clock,
|
761 |
|
|
clock2 => clock2,
|
762 |
|
|
reset => reset,
|
763 |
|
|
stop_all => stop_all,
|
764 |
|
|
stop_all2 => stop_all2, -- Unconditionnal locking of outputs
|
765 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
766 |
|
|
|
767 |
|
|
-- Datas from DI2 stage
|
768 |
|
|
DI_bra => DI_bra2, -- Branch instruction
|
769 |
|
|
DI_link => DI_link2, -- Branch with link
|
770 |
|
|
DI_op1 => DI_op3, -- Operand 1 for alu
|
771 |
|
|
DI_op2 => DI_op4, -- Operand 2 for alu
|
772 |
|
|
DI_code_ual => DI_code_ual2, -- Alu operation
|
773 |
|
|
DI_offset => DI_offset2, -- Offset for address calculation
|
774 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest2, -- Destination register address for the result
|
775 |
|
|
DI_ecr_reg => DI_ecr_reg2, -- Effective writing of the result
|
776 |
|
|
DI_mode => DI_mode2, -- Address mode (relative to pc ou index by a register)
|
777 |
|
|
DI_op_mem => DI_op_mem2, -- Memory operation
|
778 |
|
|
DI_r_w => DI_r_w2, -- Type of memory operation (read or write)
|
779 |
|
|
DI_adr => DI_adr2, -- Instruction address
|
780 |
|
|
DI_exc_cause => DI_exc_cause2, -- Potential cause exception
|
781 |
|
|
DI_level => DI_level2, -- Availability stage of the result for bypassing
|
782 |
|
|
DI_it_ok => DI_it_ok2, -- Allow hardware interruptions
|
783 |
|
|
EX2_data_hilo => ex2_data_hilo, -- saida p resultado do hilo p2
|
784 |
|
|
EX_data_hilo => ex_data_hilo, -- entrada p resultado do hilo p1
|
785 |
|
|
-- Synchronous outputs to MEM stage
|
786 |
|
|
EX_adr => EX_adr2, -- Instruction address
|
787 |
|
|
EX_bra_confirm => EX_bra_confirm2, -- Branch execution confirmation
|
788 |
|
|
EX_data_ual => EX_data_ual2, -- Ual result
|
789 |
|
|
EX_adresse => EX_adresse2, -- Address calculation result
|
790 |
|
|
EX_adresse_p2p1 => ex_adresse_p2p1_s, --resultado do calculo do endereco do desvio + 4 para pipe 1. 12-08-2018
|
791 |
|
|
EX_adr_reg_dest => EX_adr_reg_dest2, -- Destination register for the result
|
792 |
|
|
EX_ecr_reg => EX_ecr_reg2, -- Effective writing of the result
|
793 |
|
|
EX_op_mem => EX_op_mem2, -- Memory operation needed
|
794 |
|
|
EX_r_w => EX_r_w2, -- Type of memory operation (read or write)
|
795 |
|
|
EX_exc_cause => EX_exc_cause2, -- Potential cause exception
|
796 |
|
|
EX_level => EX_level2, -- Availability stage of result for bypassing
|
797 |
|
|
EX_it_ok => EX_it_ok2 -- Allow hardware interruptions
|
798 |
|
|
);
|
799 |
|
|
|
800 |
|
|
U13_bus_ctrl02 : bus_ctrl02 port map (
|
801 |
|
|
clock => clock2,
|
802 |
|
|
reset => reset,
|
803 |
|
|
|
804 |
|
|
-- Interruption in the pipeline
|
805 |
|
|
interrupt => interrupt,
|
806 |
|
|
|
807 |
|
|
-- Interface for the Instruction Extraction Stage
|
808 |
|
|
adr_from_ei => ETC_adr2, -- The address of the data to read
|
809 |
|
|
instr_to_ei => CTE_instr2, -- Instruction from the memory
|
810 |
|
|
-- Interface with the MEMory Stage
|
811 |
|
|
req_from_mem => MTC_req2, -- Request to access the ram
|
812 |
|
|
r_w_from_mem => MTC_r_w2, -- Read/Write request
|
813 |
|
|
adr_from_mem => MTC_adr2, -- Address in ram
|
814 |
|
|
data_from_mem => MTC_data2, -- Data to write in ram
|
815 |
|
|
data_to_mem => CTM_data2, -- Data from the ram to the MEMory stage
|
816 |
|
|
|
817 |
|
|
-- RAM interface signals
|
818 |
|
|
req_to_ram => ram_req2, -- Request to ram
|
819 |
|
|
adr_to_ram => ram_adr2, -- Address of the data to read or write
|
820 |
|
|
r_w_to_ram => ram_r_w2, -- Read/Write request
|
821 |
|
|
ack_from_ram => ram_ack2, -- Acknowledge from the memory
|
822 |
|
|
data_inout_ram => ram_data2, -- Data from/to the memory
|
823 |
|
|
|
824 |
|
|
-- Pipeline progress control signal
|
825 |
|
|
stop_all => stop_all2
|
826 |
|
|
);
|
827 |
|
|
|
828 |
18 |
mcafruni |
U14_delay_gate : delay_gate port map (
|
829 |
2 |
mcafruni |
clock => clock,
|
830 |
|
|
in1 => DI_bra,
|
831 |
|
|
in2 => bra_detect,
|
832 |
|
|
in3 => EX_bra_confirm,
|
833 |
|
|
in4 => alea,
|
834 |
|
|
in5 => alea2,
|
835 |
|
|
in6 => EX_bra_confirm2,
|
836 |
|
|
in7 => bra_detect2,
|
837 |
|
|
in8 => DI_bra2,
|
838 |
|
|
in9 => istore,
|
839 |
|
|
in10 => istore2,
|
840 |
|
|
in11 => zero,
|
841 |
|
|
in12 => zero,
|
842 |
|
|
out1 => DI_bra_D,
|
843 |
|
|
out2 => bra_detect_D,
|
844 |
|
|
out3 => EX_bra_confirm_D,
|
845 |
|
|
out4 => alea_D,
|
846 |
|
|
out5 => alea2_D,
|
847 |
|
|
out6 => EX_bra_confirm2_D,
|
848 |
|
|
out7 => bra_detect2_D,
|
849 |
|
|
out8 => DI_bra2_D,
|
850 |
|
|
out9 => istore_D,
|
851 |
|
|
out10 => istore2_D,
|
852 |
|
|
out11 => iload,
|
853 |
|
|
out12 => iload_D
|
854 |
|
|
);
|
855 |
|
|
end rtl;
|