source: PROJECT_CORE_MPI/MPI_HCL/TRUNK/PE.vhd @ 106

Last change on this file since 106 was 106, checked in by rolagamo, 10 years ago
File size: 8.9 KB
Line 
1----------------------------------------------------------------------------------
2-- Company:
3-- Engineer: GAMOM Roland Christian
4--
5-- Create Date:    21:20:54 07/16/2012
6-- Design Name:
7-- Module Name:    PE - Behavioral
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description: Ce module permet d'encapsuler une tâche matérielle
12-- et lui donne la possiblité de communiquer à l'aide des fonctions MPI-2 RMA
13-- Dependencies:
14--
15-- Revision:
16-- Revision 0.01 - File Created
17-- Additional Comments:
18--
19----------------------------------------------------------------------------------
20library IEEE;
21use IEEE.STD_LOGIC_1164.ALL;
22library NocLib ;
23library Std;
24--use IEEE.STD_LOGIC_ARITH.ALL;
25--use IEEE.STD_LOGIC_UNSIGNED.ALL;
26Library MPI_HCL;
27use NocLib.CoreTypes.all;
28use MPI_HCL.Packet_type.all;
29use MPI_HCL.MPI_RMA.all;
30-- synthesis translate_off
31use std.textio.all;
32-- synthesis translate_on
33use IEEE.NUMERIC_STD.ALL;
34
35
36entity PE is
37        Generic (DestId : natural:=0 );
38    Port ( Instruction : out  STD_LOGIC_VECTOR (Word-1 downto 0);
39           Instruction_en : out  STD_LOGIC;
40                          Core_PushOut : in STD_LOGIC_VECTOR (Word-1 downto 0);
41           clk : in  STD_LOGIC;
42           reset : in  STD_LOGIC;
43                          CE : in STD_LOGIC; -- Active le  PE après sa synthèse
44           Core_RAM_Data_Out : out  STD_LOGIC_VECTOR (Word-1 downto 0);
45           Core_RAM_Data_In : in  STD_LOGIC_VECTOR (Word-1 downto 0);
46           Core_RAM_WE : in  STD_LOGIC;
47           Core_RAM_EN : in  STD_LOGIC;
48           --Core_RAM_ENB : in  STD_LOGIC;
49           Core_RAM_ADDRESS_WR : in  STD_LOGIC_VECTOR (ADRLEN-1 downto 0);
50           Core_RAM_ADDRESS_RD : in  STD_LOGIC_VECTOR (ADRLEN-1 downto 0);
51           Core_Hold_req : in  STD_LOGIC;
52           Core_Hold_Ack : out  STD_LOGIC);
53end PE;
54
55architecture Behavioral of PE is
56COMPONENT RAM_v
57  generic (width : positive;size :positive);
58        PORT(
59                clka : IN std_logic;
60                clkb : IN std_logic;
61                wea : IN std_logic;
62                ena : IN std_logic;
63                enb : IN std_logic;
64                addra : IN std_logic_vector;
65                addrb : IN std_logic_vector;
66                dia : IN std_logic_vector;         
67                dob : OUT std_logic_vector
68                );
69        END COMPONENT;
70COMPONENT mem8k8
71  PORT (
72    clka : IN STD_LOGIC;
73    ena : IN STD_LOGIC;
74    wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
75    addra : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
76    dina : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
77    clkb : IN STD_LOGIC;
78    enb : IN STD_LOGIC;
79    addrb : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
80    doutb : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
81  );
82END COMPONENT;
83COMPONENT HT_process is
84                generic (Task_Id : natural);
85    Port ( clk : in  STD_LOGIC;
86           reset : in  STD_LOGIC;
87                          en : in std_logic; -- active la tâche
88           Interf_i : in  core_i; --signaux pour l'interface I
89           Interf_o : out  core_o; --signaux pour l'interface IO
90           mem_i : in typ_dpram_i; -- signaux pour l'accès à la mémoire
91           mem_o : out typ_dpram_o -- signaux pour l'accès à la mémoire
92                          );
93end COMPONENT HT_process;
94 
95COMPONENT Hold_FSM is
96       
97    Port ( Hold_Req : in  STD_LOGIC;
98           Ram_busy : in  STD_LOGIC;
99           Clk : in  STD_LOGIC;
100           Reset : in  STD_LOGIC;
101           Ramsel : out  STD_LOGIC;
102           Hold_Ack : out  STD_LOGIC);
103end COMPONENT Hold_FSM;
104--données du programme PE
105           --signaux pour l'interconnexionsignal datain :std_logic_vector(word-1 downto 0):= (others => '0');
106        signal ram_we ,ram_ena,ram_enb,ramsel_i: std_logic:='0';
107        signal pe_ram_we ,pe_ram_ena,pe_ram_enb: std_logic;
108        signal pe_instr_en,pe_hold_ack: std_logic:='0';
109        signal ram_do,ram_din:std_logic_vector(word-1 downto 0):= (others => '0');
110        signal pe_ram_do,pe_ram_din:std_logic_vector(word-1 downto 0):= (others => '0');
111        signal ram_addra,ram_addrb :std_logic_vector(ADRLEN-1 downto 0);
112        signal pe_ram_addra,pe_ram_addrb :std_logic_vector(ADRLEN-1 downto 0);
113        signal sram : typ_dpram;
114        signal clk_ht : std_logic;
115        signal MyGroup:mpi_group;
116        signal MyWin : mpi_win;
117        signal SrcAdr0,SrcAdr1,destAdr0,destAdr1,Datalen:std_logic_vector(word-1 downto 0);
118        signal dpid,dpid_i : natural range 0 to 15:=DestId;
119        signal MyRank :std_logic_vector(3 downto 0);
120        signal Libr : Core_io;  --regroupe tous les signaux IO de la bibliothèque
121        signal Lib_Ready:std_logic; --indique que l'exécution de la fonction est terminée
122        signal Lib_instr_ack : std_logic; -- l'instruction est copiée dans le tampon FIFO
123        signal Lib_Init : std_logic; -- l'initialisation est terminée
124        signal Lib_Enable : std_logic:='0';
125        signal Ex1_run,Ex4_run : std_logic:='0'; --indique que ces modules sont en fin d'exécution
126        signal Hold_Ack : std_logic;
127        signal en_task : std_logic;
128        signal ht_reset :std_logic;
129 --signaux pour la gestion de la MAE
130 type typ_mae is (start,Fillmem,NextFill,InitApp,GetRank,WInCreate,WinStart, putdata,getdata,WinCompleted,finalize,st_timeout);
131        type typ_Hld is (Ht_Lock,Core_Lock,Ht_free);
132signal dcount : natural range 0 to 255:=0; 
133signal wea : std_logic_vector (0 downto 0);
134signal count,count_i : natural range 0 to 15:=0;
135
136
137                signal RunState : typ_mae;
138                signal Hld_state :typ_hld;
139                signal Ram_busy :std_logic:='0';
140begin
141--Inst_RAM_v: RAM_v generic map(width=>word,size=>ADRLEN)
142--      PORT MAP(
143--              clka =>clk ,
144--              clkb => clk ,
145--              wea => ram_we,
146--              ena => ram_ena,
147--              enb => ram_enb,
148--              addra => ram_addra,
149--              addrb =>ram_addrb,
150--              dia => ram_din,
151--              dob => ram_do
152--      );
153        wea(0)<=ram_we;
154        Ram8k8 : mem8k8
155  PORT MAP (
156    clka => clk,
157    ena => ram_ena,
158    wea => wea,
159    addra => ram_addra(12 downto 0),
160    dina => ram_din,
161    clkb => clk,
162    enb => ram_enb,
163    addrb => ram_addrb(12 downto 0),
164    doutb => ram_do
165  );
166        HT_task:HT_process generic map(Task_id =>DestId)
167        port map (
168        clk=>clk,
169        reset=>ht_reset,
170        en=>en_task,
171   Interf_i =>Libr.i,
172   Interf_o=>Libr.o,
173  mem_i =>sram.i,
174   mem_o =>sram.o       );
175 
176--================================================================
177        --MUX de la RAM
178                               
179Ram_mux: process (clk,ramsel_i,pe_ram_addra,pe_ram_addrb,Core_ram_address_rd,Core_ram_address_wr,
180                                                Core_ram_en,Core_ram_we,Core_ram_data_in,pe_ram_ena,pe_ram_enb,Ram_do,
181                                                Pe_ram_din,Pe_ram_we    )
182 begin                         
183 case ramsel_i is
184       
185        when '1' =>
186                ram_addra <= Core_ram_address_wr ;
187                ram_addrb <= Core_ram_address_rd ;
188                ram_ena <= Core_ram_en;
189                ram_enb <= Core_ram_en;
190                ram_we<= Core_ram_we;
191                ram_din <= Core_ram_data_in;
192                pe_ram_do<=(others=>'U');
193                Core_ram_data_out<=ram_do;
194               
195        when others =>
196                ram_addra <=  pe_ram_addra;
197                ram_addrb <=  pe_ram_addrb;
198                ram_ena <= pe_ram_ena;
199                ram_enb <= pe_ram_enb;
200                ram_we<= pe_ram_we;
201                ram_din <=pe_ram_din;
202                Core_ram_data_out<=(others=>'U');
203                pe_ram_do<=ram_do;
204end case ;
205end process ;
206
207
208
209Instruction_En<=PE_instr_EN; -- Libr.Instr_en; --********A changer **********
210--=== !!!!! attention la suppression de la ligne ci-dessous empêche ce
211-- composant de bien fonctionner !!! !!!!!!!!!!!!!!!!!!!!!!!
212--instruction<=std_logic_vector(to_unsigned(Core_upper_adr,8));
213
214dpid<=dpid_i;
215en_task<= CE or Lib_enable; --l'activation d'une HT peut être directe ou commandée
216Lib_Instr_ack<=Core_Pushout(0); --l'instruction a été copié
217Lib_init<=Core_Pushout(4); -- Initialized
218Lib_Enable<=Core_Pushout(6);-- HT activée par la Librairie.
219Ex1_Run<=Core_Pushout(5);  -- fin de l'exécution de Ex1
220Ex4_Run<=Core_pushout(7); -- fin de l'exécution de Ex4 pour Spawn
221horloge_ht:process (reset,en_task,clk)
222begin
223if reset='1' then
224clk_ht<='0';
225count<=0;
226Ht_reset<='1';
227else
228if en_task='1' then
229  clk_ht<=clk;
230  if count=10 then --circuit de reset pour la  HT
231    ht_reset<='0';
232  else
233  if rising_edge(clk) then
234  count<=count+1;
235  end if;
236  ht_reset<='1';
237  end if;
238else
239  count<=0;
240  clk_ht<='0';
241  Ht_reset<='1';
242end if;
243end if;
244end process horloge_ht;
245
246Hold1: Hold_fsm port map (
247clk=>clk ,
248reset =>reset,
249Ram_Busy=>Ram_busy,
250Hold_Ack=>Hold_Ack,
251Hold_req =>Core_Hold_Req,
252RamSel => RamSel_i);
253Core_Hold_Ack<=Hold_Ack;
254
255--================RAM signals ======================                                   
256sram.I.data_out<=PE_ram_do;
257pe_Ram_addra<=sram.O.addr_wr;
258pe_Ram_addrb<=sram.O.addr_rd ; 
259PE_Ram_we<=sram.O.we;
260PE_Ram_ena<=sram.O.ena;
261PE_Ram_enb<=sram.O.enb;
262PE_ram_din<=sram.O.data_in;
263--==========MPI HCL signals ============================
264
265affect:process (clk,en_task,Lib_enable,Core_hold_req,RamSel_i,Core_pushout,Libr.O)
266begin
267        --if (clk'event and clk='1') then
268if en_task='1' then
269Instruction<=Libr.O.Instruction;                       
270        Ram_busy<=Libr.O.membusy;
271PE_Instr_EN<=Libr.O.instr_en;
272else --si le HT n'est pas activé ces valeurs sont à 0 !
273 Instruction<=(others=>'0');                   
274        Ram_busy<='0';
275  PE_Instr_EN<='0'; 
276end if;
277Libr.I.Instr_ack<=Core_pushout(0);
278Libr.I.InitOk<=Core_pushout(4);
279if Lib_enable='1' then
280Libr.I.Spawned<='1';
281else
282  Libr.I.Spawned<='0';
283end if;
284Libr.I.Hold_Req<=Core_Hold_req;
285--Libr.I.Hold_Ack<=Hold_Ack;
286Libr.I.RamSel<=RamSel_i;               
287--end if;
288assert not(Lib_enable='1')
289report "Spawn Activé"
290severity WARNING ;
291
292end process affect;
293--=======================================================================
294--MAE du PE
295--=======================================================================
296
297 
298end Behavioral;
299
Note: See TracBrowser for help on using the repository browser.