1 |
2 |
poppy |
------------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- Copyright (c) 2004, Hangouet Samuel --
|
4 |
|
|
-- , Jan Sebastien --
|
5 |
|
|
-- , Mouton Louis-Marie --
|
6 |
|
|
-- , Schneider Olivier all rights reserved --
|
7 |
|
|
-- --
|
8 |
|
|
-- This file is part of miniMIPS. --
|
9 |
|
|
-- --
|
10 |
|
|
-- miniMIPS is free software; you can redistribute it and/or modify --
|
11 |
5 |
poppy |
-- it under the terms of the GNU Lesser General Public License as published by --
|
12 |
|
|
-- the Free Software Foundation; either version 2.1 of the License, or --
|
13 |
2 |
poppy |
-- (at your option) any later version. --
|
14 |
|
|
-- --
|
15 |
|
|
-- miniMIPS is distributed in the hope that it will be useful, --
|
16 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
|
17 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
|
18 |
5 |
poppy |
-- GNU Lesser General Public License for more details. --
|
19 |
2 |
poppy |
-- --
|
20 |
5 |
poppy |
-- You should have received a copy of the GNU Lesser General Public License --
|
21 |
2 |
poppy |
-- along with miniMIPS; if not, write to the Free Software --
|
22 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
|
23 |
|
|
-- --
|
24 |
|
|
------------------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
-- If you encountered any problem, please contact :
|
28 |
|
|
--
|
29 |
|
|
-- lmouton@enserg.fr
|
30 |
|
|
-- oschneid@enserg.fr
|
31 |
|
|
-- shangoue@enserg.fr
|
32 |
|
|
--
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
--------------------------------------------------------------------------
|
36 |
|
|
-- --
|
37 |
|
|
-- --
|
38 |
|
|
-- miniMIPS Processor : miniMIPS processor --
|
39 |
|
|
-- --
|
40 |
|
|
-- --
|
41 |
|
|
-- --
|
42 |
|
|
-- Authors : Hangouet Samuel --
|
43 |
|
|
-- Jan Sébastien --
|
44 |
|
|
-- Mouton Louis-Marie --
|
45 |
|
|
-- Schneider Olivier --
|
46 |
|
|
-- --
|
47 |
5 |
poppy |
-- june 2004 --
|
48 |
2 |
poppy |
--------------------------------------------------------------------------
|
49 |
|
|
|
50 |
|
|
library ieee;
|
51 |
|
|
use ieee.std_logic_1164.all;
|
52 |
|
|
|
53 |
|
|
library work;
|
54 |
|
|
use work.pack_mips.all;
|
55 |
|
|
|
56 |
|
|
entity minimips is
|
57 |
|
|
port (
|
58 |
|
|
clock : in std_logic;
|
59 |
|
|
reset : in std_logic;
|
60 |
|
|
|
61 |
|
|
-- Ram connexion
|
62 |
|
|
ram_req : out std_logic;
|
63 |
|
|
ram_adr : out bus32;
|
64 |
|
|
ram_r_w : out std_logic;
|
65 |
|
|
ram_data : inout bus32;
|
66 |
|
|
ram_ack : in std_logic;
|
67 |
|
|
|
68 |
|
|
-- Hardware interruption
|
69 |
|
|
it_mat : in std_logic
|
70 |
|
|
);
|
71 |
|
|
end minimips;
|
72 |
|
|
|
73 |
|
|
architecture rtl of minimips is
|
74 |
|
|
|
75 |
|
|
-- General signals
|
76 |
|
|
signal stop_all : std_logic; -- Lock the pipeline evolution
|
77 |
|
|
signal it_mat_clk : std_logic; -- Synchronised hardware interruption
|
78 |
|
|
|
79 |
|
|
-- interface PF - EI
|
80 |
|
|
signal PF_pc : bus32; -- PC value
|
81 |
|
|
|
82 |
|
|
-- interface Controler - EI
|
83 |
|
|
signal CTE_instr : bus32; -- Instruction from the memory
|
84 |
|
|
signal ETC_adr : bus32; -- Address to read in memory
|
85 |
|
|
|
86 |
|
|
-- interface EI - DI
|
87 |
|
|
signal EI_instr : bus32; -- Read interface
|
88 |
|
|
signal EI_adr : bus32; -- Address from the read instruction
|
89 |
|
|
signal EI_it_ok : std_logic; -- Allow hardware interruptions
|
90 |
|
|
|
91 |
|
|
-- Asynchronous connexion with the bypass unit
|
92 |
|
|
signal adr_reg1 : adr_reg_type; -- Operand 1 address
|
93 |
|
|
signal adr_reg2 : adr_reg_type; -- Operand 2 address
|
94 |
|
|
signal use1 : std_logic; -- Operand 1 utilisation
|
95 |
|
|
signal use2 : std_logic; -- Operand 2 utilisation
|
96 |
|
|
signal data1 : bus32; -- First register value
|
97 |
|
|
signal data2 : bus32; -- Second register value
|
98 |
|
|
signal alea : std_logic; -- Unresolved hazards detected
|
99 |
|
|
|
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 EX - MEM
|
119 |
|
|
signal EX_adr : bus32; -- Instruction address
|
120 |
|
|
signal EX_bra_confirm : std_logic; -- Branch execution confirmation
|
121 |
|
|
signal EX_data_ual : bus32; -- Ual result
|
122 |
|
|
signal EX_adresse : bus32; -- Address calculation result
|
123 |
|
|
signal EX_adr_reg_dest : adr_reg_type; -- Destination register for the result
|
124 |
|
|
signal EX_ecr_reg : std_logic; -- Effective writing of the result
|
125 |
|
|
signal EX_op_mem : std_logic; -- Memory operation needed
|
126 |
|
|
signal EX_r_w : std_logic; -- Type of memory operation (read or write)
|
127 |
|
|
signal EX_exc_cause : bus32; -- Potential cause exception
|
128 |
|
|
signal EX_level : level_type; -- Availability stage of result for bypassing
|
129 |
|
|
signal EX_it_ok : std_logic; -- Allow hardware interruptions
|
130 |
|
|
|
131 |
|
|
-- interface Controler - MEM
|
132 |
|
|
signal MTC_data : bus32; -- Data to write in memory
|
133 |
|
|
signal MTC_adr : bus32; -- Address for memory
|
134 |
|
|
signal MTC_r_w : std_logic; -- Read/Write in memory
|
135 |
|
|
signal MTC_req : std_logic; -- Request access to memory
|
136 |
|
|
signal CTM_data : bus32; -- Data from memory
|
137 |
|
|
|
138 |
|
|
-- interface MEM - REG
|
139 |
|
|
signal MEM_adr : bus32; -- Instruction address
|
140 |
|
|
signal MEM_adr_reg_dest : adr_reg_type; -- Destination register address
|
141 |
|
|
signal MEM_ecr_reg : std_logic; -- Writing of the destination register
|
142 |
|
|
signal MEM_data_ecr : bus32; -- Data to write (from alu or memory)
|
143 |
|
|
signal MEM_exc_cause : bus32; -- Potential exception cause
|
144 |
|
|
signal MEM_level : level_type; -- Availability stage for the result for bypassing
|
145 |
|
|
signal MEM_it_ok : std_logic; -- Allow hardware interruptions
|
146 |
|
|
|
147 |
|
|
-- connexion to the register banks
|
148 |
|
|
|
149 |
|
|
-- Writing commands in the register banks
|
150 |
|
|
signal write_data : bus32; -- Data to write
|
151 |
|
|
signal write_adr : bus5; -- Address of the register to write
|
152 |
|
|
signal write_GPR : std_logic; -- Selection in the internal registers
|
153 |
|
|
signal write_SCP : std_logic; -- Selection in the coprocessor system registers
|
154 |
|
|
|
155 |
|
|
-- Reading commands for Reading in the registers
|
156 |
|
|
signal read_adr1 : bus5; -- Address of the first register to read
|
157 |
|
|
signal read_adr2 : bus5; -- Address of the second register to read
|
158 |
|
|
signal read_data1_GPR : bus32; -- Value of operand 1 from the internal registers
|
159 |
|
|
signal read_data1_SCP : bus32; -- Value of operand 2 from the internal registers
|
160 |
|
|
signal read_data2_GPR : bus32; -- Value of operand 1 from the coprocessor system registers
|
161 |
|
|
signal read_data2_SCP : bus32; -- Value of operand 2 from the coprocessor system registers
|
162 |
|
|
|
163 |
|
|
-- Interruption controls
|
164 |
|
|
signal interrupt : std_logic; -- Interruption to take into account
|
165 |
|
|
signal vecteur_it : bus32; -- Interruption vector
|
166 |
|
|
|
167 |
5 |
poppy |
-- Connexion with predict
|
168 |
|
|
signal PR_bra_cmd : std_logic; -- Defined a branch
|
169 |
|
|
signal PR_bra_bad : std_logic; -- Defined a branch to restore from a bad prediction
|
170 |
|
|
signal PR_bra_adr : std_logic_vector(31 downto 0); -- New PC
|
171 |
|
|
signal PR_clear : std_logic; -- Clear the three pipeline stage : EI, DI, EX
|
172 |
|
|
|
173 |
|
|
-- Clear asserted when interrupt or PR_clear are asserted
|
174 |
|
|
signal clear : std_logic;
|
175 |
|
|
|
176 |
2 |
poppy |
begin
|
177 |
|
|
|
178 |
5 |
poppy |
clear <= interrupt or PR_clear;
|
179 |
|
|
|
180 |
2 |
poppy |
-- Take into account the hardware interruption on rising edge
|
181 |
|
|
process (clock)
|
182 |
|
|
begin
|
183 |
|
|
if clock='1' and clock'event then
|
184 |
|
|
it_mat_clk <= it_mat;
|
185 |
|
|
end if;
|
186 |
|
|
end process;
|
187 |
|
|
|
188 |
|
|
U1_pf : pps_pf port map (
|
189 |
|
|
clock => clock,
|
190 |
|
|
reset => reset,
|
191 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the pipeline stage
|
192 |
|
|
|
193 |
|
|
-- entrees asynchrones
|
194 |
5 |
poppy |
bra_adr => PR_bra_adr, -- Branch
|
195 |
|
|
bra_cmd => PR_bra_cmd, -- Address to load when an effective branch
|
196 |
|
|
bra_cmd_pr => PR_bra_bad, -- Branch which have a priority on stop_pf (bad prediction branch)
|
197 |
2 |
poppy |
exch_adr => vecteur_it, -- Exception branch
|
198 |
|
|
exch_cmd => interrupt, -- Exception vector
|
199 |
|
|
-- Lock the stage
|
200 |
5 |
poppy |
stop_pf => alea,
|
201 |
2 |
poppy |
|
202 |
|
|
-- Synchronous output to EI stage
|
203 |
|
|
PF_pc => PF_pc -- PC value
|
204 |
|
|
);
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
U2_ei : pps_ei port map (
|
208 |
|
|
clock => clock,
|
209 |
|
|
reset => reset,
|
210 |
5 |
poppy |
clear => clear, -- Clear the pipeline stage
|
211 |
2 |
poppy |
stop_all => stop_all, -- Evolution locking signal
|
212 |
|
|
|
213 |
|
|
-- Asynchronous inputs
|
214 |
|
|
stop_ei => alea, -- Lock the EI_adr and Ei_instr registers
|
215 |
|
|
|
216 |
|
|
-- interface Controler - EI
|
217 |
|
|
CTE_instr => CTE_instr, -- Instruction from the memory
|
218 |
|
|
ETC_adr => ETC_adr, -- Address to read in memory
|
219 |
|
|
|
220 |
|
|
-- Synchronous inputs from PF stage
|
221 |
|
|
PF_pc => PF_pc, -- Current value of the pc
|
222 |
|
|
|
223 |
|
|
-- Synchronous outputs to DI stage
|
224 |
|
|
EI_instr => EI_instr, -- Read interface
|
225 |
|
|
EI_adr => EI_adr, -- Address from the read instruction
|
226 |
|
|
EI_it_ok => EI_it_ok -- Allow hardware interruptions
|
227 |
|
|
);
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
U3_di : pps_di port map (
|
231 |
|
|
clock => clock,
|
232 |
|
|
reset => reset,
|
233 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the outputs
|
234 |
5 |
poppy |
clear => clear, -- Clear the pipeline stage (nop in the outputs)
|
235 |
2 |
poppy |
|
236 |
|
|
-- Asynchronous connexion with the register management and data bypass unit
|
237 |
|
|
adr_reg1 => adr_reg1, -- Address of the first register operand
|
238 |
|
|
adr_reg2 => adr_reg2, -- Address of the second register operand
|
239 |
|
|
use1 => use1, -- Effective use of operand 1
|
240 |
|
|
use2 => use2, -- Effective use of operand 2
|
241 |
|
|
|
242 |
|
|
stop_di => alea, -- Unresolved detected : send nop in the pipeline
|
243 |
|
|
data1 => data1, -- Operand register 1
|
244 |
|
|
data2 => data2, -- Operand register 2
|
245 |
|
|
|
246 |
|
|
-- Datas from EI stage
|
247 |
|
|
EI_adr => EI_adr, -- Address of the instruction
|
248 |
|
|
EI_instr => EI_instr, -- The instruction to decode
|
249 |
|
|
EI_it_ok => EI_it_ok, -- Allow hardware interruptions
|
250 |
|
|
|
251 |
|
|
-- Synchronous output to EX stage
|
252 |
|
|
DI_bra => DI_bra, -- Branch decoded
|
253 |
|
|
DI_link => DI_link, -- A link for that instruction
|
254 |
|
|
DI_op1 => DI_op1, -- operand 1 for alu
|
255 |
|
|
DI_op2 => DI_op2, -- operand 2 for alu
|
256 |
|
|
DI_code_ual => DI_code_ual, -- Alu operation
|
257 |
|
|
DI_offset => DI_offset, -- Offset for the address calculation
|
258 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest, -- Address of the destination register of the result
|
259 |
|
|
DI_ecr_reg => DI_ecr_reg, -- Effective writing of the result
|
260 |
|
|
DI_mode => DI_mode, -- Address mode (relative to pc or indexed to a register)
|
261 |
|
|
DI_op_mem => DI_op_mem, -- Memory operation request
|
262 |
|
|
DI_r_w => DI_r_w, -- Type of memory operation (reading or writing)
|
263 |
|
|
DI_adr => DI_adr, -- Address of the decoded instruction
|
264 |
|
|
DI_exc_cause => DI_exc_cause, -- Potential exception detected
|
265 |
|
|
DI_level => DI_level, -- Availability of the result for the data bypass
|
266 |
|
|
DI_it_ok => DI_it_ok -- Allow hardware interruptions
|
267 |
|
|
);
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
U4_ex : pps_ex port map (
|
271 |
|
|
clock => clock,
|
272 |
|
|
reset => reset,
|
273 |
|
|
stop_all => stop_all, -- Unconditionnal locking of outputs
|
274 |
5 |
poppy |
clear => clear, -- Clear the pipeline stage
|
275 |
2 |
poppy |
|
276 |
|
|
-- Datas from DI stage
|
277 |
|
|
DI_bra => DI_bra, -- Branch instruction
|
278 |
|
|
DI_link => DI_link, -- Branch with link
|
279 |
|
|
DI_op1 => DI_op1, -- Operand 1 for alu
|
280 |
|
|
DI_op2 => DI_op2, -- Operand 2 for alu
|
281 |
|
|
DI_code_ual => DI_code_ual, -- Alu operation
|
282 |
|
|
DI_offset => DI_offset, -- Offset for address calculation
|
283 |
|
|
DI_adr_reg_dest => DI_adr_reg_dest, -- Destination register address for the result
|
284 |
|
|
DI_ecr_reg => DI_ecr_reg, -- Effective writing of the result
|
285 |
|
|
DI_mode => DI_mode, -- Address mode (relative to pc ou index by a register)
|
286 |
|
|
DI_op_mem => DI_op_mem, -- Memory operation
|
287 |
|
|
DI_r_w => DI_r_w, -- Type of memory operation (read or write)
|
288 |
|
|
DI_adr => DI_adr, -- Instruction address
|
289 |
|
|
DI_exc_cause => DI_exc_cause, -- Potential cause exception
|
290 |
|
|
DI_level => DI_level, -- Availability stage of the result for bypassing
|
291 |
|
|
DI_it_ok => DI_it_ok, -- Allow hardware interruptions
|
292 |
|
|
|
293 |
|
|
-- Synchronous outputs to MEM stage
|
294 |
|
|
EX_adr => EX_adr, -- Instruction address
|
295 |
|
|
EX_bra_confirm => EX_bra_confirm, -- Branch execution confirmation
|
296 |
|
|
EX_data_ual => EX_data_ual, -- Ual result
|
297 |
|
|
EX_adresse => EX_adresse, -- Address calculation result
|
298 |
|
|
EX_adr_reg_dest => EX_adr_reg_dest, -- Destination register for the result
|
299 |
|
|
EX_ecr_reg => EX_ecr_reg, -- Effective writing of the result
|
300 |
|
|
EX_op_mem => EX_op_mem, -- Memory operation needed
|
301 |
|
|
EX_r_w => EX_r_w, -- Type of memory operation (read or write)
|
302 |
|
|
EX_exc_cause => EX_exc_cause, -- Potential cause exception
|
303 |
|
|
EX_level => EX_level, -- Availability stage of result for bypassing
|
304 |
|
|
EX_it_ok => EX_it_ok -- Allow hardware interruptions
|
305 |
|
|
);
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
U5_mem : pps_mem port map (
|
309 |
|
|
clock => clock,
|
310 |
|
|
reset => reset,
|
311 |
|
|
stop_all => stop_all, -- Unconditionnal locking of the outputs
|
312 |
|
|
clear => interrupt, -- Clear the pipeline stage
|
313 |
|
|
|
314 |
|
|
-- Interface with the control bus
|
315 |
|
|
MTC_data => MTC_data, -- Data to write in memory
|
316 |
|
|
MTC_adr => MTC_adr, -- Address for memory
|
317 |
|
|
MTC_r_w => MTC_r_w, -- Read/Write in memory
|
318 |
|
|
MTC_req => MTC_req, -- Request access to memory
|
319 |
|
|
CTM_data => CTM_data, -- Data from memory
|
320 |
|
|
|
321 |
|
|
-- Datas from Execution stage
|
322 |
|
|
EX_adr => EX_adr, -- Instruction address
|
323 |
|
|
EX_data_ual => EX_data_ual, -- Result of alu operation
|
324 |
|
|
EX_adresse => EX_adresse, -- Result of the calculation of the address
|
325 |
|
|
EX_adr_reg_dest => EX_adr_reg_dest, -- Destination register address for the result
|
326 |
|
|
EX_ecr_reg => EX_ecr_reg, -- Effective writing of the result
|
327 |
|
|
EX_op_mem => EX_op_mem, -- Memory operation needed
|
328 |
|
|
EX_r_w => EX_r_w, -- Type of memory operation (read or write)
|
329 |
|
|
EX_exc_cause => EX_exc_cause, -- Potential exception cause
|
330 |
|
|
EX_level => EX_level, -- Availability stage for the result for bypassing
|
331 |
|
|
EX_it_ok => EX_it_ok, -- Allow hardware interruptions
|
332 |
|
|
|
333 |
|
|
-- Synchronous outputs for bypass unit
|
334 |
|
|
MEM_adr => MEM_adr, -- Instruction address
|
335 |
|
|
MEM_adr_reg_dest=>MEM_adr_reg_dest, -- Destination register address
|
336 |
|
|
MEM_ecr_reg => MEM_ecr_reg, -- Writing of the destination register
|
337 |
|
|
MEM_data_ecr => MEM_data_ecr, -- Data to write (from alu or memory)
|
338 |
|
|
MEM_exc_cause => MEM_exc_cause, -- Potential exception cause
|
339 |
|
|
MEM_level => MEM_level, -- Availability stage for the result for bypassing
|
340 |
|
|
MEM_it_ok => MEM_it_ok -- Allow hardware interruptions
|
341 |
|
|
);
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
U6_renvoi : renvoi port map (
|
345 |
|
|
-- Register access signals
|
346 |
|
|
adr1 => adr_reg1, -- Operand 1 address
|
347 |
|
|
adr2 => adr_reg2, -- Operand 2 address
|
348 |
|
|
use1 => use1, -- Operand 1 utilisation
|
349 |
|
|
use2 => use2, -- Operand 2 utilisation
|
350 |
|
|
|
351 |
|
|
data1 => data1, -- First register value
|
352 |
|
|
data2 => data2, -- Second register value
|
353 |
|
|
alea => alea, -- Unresolved hazards detected
|
354 |
|
|
|
355 |
|
|
-- Bypass signals of the intermediary datas
|
356 |
|
|
DI_level => DI_level, -- Availability level of the data
|
357 |
|
|
DI_adr => DI_adr_reg_dest, -- Register destination of the result
|
358 |
|
|
DI_ecr => DI_ecr_reg, -- Writing register request
|
359 |
|
|
DI_data => DI_op2, -- Data to used
|
360 |
|
|
|
361 |
|
|
EX_level => EX_level, -- Availability level of the data
|
362 |
|
|
EX_adr => EX_adr_reg_dest, -- Register destination of the result
|
363 |
|
|
EX_ecr => EX_ecr_reg, -- Writing register request
|
364 |
|
|
EX_data => EX_data_ual, -- Data to used
|
365 |
|
|
|
366 |
|
|
MEM_level => MEM_level, -- Availability level of the data
|
367 |
|
|
MEM_adr => MEM_adr_reg_dest, -- Register destination of the result
|
368 |
|
|
MEM_ecr => MEM_ecr_reg, -- Writing register request
|
369 |
|
|
MEM_data => MEM_data_ecr, -- Data to used
|
370 |
|
|
|
371 |
|
|
interrupt => interrupt, -- Exceptions or interruptions
|
372 |
|
|
|
373 |
|
|
-- Connexion to the differents bank of register
|
374 |
|
|
|
375 |
|
|
-- Writing commands for writing in the registers
|
376 |
|
|
write_data => write_data, -- Data to write
|
377 |
|
|
write_adr => write_adr, -- Address of the register to write
|
378 |
|
|
write_GPR => write_GPR, -- Selection in the internal registers
|
379 |
|
|
write_SCP => write_SCP, -- Selection in the coprocessor system registers
|
380 |
|
|
|
381 |
|
|
-- Reading commands for Reading in the registers
|
382 |
|
|
read_adr1 => read_adr1, -- Address of the first register to read
|
383 |
|
|
read_adr2 => read_adr2, -- Address of the second register to read
|
384 |
|
|
read_data1_GPR => read_data1_GPR, -- Value of operand 1 from the internal registers
|
385 |
|
|
read_data1_SCP => read_data1_SCP, -- Value of operand 2 from the internal registers
|
386 |
|
|
read_data2_GPR => read_data2_GPR, -- Value of operand 1 from the coprocessor system registers
|
387 |
|
|
read_data2_SCP => read_data2_SCP -- Value of operand 2 from the coprocessor system registers
|
388 |
|
|
);
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
U7_banc : banc port map(
|
392 |
|
|
clock => clock,
|
393 |
|
|
reset => reset,
|
394 |
|
|
|
395 |
|
|
-- Register addresses to read
|
396 |
|
|
reg_src1 => read_adr1,
|
397 |
|
|
reg_src2 => read_adr2,
|
398 |
|
|
|
399 |
|
|
-- Register address to write and its data
|
400 |
|
|
reg_dest => write_adr,
|
401 |
|
|
donnee => write_data,
|
402 |
|
|
|
403 |
|
|
-- Write signal
|
404 |
|
|
cmd_ecr => write_GPR,
|
405 |
|
|
|
406 |
|
|
-- Bank outputs
|
407 |
|
|
data_src1 => read_data1_GPR,
|
408 |
|
|
data_src2 => read_data2_GPR
|
409 |
|
|
);
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
U8_syscop : syscop port map (
|
413 |
|
|
clock => clock,
|
414 |
|
|
reset => reset,
|
415 |
|
|
|
416 |
|
|
-- Datas from the pipeline
|
417 |
|
|
MEM_adr => MEM_adr, -- Address of the current instruction in the pipeline end -> responsible of the exception
|
418 |
|
|
MEM_exc_cause => MEM_exc_cause, -- Potential cause exception of that instruction
|
419 |
|
|
MEM_it_ok => MEM_it_ok, -- Allow hardware interruptions
|
420 |
|
|
|
421 |
|
|
-- Hardware interruption
|
422 |
|
|
it_mat => it_mat_clk, -- Hardware interruption detected
|
423 |
|
|
|
424 |
|
|
-- Interruption controls
|
425 |
|
|
interrupt => interrupt, -- Interruption to take into account
|
426 |
|
|
vecteur_it => vecteur_it, -- Interruption vector
|
427 |
|
|
|
428 |
|
|
-- Writing request in register bank
|
429 |
|
|
write_data => write_data, -- Data to write
|
430 |
|
|
write_adr => write_adr, -- Address of the register to write
|
431 |
|
|
write_SCP => write_SCP, -- Writing request
|
432 |
|
|
|
433 |
|
|
-- Reading request in register bank
|
434 |
|
|
read_adr1 => read_adr1, -- Address of the first register
|
435 |
|
|
read_adr2 => read_adr2, -- Address of the second register
|
436 |
|
|
read_data1 => read_data1_SCP, -- Value of register 1
|
437 |
|
|
read_data2 => read_data2_SCP -- Value of register 2
|
438 |
|
|
);
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
U9_bus_ctrl : bus_ctrl port map (
|
442 |
|
|
clock => clock,
|
443 |
|
|
reset => reset,
|
444 |
|
|
|
445 |
|
|
-- Interruption in the pipeline
|
446 |
|
|
interrupt => interrupt,
|
447 |
|
|
|
448 |
|
|
-- Interface for the Instruction Extraction Stage
|
449 |
|
|
adr_from_ei => ETC_adr, -- The address of the data to read
|
450 |
|
|
instr_to_ei => CTE_instr, -- Instruction from the memory
|
451 |
|
|
|
452 |
|
|
-- Interface with the MEMory Stage
|
453 |
|
|
req_from_mem => MTC_req, -- Request to access the ram
|
454 |
|
|
r_w_from_mem => MTC_r_w, -- Read/Write request
|
455 |
|
|
adr_from_mem => MTC_adr, -- Address in ram
|
456 |
|
|
data_from_mem => MTC_data, -- Data to write in ram
|
457 |
|
|
data_to_mem => CTM_data, -- Data from the ram to the MEMory stage
|
458 |
|
|
|
459 |
|
|
-- RAM interface signals
|
460 |
|
|
req_to_ram => ram_req, -- Request to ram
|
461 |
|
|
adr_to_ram => ram_adr, -- Address of the data to read or write
|
462 |
|
|
r_w_to_ram => ram_r_w, -- Read/Write request
|
463 |
|
|
ack_from_ram => ram_ack, -- Acknowledge from the memory
|
464 |
|
|
data_inout_ram => ram_data, -- Data from/to the memory
|
465 |
|
|
|
466 |
|
|
-- Pipeline progress control signal
|
467 |
|
|
stop_all => stop_all
|
468 |
|
|
);
|
469 |
5 |
poppy |
|
470 |
|
|
U10_predict : predict port map (
|
471 |
|
|
clock => clock,
|
472 |
|
|
reset => reset,
|
473 |
|
|
|
474 |
|
|
-- Datas from PF pipeline stage
|
475 |
|
|
PF_pc => PF_pc, -- PC of the current instruction extracted
|
476 |
|
|
|
477 |
|
|
-- Datas from DI pipeline stage
|
478 |
|
|
DI_bra => DI_bra, -- Branch detected
|
479 |
|
|
DI_adr => DI_adr, -- Address of the branch
|
480 |
|
|
|
481 |
|
|
-- Datas from EX pipeline stage
|
482 |
|
|
EX_bra_confirm => EX_bra_confirm, -- Confirm if the branch test is ok
|
483 |
|
|
EX_adr => EX_adr, -- Address of the branch
|
484 |
|
|
EX_adresse => EX_adresse, -- Result of the branch
|
485 |
|
|
EX_uncleared => EX_it_ok, -- Define if the EX stage is cleared
|
486 |
|
|
|
487 |
|
|
-- Outputs to PF pipeline stage
|
488 |
|
|
PR_bra_cmd => PR_bra_cmd, -- Defined a branch
|
489 |
|
|
PR_bra_bad => PR_bra_bad, -- Defined a branch to restore from a bad prediction
|
490 |
|
|
PR_bra_adr => PR_bra_adr, -- New PC
|
491 |
|
|
|
492 |
|
|
-- Clear the three pipeline stage : EI, DI, EX
|
493 |
|
|
PR_clear => PR_clear
|
494 |
|
|
);
|
495 |
2 |
poppy |
|
496 |
|
|
end rtl;
|