source: PROJECT_CORE_MPI/MPI_HCL/BRANCHES/v2.0/NOC/SCHEDULER3_3.VHD @ 160

Last change on this file since 160 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: 8.8 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 Scheduler3_3 is
32    Port ( Req : in  STD_LOGIC_VECTOR (9 downto 1);
33                   Fifo_full : in STD_LOGIC_VECTOR (3 downto 1);
34           clk : in  STD_LOGIC;
35           reset : in  STD_LOGIC;
36            priority_rotation : in  STD_LOGIC_VECTOR (3 downto 1);
37           port_grant : out  STD_LOGIC_VECTOR (9 downto 1));
38end Scheduler3_3;
39
40architecture Behavioral of Scheduler3_3 is
41constant NB_IO:positive:=3;
42--Declaration du types
43--tableau de signaux de connexion des cellules arbitres
44TYPE C_Bar_Signal_Array IS ARRAY(5 downto 1) of STD_LOGIC_VECTOR(3 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;
50--
51component Def_Request is
52generic (NB_IO :positive:=3);
53    Port ( Req : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
54           clk : in  STD_LOGIC;
55           reset : in  STD_LOGIC;
56                          fifo_full : in STD_LOGIC_VECTOR (NB_IO downto 1);
57           priority_rotation : in  STD_LOGIC_VECTOR (NB_IO downto 1);
58           grant : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
59           request : out  STD_LOGIC_VECTOR (NB_IO**2 downto 1));
60end component;
61constant NB_IO2 :positive:=NB_IO**2; -- le carré du nombre de ports d'E/S
62--Signaux de connexion des cellues
63SIGNAL south_2_north :  C_Bar_Signal_Array; -- connexion south north
64SIGNAL east_2_west   :  C_Bar_Signal_Array; -- connexion east west
65SIGNAL Signal_mask      : C_Bar_Signal_Array;-- connexion des masques de priorité
66SIGNAL Signal_grant     : C_Bar_Signal_Array;-- connexion des signaux de validation
67SIGNAL Signal_priority  : STD_LOGIC_VECTOR (2*NB_IO-1 DOWNTO 1);--signal pour la connection des vecteurs de priorité
68SIGNAL High         : std_logic;--niveau pour les cellules des extremités nord et ouest
69
70 signal priority_rotation_en : std_logic;
71
72  signal Grant,request :  std_logic_vector(NB_IO2 downto 1):=(others=>'0');
73 begin
74
75--validation de la rotation de priorité lorsque aucun port n'emet
76
77 --priority_rotation_en <= '1' when unsigned(priority_rotation) = 7 else        '0';
78 priority_rotation_en <= '1' when   unsigned(priority_rotation) = 2**NB_IO-1 else       '0';
79--latch servant qui memorise le signal grant pendant a transmission
80--cette instance permet de déterminer le vecteur request
81--en fonction de l'état fifo_full et de la requête initiale
82inst_defreq: def_request generic map (NB_IO)
83port map (clk=>clk,
84reset=>reset,
85req=>req,
86fifo_full=>fifo_full,
87priority_rotation=>priority_rotation,
88grant=>grant,
89request=>request
90);
91 port_grant <= grant;
92 Grant(1)  <= Signal_grant(1)(1) or Signal_grant(4)(1); --  Grant(1,1)
93Grant(2)  <= Signal_grant(2)(2) or Signal_grant(5)(2); --  Grant(1,2)
94Grant(3)  <= Signal_grant(3)(3) ;                      --  Grant(1,3)
95Grant(4)  <= Signal_grant(2)(1) or Signal_grant(5)(1); --  Grant(2,1)
96Grant(5)  <= Signal_grant(3)(2) ;                      --  Grant(2,2)
97Grant(6)  <= Signal_grant(1)(3) or Signal_grant(4)(3); --  Grant(2,3)
98Grant(7)  <= Signal_grant(3)(1) ;                      --  Grant(3,1)
99Grant(8)  <= Signal_grant(1)(2) or Signal_grant(4)(2); --  Grant(3,2)
100Grant(9)  <= Signal_grant(2)(3) or Signal_grant(5)(3); --  Grant(3,3)
101High <= '1';
102
103----instantiations des cellules arbitres et interconnection
104
105-------------------------- Diagonale n° 1
106
107
108Arbiter_1_1 : Arbiter
109
110PORT MAP (Request => Request(1), North => High, West => High, P => Signal_priority(5), Fifo_full => Fifo_full(1), 
111South => south_2_north(1)(1), East => east_2_west(1)(1) , Grant => Signal_grant(1)(1));
112
113Arbiter_1_2 : Arbiter
114
115PORT MAP (Request => Request(8), North => High, West => High, P => Signal_priority(5), Fifo_full => Fifo_full(2), 
116South => south_2_north(1)(2), East => east_2_west(1)(2) , Grant => Signal_grant(1)(2));
117
118Arbiter_1_3 : Arbiter
119
120PORT MAP (Request => Request(6), North => High, West => High, P => Signal_priority(5), Fifo_full => Fifo_full(3), 
121South => south_2_north(1)(3), East => east_2_west(1)(3) , Grant => Signal_grant(1)(3));
122
123-------------------------- Diagonale n° 2
124
125
126Arbiter_2_1 : Arbiter
127
128PORT MAP (Request => Request(4), North => south_2_north(1)(1), West => east_2_west(1)(3), P => Signal_priority(4), Fifo_full => Fifo_full(1), 
129South => south_2_north(2)(1), East => east_2_west(2)(1) , Grant => Signal_grant(2)(1));
130
131Arbiter_2_2 : Arbiter
132
133PORT MAP (Request => Request(2), North => south_2_north(1)(2), West => east_2_west(1)(1), P => Signal_priority(4), Fifo_full => Fifo_full(2), 
134South => south_2_north(2)(2), East => east_2_west(2)(2) , Grant => Signal_grant(2)(2));
135
136Arbiter_2_3 : Arbiter
137
138PORT MAP (Request => Request(9), North => south_2_north(1)(3), West => east_2_west(1)(2), P => Signal_priority(4), Fifo_full => Fifo_full(3), 
139South => south_2_north(2)(3), East => east_2_west(2)(3) , Grant => Signal_grant(2)(3));
140
141-------------------------- Diagonale n° 3
142
143
144Arbiter_3_1 : Arbiter
145
146PORT MAP (Request => Request(7), North => south_2_north(2)(1), West => east_2_west(2)(3), P => Signal_priority(3), Fifo_full => Fifo_full(1), 
147South => south_2_north(3)(1), East => east_2_west(3)(1) , Grant => Signal_grant(3)(1));
148
149Arbiter_3_2 : Arbiter
150
151PORT MAP (Request => Request(5), North => south_2_north(2)(2), West => east_2_west(2)(1), P => Signal_priority(3), Fifo_full => Fifo_full(2), 
152South => south_2_north(3)(2), East => east_2_west(3)(2) , Grant => Signal_grant(3)(2));
153
154Arbiter_3_3 : Arbiter
155
156PORT MAP (Request => Request(3), North => south_2_north(2)(3), West => east_2_west(2)(2), P => Signal_priority(3), Fifo_full => Fifo_full(3), 
157South => south_2_north(3)(3), East => east_2_west(3)(3) , Grant => Signal_grant(3)(3));
158
159-------------------------- Diagonale n° 4
160
161
162Arbiter_4_1 : Arbiter
163
164PORT MAP (Request => Request(1), North => south_2_north(3)(1), West => east_2_west(3)(3), P => Signal_priority(2), Fifo_full => Fifo_full(1), 
165South => south_2_north(4)(1), East => east_2_west(4)(1) , Grant => Signal_grant(4)(1));
166
167Arbiter_4_2 : Arbiter
168
169PORT MAP (Request => Request(8), North => south_2_north(3)(2), West => east_2_west(3)(1), P => Signal_priority(2), Fifo_full => Fifo_full(2), 
170South => south_2_north(4)(2), East => east_2_west(4)(2) , Grant => Signal_grant(4)(2));
171
172Arbiter_4_3 : Arbiter
173
174PORT MAP (Request => Request(6), North => south_2_north(3)(3), West => east_2_west(3)(2), P => Signal_priority(2), Fifo_full => Fifo_full(3), 
175South => south_2_north(4)(3), East => east_2_west(4)(3) , Grant => Signal_grant(4)(3));
176
177-------------------------- Diagonale n° 5
178
179
180Arbiter_5_1 : Arbiter
181
182PORT MAP (Request => Request(4), North => south_2_north(4)(1), West => east_2_west(4)(3), P => Signal_priority(1), Fifo_full => Fifo_full(1), 
183South => south_2_north(5)(1), East => east_2_west(5)(1) , Grant => Signal_grant(5)(1));
184
185Arbiter_5_2 : Arbiter
186
187PORT MAP (Request => Request(2), North => south_2_north(4)(2), West => east_2_west(4)(1), P => Signal_priority(1), Fifo_full => Fifo_full(2), 
188South => south_2_north(5)(2), East => east_2_west(5)(2) , Grant => Signal_grant(5)(2));
189
190Arbiter_5_3 : Arbiter
191
192PORT MAP (Request => Request(9), North => south_2_north(4)(3), West => east_2_west(4)(2), P => Signal_priority(1), Fifo_full => Fifo_full(3), 
193South => south_2_north(5)(3), East => east_2_west(5)(3) , Grant => Signal_grant(5)(3));
194
195
196--processus permettant de roter la priorité des diagonales à chaque front d'horloge
197 -- rotation round robin
198         round_robin : process(clk)
199        begin
200                if rising_edge(clk) then
201                 if reset ='1' then
202                    Signal_priority <= "11100";
203                  elsif priority_rotation_en = '1' then
204                    case Signal_priority is
205                       when "11100" => Signal_priority <= "01110";
206                       when "01110" => Signal_priority <= "00111";
207                       when "00111" => Signal_priority <= "11100";
208                       when others    => Signal_priority <= "11100";
209                  end case;
210                 end if;
211             end if;
212         end process;
213
214end Behavioral;
215
Note: See TracBrowser for help on using the repository browser.