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/EX1_FSM.vhd

    r35 r39  
    5656                          fifo_empty : in  STD_LOGIC;
    5757           fifo_data_out : in  STD_LOGIC_VECTOR (7 downto 0);
     58                          fifo_src :      in STD_LOGIC; --permet de désigner le fifo qui est en service
    5859
    5960                                                                                                -- Accès au réseau sur puce
     
    9091signal packet_length : std_logic_vector(Word-1 downto 0);
    9192signal src_address : std_logic_vector(ADRLEN-1 downto 0);
    92 signal Wr_ok,rd_ok:std_logic:='0';
     93signal dma_rd,dma_wr,Wr_ok,rd_ok:std_logic:='0';
    9394--signal res_address : std_logic_vector(15 downto 0);
    9495signal dest_address : std_logic_vector(ADRLEN-1 downto 0);
     
    217218                                                                                                end if;
    218219                                                                                 else
     220                                                                                                Wr_Ok<='0';
    219221                                                                                        ex1_state_mach <= execute_put4;
    220222                                                                                end if;
    221                         when execute_put4 => if dma_wr_grant = '1' then -- fin du mpi_put
     223                        when execute_put4 => if dma_rd_grant = '1' then -- fin du mpi_put
    222224                                                                                   ex1_state_mach <= execute_put5;
    223225                                                                                        n<="0000";
    224226                                                                                        data_to_send<="00000001";
    225                                                                                         rd_ok<='1';
    226                                                                                         wr_ok<='0';
    227227                                                                                  else
    228228                                                                                        ex1_state_mach <= execute_put4;
    229229                                                                      end if;
     230                                                                                rd_ok<='1';
     231                                                                                wr_ok<='0';
    230232                                                                                src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
    231                         when execute_put5 =>
    232                                                                                         if n=0 then
     233       
     234                        when execute_put5 =>  if n <6 then     
     235                       
     236                                                                                                dma_wr<='1';  --demander un accès exclusif au bus
     237                                                                                                dma_rd<='1'; -- pour éviter une mauvaise mise à jour des données
     238                                                                                        else
     239                                                                                                dma_wr<='0';                                                                           
     240                                                                                                dma_rd<='0';
     241                                                                                        end if;
     242                                                                               
     243                                                                                if n=0 then
    233244                                                                                                if dma_rd_grant='1' then
    234                                                                                                         n<=n+1;
    235                                                                                                         tempval:=Ram_data_in;
    236                                                                                                         src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
    237                                                                                                         tempval(5):='1';                        -- SET du bit DSENT
    238                                                                                                         data_to_send<=tempval;
    239                                                                                                        
     245                                                                                                n<=n+1;
     246                                                                                               
    240247                                                                                                end if;
    241248                                                                                                rd_ok<='1';
    242249                                                                                                wr_ok<='0';
     250                                                                                                dma_wr<='1';                                                                           
     251                                                                                                dma_rd<='1';
    243252                                                                                        elsif n=1 then
    244                                                                                                 if dma_wr_grant = '1'  then
     253                                                                                                if dma_rd_grant='1' then
     254                                                                                                        n<=n+1;
     255                                                                                                        dma_wr<='1';
     256                                                                                                        end if;
     257                                                                                                        rd_ok<='1';
     258                                                                                                        wr_ok<='0';
     259                                                                                                                                                                                       
     260                                                                                                        dma_rd<='1';
     261                                                                                        elsif n=2 then
     262                                                                                                if dma_rd_grant='1' and dma_wr_grant='1' then
     263                                                                                                        n<=n+1;
     264                                                                                                        tempval:=Ram_data_in;
     265                                                                                                        src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
     266                                                                                                        if fifo_src='0' then -- c'est un put qui est exécuté
     267                                                                                                                tempval(5):='1';                        -- SET du bit DSENT
     268                                                                                                        else  -- c'est un Get qui est exécuté
     269                                                                                                                tempval(2):='0';  --annuler le sending après un GET
     270                                                                                                        end if;
     271                                                                                                        data_to_send<=tempval;
     272                                                                                                        rd_ok<='0';
     273                                                                                                        wr_ok<='1';
     274                                                                                                        dma_wr<='1';                                                                           
     275                                                                                                        dma_rd<='1';
     276                                                                                                else
     277                                                                                                rd_ok<='1';
     278                                                                                                wr_ok<='0';
     279                                                                                                dma_rd<='0'; --libérer le bus et revenir en arrière
     280                                                                                                dma_wr<='0';
     281                                                                                                n<=n-1;
     282                                                                                                end if;
     283                                                                                        elsif n=3 then
     284                                                                                                if dma_wr_grant = '1' and dma_rd_grant='1' then
    245285                                                                                                        n<=n+1;
    246286                                                                                                       
     
    249289                                                                                                        rd_ok<='0';
    250290                                                                                                        wr_ok<='1';
    251                                                                                         elsif n=2 then
    252                                                                                                 if dma_wr_grant = '1'  then
     291                                                                                                        dma_wr<='1';                                                                           
     292                                                                                                        dma_rd<='1';
     293                                                                                        elsif n=4 then
     294                                                                                                if dma_wr_grant = '1' and dma_rd_grant='1' then
    253295                                                                                                        n<=n+1;
    254296                                                                                                                                                                                               
     
    258300                                                                                                        rd_ok<='0';
    259301                                                                                                        wr_ok<='1';     
    260                                                                                         elsif n=3 then
     302                                                                                                        dma_wr<='1';                                                                           
     303                                                                                                        dma_rd<='0';
     304                                                                                        elsif n=5 then
    261305                                                                                                        if dma_wr_grant = '1'  then
    262306                                                                                                                n<=n+1;
     
    267311                                                                                                                rd_ok<='0';
    268312                                                                                                                wr_ok<='1';
    269                                                                                         elsif n=4 then
     313                                                                                                                dma_wr<='1';                                                                           
     314                                                                                                                dma_rd<='0';
     315                                                                                        elsif n=6 then
    270316                                                                                                                n<="0000";
    271317                                                                                                                ex1_state_mach <= fifo_select;
    272318                                                                                                                rd_ok<='0';
    273319                                                                                                                wr_ok<='0';
     320                                                                                                                dma_wr<='0';                                                                           
     321                                                                                                                dma_rd<='0';
    274322                                                                                        end if;
    275323                                                                                 
     
    302350                                                                                           data_to_send <= dest_address(7 downto 0);
    303351                                                                                                n <= n + 1;
     352                                                                                                ex1_state_mach <= execute_get1;
     353                                                                                         elsif switch_port_in_full = '0' and n = 7 then
    304354                                                                                                ex1_state_mach <= execute_get2;
     355                                                                                                n<="0000";
    305356                                                                                                 else
    306357                                                                                                  ex1_state_mach <= execute_get1;
    307358                                                                      end if;   
    308                         when execute_get2 => if switch_port_in_full = '0' then
     359                        when execute_get2 => if dma_wr_grant = '1' then
    309360                                                                                 ex1_state_mach <= execute_get3;
     361                                                                                 src_address<=std_logic_vector(to_unsigned(core_get_adr+6,16));
     362                                                                                data_to_send<="00000001";
    310363                                                                                else
    311364                                                                                 ex1_state_mach <= execute_get2;
    312                                                                 end if;
     365                                                                                 wr_ok<='1';
     366                                                                                end if;
     367                                                                               
    313368                        when execute_get3 => if dma_wr_grant = '1' then -- fin du post de mpi_get
    314369                                                                                   ex1_state_mach <= execute_get4;
    315370                                                                                        n<="0000";
    316371                                                                                        data_to_send<="00000001";
     372                                                                                        wr_ok<='0';
     373                                                                                        rd_ok<='1';
    317374                                                                                  else
    318375                                                                                        ex1_state_mach <= execute_get3;
    319376                                                                      end if;
    320377                                                                                src_address<=std_logic_vector(to_unsigned(core_get_adr+6,16));
    321                         when execute_get4 =>
    322                                                                                         if n=0 then
    323                                                                                                 if  dma_rd_grant='1' then
    324                                                                                                         n<=n+1;
    325                                                                                                         tempval:=Ram_data_in;
     378                        when execute_get4 =>    if n=0 then
     379                                                                                       
     380                                                                                                if dma_rd_grant='1' then
     381                                                                                                        n<=n+1;
     382                                                                                                       
     383                                                                                                        end if;
     384                                                                                                        rd_ok<='1';
     385                                                                                                        wr_ok<='0';
     386                                                                                                        dma_wr<='1';                                                                           
     387                                                                                                        dma_rd<='1';
     388                                                                                        elsif n=1 then
     389                                                                                                src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
     390                                                                                                if dma_rd_grant='1' then
     391                                                                                                        n<=n+1;
     392                                                                                                       
     393                                                                                                        end if;
     394                                                                                                        rd_ok<='1';
     395                                                                                                        wr_ok<='0';
     396                                                                                                        dma_wr<='1';                                                                           
     397                                                                                                        dma_rd<='1';
     398                                                                                        elsif n=2 then
     399                                                                                                if  dma_rd_grant='1'  then
     400                                                                                                        n<=n+1;
     401                                                                                                       
    326402                                                                                                        src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
    327403                                                                                                end if;
    328                                                                                                 elsif n=1 then
    329                                                                                                         n<=n+1;
     404                                                                                                        dma_wr<='1';                                                                           
     405                                                                                                        dma_rd<='1';
     406                                                                                        elsif n=3 then
     407                                                                                                        if  dma_rd_grant='1' and dma_wr_grant='1' then
     408                                                                                                        n<=n+1;
     409                                                                                                        tempval:=Ram_data_in;
     410                                                                                                        rd_ok<='0';
     411                                                                                                        wr_ok<='1';
     412                                                                                                        dma_wr<='1';                                                                           
     413                                                                                                        dma_rd<='1';
     414                                                                                                        else
     415                                                                                                                dma_wr<='0';                                                                           
     416                                                                                                                dma_rd<='0';
     417                                                                                                                n<=n-1;
     418                                                                                                        end if;
    330419                                                                                                        src_address<=std_logic_vector(to_unsigned(core_base_adr+4,16));
    331                                                                                                 elsif n=2 then
    332                                                                                                         if dma_wr_grant = '1' then
     420                                                                                                elsif n=4 then
     421                                                                                                        if dma_wr_grant = '1' and dma_rd_grant='1' then
    333422                                                                                                        n<=n+1;
    334423                                                                                                       
    335                                                                                                         tempval(4):='0';                        --RESET du bit DReceived
     424                                                                                                        --tempval(4):='0';                      --RESET du bit DReceived
    336425                                                                                                        tempval(1):='1';                        -- SET du bit DReceiving
    337426                                                                                                        data_to_send<=tempval;
     427                                                                                                        else
     428                                                                                                        rd_ok<='0';
     429                                                                                                        wr_ok<='1';
    338430                                                                                                        end if;
    339                                                                                                 elsif n=3 then
     431                                                                                                        dma_wr<='1';                                                                           
     432                                                                                                        dma_rd<='1';
     433                                                                                                elsif n=5 then
    340434                                                                                                        n<="0000";
    341435                                                                                                ex1_state_mach <= fifo_select;
     436                                                                                                dma_wr<='0';                                                                           
     437                                                                                                dma_rd<='0';
    342438                                                                                                end if;
    343439                                                                               
     
    536632                                                                                  fifo_rd_en <= '0';
    537633                                                                        switch_port_in_data <= data_to_send;
    538                                                                         switch_port_in_wr_en <= not(switch_port_in_full);
     634                                                                        switch_port_in_wr_en <='0';
    539635                                                                        AppInitReq<='0';
    540636                                                                        Ram_rd<='0';
    541637                                                                                Ram_wr<='0';
    542638                                                                        dma_rd_request <= '0';
    543                                                                                   dma_wr_request <= '0';
     639                                                                                  dma_wr_request <= Wr_ok;
    544640                                                                                  Ram_rd<='0';
    545641                                                                                  Ram_wr<='0';
     
    565661                                                                        switch_port_in_wr_en <= '0';
    566662                                                                        AppInitReq<='0';
    567                                                                         dma_rd_request <= '1';
    568                                                                                   dma_wr_request <= '1';
    569                                                                                         Ram_rd<='1';
    570                                                                                         Ram_wr<='1';
     663                                                                        dma_rd_request <= dma_rd;
     664                                                                                  dma_wr_request <= dma_wr;
     665                                                                                        Ram_rd<=rd_ok;
     666                                                                                        Ram_wr<=wr_ok;
    571667                                                                                        Ram_data_out<=data_to_send; --"00000001";
    572668                                                                                        Result <=(2=>'1',others=>'0'); --get completed
     
    613709                                                                        switch_port_in_wr_en <= '0';
    614710                                                                        AppInitReq<='0';
    615                                                                         dma_rd_request <= '0';
    616                                                                                   dma_wr_request <= '1';
    617                                                                                         Ram_rd<='0';
    618                                                                                         Ram_wr<='1';
     711                                                                        dma_rd_request <= rd_ok;
     712                                                                                  dma_wr_request <= wr_ok;
     713                                                                                        Ram_rd<=rd_ok;
     714                                                                                        Ram_wr<=wr_ok;
    619715                                                                                        Ram_data_out<=data_to_send; --"00000001"; -- le résultat de l'exécution
    620716                                                                                        --result(1)<='1';
     
    625721                                                                        switch_port_in_wr_en <= '0';
    626722                                                                        AppInitReq<='0';
    627                                                                         dma_rd_request <= rd_ok;
    628                                                                                   dma_wr_request <= wr_ok;
     723                                                                        dma_rd_request <= dma_rd;
     724                                                                                  dma_wr_request <= dma_wr;
    629725                                                                                        Ram_rd<=rd_ok;
    630726                                                                                        Ram_wr<=wr_ok;
Note: See TracChangeset for help on using the changeset viewer.