Ignore:
Timestamp:
Dec 7, 2012, 11:31:34 AM (12 years ago)
Author:
rolagamo
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PROJECT_CORE_MPI/CORE_MPI/BRANCHES/v0.01/PE.vhd

    r35 r39  
    2121use IEEE.STD_LOGIC_1164.ALL;
    2222library NocLib ;
     23library Std;
    2324--use IEEE.STD_LOGIC_ARITH.ALL;
    2425--use IEEE.STD_LOGIC_UNSIGNED.ALL;
     
    2627use work.Packet_type.all;
    2728use work.MPI_RMA.all;
     29use std.textio.all;
    2830use IEEE.NUMERIC_STD.ALL;
    2931
     
    8183        signal Lib_Init : std_logic; -- l'initialisation est terminée
    8284 --signaux pour la gestion de la MAE
    83  type typ_mae is (start,Fillmem,NextFill,InitApp,InitCompleted,GetRank1,GetRank2,GetRank3,writeptr,InstrCopy,
    84  putdata,putdata2,putcompleted,getdata,getdata2,getcompleted,terminate,st_timeout);
     85 type typ_mae is (start,Fillmem,NextFill,InitApp,GetRank,WInCreate, putdata,getdata,WinCompleted,finalize,st_timeout);
    8586signal dcount : natural range 0 to 255:=0; --permet de compter le packet de données envoyées
    8687signal count,count_i : natural range 0 to 15:=0;
     
    182183        variable timeout,ct,dlen : natural range 0 to 255;
    183184        variable adrToset,SrcAdr,DestAdr : std_logic_vector(ADRLEN-1 downto 0);
     185        variable mywin : Mpi_win;
    184186        variable iack : std_logic:='0';
    185187        variable  adresse,adresse_rd :natural range 0 to 65536;
    186188        variable status_reg,config_reg :std_logic_vector(Word-1 downto 0):=(others=>'0');
     189        --=======================================================
     190        --variables pour la création du fichier de résultats
     191                type char_file is file of character;
     192        file f: text;
     193        variable status :file_open_status ;
     194        variable char_count: integer range 0 to 65536 := 0;
     195                  variable str: string (1 to 79) ;
     196                  variable L: line;
     197                  variable fopened: std_logic:='0';
     198--======================================================
    187199        begin
    188200        --=== Partie combinatoire du process ===================================
     
    193205                        Libr.RamSel<=RamSel;
    194206                        sram.data_out<=PE_ram_do;
    195         --=== Fin de la partie combinatoire du process ==========================               
     207        --=== Fin de la partie combinatoire du process ==========================       
     208               
     209                   
     210           
     211        --end loop;
     212       
    196213        if (clk'event and clk='1') then
    197214                if reset='1' then
     
    220237                                timeout:=0;
    221238                                dcount<=0;
     239                        if fopened='0' then
     240                        file_open(status,f, integer'image(destid) & "test_file0.txt", APPEND_MODE);
     241        --while not endfile(c_file_handle) loop
     242                        --end if;
     243               
     244                                --write (l,string'("Ce fichier contient des resultats de la simulation ; ;" & " started at time ; " & time'image(now)));
     245                                --report l.all;
     246           -- writeline (f, l) ;
     247                                fopened:='1';
     248                        end if;
     249                         
    222250                         when Fillmem =>
    223251                                if Ramsel='0' then
     
    256284                when InitApp =>
    257285                                --code pour Init
    258                                                                
     286                                dlen:=1;
     287                                if ct=0 then
     288                                write (l,string'("Dlen; ;INIT of Process n°; " & image(MyRank) & "; started at ; " & time'image(now)));
     289                               
     290                                report l.all;
     291            writeline (f, l) ;
     292                                end if;
    259293                                pMPI_Init(ct,Libr,Clk,SRam);
    260294                                PE_Instr_EN<=Libr.instr_en;
     
    265299                                --if Libr.InitOk='1' then
    266300                                if ct=0 then
    267                                         RunState<=GetRank1;
     301                                        RunState<=GetRank;
     302                                        write (l,string'("Dlen; ;INIT;" & ";  ended at  ; " & time'image(now)));
     303                                        report l.all;
     304                                        writeline (f, l) ; 
    268305                                end if;
    269306                               
    270307               
    271                 when writeptr =>
    272                                
    273                 When InstrCopy =>
    274                                
    275                
    276                 when InitCompleted =>
    277                                
    278                 when GetRank1 =>
    279                
     308               
     309                when GetRank =>
     310                if ct=0 then
     311                               
     312                                write (l,string'("Dlen; ; Rank ; " & "; started  ; " & time'image(now)));
     313                                report l.all;
     314            writeline (f, l) ; 
     315                        end if;
    280316                        pMPI_Comm_rank(ct,Libr,sram,MPI_COMM_WORLD,MyRank);
     317                        adresse_rd:=to_integer(unsigned(sram.addr_rd));
    281318                        if ct=0 then
    282                                 RunState<=PutData2;
     319                                RunState<=PutData;
     320                                write (l,string'("Dlen; ; Rank ; " & "; ended at  ; " & time'image(now)));
     321                                report l.all;
     322            writeline (f, l) ; 
    283323                        end if;
    284                         adresse_rd:=to_integer(unsigned(sram.addr_rd));
    285 
    286                 when GetRank2 =>
    287                         adresse_rd:=CORE_INIT_ADR+1;
    288                         if ramsel='0' then
    289                                 RunState<=Getrank3;
    290                         end if;
    291                 when GetRank3=>
    292                         adresse_rd:=CORE_INIT_ADR+1;
    293                         if ramsel='0' then
    294                                 RunState<=putdata2;
    295                         end if;
     324                       
     325
     326                when Wincreate =>
     327                       
     328               
    296329                when putdata => --construire le packet pour le Put
    297330                               
    298                                
    299                 when putdata2 =>
    300                                        
     331                                        --dlen:=251; ---
     332                                        if ct=0 then
     333                                        write (l,string'("Dlen;" & integer'image(dlen) & ";Put of Pr n°; " & image(MyRank) & "; started at ; " & time'image(now)));
     334                                        report l.all;
     335                                        writeline (f, l) ;
     336                                        end if;
    301337                                        if unsigned(MyRank) = 0 then
    302338                                                Destrank:=1;
     
    304340                                                DestRank:=0;
    305341                                        end if;
    306                                         dlen:=200; --- to_integer(unsigned(datalen));
     342                                         
    307343                                        SrcAdr:=std_logic_vector(to_unsigned(DATAPTR,ADRLEN));
    308344                                        DestAdr:=X"2000";
    309345                                       
    310                                         pMPI_put(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr1 & DestAdr,Dlen,Mpi_int,Default_win);
     346                                        pMPI_put(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr,Dlen,Mpi_int,Default_win);
    311347                                        adresse:=to_integer(unsigned(sram.addr_wr));
    312348                                        adresse_rd:=to_integer(unsigned(sram.addr_rd));
     
    317353                                        if ct=0 then
    318354                                                RunState<=GetData;
     355                                        report "Put of Process n°; " & image(MyRank) & "; ended at ; " & time'image(now);
     356                                        write (l,string'("Dlen;" & integer'image(dlen) & ";Put of Pr n°; " & image(MyRank) & "; ended at time ; " & time'image(now)));
     357                                        report l.all;
     358                                        writeline (f, l) ;                                                                                                                                     
    319359                                        end if;
    320                                                
    321                        
    322                         when putcompleted =>
     360                                       
    323361                               
    324362                        when getdata =>   --positionnement du mot de longueur des données
    325                            
    326                                         dlen:=200; --- to_integer(unsigned(datalen));
     363                                        --dlen:=251; ---
     364                                        if ct=0 then
     365                                        write (l,string'("Dlen;" & integer'image(dlen) & ";GET of Process n°; " & image(MyRank) & "; started at ; " & time'image(now)));
     366                                        report l.all;
     367                                        writeline (f, l) ;
     368                                        end if;
     369                                       
    327370                                        SrcAdr:=X"0120";
    328371                                        DestAdr:=X"4000";
    329372                                       
    330                                         pMPI_GET(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr1 & DestAdr,Dlen,Mpi_int,Default_win);
     373                                        pMPI_GET(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr,Dlen,Mpi_int,Default_win);
    331374                                        adresse:=to_integer(unsigned(sram.addr_wr));
    332375                                        adresse_rd:=to_integer(unsigned(sram.addr_rd));
     
    336379                                       
    337380                                        if ct=0 then
    338                                                 RunState<=terminate;
     381                                                RunState<=wincompleted;
     382                                                assert ct/=0 report "GET_END " & integer'image(destrank)
     383                                                                severity Warning ;
     384                                                write (l,string'("Dlen ;" & integer'image(dlen) & ";GET of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now)));
     385                                        report l.all;
     386                                       
     387                                        writeline (f, l) ; 
    339388                                        end if;
    340                                 when getdata2 =>
    341                                        
    342                                        
    343                                
    344                                        
    345                                 when getcompleted =>
    346                                
    347                                        
     389                               
     390                                when WinCompleted =>
     391                                if ct=0 then
     392                                                write (l,string'("Dlen ;" & integer'image(dlen) & ";Wait of Proc n°; " & image(MyRank) & "; started at ; " & time'image(now)));
     393                                                report l.all;
     394                                                writeline (f, l) ;
     395                                        end if;
     396                                         pMPI_Win_wait(ct,Libr,sram,MyWin );
     397                                         adresse:=to_integer(unsigned(sram.addr_wr));
     398                                        adresse_rd:=to_integer(unsigned(sram.addr_rd));
     399                                        if ct=0 then
     400                                                RunState<=finalize;     
     401                                                write (l,string'("Dlen ;" & integer'image(dlen) & ";Wait of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now)));
     402                                                report l.all;
     403                                                writeline (f, l) ;
    348404                                               
    349                         when terminate =>
    350                        
    351                
    352                                         RunState<=start;
    353                                        
     405                                        end if;   
     406                                       
     407                                               
     408                        when finalize =>
     409                                        if ct=0 then
     410                                                write (l,string'("Dlen ;" & integer'image(dlen) & ";Finalize of Proc n°; " & image(MyRank) & "; started at ; " & time'image(now)));
     411                                                report l.all;
     412                                                writeline (f, l) ;
     413                                        end if;
     414                                         
     415                                        if ct=0 then
     416                                                RunState<=start;       
     417                                                write (l,string'("Dlen ;" & integer'image(dlen) & ";Finalize of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now)));
     418                                                report l.all;
     419                                                writeline (f, l) ;
     420                                                file_close(f); 
     421                                        end if;   
     422               
    354423                        when st_timeout =>
    355424                         
     
    397466                                        PE_Ram_enb<=sram.enb;
    398467                                       
    399                  when Initcompleted =>
    400                              
    401                                         PE_Ram_ena<=Lib_Init;
    402                                         PE_Ram_we<='1';
    403                                         PE_Ram_enb<='1';
    404                                        
    405                         when GetRank1 =>
     468                                                       
     469                        when GetRank =>
    406470
    407471                                        PE_Ram_we<=sram.we;
    408472                                        PE_Ram_ena<=sram.ena;
    409473                                        PE_Ram_enb<=sram.enb;
    410                         when GetRank2 =>
    411                                         PE_Ram_ena<='0';
    412                                            --lecture effective du rang
    413                                         PE_Ram_enb<='1';
    414                                         --MyRank<=PE_ram_do(3 downto 0);
    415                         when GetRank3 =>
    416                                         PE_Ram_ena<='0';
    417                                            --lecture effective du rang
    418                                         PE_Ram_enb<='1';
    419                                         --MyRank<=PE_ram_do(3 downto 0);               
    420                  when writeptr =>
    421                                         PE_Ram_we  <='1';   --écriture dans la RAM
    422                                         PE_Ram_ena <='1';
    423                                        
    424                                         PE_Ram_enb <='0';
    425                         --              dcount<=dcount+1;
    426                                        
    427                                         --PE_Instr_En<='0';
    428                 when InstrCopy =>  --instruction copy
    429                                    PE_Ram_we<='0';
    430                                         PE_Ram_ena<='0';
    431                                         PE_Ram_enb<='0';
    432 
    433                
    434                 when putdata =>   --positionnement du mot de longueur des données
    435                                 --dcount<=0;
    436                                 srcadr0<=X"00";
    437                                 srcadr1<=X"01";
    438                                 destadr0<=X"00";
    439                                 destadr1<=X"02";
    440                                    PE_Ram_we<='0';
    441                                         PE_Ram_ena<='0';
    442                                
    443                                         PE_Ram_enb<='1';
    444                                
    445                         when putdata2 =>
    446 --                                      PE_Ram_we  <='1';   --écriture dans la RAM
    447 --                                      PE_Ram_ena <='1';
    448 --                                      PE_Ram_enb <='0';
     474                        when WinCreate =>
     475                                       
     476                                        PE_Ram_we<=sram.we;
     477                                        PE_Ram_ena<=sram.ena;
     478                                        PE_Ram_enb<=sram.enb;
     479
     480               
     481                          --positionnement du mot de longueur des données
     482                               
     483                               
     484                        when putdata =>
    449485                                        srcadr0<=X"00";
    450486                                        srcadr1<=X"01";
     
    454490                                        PE_Ram_ena<=sram.ena;
    455491                                        PE_Ram_enb<=sram.enb;
    456                                        
    457                         when putcompleted =>                   
    458                                         PE_Ram_we  <='1';
    459                                         PE_Ram_ena <='1';
    460                                           -- lecture du résultat
    461                                         PE_Ram_enb  <='1';
    462                                         --PE_Instr_En<='1';
     492               
    463493                        when getdata =>
    464494                                PE_Ram_we<=sram.we;
    465495                                PE_Ram_ena<=sram.ena;
    466496                                PE_Ram_enb<=sram.enb;
    467 
    468                                
    469                         when getdata2 =>
    470                                    PE_Ram_we  <='1';   --écriture dans la RAM
    471                                         PE_Ram_ena <='1';
    472                                        
    473                                         PE_Ram_enb <='0';
    474                                
    475                         when getcompleted =>                           
    476                                         PE_Ram_we  <='1';
    477                                         PE_Ram_ena <='1';
    478 
    479                                         PE_Ram_enb  <='1';
    480                                
    481                         when terminate =>
     497                               
     498                        when Wincompleted =>                           
     499                                        PE_Ram_we<=sram.we;
     500                                        PE_Ram_ena<=sram.ena;
     501                                        PE_Ram_enb<=sram.enb;
     502                               
     503                        when finalize =>
    482504                       
    483505                                   PE_Ram_we<='0';
Note: See TracChangeset for help on using the changeset viewer.