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

Last change on this file since 70 was 70, checked in by rolagamo, 11 years ago
File size: 7.5 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;
110        signal Hold_Ack : std_logic;
111        signal en_task : std_logic;
112 --signaux pour la gestion de la MAE
113 type typ_mae is (start,Fillmem,NextFill,InitApp,GetRank,WInCreate,WinStart, putdata,getdata,WinCompleted,finalize,st_timeout);
114        type typ_Hld is (Ht_Lock,Core_Lock,Ht_free);
115signal dcount : natural range 0 to 255:=0; --permet de compter le packet de données envoyées
116signal count,count_i : natural range 0 to 15:=0;
117
118
119                signal RunState : typ_mae;
120                signal Hld_state :typ_hld;
121                signal Ram_busy :std_logic:='0';
122begin
123Inst_RAM_v: RAM_v generic map(width=>word,size=>ADRLEN)
124        PORT MAP(
125                clka =>clk ,
126                clkb => clk ,
127                wea => ram_we,
128                ena => ram_ena,
129                enb => ram_enb,
130                addra => ram_addra,
131                addrb =>ram_addrb,
132                dia => ram_din,
133                dob => ram_do
134        );
135        HT_task:HT_process generic map(Task_id =>DestId)
136        port map (
137        clk=>clk_ht,
138        reset=>reset,
139        en=>en_task,
140   Interf_i =>Libr.i,
141   Interf_o=>Libr.o,
142  mem_i =>sram.i,
143   mem_o =>sram.o       );
144
145--================================================================
146        --MUX de la RAM
147                               
148Ram_mux: process (clk,ramsel_i,pe_ram_addra,pe_ram_addrb,Core_ram_address_rd,Core_ram_address_wr,
149                                                Core_ram_en,Core_ram_we,Core_ram_data_in,pe_ram_ena,pe_ram_enb,Ram_do,
150                                                Pe_ram_din,Pe_ram_we    )
151 begin                         
152 case ramsel_i is
153       
154        when '1' =>
155                ram_addra <= Core_ram_address_wr ;
156                ram_addrb <= Core_ram_address_rd ;
157                ram_ena <= Core_ram_en;
158                ram_enb <= Core_ram_en;
159                ram_we<= Core_ram_we;
160                ram_din <= Core_ram_data_in;
161                pe_ram_do<=(others=>'-');
162                Core_ram_data_out<=ram_do;
163               
164        when others =>
165                ram_addra <=  pe_ram_addra;
166                ram_addrb <=  pe_ram_addrb;
167                ram_ena <= pe_ram_ena;
168                ram_enb <= pe_ram_enb;
169                ram_we<= pe_ram_we;
170                ram_din <=pe_ram_din;
171                Core_ram_data_out<=(others=>'-');
172                pe_ram_do<=ram_do;
173end case ;
174end process ;
175
176
177
178Instruction_En<=PE_instr_EN; -- Libr.Instr_en; --********A changer **********
179--=== !!!!! attention la suppression de la ligne ci-dessous empêche ce
180-- composant de bien fonctionner !!! !!!!!!!!!!!!!!!!!!!!!!!
181--instruction<=std_logic_vector(to_unsigned(Core_upper_adr,8));
182
183dpid<=dpid_i;
184en_task<= CE or Lib_enable; --l'activation d'une HT peut être directe ou commandée
185Lib_Instr_ack<=Core_Pushout(0); --l'instruction a été copié
186Lib_init<=Core_Pushout(4); -- Initialized
187Lib_Enable<=Core_Pushout(6);-- HT activée par la Librairie.
188
189horloge_ht:process (reset,ce,lib_enable,clk)
190begin
191if reset='1' then
192clk_ht<='0';
193else
194if ce='1' then
195clk_ht<=clk;
196elsif lib_enable='1' then
197clk_ht<=clk;
198else
199clk_ht<='0';
200end if;
201end if;
202end process horloge_ht;
203
204Hold1: Hold_fsm port map (
205clk=>clk ,
206reset =>reset,
207Ram_Busy=>Libr.O.membusy,
208Hold_Ack=>Hold_Ack,
209Hold_req =>Core_Hold_Req,
210RamSel => RamSel_i);
211Core_Hold_Ack<=Hold_Ack;
212
213--================RAM signals ======================                                   
214sram.I.data_out<=PE_ram_do;
215pe_Ram_addra<=sram.O.addr_wr;
216pe_Ram_addrb<=sram.O.addr_rd ; 
217PE_Ram_we<=sram.O.we;
218PE_Ram_ena<=sram.O.ena;
219PE_Ram_enb<=sram.O.enb;
220PE_ram_din<=sram.O.data_in;
221--==========MPI HCL signals ============================
222
223affect:process (clk,Core_hold_req,RamSel_i,Core_pushout,Libr)
224begin
225        --if (clk'event and clk='1') then
226Instruction<=Libr.O.Instruction;                       
227        Ram_busy<=Libr.O.membusy;
228PE_Instr_EN<=Libr.O.instr_en;
229Libr.I.Instr_ack<=Core_pushout(0);
230Libr.I.InitOk<=Core_pushout(4);
231Libr.I.Spawned<=Core_pushout(6);
232Libr.I.Hold_Req<=Core_Hold_req;
233--Libr.I.Hold_Ack<=Hold_Ack;
234Libr.I.RamSel<=RamSel_i;               
235--end if;
236end process affect;
237--=======================================================================
238--MAE du PE
239--=======================================================================
240
241 
242end Behavioral;
243
Note: See TracBrowser for help on using the repository browser.