retard synthétisable en VHDL
Répondre à la discussion
Affichage des résultats 1 à 7 sur 7

retard synthétisable en VHDL



  1. #1
    isamel85

    Question retard synthétisable en VHDL


    ------

    Bonjour,
    Je veux savoir comment créer un retard de 16 microsecondes synthétisable en VHDL de la sortie synchronisé sur une horloge de 1 MHz (1 microseconde):
    On peut le créer par un process sensible à l'horloge 1 MHz et aussi utilisé "wait for 16 us". Le problème qu'il n'est pas synthétisable mais il marche au niveau de simulation.
    exemple:

    entity retard is
    Port ( Entree : in STD_LOGIC_VECTOR (19 downto 0);
    Horloge_1MHz : in STD_LOGIC;

    Sortie : out STD_LOGIC_VECTOR (3 downto 0));
    end retard;

    architecture Behavioral of retard is

    Process(Horloge_1MHz)
    begin
    if rising_edge (Horloge_1MHz) then
    Sortie <= Entree(3 downto 0);
    wait for 16us;
    Sortie <= Entree(7 downto 4);
    wait for 16us;
    Sortie <= Entree(11 downto 8);
    wait for 16us;
    Sortie <= Entree(15 downto 12);
    wait for 16us;
    Sortie <= Entree(19 downto 16);
    wait for 16us;

    end if;
    end Process;

    end Behavioral;

    Donc comment créer cette temporisation pour avoir un code synthetisable sachant que 1us (période d'horloge 1 MHz) x 16 = 16us
    Et merci d'avance.

    Isamel

    -----

  2. #2
    jiherve

    Re : retard synthétisable en VHDL

    Bonsoir,
    Pour faire un retard synthétisable il faut instancier un compteur et la tripaille qui va bien autour.
    Ici un compteur 4 bits serait suffisant.
    J'ai la flemme de pondre le code.
    JR
    l'électronique c'est pas du vaudou!

  3. #3
    isamel85

    Re : retard synthétisable en VHDL

    Merci pour me répondre
    Pouvez vous me décrire un exemple s'il vous plait.
    Et merci.

    Isamel

  4. #4
    indri

    Re : retard synthétisable en VHDL

    Salut,
    1 compteur pour les 16µs et un pour savoir à quel étape tu es
    Quelque chose comme ca:

    Code:
    variable cpt_16,cpt : int
    if rising_edge(clk)
     cpt_16=cpt_16+1;
     if cpt_16=16
       cpt_16=0;
       cpt=cpt+1;
    
    case cpt:
      when 1: blabla;
      when 2: blabla2;
    ...
    A transformer en bon vhdl biensur,mais tu vois l'idée!!
    Là où va le vent...

  5. A voir en vidéo sur Futura
  6. #5
    jiherve

    Re : retard synthétisable en VHDL

    Bonjour,
    j'ai pris le temps, cela compile et doit fonctionner ,je n'ai cependant pas testé, il faut bien que tu bosses un peu tout de même:

    Code:
    --Déclaration des librairies--
    Library IEEE;
    use IEEE.Std_Logic_1164.all;
    use IEEE.numeric_std.all;
    
    
    --Déclaration des entrées et sorties--
    entity retard is
    Port ( Entree : in std_logic_vector (19 downto 0);
    Horloge_1MHz : in std_logic;
    Resetn : in std_logic;
    
    Sortie : out std_logic_vector (3 downto 0));
    end retard;
    --------------------------------------
    
    
    --Déclaration des signaux--
    architecture EX_arch of retard is
    signal cpt_delay : unsigned(4 downto 0);
    signal sel_bit : unsigned(2 downto 0);
    signal end_delay : std_logic;
    signal start_delay : std_logic;
    ---------------------------
    begin
      P1: process(Horloge_1MHz,Resetn)
      begin
        if Resetn = '0' then
          sel_bit <= (others =>'0');
          Sortie    <= (others =>'0');
          start_delay <= '0';
        elsif rising_edge(Horloge_1MHz) then
          start_delay <= '0';
          if end_delay = '1' then
            case sel_bit is
              when "000" =>
                Sortie <= Entree(3 downto 0);
              when "001" =>
                Sortie <= Entree(7 downto 4);
              when "010" =>
                Sortie <= Entree(11 downto 8);
              when "011" =>
                Sortie <= Entree(15 downto 12);
              when "100" =>
                Sortie <= Entree(19 downto 16);
              when others =>
                Sortie <= (others =>'0');
              end case;
            if sel_bit <= 4 then
              sel_bit <= sel_bit + 1; 
            --else --à decommenter si tu veux que cela recommence
               --sel_bit <= (others =>'0');
            end if;
            start_delay <= '1';-- lorsque la condition du if est vraie c'est cette ligne qui gagne
           end if;
        end if;
      end process P1;
      -- le process qui crée le delay
    
      P2: process (Horloge_1MHz,Resetn)
      begin
        if Resetn = '0' then
          cpt_delay <= ((4) => '1', others =>'0');
          end_delay <= '1';
        elsif rising_edge(Horloge_1MHz) then
          if (start_delay = '1') and (cpt_delay(4) = '1') then
            cpt_delay <= (others =>'0');
          elsif (cpt_delay(4) = '0') then
            cpt_delay <= cpt_delay + 1;
          end if;
          if cpt_delay = 14 then
            end_delay <= '1' ;
          else
            end_delay <= '0' ;
          end if;  
    
        end if;
      end process P2;
    end architecture EX_arch;
    JR
    l'électronique c'est pas du vaudou!

  7. #6
    isamel85

    Re : retard synthétisable en VHDL

    Bonjour,
    Je vous remercie énormément.
    Je l'ai testé il fonctionne mais il donne un délai de 17us au lieu 16us. Donc on joue sur quoi pour le rendre à 16us
    Et merci.

    Isamel

  8. #7
    isamel85

    Re : retard synthétisable en VHDL

    Le problème est résolu.
    Le fait d'initialiser le compteur du délai à 00001 au lieu de 00000 afin d'éviter une période d'horloge
    Je vous remercie beaucoup pour l'aide.

    Isamel

Discussions similaires

  1. commande d'ascenseur avec VHDL la carte vhdl
    Par chakib123 dans le forum Électronique
    Réponses: 6
    Dernier message: 02/06/2014, 02h41
  2. en vhdl: wait n'est pas synthetisable
    Par invitefa544961 dans le forum Électronique
    Réponses: 2
    Dernier message: 07/06/2011, 19h11
  3. Point flottant en VHDL et vhdl-200x
    Par invite6eee6b27 dans le forum Logiciel - Software - Open Source
    Réponses: 0
    Dernier message: 02/09/2008, 19h47
  4. comment faire un retard en vhdl
    Par invite940ed57f dans le forum Électronique
    Réponses: 11
    Dernier message: 05/06/2008, 09h11
  5. triglycérides synthétisable
    Par invite97d810f4 dans le forum Chimie
    Réponses: 8
    Dernier message: 12/01/2007, 08h09
Découvrez nos comparatifs produits sur l'informatique et les technologies.