source: PROJECT_CORE_MPI/MPI_HCL/BRANCHES/v2.0/NOC/SCHEDULER5_5.VHD @ 139

Last change on this file since 139 was 139, checked in by rolagamo, 10 years ago

Ceci est la version 16 bits de la plateforme ainsi que la version hierarchique du NoCNoC

File size: 18.1 KB
Line 
1---------------------------------------------------------------------------------
2-- Company:
3-- Engineer: KIEGAING EMMANUEL GEL EN 5
4--
5-- Create Date:    03:56:34 05/06/2011
6-- Design Name:
7-- Module Name:    Sheduler - Behavioral
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description: Module de l'ordonnanceur du switch crossbar
12-- l'algorithme utilisée est le DPA (diagonal propagation arbiter)
13--
14-- Dependencies:
15--
16-- Revision:
17-- Revision 0.01 - File Created
18-- Additional Comments:
19--
20----------------------------------------------------------------------------------
21library IEEE;
22use IEEE.STD_LOGIC_1164.ALL;
23use IEEE.STD_LOGIC_ARITH.ALL;
24use IEEE.STD_LOGIC_UNSIGNED.ALL;
25--use Work.Sheduler_package.all;
26
27---- Uncomment the following library declaration if instantiating
28---- any Xilinx primitives in this code.
29--library UNISIM;
30--use UNISIM.VComponents.all;
31entity Scheduler5_5 is
32    Port ( Req : in  STD_LOGIC_VECTOR (25 downto 1);
33                   Fifo_full : in STD_LOGIC_VECTOR (5 downto 1);
34           clk : in  STD_LOGIC;
35           reset : in  STD_LOGIC;
36            priority_rotation : in  STD_LOGIC_VECTOR (5 downto 1);
37           port_grant : out  STD_LOGIC_VECTOR (25 downto 1));
38end Scheduler5_5;
39
40architecture Behavioral of Scheduler5_5 is
41--Declaration du types
42--tableau de signaux de connexion des cellules arbitres
43constant NB_IO:positive:=5;
44TYPE C_Bar_Signal_Array IS ARRAY(9 downto 1) of STD_LOGIC_VECTOR(5 downto 1);
45-- declaration du composant cellule d'arbitrage
46Component Arbiter
47  PORT (P, Fifo_full,Request, West,North : in  STD_LOGIC;
48        Grant,East,South : out  STD_LOGIC );
49End Component;--Signaux de connexion des cellues
50component Def_Request is
51generic (NB_IO :positive:=5);
52    Port ( Req : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
53           clk : in  STD_LOGIC;
54           reset : in  STD_LOGIC;
55                          fifo_full : in STD_LOGIC_VECTOR (NB_IO downto 1);
56           priority_rotation : in  STD_LOGIC_VECTOR (NB_IO downto 1);
57           grant : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
58           request : out  STD_LOGIC_VECTOR (NB_IO**2 downto 1));
59end component;
60constant NB_IO2 :positive:=NB_IO**2; -- le carré du nombre de ports d'E/S
61SIGNAL south_2_north :  C_Bar_Signal_Array; -- connexion south north
62SIGNAL east_2_west   :  C_Bar_Signal_Array; -- connexion east west
63SIGNAL Signal_mask      : C_Bar_Signal_Array;-- connexion des masques de priorité
64SIGNAL Signal_grant     : C_Bar_Signal_Array;-- connexion des signaux de validation
65SIGNAL Signal_priority  : STD_LOGIC_VECTOR (9 DOWNTO 1);--signal pour la connection des vecteur de priorité
66SIGNAL High         : std_logic;--niveau pour les cellules des extremités nord et ouest
67 --signal grant_latch : std_logic_vector(25 downto 1);
68 signal priority_rotation_en : std_logic;
69 --signal Grant ,req_grant:  std_logic_vector(25 downto 1);
70 signal Grant,request :  std_logic_vector(NB_IO2 downto 1):=(others=>'0');
71 begin
72
73--validation de la rotation de priorité lorsque aucun port n'emet
74 -- req_grant<=(request and grant_latch);
75  priority_rotation_en <= '1' when   unsigned(priority_rotation) = 2**NB_IO-1 else      '0';
76 --priority_rotation_en <= '1' when   unsigned(req_grant) = 0 or unsigned(priority_rotation) = 31 else  '0';
77--latch servant qui memorise le signal grant pendant a transmission
78--cette instance permet de déterminer le vecteur request
79--en fonction de l'état fifo_full et de la requête initiale
80inst_defreq: def_request generic map (NB_IO)
81port map (clk=>clk,
82reset=>reset,
83req=>req,
84fifo_full=>fifo_full,
85priority_rotation=>priority_rotation,
86grant=>grant,
87request=>request
88);
89
90 port_grant <=  grant;
91 --port_grant <= grant_latch;
92 Grant(1)  <= Signal_grant(1)(1) or Signal_grant(6)(1); --  Grant(1,1)
93Grant(2)  <= Signal_grant(2)(2) or Signal_grant(7)(2); --  Grant(1,2)
94Grant(3)  <= Signal_grant(3)(3) or Signal_grant(8)(3); --  Grant(1,3)
95Grant(4)  <= Signal_grant(4)(4) or Signal_grant(9)(4); --  Grant(1,4)
96Grant(5)  <= Signal_grant(5)(5) ;                      --  Grant(1,5)
97Grant(6)  <= Signal_grant(2)(1) or Signal_grant(7)(1); --  Grant(2,1)
98Grant(7)  <= Signal_grant(3)(2) or Signal_grant(8)(2); --  Grant(2,2)
99Grant(8)  <= Signal_grant(4)(3) or Signal_grant(9)(3); --  Grant(2,3)
100Grant(9)  <= Signal_grant(5)(4) ;                      --  Grant(2,4)
101Grant(10)  <= Signal_grant(1)(5) or Signal_grant(6)(5); --  Grant(2,5)
102Grant(11)  <= Signal_grant(3)(1) or Signal_grant(8)(1); --  Grant(3,1)
103Grant(12)  <= Signal_grant(4)(2) or Signal_grant(9)(2); --  Grant(3,2)
104Grant(13)  <= Signal_grant(5)(3) ;                      --  Grant(3,3)
105Grant(14)  <= Signal_grant(1)(4) or Signal_grant(6)(4); --  Grant(3,4)
106Grant(15)  <= Signal_grant(2)(5) or Signal_grant(7)(5); --  Grant(3,5)
107Grant(16)  <= Signal_grant(4)(1) or Signal_grant(9)(1); --  Grant(4,1)
108Grant(17)  <= Signal_grant(5)(2) ;                      --  Grant(4,2)
109Grant(18)  <= Signal_grant(1)(3) or Signal_grant(6)(3); --  Grant(4,3)
110Grant(19)  <= Signal_grant(2)(4) or Signal_grant(7)(4); --  Grant(4,4)
111Grant(20)  <= Signal_grant(3)(5) or Signal_grant(8)(5); --  Grant(4,5)
112Grant(21)  <= Signal_grant(5)(1) ;                      --  Grant(5,1)
113Grant(22)  <= Signal_grant(1)(2) or Signal_grant(6)(2); --  Grant(5,2)
114Grant(23)  <= Signal_grant(2)(3) or Signal_grant(7)(3); --  Grant(5,3)
115Grant(24)  <= Signal_grant(3)(4) or Signal_grant(8)(4); --  Grant(5,4)
116Grant(25)  <= Signal_grant(4)(5) or Signal_grant(9)(5); --  Grant(5,5)
117High <= '1';
118
119----instantiations des cellules arbitres et interconnection
120
121-------------------------- Diagonale n° 1
122
123
124Arbiter_1_1 : Arbiter
125
126PORT MAP (Request => Request(1), North => High, West => High, P => Signal_priority(9), Fifo_full => Fifo_full(1), 
127South => south_2_north(1)(1), East => east_2_west(1)(1) , Grant => Signal_grant(1)(1));
128
129Arbiter_1_2 : Arbiter
130
131PORT MAP (Request => Request(22), North => High, West => High, P => Signal_priority(9), Fifo_full => Fifo_full(2), 
132South => south_2_north(1)(2), East => east_2_west(1)(2) , Grant => Signal_grant(1)(2));
133
134Arbiter_1_3 : Arbiter
135
136PORT MAP (Request => Request(18), North => High, West => High, P => Signal_priority(9), Fifo_full => Fifo_full(3), 
137South => south_2_north(1)(3), East => east_2_west(1)(3) , Grant => Signal_grant(1)(3));
138
139Arbiter_1_4 : Arbiter
140
141PORT MAP (Request => Request(14), North => High, West => High, P => Signal_priority(9), Fifo_full => Fifo_full(4), 
142South => south_2_north(1)(4), East => east_2_west(1)(4) , Grant => Signal_grant(1)(4));
143
144Arbiter_1_5 : Arbiter
145
146PORT MAP (Request => Request(10), North => High, West => High, P => Signal_priority(9), Fifo_full => Fifo_full(5), 
147South => south_2_north(1)(5), East => east_2_west(1)(5) , Grant => Signal_grant(1)(5));
148
149-------------------------- Diagonale n° 2
150
151
152Arbiter_2_1 : Arbiter
153
154PORT MAP (Request => Request(6), North => south_2_north(1)(1), West => east_2_west(1)(5), P => Signal_priority(8), Fifo_full => Fifo_full(1), 
155South => south_2_north(2)(1), East => east_2_west(2)(1) , Grant => Signal_grant(2)(1));
156
157Arbiter_2_2 : Arbiter
158
159PORT MAP (Request => Request(2), North => south_2_north(1)(2), West => east_2_west(1)(1), P => Signal_priority(8), Fifo_full => Fifo_full(2), 
160South => south_2_north(2)(2), East => east_2_west(2)(2) , Grant => Signal_grant(2)(2));
161
162Arbiter_2_3 : Arbiter
163
164PORT MAP (Request => Request(23), North => south_2_north(1)(3), West => east_2_west(1)(2), P => Signal_priority(8), Fifo_full => Fifo_full(3), 
165South => south_2_north(2)(3), East => east_2_west(2)(3) , Grant => Signal_grant(2)(3));
166
167Arbiter_2_4 : Arbiter
168
169PORT MAP (Request => Request(19), North => south_2_north(1)(4), West => east_2_west(1)(3), P => Signal_priority(8), Fifo_full => Fifo_full(4), 
170South => south_2_north(2)(4), East => east_2_west(2)(4) , Grant => Signal_grant(2)(4));
171
172Arbiter_2_5 : Arbiter
173
174PORT MAP (Request => Request(15), North => south_2_north(1)(5), West => east_2_west(1)(4), P => Signal_priority(8), Fifo_full => Fifo_full(5), 
175South => south_2_north(2)(5), East => east_2_west(2)(5) , Grant => Signal_grant(2)(5));
176
177-------------------------- Diagonale n° 3
178
179
180Arbiter_3_1 : Arbiter
181
182PORT MAP (Request => Request(11), North => south_2_north(2)(1), West => east_2_west(2)(5), P => Signal_priority(7), Fifo_full => Fifo_full(1), 
183South => south_2_north(3)(1), East => east_2_west(3)(1) , Grant => Signal_grant(3)(1));
184
185Arbiter_3_2 : Arbiter
186
187PORT MAP (Request => Request(7), North => south_2_north(2)(2), West => east_2_west(2)(1), P => Signal_priority(7), Fifo_full => Fifo_full(2), 
188South => south_2_north(3)(2), East => east_2_west(3)(2) , Grant => Signal_grant(3)(2));
189
190Arbiter_3_3 : Arbiter
191
192PORT MAP (Request => Request(3), North => south_2_north(2)(3), West => east_2_west(2)(2), P => Signal_priority(7), Fifo_full => Fifo_full(3), 
193South => south_2_north(3)(3), East => east_2_west(3)(3) , Grant => Signal_grant(3)(3));
194
195Arbiter_3_4 : Arbiter
196
197PORT MAP (Request => Request(24), North => south_2_north(2)(4), West => east_2_west(2)(3), P => Signal_priority(7), Fifo_full => Fifo_full(4), 
198South => south_2_north(3)(4), East => east_2_west(3)(4) , Grant => Signal_grant(3)(4));
199
200Arbiter_3_5 : Arbiter
201
202PORT MAP (Request => Request(20), North => south_2_north(2)(5), West => east_2_west(2)(4), P => Signal_priority(7), Fifo_full => Fifo_full(5), 
203South => south_2_north(3)(5), East => east_2_west(3)(5) , Grant => Signal_grant(3)(5));
204
205-------------------------- Diagonale n° 4
206
207
208Arbiter_4_1 : Arbiter
209
210PORT MAP (Request => Request(16), North => south_2_north(3)(1), West => east_2_west(3)(5), P => Signal_priority(6), Fifo_full => Fifo_full(1), 
211South => south_2_north(4)(1), East => east_2_west(4)(1) , Grant => Signal_grant(4)(1));
212
213Arbiter_4_2 : Arbiter
214
215PORT MAP (Request => Request(12), North => south_2_north(3)(2), West => east_2_west(3)(1), P => Signal_priority(6), Fifo_full => Fifo_full(2), 
216South => south_2_north(4)(2), East => east_2_west(4)(2) , Grant => Signal_grant(4)(2));
217
218Arbiter_4_3 : Arbiter
219
220PORT MAP (Request => Request(8), North => south_2_north(3)(3), West => east_2_west(3)(2), P => Signal_priority(6), Fifo_full => Fifo_full(3), 
221South => south_2_north(4)(3), East => east_2_west(4)(3) , Grant => Signal_grant(4)(3));
222
223Arbiter_4_4 : Arbiter
224
225PORT MAP (Request => Request(4), North => south_2_north(3)(4), West => east_2_west(3)(3), P => Signal_priority(6), Fifo_full => Fifo_full(4), 
226South => south_2_north(4)(4), East => east_2_west(4)(4) , Grant => Signal_grant(4)(4));
227
228Arbiter_4_5 : Arbiter
229
230PORT MAP (Request => Request(25), North => south_2_north(3)(5), West => east_2_west(3)(4), P => Signal_priority(6), Fifo_full => Fifo_full(5), 
231South => south_2_north(4)(5), East => east_2_west(4)(5) , Grant => Signal_grant(4)(5));
232
233-------------------------- Diagonale n° 5
234
235
236Arbiter_5_1 : Arbiter
237
238PORT MAP (Request => Request(21), North => south_2_north(4)(1), West => east_2_west(4)(5), P => Signal_priority(5), Fifo_full => Fifo_full(1), 
239South => south_2_north(5)(1), East => east_2_west(5)(1) , Grant => Signal_grant(5)(1));
240
241Arbiter_5_2 : Arbiter
242
243PORT MAP (Request => Request(17), North => south_2_north(4)(2), West => east_2_west(4)(1), P => Signal_priority(5), Fifo_full => Fifo_full(2), 
244South => south_2_north(5)(2), East => east_2_west(5)(2) , Grant => Signal_grant(5)(2));
245
246Arbiter_5_3 : Arbiter
247
248PORT MAP (Request => Request(13), North => south_2_north(4)(3), West => east_2_west(4)(2), P => Signal_priority(5), Fifo_full => Fifo_full(3), 
249South => south_2_north(5)(3), East => east_2_west(5)(3) , Grant => Signal_grant(5)(3));
250
251Arbiter_5_4 : Arbiter
252
253PORT MAP (Request => Request(9), North => south_2_north(4)(4), West => east_2_west(4)(3), P => Signal_priority(5), Fifo_full => Fifo_full(4), 
254South => south_2_north(5)(4), East => east_2_west(5)(4) , Grant => Signal_grant(5)(4));
255
256Arbiter_5_5 : Arbiter
257
258PORT MAP (Request => Request(5), North => south_2_north(4)(5), West => east_2_west(4)(4), P => Signal_priority(5), Fifo_full => Fifo_full(5), 
259South => south_2_north(5)(5), East => east_2_west(5)(5) , Grant => Signal_grant(5)(5));
260
261-------------------------- Diagonale n° 6
262
263
264Arbiter_6_1 : Arbiter
265
266PORT MAP (Request => Request(1), North => south_2_north(5)(1), West => east_2_west(5)(5), P => Signal_priority(4), Fifo_full => Fifo_full(1), 
267South => south_2_north(6)(1), East => east_2_west(6)(1) , Grant => Signal_grant(6)(1));
268
269Arbiter_6_2 : Arbiter
270
271PORT MAP (Request => Request(22), North => south_2_north(5)(2), West => east_2_west(5)(1), P => Signal_priority(4), Fifo_full => Fifo_full(2), 
272South => south_2_north(6)(2), East => east_2_west(6)(2) , Grant => Signal_grant(6)(2));
273
274Arbiter_6_3 : Arbiter
275
276PORT MAP (Request => Request(18), North => south_2_north(5)(3), West => east_2_west(5)(2), P => Signal_priority(4), Fifo_full => Fifo_full(3), 
277South => south_2_north(6)(3), East => east_2_west(6)(3) , Grant => Signal_grant(6)(3));
278
279Arbiter_6_4 : Arbiter
280
281PORT MAP (Request => Request(14), North => south_2_north(5)(4), West => east_2_west(5)(3), P => Signal_priority(4), Fifo_full => Fifo_full(4), 
282South => south_2_north(6)(4), East => east_2_west(6)(4) , Grant => Signal_grant(6)(4));
283
284Arbiter_6_5 : Arbiter
285
286PORT MAP (Request => Request(10), North => south_2_north(5)(5), West => east_2_west(5)(4), P => Signal_priority(4), Fifo_full => Fifo_full(5), 
287South => south_2_north(6)(5), East => east_2_west(6)(5) , Grant => Signal_grant(6)(5));
288
289-------------------------- Diagonale n° 7
290
291
292Arbiter_7_1 : Arbiter
293
294PORT MAP (Request => Request(6), North => south_2_north(6)(1), West => east_2_west(6)(5), P => Signal_priority(3), Fifo_full => Fifo_full(1), 
295South => south_2_north(7)(1), East => east_2_west(7)(1) , Grant => Signal_grant(7)(1));
296
297Arbiter_7_2 : Arbiter
298
299PORT MAP (Request => Request(2), North => south_2_north(6)(2), West => east_2_west(6)(1), P => Signal_priority(3), Fifo_full => Fifo_full(2), 
300South => south_2_north(7)(2), East => east_2_west(7)(2) , Grant => Signal_grant(7)(2));
301
302Arbiter_7_3 : Arbiter
303
304PORT MAP (Request => Request(23), North => south_2_north(6)(3), West => east_2_west(6)(2), P => Signal_priority(3), Fifo_full => Fifo_full(3), 
305South => south_2_north(7)(3), East => east_2_west(7)(3) , Grant => Signal_grant(7)(3));
306
307Arbiter_7_4 : Arbiter
308
309PORT MAP (Request => Request(19), North => south_2_north(6)(4), West => east_2_west(6)(3), P => Signal_priority(3), Fifo_full => Fifo_full(4), 
310South => south_2_north(7)(4), East => east_2_west(7)(4) , Grant => Signal_grant(7)(4));
311
312Arbiter_7_5 : Arbiter
313
314PORT MAP (Request => Request(15), North => south_2_north(6)(5), West => east_2_west(6)(4), P => Signal_priority(3), Fifo_full => Fifo_full(5), 
315South => south_2_north(7)(5), East => east_2_west(7)(5) , Grant => Signal_grant(7)(5));
316
317-------------------------- Diagonale n° 8
318
319
320Arbiter_8_1 : Arbiter
321
322PORT MAP (Request => Request(11), North => south_2_north(7)(1), West => east_2_west(7)(5), P => Signal_priority(2), Fifo_full => Fifo_full(1), 
323South => south_2_north(8)(1), East => east_2_west(8)(1) , Grant => Signal_grant(8)(1));
324
325Arbiter_8_2 : Arbiter
326
327PORT MAP (Request => Request(7), North => south_2_north(7)(2), West => east_2_west(7)(1), P => Signal_priority(2), Fifo_full => Fifo_full(2), 
328South => south_2_north(8)(2), East => east_2_west(8)(2) , Grant => Signal_grant(8)(2));
329
330Arbiter_8_3 : Arbiter
331
332PORT MAP (Request => Request(3), North => south_2_north(7)(3), West => east_2_west(7)(2), P => Signal_priority(2), Fifo_full => Fifo_full(3), 
333South => south_2_north(8)(3), East => east_2_west(8)(3) , Grant => Signal_grant(8)(3));
334
335Arbiter_8_4 : Arbiter
336
337PORT MAP (Request => Request(24), North => south_2_north(7)(4), West => east_2_west(7)(3), P => Signal_priority(2), Fifo_full => Fifo_full(4), 
338South => south_2_north(8)(4), East => east_2_west(8)(4) , Grant => Signal_grant(8)(4));
339
340Arbiter_8_5 : Arbiter
341
342PORT MAP (Request => Request(20), North => south_2_north(7)(5), West => east_2_west(7)(4), P => Signal_priority(2), Fifo_full => Fifo_full(5), 
343South => south_2_north(8)(5), East => east_2_west(8)(5) , Grant => Signal_grant(8)(5));
344
345-------------------------- Diagonale n° 9
346
347
348Arbiter_9_1 : Arbiter
349
350PORT MAP (Request => Request(16), North => south_2_north(8)(1), West => east_2_west(8)(5), P => Signal_priority(1), Fifo_full => Fifo_full(1), 
351South => south_2_north(9)(1), East => east_2_west(9)(1) , Grant => Signal_grant(9)(1));
352
353Arbiter_9_2 : Arbiter
354
355PORT MAP (Request => Request(12), North => south_2_north(8)(2), West => east_2_west(8)(1), P => Signal_priority(1), Fifo_full => Fifo_full(2), 
356South => south_2_north(9)(2), East => east_2_west(9)(2) , Grant => Signal_grant(9)(2));
357
358Arbiter_9_3 : Arbiter
359
360PORT MAP (Request => Request(8), North => south_2_north(8)(3), West => east_2_west(8)(2), P => Signal_priority(1), Fifo_full => Fifo_full(3), 
361South => south_2_north(9)(3), East => east_2_west(9)(3) , Grant => Signal_grant(9)(3));
362
363Arbiter_9_4 : Arbiter
364
365PORT MAP (Request => Request(4), North => south_2_north(8)(4), West => east_2_west(8)(3), P => Signal_priority(1), Fifo_full => Fifo_full(4), 
366South => south_2_north(9)(4), East => east_2_west(9)(4) , Grant => Signal_grant(9)(4));
367
368Arbiter_9_5 : Arbiter
369
370PORT MAP (Request => Request(25), North => south_2_north(8)(5), West => east_2_west(8)(4), P => Signal_priority(1), Fifo_full => Fifo_full(5), 
371South => south_2_north(9)(5), East => east_2_west(9)(5) , Grant => Signal_grant(9)(5));
372
373
374--processus permettant de roter la priorité des diagonales à chaque front d'horloge
375 -- rotation round robin
376         round_robin : process(clk)
377        begin
378                if rising_edge(clk) then
379                 if reset ='1' then
380                    Signal_priority <= "111110000";
381                  elsif priority_rotation_en = '1' then
382                    case Signal_priority is
383                       when "111110000" => Signal_priority <= "011111000";
384                       when "011111000" => Signal_priority <= "001111100";
385                       when "001111100" => Signal_priority <= "000111110";
386                       when "000111110" => Signal_priority <= "000011111";
387                       when "000011111" => Signal_priority <= "111110000";
388                       when others    => Signal_priority <= "111110000";
389                  end case;
390                 end if;
391             end if;
392         end process;
393
394end Behavioral;
395
Note: See TracBrowser for help on using the repository browser.