source: PROJECT_CORE_MPI/MPI_HCL/TRUNK/MPICORETEST.vhd @ 96

Last change on this file since 96 was 96, checked in by rolagamo, 10 years ago
File size: 19.0 KB
Line 
1--------------------------------------------------------------------------------
2-- Company:
3-- Engineer:
4--
5-- Create Date:   01:27:32 04/20/2012
6-- Design Name:   
7-- Module Name:   C:/Core MPI/CORE_MPI/MPICORETEST.vhd
8-- Project Name:  MPI_CORE_COMPONENTS
9-- Target Device: 
10-- Tool versions: 
11-- Description:   
12--
13-- VHDL Test Bench Created by ISE for module: MPI_NOC
14--
15-- Dependencies:
16--
17-- Revision: 11 Juillet 2012
18-- Revision 0.01 - File Created
19-- Additional Comments:Permet de tester le composant MPI
20-- en simulant deux PE qui s'échangent des données.
21-- Notes:
22--
23--
24--------------------------------------------------------------------------------
25LIBRARY ieee;
26USE ieee.std_logic_1164.ALL;
27library NocLib ;
28--use IEEE.STD_LOGIC_ARITH.ALL;
29--use IEEE.STD_LOGIC_UNSIGNED.ALL;
30use NocLib.CoreTypes.all;
31use work.Packet_type.all;
32use work.MPI_RMA.all;
33-- Uncomment the following library declaration if using
34-- arithmetic functions with Signed or Unsigned values
35USE ieee.numeric_std.ALL;
36 
37ENTITY MPICORETEST IS
38--port (clkm : in std_logic;
39--reset : in std_logic;
40--result : out std_logic_vector(Word-1 downto 0));
41END MPICORETEST;
42 
43ARCHITECTURE behavior OF MPICORETEST IS 
44--constant WORD :positive:=8;
45constant MEMSIZE:positive:=65535;
46 -- Components declaration
47 COMPONENT RAM_v
48  generic (width : positive;size :positive);
49        PORT(
50                clka : IN std_logic;
51                clkb : IN std_logic;
52                wea : IN std_logic;
53                ena : IN std_logic;
54                enb : IN std_logic;
55                addra : IN std_logic_vector;
56                addrb : IN std_logic_vector;
57                dia : IN std_logic_vector;         
58                dob : OUT std_logic_vector
59                );
60        END COMPONENT;
61
62       
63    -- Component Declaration for the Unit Under Test (UUT)
64 
65    COMPONENT MPI_NOC
66         generic (NPROC : positive:=2);
67    PORT(
68         MPI_Node_in : IN  Ar_MPIPort_in(1 to 2);
69         MPI_Node_Out : OUT  Ar_MPIPort_out(1 to 2)
70        );
71    END COMPONENT;
72   
73        constant clk_period : time := 10 ns;
74
75--===================signaux pour l'horloge ==============================
76signal reset,clkm : std_logic := '0';
77--========================================================================
78           --signaux pour l'interconnexionsignal datain :std_logic_vector(word-1 downto 0):= (others => '0');
79        signal ram_we ,ram_ena,ram_enb,ramsel: std_logic:='0';
80        signal pe_ram_we ,pe_ram_ena,pe_ram_enb: std_logic;
81        signal ram_do,ram_din:std_logic_vector(word-1 downto 0):= (others => '0');
82        signal pe_ram_do,pe_ram_din:std_logic_vector(word-1 downto 0):= (others => '0');
83        signal ram_addra,ram_addrb :std_logic_vector(ADRLEN-1 downto 0);
84        signal pe_ram_addra,pe_ram_addrb :std_logic_vector(ADRLEN-1 downto 0);
85        signal PE_Instr_en : std_logic:='0';
86        signal sram : typ_dpram;
87   signal pe_hold_ack,pe_hold_req : std_logic;
88        --signal pe_putadr:std_logic_vector(MEMSIZE-1 downto 0);-- adresse du bloc pour Put
89        --signal pe_getadr:std_logic_vector(MEMSIZE-1 downto 0);-- adresse du bloc pour get
90        signal Lib_Ready:std_logic; --indique que l'exécution de la fonction est terminée
91        signal Lib_instr_ack : std_logic; -- l'instruction est copiée dans le tampon FIFO
92        signal Lib_Init : std_logic; -- l'initialisation est terminée
93       
94        --données du programme PE
95        signal SrcAdr0,SrcAdr1,destAdr0,destAdr1,Datalen:std_logic_vector(word-1 downto 0);
96        signal dpid,dpid_i : natural range 0 to 15:=1;
97        --Inputs
98   signal MPI_Node_in : Ar_MPIPort_in(1 to 2) ;
99-- Port details
100--                      instruction :   STD_LOGIC_VECTOR (Word -1 downto 0);
101--           instruction_en :  STD_LOGIC;
102--           packet_ack : std_logic;
103--           ram_data_in :  STD_LOGIC_VECTOR (Word-1 downto 0);
104--                        clk :  STD_LOGIC;
105--           reset :  STD_LOGIC;
106        --Outputs
107   signal MPI_Node_Out : Ar_MPIPort_out(1 to 2);
108--      détails des champs de Typ_MPIPORT_Out             
109--         
110--                       
111--         ram_we :  STD_LOGIC;
112--                        ram_en :  STD_LOGIC;
113--                        packet_received : STD_LOGIC;
114--                        barrier_completed : STD_LOGIC;
115--         instruction_fifo_full : STD_LOGIC;
116--                        PushOut :  STD_LOGIC_VECTOR (WORD-1 downto 0);
117--                        ram_data_out : STD_LOGIC_VECTOR (WORD-1 downto 0);
118--           ram_address :  STD_LOGIC_VECTOR (ADRLEN-1 downto 0);
119--                       
120--end record;
121   --
122   -- a
123 
124   
125 --signaux pour la gestion de la MAE
126 type typ_mae is (start,Fillmem,NextFill,InitApp,InitCompleted,writeptr,InstrCopy, 
127 putdata,putdata2,putcompleted,getdata,getdata2,getcompleted,terminate,st_timeout);
128signal dcount : natural range 0 to 255:=0; --permet de compter le packet de données envoyées
129signal count,count_i : natural range 0 to 15:=0;
130
131--signal adresse,adresse_rd :natural range 0 to 65536;
132
133                signal etPutGet : typ_mae;
134                signal Ram_busy :std_logic:='0';
135               
136BEGIN
137 
138        -- Instantiate the Unit Under Test (UUT)
139   uut: MPI_NOC GENERIC MAP (NPROC=>2)
140                PORT MAP (
141          MPI_Node_in => MPI_Node_in,
142          MPI_Node_Out => MPI_Node_Out
143        );
144Inst_RAM_v: RAM_v generic map(width=>word,size=>ADRLEN)
145        PORT MAP(
146                clka =>clkm,
147                clkb => clkm,
148                wea => ram_we,
149                ena => ram_ena,
150                enb => ram_enb,
151                addra => ram_addra,
152                addrb =>ram_addrb,
153                dia => ram_din,
154                dob => ram_do
155        );
156       
157        --MUX de la RAM
158                               
159  ram_addrb <= MPI_Node_out(1).ram_address_rd WHEN ramsel ='1' ELSE 
160            pe_ram_addrb; 
161 ram_addra <= MPI_Node_out(1).ram_address_wr WHEN ramsel ='1' ELSE 
162            pe_ram_addra; 
163
164
165ram_ena <= MPI_Node_out(1).ram_en WHEN ramsel ='1' ELSE 
166            pe_ram_ena; 
167ram_enb <= MPI_Node_out(1).ram_en WHEN ramsel ='1' ELSE 
168            pe_ram_enb; 
169ram_ena <= MPI_Node_out(1).ram_en WHEN ramsel ='1' ELSE 
170            pe_ram_ena; 
171               
172ram_we<= MPI_Node_out(1).ram_we WHEN ramsel ='1' ELSE 
173            pe_ram_we; 
174
175ram_din <= MPI_Node_out(1).ram_data_in WHEN ramsel ='1' ELSE 
176            pe_ram_din;
177                               
178
179MPI_Node_in(1).ram_data_out<=ram_do when ramsel='1' else (others=>'Z');
180pe_ram_do<=ram_do when ramsel='0' else (others=>'Z');
181
182
183pe_hold_req<=MPI_Node_out(1).hold_req;
184MPI_Node_in(1).hold_ack<=pe_hold_ack;
185MPI_Node_in(1).reset<=reset;   
186MPI_Node_in(1).clk<=clkm;
187MPI_Node_in(1).instruction_en<=PE_instr_en;
188MPI_Node_in(1).instruction<=std_logic_vector(to_unsigned(Core_upper_adr,8));
189
190Lib_Instr_ack<=MPI_Node_out(1).Pushout(0); --l'instruction a été copié
191Lib_init<=MPI_Node_out(1).Pushout(4); -- Initialized
192--=============================================================
193   -- Clock process definitions
194--=============================================================
195   clk_process :process
196   begin
197                clkm <= '0' ;
198                wait for 10 ns;--clk_period/2;
199                clkm <= '1' ;
200                wait for 10 ns;--clk_period/2;
201   end process;
202 stim_proc: process 
203   begin               
204      -- hold reset state for 100 ns.
205      reset<='0';
206                wait for 1 ns; 
207                reset<='1';
208      wait for clk_period*10;
209                reset<='0';
210                wait;
211     
212       
213        end process;
214--================================================================
215dpid<=dpid_i;
216 pPutGet:process(clkm)
217       
218        variable bfill,destrank,pid,mport : natural range 0 to 15;
219        variable fsrc,ret : natural range 0 to 15:=0;
220        variable timeout,dlen,ct : natural range 0 to 255;
221        variable adrToset : std_logic_vector(ADRLEN-1 downto 0);
222        variable iack : std_logic:='0';
223        variable  adresse,adresse_rd :natural range 0 to 65536;
224       
225        begin
226       
227        if (clkm'event and clkm='1') then 
228                if reset='1' then
229                                        etputget<=start;
230                                       
231                                       
232                                        dcount<=0;
233                       
234                else
235       
236                        case  etputget is
237                        when start =>
238                                if bfill=0 then -- si le nombre de bloc de mémoire remplis est vide
239                                                etputget<=Fillmem;
240                                 end if;
241                                 Ram_busy<='0';
242                                 PE_Instr_En<='0';
243                                iack:='0';
244                                adresse:=256;
245                                adresse_rd:=0;
246                                timeout:=0;
247                                dcount<=0;
248                         when Fillmem =>
249                                if mpi_node_out(1).hold_req='0' then 
250                                       
251                                       
252                                       
253                                        PE_Ram_din<=std_logic_vector(to_unsigned(dcount,8)); -- x"0f";
254                                        PE_Instr_En<='0';
255                                        dcount<=dcount+1;
256                                       
257                                        if dcount=50 then
258                                                 bfill:=bfill+1;
259                                                 
260                                                 if bfill=4 then
261                                                  etputget<=InitApp;
262                                                 else
263                                                        etputget<=nextfill;
264                                                end if;
265                                        else
266                                                adresse:=adresse+1;
267                                                etputget<=Fillmem;
268                                        end if;
269                        else -- attente de la libéraion de la mémoire
270                                timeout:=timeout+1;
271                                          if timeout=100 then
272                                                etputget<=st_timeout;
273                                          end if;
274                                                       
275                        end if;
276                when nextfill  =>   --prépare le prochain bloc mémoire qui sera rempli
277                                adresse:=100*bfill;
278                                dcount<=0;
279                                etputget<=Fillmem;
280                                PE_Instr_En<='0';
281                when InitApp =>
282                                --code pour Init ici
283                                --mettre mpi_init à l'adresse mpi
284                               
285                                PE_Ram_din<=MPI_INIT & x"0" ;
286                                adresse:=core_init_adr;
287                               
288                                PE_Instr_En<='0';
289                                fsrc:=1;
290                                adrToSet:=std_logic_vector(to_unsigned(core_init_adr,ADRLEN));
291                                if ret/=fsrc then
292                                dcount<=0;
293                                        etputget<=writeptr;
294                                        adresse:=core_base_adr+2;
295                                        PE_Instr_En<='0';
296                                else
297                                if Lib_instr_ack='1' then  -- attente de la prise en compte de l'instruction
298                                        etputget<=InitCompleted;
299                                        PE_instr_en<='0';
300                               
301                                else
302                                        PE_Instr_en<='1';
303                                end if;
304                                   
305                                end if;
306               
307                when writeptr =>
308                                PE_Instr_En<='0';
309                                if PE_Hold_req = '0' then --s'assurer que le bus est disponible
310                                       
311                                        if dcount=0 then 
312                                                PE_RAM_Din<=AdrToSet(Word-1 downto 0);
313                                                dcount <=dcount+1;
314                                                --adresse:=adresse+1; --prépare la prochaine écriture
315                                        elsif dcount=1 then
316                                                dcount <=dcount+1;
317                                                adresse:=adresse+1; --prépare la prochaine écriture
318                                                PE_RAM_Din<=AdrToSet(15 downto 8);
319                                        elsif dcount=2 then -- ce cycle permet juste de vider le tampon d'écriture en RAM
320                                                ret:=fsrc;
321                                                dcount<=0;
322                                                timeout:=0;
323                                               
324                                                                if fsrc=1 then
325                                                                etputget <= InitApp;
326                                                                elsif fsrc=2 then
327                                                                etputget <= putdata;
328                                                                elsif fsrc=3 then
329                                                                etputget <= getdata;
330                                                                else
331                                                                etputget <= start;
332                                                                end if;
333                                                       
334                                        end if;
335                                       
336                                end if;
337                When InstrCopy =>
338                                if Lib_instr_ack='1' then
339                                        etputget<=Writeptr;
340                                        PE_instr_en<='0';
341                                        iack:='1';
342                                       
343                                else
344                                        PE_Instr_en<='1';
345                                end if;
346               
347                when InitCompleted =>
348                               
349                                if Lib_Init='1' then
350                                        etputget<=putdata;
351                                        PE_Instr_En<='0';
352                                else
353                                        PE_Instr_En<='0';
354                                end if;
355                when putdata => --construire le packet pour le Put
356                                DestRank:=1;
357                                adresse_rd:=core_base_adr+Core_Rank2port_base+DestRank;
358                               
359                                PE_Instr_En<='0';
360                                timeout:=0;
361                                dcount<=0;
362                                fsrc:=2;
363                                adrToSet:=std_logic_vector(to_unsigned(core_put_adr,ADRLEN));
364                                if ret/=fsrc then
365                                  adresse:=core_base_adr+2;
366                                        etputget<=writeptr;
367                                        ret:=0;
368                                else
369                                        if Lib_instr_ack/='1' then 
370                                                etputget<= putdata2;
371                                        end if;
372                                end if;
373                               
374                when putdata2 =>
375               
376                        if ramsel = '0' then  --si le PE a accès à la RAM
377                                        dlen:=to_integer(unsigned(datalen));
378                                        pMPI_put(clkm,destrank,SrcAdr1 & Srcadr0,DestAdr1 & DestAdr0,Dlen,sram,ct);
379                                        adresse:=to_integer(unsigned(sram.addr_wr));
380                                        PE_ram_din<=sram.data_in;
381                                        dcount<=ct;
382                                        if dcount<=6 then
383--                                                 
384--                                                      PE_Instr_En<='0';
385--                                                      if dcount=0 then
386--                                                      adresse:=core_put_adr;
387--                                                      PE_Ram_din<=MPI_PUT & std_logic_vector(to_unsigned(Dpid,4));
388--                                                      elsif dcount=1 then
389--                                                      adresse:=core_put_adr+dcount;
390--                                                      PE_Ram_din<=Datalen ;
391--                                                      elsif dcount=2 then
392--                                                      adresse:=core_put_adr+dcount;
393--                                                      PE_Ram_din<=SrcAdr1 ;
394--                                                      elsif dcount=3 then
395--                                                      adresse:=core_put_adr+dcount;
396--                                                      PE_Ram_din<=SrcAdr0 ;
397--                                                      elsif dcount=4 then
398--                                                      adresse:=core_put_adr+dcount;
399--                                                      PE_Ram_din<=DestAdr1 ;
400--                                                      elsif dcount=5 then
401--                                                      adresse:=core_put_adr+dcount;
402--                                                      PE_Ram_din<=DestAdr0 ;
403                                                        elsif dcount=7 then  --juste après la valeur 6 en fait
404--                                                      adresse:=core_base_adr+1;
405--                                                      adresse_rd:=core_base_adr;
406--                                                      PE_Ram_din<=x"01"; --instruction pulse enable;
407                                                        PE_Instr_En<='1';
408--                                                     
409                                                        end if;
410--                                              dcount<=dcount+1;
411--                                      end if;
412                        elsif PE_instr_En='0' then
413                                        timeout:=timeout+1;
414                                        if timeout>=10 then -- reprendre le contrôle du Bus de force si nécessaire
415                                                ram_busy<='1';
416                                                timeout:=0;
417                                                PE_Instr_En<='0';
418                                        end if;
419                        end if;
420                                if dcount >=6 then
421                                                Ram_busy<='0';--libérer le bus et attendre la réponse du Core MPI
422                                                if Lib_instr_ack='1' then -- Instruction ack
423                                                  PE_Instr_En<='0'; 
424                                                        if Ramsel='0' then
425                                                                adresse:=core_base_adr+1;
426                                                                PE_Ram_din<=x"00"; --ramener le IPulse à 0;
427                                                                Ram_busy<='0';
428                                                                etPutGet<=putcompleted;
429                                                        else
430                                                               
431                                                                Ram_busy<='1';  --force la prise du bus
432                                                        end if;
433                                                else
434                                               
435                                                  timeout:=timeout+1; 
436                                                  if timeout=150 then 
437                                                                etputget<=st_timeout;
438                                                        end if;
439                                                end if;
440                                end if;
441                       
442                       
443                        when putcompleted =>
444                                adresse_rd:=core_put_adr+6;
445                                if PE_Ram_do(0)='1' then  --Put completed
446                                        etPutGet<=GetData;
447                                end if;
448                                PE_Instr_En<='0';
449                        when getdata =>   --positionnement du mot de longueur des données
450                           
451                                DestRank:=1;
452                                timeout:=0;
453                                dcount<=0;
454                                        fsrc:=3;
455                                adrToSet:=std_logic_vector(to_unsigned(core_get_adr,ADRLEN));
456                                if ret/=fsrc then
457                                        adresse:=core_base_adr+2;
458                                        etputget<=writeptr;
459                                        ret:=0;
460                                else
461                                        adresse:=core_get_adr;
462                                        etputget<= getdata2;
463                                end if;
464                            PE_Instr_En<='0';
465                                when getdata2 =>
466                                       
467                                        if ramsel='0' then
468                                               
469                                                pMPI_get(clkm,destrank,SrcAdr1 & Srcadr0,DestAdr1 & DestAdr0,Dlen,sram,ct);
470                                           adresse:=to_integer(unsigned(sram.addr_wr));
471                                                PE_ram_din<=sram.data_in;
472                                                dcount<=ct;
473                                                if dcount<=6 then
474                                                       
475--                                                      if dcount<=0 then
476--                                                              adresse:=core_get_adr;
477--                                                      PE_Ram_din<=MPI_GET & std_logic_vector(to_unsigned(Dpid,4));
478--                                                      elsif dcount=1 then
479--                                                      adresse:=core_get_adr+dcount;
480--                                                      PE_Ram_din<=Datalen ;
481--                                                      elsif dcount=2 then
482--                                                      adresse:=core_get_adr+dcount;
483--                                                      PE_Ram_din<=SrcAdr1 ;
484--                                                      elsif dcount=3 then
485--                                                      adresse:=core_get_adr+dcount;
486--                                                      PE_Ram_din<=SrcAdr0 ;
487--                                                      elsif dcount=4 then
488--                                                      adresse:=core_get_adr+dcount;
489--                                                      PE_Ram_din<=DestAdr1 ;
490--                                                      elsif dcount=5 then
491--                                                      adresse:=core_get_adr+dcount;
492--                                                      PE_Ram_din<=DestAdr0 ;
493                                                       
494                                                        elsif dcount=7 then
495--                                                      adresse:=core_base_adr+1;
496                                                        adresse_rd:=core_base_adr;
497                                                        PE_Instr_En<='1';
498--                                                      PE_Ram_din<=x"01"; --instruction pulse enable;
499                                                        timeout:=0;
500                                                        end if;
501--                                                      dcount<=dcount+1;
502--                                      end if;
503                                        elsif  PE_Instr_En='0'then
504                                                timeout:=timeout+1;
505                                                if timeout>=10 then -- reprendre le contrôle du Bus de force si nécessaire
506                                                        ram_busy<='1';
507                                                        timeout:=0;
508                                                        PE_Instr_En<='0';
509                                                end if;
510                                        end if;
511                       
512                                  if dcount >=6 then
513                                                  Ram_busy<='0';--libérer le bus et attendre la réponse du Core MPI
514                                                                if Lib_instr_ack='1' then -- Instruction ack
515                                                                  PE_Instr_En<='0'; 
516                                                                        if Ramsel='0' then
517                                                                                adresse:=core_base_adr+1;
518                                                                                PE_Ram_din<=x"00"; --ramener le IPulse à 0;
519                                                                                Ram_busy<='0';
520                                                                                etPutGet<=getcompleted;
521                                                                        else
522                                                                               
523                                                                                Ram_busy<='1';  --force la prise du bus
524                                                                        end if;
525                                                                else
526                                                               
527                                                                          timeout:=timeout+1; 
528                                                                          if timeout=150 then 
529                                                                                        etputget<=st_timeout;
530                                                                                end if;
531                                                                end if;
532                                                               
533                                                               
534                                                end if;
535                                               
536                               
537                                       
538                                when getcompleted =>
539                                adresse_rd:=core_get_adr+6;
540                                PE_Instr_En<='0';
541                                if PE_Ram_do(0)='1' then  --Put completed
542                                   if Ramsel='0' then
543                                        adresse:=core_base_adr+1;
544                                        PE_Ram_din<=x"00"; --ramener le IPulse à 0;
545                                        etPutGet<=Terminate;
546                                        else
547                                                timeout:=timeout+1;
548                                        end if;
549                                end if; 
550                                       
551                                               
552                        when terminate =>
553                       
554               
555                                        etputget<=start;
556                                       
557                        when st_timeout =>
558                         
559                          --if ram_busy='1' then
560                                 etputget<=start;
561                          --end if
562               
563                          etputget<=start;
564                        end case;
565                        pe_Ram_addra<=STD_LOGIC_VECTOR(to_unsigned(adresse,ADRLEN));
566                        pe_Ram_addrb<=STD_LOGIC_VECTOR(to_unsigned(adresse_rd,ADRLEN));
567                end if;   --reset='1'
568        end if;
569  end process pPutGet; 
570
571majPutGet:process (etputget)
572
573        begin
574                        case  etputget is
575                        when start =>
576                       
577                                   PE_Ram_we<='0';
578                                        PE_Ram_ena<='0';
579                                        PE_Ram_enb<='0';
580                                        --PE_Instr_En<='0';
581
582                 when fillmem =>
583                                   PE_Ram_we<='1';
584                                        PE_Ram_ena<='1';
585                                       
586                                        PE_Ram_enb<='0';
587                                        --PE_Instr_En<='0';
588                 when nextfill =>
589                                        PE_Ram_we<='1';
590                                        PE_Ram_ena<='1';
591                                        PE_Ram_enb<='0';
592                                        --PE_Instr_En<='0';
593            when InitApp =>
594                                   PE_Ram_we<='1';
595                                        PE_Ram_ena<='1';
596                                        PE_Ram_enb<='0';
597                                        --PE_Instr_En<='0';
598                 when Initcompleted =>
599                              --PE_Instr_En<='1';
600                 when writeptr =>
601                                        PE_Ram_we  <='1';   --écriture dans la RAM
602                                        PE_Ram_ena <='1';
603                                       
604                                        PE_Ram_enb <='0';
605                        --              dcount<=dcount+1;
606                                       
607                                        --PE_Instr_En<='0';
608                when InstrCopy =>  --instruction copy
609                                   PE_Ram_we<='0';
610                                        PE_Ram_ena<='0';
611                                        PE_Ram_enb<='0';
612
613               
614                when putdata =>   --positionnement du mot de longueur des données
615                                --dcount<=0;
616                                srcadr0<=X"00";
617                                srcadr1<=X"01";
618                                destadr0<=X"00";
619                                destadr1<=X"02";
620                                   PE_Ram_we<='0';
621                                        PE_Ram_ena<='0';
622                                           --lecture du n° de port de destination
623                                        PE_Ram_enb<='1';
624                                datalen<=std_logic_vector(to_unsigned(50,8));
625                                dpid_i<=to_integer(unsigned(PE_ram_do(3 downto 0))); --le port est situé ur les 4 bits de poids faible
626                                --PE_Instr_En<='0';
627                        when putdata2 =>
628                                        PE_Ram_we  <='1';   --écriture dans la RAM
629                                        PE_Ram_ena <='1';
630                                       
631                                        PE_Ram_enb <='0';
632                        --              dcount<=dcount+1;
633                                        if dcount>=5 then
634                                        --PE_Instr_En<='1';
635                                        else
636                                        --PE_Instr_En<='0';
637                                        end if;
638                        when putcompleted =>                   
639                                        PE_Ram_we  <='1';
640                                        PE_Ram_ena <='1';
641                                          -- lecture du résultat
642                                        PE_Ram_enb  <='1';
643                                        --PE_Instr_En<='1';
644                        when getdata =>
645                                --dcount<=0;
646                                srcadr0<=X"00";
647                                srcadr1<=X"02";
648                                destadr0<=X"00";
649                                destadr1<=X"03";
650                                datalen<=std_logic_vector(to_unsigned(50,8));
651                                --PE_Instr_En<='0';     
652                        when getdata2 =>
653                                   PE_Ram_we  <='1';   --écriture dans la RAM
654                                        PE_Ram_ena <='1';
655                                       
656                                        PE_Ram_enb <='0';
657                                --dcount<=dcount+1;
658                                   if dcount=5 then
659                                                --PE_Instr_En<='1';
660                                        else
661                                                --PE_Instr_En<='0';
662                                        end if;
663                        when getcompleted =>                           
664                                        PE_Ram_we  <='1';
665                                        PE_Ram_ena <='1';
666                                          -- lecture du résultat
667                                        PE_Ram_enb  <='1';
668                                        --PE_Instr_En<='1';
669                        when terminate =>
670                       
671                                   PE_Ram_we<='0';
672                                        PE_Ram_ena<='0';
673                                        PE_Ram_enb<='0';
674                                        --PE_Instr_En<='0';
675                       
676                        when st_timeout =>
677                                  PE_Ram_we<='0';
678                                        PE_Ram_ena<='0';
679                                        PE_Ram_enb<='0';
680                                        --PE_Instr_En<='0';
681                         
682                        end case;
683               
684end process majPutGet ; 
685
686 hold:process (pe_hold_req,clkm,reset)
687 begin
688 if rising_edge(clkm) then
689        if reset='1' then
690                pe_hold_ack<='0';
691        else
692                if pe_hold_req='1' then
693                        ramsel<=not(ram_busy);
694                        pe_hold_ack<=not(ram_busy); --si la mémoire est occupé, forcé une libération
695                else
696                        pe_hold_ack<='0';
697                        ramsel<='0';
698                end if;
699        end if;
700 end if;
701 end process hold;
702END;
Note: See TracBrowser for help on using the repository browser.