1 | ---------------------------------------------------------------------------------- |
---|
2 | -- Company: |
---|
3 | -- Engineer: GAMOM NGOUNOU |
---|
4 | -- |
---|
5 | -- Create Date: 05:52:25 06/21/2011 |
---|
6 | -- Design Name: |
---|
7 | -- Module Name: CORE_MPI - Behavioral |
---|
8 | -- Project Name: |
---|
9 | -- Target Devices: |
---|
10 | -- Tool versions: |
---|
11 | -- Description: |
---|
12 | -- |
---|
13 | -- Dependencies: |
---|
14 | -- |
---|
15 | -- Revision: |
---|
16 | -- Revision 0.01 - File Created |
---|
17 | -- Additional Comments: |
---|
18 | -- |
---|
19 | ---------------------------------------------------------------------------------- |
---|
20 | library IEEE; |
---|
21 | Library NocLib; |
---|
22 | use IEEE.STD_LOGIC_1164.ALL; |
---|
23 | use IEEE.STD_LOGIC_ARITH.ALL; |
---|
24 | use IEEE.STD_LOGIC_UNSIGNED.ALL; |
---|
25 | use NocLib.CoreTypes.all; |
---|
26 | ---- Uncomment the following library declaration if instantiating |
---|
27 | ---- any Xilinx primitives in this code. |
---|
28 | --library UNISIM; |
---|
29 | --use UNISIM.VComponents.all; |
---|
30 | |
---|
31 | entity CORE_MPI is |
---|
32 | Port ( |
---|
33 | clk : in STD_LOGIC; |
---|
34 | reset : in STD_LOGIC; |
---|
35 | clkout : out std_logic; |
---|
36 | instruction : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
37 | instruction_en : in STD_LOGIC; --valide l'instruction |
---|
38 | instruction_fifo_full : out STD_LOGIC; |
---|
39 | ram_data_in : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
40 | barrier_completed : out STD_LOGIC; |
---|
41 | packet_received : out STD_LOGIC; |
---|
42 | packet_ack : in std_logic; |
---|
43 | PushOut : out STD_LOGIC_VECTOR (Word-1 downto 0); --le resultat de l'exécution |
---|
44 | ram_we : out STD_LOGIC; |
---|
45 | ram_en : out STD_LOGIC; |
---|
46 | ram_address_rd : out STD_LOGIC_VECTOR (15 downto 0); |
---|
47 | ram_address_wr : out STD_LOGIC_VECTOR (15 downto 0); |
---|
48 | ram_data_out : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
49 | hold_req : out STD_Logic; --requete vers application |
---|
50 | hold_ack : in STD_Logic; --autorisation par l'application |
---|
51 | switch_port_in_cmd_en : out std_logic; |
---|
52 | switch_port_out_data : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
53 | switch_port_in_wr_en : out STD_LOGIC; |
---|
54 | switch_port_in_full : in STD_LOGIC; |
---|
55 | switch_port_in_data : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
56 | switch_port_out_rd_en : out STD_LOGIC; |
---|
57 | switch_port_in_empty : in STD_LOGIC; |
---|
58 | switch_port_out_data_vailaible : in STD_LOGIC |
---|
59 | |
---|
60 | |
---|
61 | ); |
---|
62 | |
---|
63 | end CORE_MPI; |
---|
64 | |
---|
65 | architecture Structural of CORE_MPI is |
---|
66 | --déclaration des types |
---|
67 | type Type_Noc is |
---|
68 | record |
---|
69 | port_in_cmd_en : std_logic; |
---|
70 | port_out_data : STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
71 | port_in_wr_en : STD_LOGIC; |
---|
72 | port_in_empty : STD_LOGIC; |
---|
73 | port_in_full : STD_LOGIC; |
---|
74 | port_in_data : STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
75 | port_out_rd_en : STD_LOGIC; |
---|
76 | port_out_data_available : STD_LOGIC; |
---|
77 | end record; |
---|
78 | -- déclaration des composants MPI |
---|
79 | |
---|
80 | COMPONENT FIFO_64_FWFT |
---|
81 | PORT( |
---|
82 | clk : IN std_logic; |
---|
83 | din : IN std_logic_vector(Word-1 downto 0); |
---|
84 | rd_en : IN std_logic; |
---|
85 | srst : IN std_logic; |
---|
86 | wr_en : IN std_logic; |
---|
87 | dout : OUT std_logic_vector(Word-1 downto 0); |
---|
88 | empty : OUT std_logic; |
---|
89 | full : OUT std_logic |
---|
90 | ); |
---|
91 | END COMPONENT; |
---|
92 | COMPONENT load_instr |
---|
93 | Port ( Instruction : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
94 | Instruction_en : in STD_LOGIC; |
---|
95 | clk : in STD_LOGIC; |
---|
96 | reset : in STD_LOGIC; |
---|
97 | dma_rd_grant : in STD_LOGIC; |
---|
98 | dma_rd_request : out STD_LOGIC; |
---|
99 | instruction_ack : out STD_LOGIC; |
---|
100 | fifo_din : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
101 | fifo_wr :out std_logic; |
---|
102 | fifo_full : in STD_LOGIC; |
---|
103 | copying : out std_logic; |
---|
104 | Ram_rd_en : out STD_LOGIC; |
---|
105 | ram_address_rd : out STD_LOGIC_VECTOR (ADRLEN-1 downto 0); |
---|
106 | ram_data : in STD_LOGIC_VECTOR (WORD-1 downto 0)); |
---|
107 | end component; |
---|
108 | COMPONENT DMA_ARBITER |
---|
109 | PORT( |
---|
110 | |
---|
111 | clk : IN std_logic; |
---|
112 | reset : IN std_logic; |
---|
113 | dma_rd_request : IN std_logic_vector(3 downto 0); |
---|
114 | data_wr_in : IN std_logic_vector(Word-1 downto 0); |
---|
115 | data_rd_out : out std_logic_vector(Word-1 downto 0); |
---|
116 | address_rd : IN std_logic_vector(15 downto 0); |
---|
117 | address_wr : IN std_logic_vector(15 downto 0); |
---|
118 | |
---|
119 | dma_wr_request : IN std_logic_vector(3 downto 0); |
---|
120 | address_out_rd : OUT std_logic_vector(15 downto 0); |
---|
121 | address_out_wr : OUT std_logic_vector(15 downto 0); |
---|
122 | ram_en : OUT std_logic; |
---|
123 | ram_we : OUT std_logic; |
---|
124 | hold_req : out STD_Logic; --requete vers application |
---|
125 | hold_ack : in STD_Logic; --autorisation par l'application |
---|
126 | data_wr_mem : OUT std_logic_vector(Word-1 downto 0); |
---|
127 | data_rd_mem : IN std_logic_vector(Word-1 downto 0); |
---|
128 | dma_wr_grant : OUT std_logic_vector(3 downto 0); |
---|
129 | dma_rd_grant : OUT std_logic_vector(3 downto 0) |
---|
130 | ); |
---|
131 | END COMPONENT; |
---|
132 | |
---|
133 | COMPONENT EX1_FSM |
---|
134 | PORT( |
---|
135 | clk : IN std_logic; |
---|
136 | reset : IN std_logic; |
---|
137 | |
---|
138 | pid : in std_logic_vector (3 downto 0); --port id |
---|
139 | nprocs : in std_logic_vector (3 downto 0); -- la taille du Noc |
---|
140 | instruction_en : in std_logic; |
---|
141 | fifo_empty : IN std_logic; |
---|
142 | fifo_data_out : IN std_logic_vector(Word-1 downto 0); |
---|
143 | fifo_rd_en : OUT std_logic; |
---|
144 | ram_data_in : IN std_logic_vector(Word-1 downto 0); |
---|
145 | ram_data_out : out std_logic_vector(Word-1 downto 0); |
---|
146 | dma_rd_grant : IN std_logic; |
---|
147 | dma_wr_grant : IN std_logic; |
---|
148 | dma_wr_request : OUT std_logic; |
---|
149 | dma_rd_request : OUT std_logic; |
---|
150 | ram_address : OUT std_logic_vector(15 downto 0); |
---|
151 | ram_rd,ram_wr : out std_logic; |
---|
152 | |
---|
153 | priority_rotation : OUT std_logic; |
---|
154 | |
---|
155 | switch_port_in_data : OUT std_logic_vector(Word-1 downto 0); |
---|
156 | switch_port_in_wr_en : OUT std_logic; |
---|
157 | switch_port_in_full : IN std_logic; |
---|
158 | Result :out std_logic_vector(Word-1 downto 0); |
---|
159 | AppInitReq :out STD_LOGIC; -- requête d'initialisation de l'application |
---|
160 | AppInitAck :in STD_LOGIC; -- Acquitement d'initialisation |
---|
161 | Initialized:in std_logic -- état de la Lib |
---|
162 | ); |
---|
163 | END COMPONENT; |
---|
164 | |
---|
165 | COMPONENT EX2_FSM |
---|
166 | PORT( |
---|
167 | clk : IN std_logic; |
---|
168 | reset : IN std_logic; |
---|
169 | |
---|
170 | instruction_en: in std_logic; |
---|
171 | Initialized : in std_logic; |
---|
172 | |
---|
173 | switch_port_out_rd_en : OUT std_logic ; |
---|
174 | switch_data_available : IN std_logic; |
---|
175 | switch_port_out_data : IN std_logic_vector(Word-1 downto 0); |
---|
176 | AppRank : in STD_LOGIC_VECTOR; |
---|
177 | AppSize : in STD_LOGIC_VECTOR; |
---|
178 | dma_wr_grant : IN std_logic; |
---|
179 | dma_wr_request : OUT std_logic; |
---|
180 | dma_rd_grant : IN std_logic; |
---|
181 | dma_rd_request : OUT std_logic; |
---|
182 | ram_address : OUT std_logic_vector(15 downto 0); |
---|
183 | ram_rd,ram_wr : out std_logic; |
---|
184 | Ram_data_out : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
185 | Ram_data_in : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
186 | fifo_full : IN std_logic; |
---|
187 | fifo_data : OUT std_logic_vector(Word-1 downto 0); |
---|
188 | fifo_wr_en : OUT std_logic; |
---|
189 | --fifo_out : out std_logic_vector; |
---|
190 | |
---|
191 | packet_received : OUT std_logic; |
---|
192 | packet_ack : IN std_logic; |
---|
193 | barrier_completed : OUT std_logic; |
---|
194 | Ready : Out std_logic; |
---|
195 | AppInitAck : in std_logic; |
---|
196 | AppInitReq : out std_logic |
---|
197 | ); |
---|
198 | END COMPONENT; |
---|
199 | |
---|
200 | |
---|
201 | COMPONENT EX3_FSM |
---|
202 | PORT( |
---|
203 | instruction : IN std_logic_vector(Word-1 downto 0); |
---|
204 | clk : IN std_logic; |
---|
205 | reset : IN std_logic; |
---|
206 | Ismain :in std_logic; |
---|
207 | ResOut : OUT std_logic_vector(Word-1 downto 0) |
---|
208 | |
---|
209 | ); |
---|
210 | END COMPONENT; |
---|
211 | |
---|
212 | COMPONENT EX4_FSM |
---|
213 | PORT( |
---|
214 | Instruction : in STD_LOGIC_VECTOR (Word-1 downto 0); --permet de lire le FIFO |
---|
215 | Instruction_En : in STD_LOGIC; |
---|
216 | clk : in STD_LOGIC; |
---|
217 | reset : in STD_LOGIC; |
---|
218 | ResultOut : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
219 | Result_En : out STD_LOGIC; |
---|
220 | NocSize : out STD_LOGIC_VECTOR; |
---|
221 | AppRank : out STD_LOGIC_VECTOR; |
---|
222 | AppSize : out STD_LOGIC_VECTOR; |
---|
223 | IsMain : out STD_LOGIC; |
---|
224 | Initialized : out STD_LOGIC; |
---|
225 | dma_wr_req : out std_logic; |
---|
226 | dma_wr_grant : in std_logic; |
---|
227 | AdrRam : out STD_LOGIC_VECTOR (15 downto 0); --accès au stockage |
---|
228 | WeRam : out STD_LOGIC; --activation de l'écriture en RAM |
---|
229 | DataRam : out STD_LOGIC_VECTOR (Word-1 downto 0);--données des ports |
---|
230 | AppAck : in STD_LOGIC; |
---|
231 | AppReq : in STD_LOGIC; |
---|
232 | PortId : out STD_LOGIC_VECTOR(3 downto 0); |
---|
233 | port_in_cmd_en : out STD_LOGIC; |
---|
234 | port_in_wr_en : out STD_LOGIC; |
---|
235 | port_in_empty : in STD_LOGIC; |
---|
236 | port_in_full : in STD_LOGIC; |
---|
237 | port_in_data : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
238 | port_out_data : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
239 | port_out_rd_en : out STD_LOGIC; |
---|
240 | port_out_data_available : in STD_LOGIC); |
---|
241 | END COMPONENT; |
---|
242 | |
---|
243 | COMPONENT EX0_FSM |
---|
244 | PORT( |
---|
245 | clk : in STD_LOGIC; |
---|
246 | reset : in STD_LOGIC; |
---|
247 | |
---|
248 | Initialized : in STD_LOGIC; |
---|
249 | Instruction : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
250 | instruction_en: in STD_LOGIC; |
---|
251 | |
---|
252 | ClkRate : in STD_LOGIC_VECTOR ; |
---|
253 | uTimeResult : out STD_LOGIC_VECTOR; |
---|
254 | TickResult : out STD_LOGIC_VECTOR |
---|
255 | ); |
---|
256 | END COMPONENT; |
---|
257 | |
---|
258 | |
---|
259 | COMPONENT MPI_CORE_SCHEDULER |
---|
260 | PORT( |
---|
261 | clk : IN std_logic; |
---|
262 | reset : IN std_logic; |
---|
263 | priority_rotation : IN std_logic; |
---|
264 | instruction_fifo_empty : IN std_logic; |
---|
265 | instruction_fifo_rd_en : OUT std_logic; |
---|
266 | instruction_fifo_data : IN std_logic_vector(Word-1 downto 0); |
---|
267 | instruction_available : OUT std_logic; |
---|
268 | |
---|
269 | get_request_fifo_empty : IN std_logic; |
---|
270 | get_request_fifo_rd_en : OUT std_logic; |
---|
271 | get_request_fifo_data : IN std_logic_vector(Word-1 downto 0); |
---|
272 | |
---|
273 | fifo_rd_en : IN std_logic; |
---|
274 | fifo_empty : OUT std_logic; |
---|
275 | fifo_selected : OUT std_logic; |
---|
276 | |
---|
277 | data_out : OUT std_logic_vector(Word-1 downto 0) |
---|
278 | |
---|
279 | |
---|
280 | ); |
---|
281 | END COMPONENT; |
---|
282 | |
---|
283 | -- declaration des signaux d'interconnexion entre les modules du coresignal fifo_sel: std_logic; -- indique l'un des deux fifos d'instructions qui sont prêts |
---|
284 | signal fifo_instr : std_logic; -- une instruction est prête dans les fifos d'instruction |
---|
285 | |
---|
286 | |
---|
287 | signal scheduler_fifo_empty : std_logic; |
---|
288 | signal scheduler_data_out : std_logic_vector(Word-1 downto 0); |
---|
289 | signal dma_arbiter_data_rd_out : std_logic_vector(Word-1 downto 0); |
---|
290 | |
---|
291 | signal scheduler_priority_rotation : std_logic; |
---|
292 | signal scheduler_rd_en : std_logic; |
---|
293 | |
---|
294 | signal dma_data_rd,dma_data_wr : std_logic_vector(Word-1 downto 0); -- bus à 3 états |
---|
295 | signal dma_rd_address,dma_rd_address1,dma_rd_address2 : std_logic_vector(15 downto 0); -- ces bus doivent être gérés en logique 3 états! |
---|
296 | signal dma_rd_address3 : std_logic_vector(15 downto 0); |
---|
297 | signal dma_wr_address1,dma_wr_address3 : std_logic_vector(15 downto 0); |
---|
298 | signal dma_wr_address2,dma_wr_address4 : std_logic_vector(15 downto 0); |
---|
299 | signal dma_wr_address : std_logic_vector(15 downto 0); |
---|
300 | signal switch_port_in_data_signal : std_logic_vector(Word-1 downto 0); |
---|
301 | signal ram_data_out_signal : std_logic_vector(Word-1 downto 0); |
---|
302 | signal weram,rdram,ram_wev,ram_env :std_logic:='0'; |
---|
303 | |
---|
304 | signal instruction_fifo2_signal : std_logic_vector(Word-1 downto 0); |
---|
305 | signal Ex_EN : std_logic_vector(4 downto 1):=(others=>'0'); --active les sous MAE permettant de décoder les instructions MPI |
---|
306 | signal Ex1_RDY,Ex2_RDY,EX3_RDY,EX4_RDY : std_logic; -- indique la fin de l'exécution de la MAE |
---|
307 | signal ex1_ram_rd,ex2_ram_rd,ex4_ram_rd ,Exi_ram_rd: std_logic ; -- validation lecture des données en RAM |
---|
308 | signal ex1_ram_wr,ex2_ram_wr,ex4_ram_wr,Exi_ram_wr : std_logic ; -- validation écriture des données en RAM |
---|
309 | signal Exi_busy : std_logic; |
---|
310 | signal Ex1_Result,Ex4_result : std_logic_vector(Word-1 downto 0); |
---|
311 | |
---|
312 | --================interface DMA avec les modules ====================================== |
---|
313 | signal dma_data_in,Dma_data_in1,dma_data_in2,dma_data_in4 : std_logic_vector(Word-1 downto 0); |
---|
314 | signal dma_data_out : std_logic_vector(Word-1 downto 0); |
---|
315 | signal dma_rd_request :std_logic_vector(4 downto 1):=(others=>'0'); |
---|
316 | signal dma_wr_request :std_logic_vector(4 downto 1):=(others=>'0'); |
---|
317 | signal dma_wr_grant,dma_rd_grant:std_logic_vector(4 downto 1); |
---|
318 | -- |
---|
319 | --====================================================================================== |
---|
320 | --connexion au switch |
---|
321 | |
---|
322 | signal Noc1,NOC2,NOC3 : Type_Noc; -- regroupement des signaux qui vont au Noc |
---|
323 | |
---|
324 | --================================================================ |
---|
325 | --déclaration des signaux d'état du Core |
---|
326 | signal IsMain,SizeSet,RankSet,Initialized,AppReq,AppAck:std_logic; |
---|
327 | signal InitReq,InitReq1,InitReq2 :std_logic; -- demande d'initialisation |
---|
328 | signal InitAck,IAck,Ilatch : std_logic; |
---|
329 | signal MPISize,MyRank : std_logic_vector(3 downto 0); |
---|
330 | signal LibState: std_logic_vector(Word-1 downto 0); --ready,receiving,sending,spawning,rwaiting,swaiting,... |
---|
331 | signal NocSize :std_logic_vector(3 downto 0); |
---|
332 | Signal PortId : std_logic_vector(3 downto 0); |
---|
333 | Signal uClkRate : std_logic_vector(Word-1 downto 0):="00011010"; --50 Mhz |
---|
334 | signal uTimeCount :std_logic_vector(31 downto 0); |
---|
335 | signal TickCount : std_logic_vector(31 downto 0); |
---|
336 | signal RankSize: std_logic_vector(Word-1 downto 0); |
---|
337 | --======================================================== |
---|
338 | --déclaration des signaux permettant d'activer le module |
---|
339 | signal AdrSelect : std_logic_vector(ADRLEN-1 downto 0); |
---|
340 | --======================================================== |
---|
341 | --signal PushOut_d,RankSize,TickUsOut:std_logic_vector; --résultat de l'execution des commandes mpi |
---|
342 | --======================================================== |
---|
343 | --connexion avec les FIFO instructions |
---|
344 | signal fifo1_wr : std_logic; |
---|
345 | signal fifo1_din : std_logic_vector (Word-1 downto 0); |
---|
346 | signal fifo_sel : std_logic; --permet d'arbitrer la priorité de lecture entre les deux fifos |
---|
347 | signal instruction_fifo1_rd_en : std_logic; |
---|
348 | signal fifo1_full : std_logic; |
---|
349 | signal instruction_fifo1_empty : std_logic; |
---|
350 | signal instruction_fifo1_data_out : std_logic_vector(Word-1 downto 0); |
---|
351 | signal instruction_fifo2_rd_en : std_logic; |
---|
352 | signal instruction_fifo2_data_out : std_logic_vector(Word-1 downto 0); |
---|
353 | signal instruction_fifo2_data_in : std_logic_vector(Word-1 downto 0); |
---|
354 | signal instruction_fifo2_wr_en : std_logic; |
---|
355 | signal instruction_fifo2_empty : std_logic; |
---|
356 | signal instruction_fifo2_full : std_logic; |
---|
357 | |
---|
358 | --=========================================================== |
---|
359 | |
---|
360 | begin |
---|
361 | --switch_port_in_data_signal <= ; |
---|
362 | --switch_port_out_data_signal <= ; |
---|
363 | -- istanciation des composants du core MPI |
---|
364 | Instruction_Fifo1: FIFO_64_FWFT PORT MAP( |
---|
365 | clk =>clk, |
---|
366 | din =>fifo1_din, |
---|
367 | rd_en => instruction_fifo1_rd_en, |
---|
368 | srst => reset, |
---|
369 | wr_en => fifo1_wr, |
---|
370 | dout =>instruction_fifo1_data_out, |
---|
371 | empty => instruction_fifo1_empty, |
---|
372 | full => fifo1_full |
---|
373 | ); |
---|
374 | |
---|
375 | Instruction_Fifo2: FIFO_64_FWFT PORT MAP( |
---|
376 | clk =>clk, |
---|
377 | din => instruction_fifo2_data_in , |
---|
378 | rd_en =>instruction_fifo2_rd_en, |
---|
379 | srst =>reset, |
---|
380 | wr_en =>instruction_fifo2_wr_en, |
---|
381 | dout =>instruction_fifo2_data_out, |
---|
382 | empty =>instruction_fifo2_empty, |
---|
383 | full => instruction_fifo2_full |
---|
384 | ); |
---|
385 | LD_instr:load_instr PORT MAP ( |
---|
386 | |
---|
387 | Instruction =>Instruction, |
---|
388 | Instruction_en =>Instruction_en, |
---|
389 | clk =>clk, |
---|
390 | reset =>reset, |
---|
391 | dma_rd_grant =>dma_rd_grant(3), |
---|
392 | dma_rd_request =>dma_rd_request(3), |
---|
393 | copying=> Exi_busy, |
---|
394 | instruction_ack =>iack, --indique la fin de la copie d'une instruction dans le FIFO |
---|
395 | fifo_din => fifo1_din, |
---|
396 | fifo_wr => fifo1_wr, |
---|
397 | fifo_full =>fifo1_full, |
---|
398 | Ram_rd_en=> Exi_ram_rd, |
---|
399 | ram_address_rd => dma_rd_address3, |
---|
400 | ram_data =>dma_data_out --sortie DMA |
---|
401 | ); |
---|
402 | |
---|
403 | pushout(0)<=ILatch; |
---|
404 | pushout(1)<=IsMain; |
---|
405 | pushout(2)<=SizeSet; |
---|
406 | pushout(3)<=RankSet; |
---|
407 | pushout(4)<=Initialized; |
---|
408 | pushout(5)<=Ex1_result(1); -- |
---|
409 | |
---|
410 | |
---|
411 | MPI_CORE_EX0_FSM: EX0_FSM PORT MAP( |
---|
412 | instruction => instruction_fifo1_data_out, |
---|
413 | instruction_en=> '1', |
---|
414 | uTimeResult => uTimeCount, |
---|
415 | TickResult => TickCount, |
---|
416 | Initialized => Initialized, -- indique si la l'appel à init a été concluant |
---|
417 | ClkRate => uClkRate, |
---|
418 | clk =>clk , |
---|
419 | reset => reset |
---|
420 | ); |
---|
421 | MPI_CORE_EX1_FSM: EX1_FSM PORT MAP( |
---|
422 | clk =>clk , |
---|
423 | reset =>reset, |
---|
424 | pid => MyRank, --port Id |
---|
425 | nprocs=>MPISize, -- à revoir dans certains cas ou tous les PEs ne sont pas connectés |
---|
426 | fifo_empty => scheduler_fifo_empty , |
---|
427 | fifo_data_out =>scheduler_data_out, |
---|
428 | fifo_rd_en =>scheduler_rd_en, |
---|
429 | priority_rotation => scheduler_priority_rotation, |
---|
430 | |
---|
431 | instruction_en=>Ex_en(1), --active le module |
---|
432 | |
---|
433 | switch_port_in_full =>Noc1.port_in_full, --ces signaux doivent être contrôlés en 3 state logic |
---|
434 | switch_port_in_data =>Noc1.port_in_data, |
---|
435 | switch_port_in_wr_en =>Noc1.Port_in_wr_en , |
---|
436 | |
---|
437 | Ram_rd => ex1_ram_rd, |
---|
438 | Ram_wr =>ex1_ram_wr, |
---|
439 | ram_data_in =>dma_data_out, |
---|
440 | Ram_data_out =>dma_data_in1, |
---|
441 | ram_address=>dma_wr_address1, |
---|
442 | --ram_address =>dma_rd_address2, --la même adresse sert pour la lecture ou l'écriture |
---|
443 | dma_rd_request =>dma_rd_request(1), |
---|
444 | dma_wr_request =>dma_wr_request(1), |
---|
445 | dma_rd_grant =>dma_rd_grant(1) , |
---|
446 | dma_wr_grant =>dma_wr_grant(1) , |
---|
447 | |
---|
448 | AppInitReq => InitReq1, -- requête d'initialisation de l'application |
---|
449 | AppInitAck =>Ex4_rdy , -- Acquitement d'initialisation |
---|
450 | Initialized=>Initialized, -- état de la Lib |
---|
451 | Result => Ex1_Result -- le résultat de l'exécution |
---|
452 | ); |
---|
453 | instruction_fifo_full<=fifo1_full; |
---|
454 | dma_rd_address1<=dma_wr_address1; --la même adresse sert pour la lecture ou l'écriture en RAM |
---|
455 | |
---|
456 | -- détermination de l'activation des module |
---|
457 | --scheduler_priority_rotation<=not(Ex1_rdy); |
---|
458 | Instr_Rdy:process(Iack,fifo_instr,fifo_sel)--A qoui sert encore ce processus (26/10/12) ???? |
---|
459 | begin |
---|
460 | case fifo_sel is |
---|
461 | when '0' => |
---|
462 | |
---|
463 | if rising_edge(Iack) then |
---|
464 | Ex_en(1)<= fifo_instr; |
---|
465 | |
---|
466 | end if; |
---|
467 | --Ex_en(2)<='0'; |
---|
468 | |
---|
469 | when '1' => |
---|
470 | Ex_en(1)<=fifo_instr; |
---|
471 | --Ex_en(2)<= fifo_instr; |
---|
472 | when others => |
---|
473 | Ex_en(1)<='0'; |
---|
474 | --Ex_en(2)<= '0'; |
---|
475 | |
---|
476 | end case; |
---|
477 | end process; |
---|
478 | |
---|
479 | Active_proc:Process(Ex1_Result) --active la réception lorsqu' Put ou un Get ou un Init a été effectué |
---|
480 | begin |
---|
481 | if Ex1_result(0)='1' or Ex1_result(1)='1' or Ex1_result(2)='1' then |
---|
482 | Ex_en(2)<='1'; |
---|
483 | else |
---|
484 | --Ex_en(2)<='0'; |
---|
485 | end if; |
---|
486 | |
---|
487 | end process; |
---|
488 | |
---|
489 | Latch_instr:process (clk,Iack,Exi_busy) |
---|
490 | begin |
---|
491 | if rising_edge(clk) then |
---|
492 | |
---|
493 | Ilatch<=IAck; |
---|
494 | |
---|
495 | end if; |
---|
496 | |
---|
497 | end process; |
---|
498 | --Ex_en(2)<=Initialized; --- Me pose des soucis en ce moment ??? |
---|
499 | Ex_en(3)<='0'; |
---|
500 | Ex_en(4)<= '1' when InitReq='1' else '0'; |
---|
501 | Appreq<=Ex_en(4); --signal d'activation de la MAE Init |
---|
502 | InitReq<=(not(Initialized) and InitReq1) or InitReq2; -- deux cas permettent d'activer l'initialisation |
---|
503 | AppAck<=Ex1_result(0); -- signal init completed |
---|
504 | -- soit une requête du PE soit une requête du Core |
---|
505 | |
---|
506 | |
---|
507 | MPI_CORE_EX2_FSM: EX2_FSM PORT MAP( |
---|
508 | |
---|
509 | clk =>clk, |
---|
510 | reset =>reset, |
---|
511 | instruction_en=>Ex_en(2), |
---|
512 | Ready =>Ex2_rdy, --signale que le module est disponible |
---|
513 | fifo_full =>instruction_fifo2_full, |
---|
514 | |
---|
515 | fifo_wr_en => instruction_fifo2_wr_en, |
---|
516 | fifo_data => instruction_fifo2_data_in, |
---|
517 | |
---|
518 | switch_port_out_rd_en => Noc2.port_out_rd_en, |
---|
519 | switch_data_available =>Noc2.port_out_data_available, |
---|
520 | switch_port_out_data =>Noc2.port_out_data , |
---|
521 | -- il manque un signal pour valider l'accès à la RAM |
---|
522 | dma_wr_request =>dma_wr_request(2), |
---|
523 | dma_wr_grant =>dma_wr_grant(2), |
---|
524 | dma_rd_request =>dma_rd_request(2), |
---|
525 | dma_rd_grant =>dma_rd_grant(2), |
---|
526 | ram_address =>dma_wr_address2, |
---|
527 | Ram_rd => ex2_ram_rd, |
---|
528 | Ram_wr =>ex2_ram_wr, |
---|
529 | Ram_data_out=> Dma_data_in2, |
---|
530 | Ram_data_in => Dma_data_out, |
---|
531 | packet_received =>packet_received, |
---|
532 | packet_ack => packet_ack, |
---|
533 | barrier_completed =>barrier_completed, |
---|
534 | AppRank =>MyRank, |
---|
535 | AppSize =>MPISize, |
---|
536 | AppInitReq => InitReq2, -- requête d'initialisation de l'application |
---|
537 | AppInitAck =>Ex4_rdy , -- Acquitement d'initialisation |
---|
538 | Initialized=>Initialized |
---|
539 | |
---|
540 | ); |
---|
541 | Dma_rd_address2<=Dma_wr_address2; |
---|
542 | ICI_MPI_CORE_EX3_FSM: EX3_FSM PORT MAP( |
---|
543 | instruction => instruction, |
---|
544 | ResOut => RankSize, |
---|
545 | clk =>clk , |
---|
546 | IsMain=>IsMain, |
---|
547 | reset => reset |
---|
548 | ); |
---|
549 | MPI_CORE_EX4_FSM :EX4_FSM PORT MAP ( |
---|
550 | Instruction => Instruction, --STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
551 | Instruction_En =>Ex_en(4), -- ='1' lorsque ce module est sollicité |
---|
552 | clk =>clk, |
---|
553 | reset =>reset, |
---|
554 | ResultOut =>Ex4_Result, --STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
555 | Result_En =>Ex4_Rdy, -- ='1' lorsque fin de l'exécution du module |
---|
556 | NocSize =>NocSize, |
---|
557 | AppRank =>MyRank, |
---|
558 | AppSize =>MPISize, |
---|
559 | IsMain =>IsMain, |
---|
560 | Initialized =>Initialized, |
---|
561 | AdrRam =>dma_wr_Address4, --accès au stockage |
---|
562 | WeRam =>Ex4_Ram_wr, --activation de l'écriture en RAM |
---|
563 | DataRam =>Dma_data_in4, --données à écrire en RAM |
---|
564 | DMA_wr_Req => dma_wr_request(4), |
---|
565 | DMA_wr_grant => dma_wr_grant(4), |
---|
566 | AppAck =>AppAck, |
---|
567 | AppReq =>AppReq, |
---|
568 | PortId=>PortId, |
---|
569 | port_in_cmd_en => Noc3.port_in_cmd_en, |
---|
570 | port_in_wr_en =>Noc3.port_in_wr_en, |
---|
571 | port_in_empty =>Noc3.port_in_empty, |
---|
572 | port_in_full =>Noc3.port_in_full, |
---|
573 | port_in_data =>Noc3.port_in_data, |
---|
574 | port_out_data =>Noc3.port_out_data, |
---|
575 | port_out_rd_en =>Noc3.port_out_rd_en, |
---|
576 | port_out_data_available =>Noc3.port_out_data_available |
---|
577 | |
---|
578 | |
---|
579 | ); |
---|
580 | --=============Mux des signaux d'accès à la RAM========= |
---|
581 | ram_we<='1' when (weram='1' and ram_wev ='1') else '0'; -- le contrôleur DMA contrôle directement |
---|
582 | Ram_en<= '1' when (rdram ='1' or weram='1') else '0'; -- les signaux qui vont vers la RAM |
---|
583 | |
---|
584 | --dma_data_in <=dma_data_in1 or dma_data_in2; |
---|
585 | --dma_data_out <=dma_data_out1 or dma_data_out2; |
---|
586 | mux_ad_ram_rd:process (dma_rd_grant,dma_rd_address1,dma_rd_address2,dma_rd_address3, |
---|
587 | ex1_ram_rd, Ex2_ram_rd, Exi_ram_rd ) |
---|
588 | begin |
---|
589 | case dma_rd_grant is |
---|
590 | when "0001" => dma_rd_address <= dma_rd_address1; |
---|
591 | rdram<= ex1_ram_rd; |
---|
592 | when "0010" => dma_rd_address <= dma_rd_address2; |
---|
593 | rdram<= ex2_ram_rd; |
---|
594 | when "0100" => dma_rd_address <= dma_rd_address3; |
---|
595 | rdram<= exi_ram_rd; |
---|
596 | -- when "1000" => dma_rd_address <= <input4>; |
---|
597 | when others => dma_rd_address <= (others =>'Z'); |
---|
598 | rdram<='0'; |
---|
599 | end case; |
---|
600 | end process; |
---|
601 | mux_ad_ram_wr:process (dma_wr_grant,dma_wr_address1,dma_wr_address2,dma_wr_address4,Dma_data_in1,Dma_data_in2,Dma_data_in4,ex2_ram_wr,ex4_ram_wr) |
---|
602 | begin |
---|
603 | case dma_wr_grant is |
---|
604 | |
---|
605 | when "0001" => dma_wr_address <= dma_wr_address1; |
---|
606 | weram<=ex1_ram_wr ; |
---|
607 | Dma_data_in<=Dma_data_in1; |
---|
608 | when "0010" => dma_wr_address <= dma_wr_address2; |
---|
609 | weram<=ex2_ram_wr ; |
---|
610 | Dma_data_in<=Dma_data_in2; |
---|
611 | when "1000" => dma_wr_address <= dma_wr_address4; |
---|
612 | weram<=ex4_ram_wr; |
---|
613 | Dma_data_in<=Dma_data_in4; |
---|
614 | -- when "0100" => dma_rd_address <= <input3>; |
---|
615 | -- when "1000" => dma_rd_address <= <input4>; |
---|
616 | when others => dma_wr_address <= (others =>'Z'); |
---|
617 | weram<='0'; |
---|
618 | end case; |
---|
619 | end process; |
---|
620 | --====================================================== |
---|
621 | |
---|
622 | --=================Mux des signaux qui vont au switch============ |
---|
623 | clkout<=clk; -- permettra le lien avec le module du switch |
---|
624 | |
---|
625 | NOC1.port_out_data<=switch_port_out_data; |
---|
626 | NOC1.port_out_data_available<=switch_port_out_data_vailaible; |
---|
627 | NOC1.port_in_empty<=switch_port_in_empty; |
---|
628 | NOC1.port_in_full<=switch_port_in_full; |
---|
629 | |
---|
630 | NOC2.port_out_data<=switch_port_out_data; |
---|
631 | NOC2.port_out_data_available<=switch_port_out_data_vailaible; |
---|
632 | NOC2.port_in_empty<=switch_port_in_empty; |
---|
633 | NOC2.port_in_full<=switch_port_in_full; |
---|
634 | |
---|
635 | NOC3.port_out_data<=switch_port_out_data; |
---|
636 | NOC3.port_out_data_available<=switch_port_out_data_vailaible; |
---|
637 | NOC3.port_in_empty<=switch_port_in_empty; |
---|
638 | NOC3.port_in_full<=switch_port_in_full; |
---|
639 | mux_Noc:process (Ex_en,Noc1,Noc2,Noc3) |
---|
640 | |
---|
641 | begin |
---|
642 | |
---|
643 | case Ex_en is |
---|
644 | |
---|
645 | when"0001" => |
---|
646 | switch_port_in_data <=Noc1.port_in_data; |
---|
647 | switch_port_out_rd_en<=NOC2.port_out_rd_en; |
---|
648 | switch_port_in_wr_en <=NOC1.port_in_wr_en; |
---|
649 | switch_port_in_cmd_en <='0'; |
---|
650 | when "0010" => |
---|
651 | switch_port_in_data <=Noc1.port_in_data; |
---|
652 | switch_port_out_rd_en<=NOC2.port_out_rd_en; |
---|
653 | switch_port_in_wr_en <=NOC1.port_in_wr_en; |
---|
654 | switch_port_in_cmd_en <='0'; |
---|
655 | when"0011" => |
---|
656 | switch_port_in_data <=Noc1.port_in_data; |
---|
657 | switch_port_out_rd_en<=NOC2.port_out_rd_en; |
---|
658 | switch_port_in_wr_en <=NOC1.port_in_wr_en; |
---|
659 | switch_port_in_cmd_en <='0'; |
---|
660 | when "1001" | "1010" => --ca où un appel à init est effectué |
---|
661 | switch_port_in_data <=Noc3.port_in_data; |
---|
662 | switch_port_out_rd_en<=NOC3.port_out_rd_en; |
---|
663 | switch_port_in_wr_en <=NOC3.port_in_wr_en; |
---|
664 | switch_port_in_cmd_en <=NOC3.port_in_cmd_en; |
---|
665 | |
---|
666 | when others => |
---|
667 | switch_port_in_data <=(others=>'0'); |
---|
668 | switch_port_out_rd_en<='0'; |
---|
669 | switch_port_in_wr_en <='0'; |
---|
670 | switch_port_in_cmd_en <='0'; |
---|
671 | end case; |
---|
672 | end process; |
---|
673 | |
---|
674 | |
---|
675 | --=============================================================== |
---|
676 | MPI_CORE_DMA_ARBITER: DMA_ARBITER PORT MAP( |
---|
677 | clk =>clk, |
---|
678 | reset =>reset, |
---|
679 | |
---|
680 | data_wr_mem => ram_data_in, --vers RAM |
---|
681 | |
---|
682 | data_rd_mem => Ram_data_out, --- Vers RAM |
---|
683 | address_rd =>dma_rd_address, |
---|
684 | address_wr =>dma_wr_address, |
---|
685 | address_out_rd =>ram_address_rd, |
---|
686 | address_out_wr =>ram_address_wr, |
---|
687 | ram_en => ram_env, --validation lecture |
---|
688 | ram_we =>ram_wev, --validation écriture |
---|
689 | hold_req=>hold_req,--demande de bus à l'application |
---|
690 | hold_ack=>hold_ack, -- libération du bus RAM par l'application |
---|
691 | |
---|
692 | data_rd_out => Dma_data_out, --vers périphérique |
---|
693 | data_wr_in =>Dma_data_in, --vers périphérique |
---|
694 | dma_wr_grant =>dma_wr_grant, |
---|
695 | dma_rd_request => dma_rd_request, |
---|
696 | dma_rd_grant => dma_rd_grant, |
---|
697 | dma_wr_request => dma_wr_request |
---|
698 | ); |
---|
699 | |
---|
700 | |
---|
701 | CORE_SCHEDULER: MPI_CORE_SCHEDULER PORT MAP( -- permet de sélectionner la source de l'instruction |
---|
702 | -- qui sera exécutée par la MAE EX1 |
---|
703 | clk => clk, |
---|
704 | reset => reset, |
---|
705 | priority_rotation =>scheduler_priority_rotation, |
---|
706 | instruction_fifo_empty =>instruction_fifo1_empty, |
---|
707 | get_request_fifo_empty => instruction_fifo2_empty, |
---|
708 | instruction_fifo_rd_en =>instruction_fifo1_rd_en, |
---|
709 | get_request_fifo_rd_en =>instruction_fifo2_rd_en , |
---|
710 | instruction_fifo_data =>instruction_fifo1_data_out, |
---|
711 | get_request_fifo_data =>instruction_fifo2_data_out, |
---|
712 | fifo_selected =>fifo_sel, |
---|
713 | instruction_available => fifo_instr, |
---|
714 | fifo_empty => scheduler_fifo_empty, |
---|
715 | fifo_rd_en =>scheduler_rd_en, |
---|
716 | data_out => scheduler_data_out |
---|
717 | ); |
---|
718 | |
---|
719 | end structural; |
---|
720 | |
---|