source: PROJECT_CORE_MPI/CORE_MPI/BRANCHES/v1.00/PE.vhd @ 74

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