Ignore:
Timestamp:
Dec 20, 2013, 7:55:55 PM (11 years ago)
Author:
rolagamo
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PROJECT_CORE_MPI/CORE_MPI/BRANCHES/v1.00/load_instr.vhd

    r64 r70  
    99-- Target Devices:
    1010-- Tool versions:
    11 -- Description: Ce mdule permet de charger une instruction dans le FIFO 1
     11-- Description: Ce module permet de charger une instruction dans le FIFO 1
    1212--
    1313-- Dependencies:
     
    5656--signal ptr, ptr_i:STD_LOGIC_VECTOR (ADRLEN-1 downto 0):=(others=>'0'); --pointeur vers l'instruction en RAM
    5757signal Base_Adr : STD_LOGIC_VECTOR (ADRLEN-1 downto 0):=(others=>'0');
    58 
     58signal adr_ptr : natural range 0 to 65536:=0;
    5959signal Base_AdrSet : std_logic:='0' ; --indique l'adresse de base des instructions positionée
    60 signal fifo_din_i:std_logic_vector(WORD-1 downto 0):=(others=>'Z');
     60signal fifo_din_i:std_logic_vector(WORD-1 downto 0):=(others=>'-');
     61signal iLen,iLen_i : natural range 0 to 15:=0; --longueur de l'instruction à copier dans le Fifo
    6162signal fifo_wr_i :std_logic:='0';
    6263signal base_adrset_i : std_logic:='0';
     
    7980                                Base_AdrSet<=Base_adrSet_i;
    8081                                ram_address_rd<=ram_address_i;
     82                                adr_ptr<=to_integer(unsigned(ram_address_i));
    8183                                dma_rd_request<=dma_rd_request_i;
    8284                                instruction_ack<=instruction_ack_i;
    8385                                count<=count_i;
     86                                Ilen<=Ilen_i;
    8487                               
    8588                               
     
    102105                 Ram_rd_en<='0';
    103106                 Instruction_ack_i<='0';
    104                  fifo_din_i<=(others=>'Z');
     107                 fifo_din_i<=(others=>'-');
    105108                 Base_AdrSet_i<='0';
    106109                 
     
    112115                 Ram_rd_en<='0';
    113116                 
    114                  fifo_din_i<=(others=>'Z');
     117                 fifo_din_i<=(others=>'-');
    115118                 Base_AdrSet_i<='1';
    116119                 
     
    121124                 Dma_rd_request_i<='1';
    122125                 Instruction_ack_i<='0';
    123                  fifo_din_i<=(others=>'Z');
     126                 fifo_din_i<=(others=>'-');
    124127                 Base_AdrSet_i<='1';
    125128                 when readptr =>
     
    130133                 Dma_rd_request_i<='1';
    131134                 Instruction_ack_i<='0';
    132                  fifo_din_i<=(others=>'Z');
     135                 fifo_din_i<=(others=>'-');
    133136                 Base_AdrSet_i<='1';
    134137                 when readmem =>
     
    147150                 Ram_rd_en<='0';
    148151                 Instruction_ack_i<='1';
    149                  fifo_din_i<=(others=>'Z');
     152                 fifo_din_i<=(others=>'-');
    150153                 Base_AdrSet_i<='1';
    151154                 when st_timeout =>
     
    155158                 Ram_rd_en<='0';
    156159                 Instruction_ack_i<='0';
    157                  fifo_din_i<=(others=>'Z');
     160                 fifo_din_i<=(others=>'-');
    158161                 Base_AdrSet_i<='1';
    159162                end case;
    160163   end process;
    161164 
    162    NEXT_STATE_DECODE: process (etloadinst, Base_AdrSet,Ram_data,Instruction,instruction_en, fifo_full,dma_rd_grant,count)
     165   NEXT_STATE_DECODE: process (etloadinst, Base_AdrSet,Ram_data,Instruction,instruction_en, fifo_full,dma_rd_grant,count,Ilen)
    163166   variable ptr : std_logic_vector(ADRLEN-1 downto 0);
    164167        variable timeout: natural range 0 to 255;
     
    171174      case (etloadinst) is
    172175         when init => if base_adrset='1'  and Instruction_en='1' then
    173                                                        
     176                                                         Ilen_i<=to_integer(unsigned(Instruction(3 downto 0)));--initialisation de longueur
    174177                                                                next_loadinst<=getbus;
    175178                                                        elsif Instruction_en='1' then
     
    179182                                                                next_loadinst<=init;
    180183                                                                Base_Adr<=X"0000";
     184                                                                Ilen_i<=0;
    181185                                                        end if;
    182186                                                        fifo_wr_i<='0';
    183187                                                        count_i<=0;
     188                                                       
    184189                                                        --
    185190                        When Setadr => if Base_adrSet='0' then
    186                                                                         Base_Adr<=instruction & X"00";  --récupération des bits de poids forts de l'instruction
     191                                                                        Base_Adr<=std_logic_vector(to_unsigned(Core_upper_adr,8)) & X"00";  --récupération des bits de poids forts de l'instruction
    187192                                                                                  --
    188193                                                                end if;
    189194                                                                next_loadinst<=init;
    190                                         Ram_address_i<=(others=>'Z');
     195                                        Ram_address_i<=(others=>'-');
    191196                                        count_i<=0;
    192197         when getbus =>
     
    196201                                       
    197202                                        -- prépare la prochaine lecture
    198                                        
    199                                        
     203
    200204                                else
    201205                                       
    202206                                end if;
    203                                 Ram_address_i<=(others=>'Z');
     207                                Ram_address_i<=(others=>'-');
    204208                                count_i<=0;
    205209         When readptr =>
     
    226230                                        elsif count=5 then
    227231                                                ptr(15 downto 8):=Ram_data;
    228                                                 --count_i <=count+1;
    229                                         --elsif count=6 then
    230                                                 --ptr(15 downto 8):=Ram_data;
    231232                                                count_i<=0;
    232233                                                timeout:=0;
     
    242243            if dma_rd_grant = '1' then --s'assurer que le bus est disponible
    243244                                        if fifo_full='0' then
    244                                                
     245                                                if ilen >0 then
    245246                                                if count=0 then
    246247                                                        iptr:=to_integer(unsigned(ptr));
     
    253254                                                elsif    count=2 then
    254255                                                        count_i <=count+1;
    255                                                         AdrTmp:=iptr+1; --incrémentation de l'adresse
     256                                                        AdrTmp:=Adr_ptr+1; --incrémentation de l'adresse
    256257                                                        fifo_wr_i<='0';
    257258                                                elsif    count=3 then
    258259                                                        count_i <=count+1;             
    259260                                                        fifo_wr_i<='1'; --écriture de la donnée dans le fifo
     261                                                        Ilen_i<=Ilen-1;
    260262                                                elsif count=4 then
    261263                                                        fifo_wr_i<='0';
    262                                                        
    263                                                         count_i <=count+1;
    264                                                 elsif count=5 then
    265                                                         fifo_wr_i<='1'; --lecture de la donnée 2
    266                                                         count_i <=count+1;     
    267                                                         AdrTmp:=iptr+2;
    268                                                 elsif    count=6 then
    269                                                         count_i <=count+1;
    270                                                         fifo_wr_i<='0';
    271                                                 elsif    count=7 then
    272                                                         count_i <=count+1;
    273                                                         fifo_wr_i<='0'; 
    274                                                 elsif count=8 then
    275                                                         fifo_wr_i<='1';--lecture de la donnée 3
    276                                                         count_i <=count+1;
    277                                                         AdrTmp:=iptr+3;
    278                                                 elsif count =9 then
    279                                                         count_i <=count+1;
    280                                                        
    281                                                         fifo_wr_i<='0';
    282                                                 elsif    count=10 then
    283                                                         count_i <=count+1;
    284                                                         fifo_wr_i<='0';
    285                                                        
    286                                                 elsif count=11 then
    287                                                         fifo_wr_i<='1'; --lecture de la donnée 4
    288                                                         count_i <=count+1;
    289                                                         ADRTmp:=iptr+4;--incrémente l'adresse
    290                                                 elsif count =12 then
    291                                                         count_i <=count+1;
    292                                                        
    293                                                         fifo_wr_i<='0';
    294                                                 elsif    count=13 then
    295                                                         count_i <=count+1;
    296                                                         fifo_wr_i<='0';
    297                                                 elsif count=14 then
    298                                                         fifo_wr_i<='1';--lecture de la donnée 5
    299                                                         count_i <=count+1;
    300                                                         ADRtmp:=iptr+5;
    301                                                 elsif count =15 then
    302                                                         count_i <=count+1;
    303                                                         fifo_wr_i<='0';
    304                                                 elsif    count=16 then
    305                                                         count_i <=count+1;
    306                                                         fifo_wr_i<='0';
    307                                                 elsif count=17 then
    308                                                         fifo_wr_i<='1';--lecture de la donnée 6
    309                                                         count_i <=count+1;
    310                                                         next_loadinst <= freebus;       
     264                                                        count_i<=1;
    311265                                                end if;
    312                                                
     266                                                else
     267                                                  fifo_wr_i<='0';
     268                                                next_loadinst <= freebus;       
     269                                                end if;         
     270
    313271                                                Ram_address_i<=STD_LOGIC_VECTOR(to_unsigned(AdrTmp,16));
    314272                                        end if;
     
    319277                                                next_loadinst<=st_timeout;
    320278                                        end if;
    321                                         Ram_address_i<=(others=>'Z'); -- le bus n'est pas libre
     279                                        Ram_address_i<=(others=>'-'); -- le bus n'est pas libre
    322280                                       
    323281                                end if;
     
    326284                                fifo_wr_i<='0';
    327285                                count_i<=0;
    328                                  Ram_address_i<=(others=>'Z');
     286                                 Ram_address_i<=(others=>'-');
    329287            if instruction_en='0' then
    330288                                        next_loadinst <= init;
     
    332290                        when st_timeout =>
    333291                                fifo_wr_i<='0';
    334                          Ram_address_i<=(others=>'Z');
     292                         Ram_address_i<=(others=>'-');
    335293                                next_loadinst<=init;
    336294                                count_i<=0;
Note: See TracChangeset for help on using the changeset viewer.