VHDL besoin d'aide niveau débutant
Répondre à la discussion
Page 1 sur 2 1 DernièreDernière
Affichage des résultats 1 à 30 sur 38

VHDL besoin d'aide niveau débutant



  1. #1
    dr4gon993

    Post VHDL besoin d'aide niveau débutant


    ------

    Salut, voila j'écris un programme en VHDL et j'ai besoin de votre aide car je suis pas sur de moi pour une syntaxe.

    Voila mon programme je vous l'ai commenté comme ca tous est expliqué :

    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;



    Entity aquisition is
    port(
    cap : in std_logic; -- signal du capteur optique après être passé dans un trigger
    DirA : out std_logic := '0'; -- signal allant de la carte DE0 vert Le L298N pour commander le sens moteur
    DirB : out std_logic := '1' -- signal allant de la carte DE0 vert Le L298N pour commander le sens moteur
     
    end entity;

    architecture bloque_1 of aquisition is

    signal OLD_DIRA : std_logic; -- memoire de l'état de rotation précedement appliqué au moteur
    signal OLD_DIRB : std_logic; -- mémoire de l'état de rotation précedement appliqué au moteur

    begin
    process
    OLD_DIRA <= DirA; -- on sauvegarde le sens se rotation
    OLD_DIRB <= DirB; -- on sauvegarde le sens de rotation

    begin

    wait until cap'event and cap='0'; -- on attend un evenement type front descendent sur le signal CAP

    DirA <='0'; -- on met un état 00 stop sur le moteur
    DirB <='0'; -- on met un état 00 stop sur le moteur
    wait for 500ms; -- clycle d'attente de 500ms pour l'arret total du moteur

    DirA <= *** -- c'est la que ca va pas en théorie DIRA prend 1
    DIRB <= *** -- et DIRB prend 0

    --- et on est reparti jusqu'au prochain front descendant ou on refait la boucle


    end process;

    end bloque_1;


    *** jai pensé à DirA <= NOT (OLD_DIRA); mais je pense pas que ca soit bon.



    merci pour votre aide

    -----
    Dernière modification par dr4gon993 ; 27/08/2014 à 14h15.

  2. #2
    JPL
    Responsable des forums

    Re : VHDL besoin d'aide niveau débutant

    Le vert est réservé à la modération.
    Rien ne sert de penser, il faut réfléchir avant - Pierre Dac

  3. #3
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonsoir,
    Citation Envoyé par JPL Voir le message
    Le vert est réservé à la modération.
    J'ai cru que tu etais déjà passé !!
    ceci dit c'est bourré d'erreurs:
    DirA : out std_logic := '0'; on ne peut pas forcer une sortie et cela ne présente aucun intérêt donc
    DirA : out std_logic;
    par contre on pourrait écrire:
    cap : in std_logic := '0'; ce qui permet de ne pas connecter une entrée à l’étage du dessus, l'instanciateur de l’entité

    on ne peut pas recopier une sortie de type out:
    OLD_DIRA <= DirA;
    solution : utiliser un signal/variable interne pour faire:
    DirA <= var;
    OLD_DIRA <= var;
    ou bien déclarer
    DirA : inout std_logic := '0'; là on a le droit de forcer car on force le "in"

    le second begin est une erreur, il faut le virer.
    JR
    l'électronique c'est pas du vaudou!

  4. #4
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Oui j'ai vue toutes les erreurs quand j'ai compilé encore est encore celle qui me bloque le plus c'est de ne pas pouvoir fait de "wait for 500ms"

    Ca t'ennuie si je te sollicite pour avancé dans mon projet quand je sais pas ?

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

    Re : VHDL besoin d'aide niveau débutant

    bonjour,
    çà cela fonctionne au moins une fois, testé avec Modelsim
    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    
    Entity aquisition is
    port(
    cap : in std_logic := '1'; -- signal du capteur optique après être passé dans un trigger
    DirA : inout std_logic := '0'; -- signal allant de la carte DE0 vert Le L298N pour commander le sens moteur
    DirB : inout std_logic := '1'); -- signal allant de la carte DE0 vert Le L298N pour commander le sens moteur
    
    end entity;
    
    architecture bloque_1 of aquisition is
    
    signal OLD_DIRA : std_logic; -- memoire de l'état de rotation précedement appliqué au moteur
    signal OLD_DIRB : std_logic; -- mémoire de l'état de rotation précedement appliqué au moteur
    
    begin
    process
      begin
      OLD_DIRA <= DirA; -- on sauvegarde le sens se rotation
      OLD_DIRB <= DirB; -- on sauvegarde le sens de rotation
    
    
    
      wait until cap'event and cap='0'; -- on attend un evenement type front descendent sur le signal CAP
    
      DirA <='0'; -- on met un état 00 stop sur le moteur
      DirB <='0'; -- on met un état 00 stop sur le moteur
      wait for 500 ms; -- clycle d'attente de 500ms pour l'arret total du moteur
    
      DirA <= '1'; -- c'est la que ca va pas en théorie DIRA prend 1
      DirB <= '1'; -- et DIRB prend 0
    
    --- et on est reparti jusqu'au prochain front descendant ou on refait la boucle
    
    end process;
    
    end bloque_1;
    JR
    l'électronique c'est pas du vaudou!

  7. #6
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    tu sais pourquoi le compilateur de quartus ne veux pas d'instruction wait for et modelsim accept ?

  8. #7
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Re,
    wait for n'est pas synthétisable or Quartus est un compilateur de synthèse.
    En VHDL il y a deux niveaux : le comportemental (behaviour) et le synthétisable (rtl) , le temps ne peu être géré qu'au moyen d'horloge et de compteurs/machines à états.
    JR
    l'électronique c'est pas du vaudou!

  9. #8
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Citation Envoyé par jiherve Voir le message
    Re,
    wait for n'est pas synthétisable or Quartus est un compilateur de synthèse.
    En VHDL il y a deux niveaux : le comportemental (behaviour) et le synthétisable (rtl) , le temps ne peu être géré qu'au moyen d'horloge et de compteurs/machines à états.
    JR
    Ok donc si je veux gérer le temps dans quartus et faire un équivalent d'un "wait for 5ms"

    je peux faire un process avec sensibilité clk ( a periode de 1ms )

    et mettre dans ce process un :
    while compte_periode /= "5" loop
    compte_periode := compte_periode + "1";
    end loop;

    si non un code compilé dans model sim et utilisable dans mon FPGA par la suite même si il ne passe pas dans quartus ?
    quartus permet d’attribué des entrée sortie au composant (ex pin out )

  10. #9
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    re
    While n'est pas non plus synthétisable!
    désolé.
    si ton code ne compile pas tu n'auras rien.
    il faut rajouter un vrai compteur.
    JR
    l'électronique c'est pas du vaudou!

  11. #10
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Citation Envoyé par jiherve Voir le message
    re
    While n'est pas non plus synthétisable!
    désolé.
    si ton code ne compile pas tu n'auras rien.
    il faut rajouter un vrai compteur.
    JR
    ok je vais essayer ! merci de me donner des réponses je pensais que j'allais devenir un peut fou en solo ....

  12. #11
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Jy arrive pas jiherve mon cerveau veux toujours faire un while dans quartus pour faire une boucle qui permet de compté et ca marche pas....
    si j'ai droit qu'au if comment je peux faire un compteur ... qui me temporise un état ?

  13. #12
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Voila j'ai ecris ca j'ai divisé en 2 partie ça c'est la première partie derrière je dois mettre la partie action qui fera les action sur le moteur et changera les signaux du capteur

    ici je sais pas pourquoi il aime pas operateur + = ......



    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;


    Entity caterham is
    port(
    Capteur : in Std_logic;
    Clk_10hz : in std_logic;
    OutCapteur : out std_logic;
    compteur_start : out boolean := false;
    compteur_stop : out boolean := false);
    end Entity;

    Architecture sydney of caterham is
    signal Xcompteur : std_logic_vector(3 downto 0):= "0000";

    begin
    process(Capteur, clk_10hz)
    begin

    if capteur'event and capteur = '0' then
    compteur_start <= true;
    outcapteur <= '0';

    elsif capteur = '0' then
    OutCapteur <= '0';

    IF CLK_10hz'EVENT and clk_10hz = '1' then

    Xcompteur <= Xcompteur + '1';
    if Xcompteur = '1' then
    compteur_start <= false;
    end if;
    if Xcompteur = '6' then
    compteur_stop <= false;
    end if;
    end if;
    if Xcompteur = 5 then
    outcapteur <='1';
    compteur_stop <= true;
    end if;
    else
    Xcompteur <= (others => '0');
    end if;


    end process;
    end;

  14. #13
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonjour,
    la reponse est tardive car le WE je randonne donc pas d'internet.
    1 : ton code ne compile pas(pour un compteur utiliser des unsigned cela permet les additions) , cela serait bien d'au moins essayer avant de poster sur le site et utilises la balise code(# en mode avancé), respecte aussi les indentations et majuscules minuscules
    2 : ce code :
    Code:
    if capteur'event and capteur = '0' then
    compteur_start <= true;
    outcapteur <= '0';
    
    elsif capteur = '0' then
    OutCapteur <= '0';
    
    IF CLK_10hz'EVENT and clk_10hz = '1' then
    ....
    if Xcompteur = 5 then
    outcapteur <='1';
    ...
    signifie que la bascule outcapteur, car c'est une bascule, doit posséder 2 signaux d'horloge comme cela n'est pas naturel pour une bascule => porte pour combiner les 2 (gated clock en godon) => catastrophe un jour ou l'autre!
    3 : le fonctionnement de ton compteur qui dépend de l'horloge à 10Khz est conditionné par le signal "capteur" qui est asynchrone donc metastabilité assurée(c'est 90% des bugs fonctionnels en VHDL, les simulateurs ne le montrent pas en général).
    4 : il faut toujours un signal d'initialisation, "Reset" ne prends pas la mauvaise habitude des mauvais softeux qui n'initialisent rien
    4 : j'ai donc réécrit le code, essayes de le comprendre
    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    Entity caterham is
    port(
    reset : in std_logic;  -- il faut TOUJOURS un reset
    Capteur : in Std_logic;
    Clk_10hz : in std_logic;
    OutCapteur : out std_logic;
    compteur_start : out boolean;
    compteur_stop : out boolean);
    end Entity;
    
    Architecture sydney of caterham is
    signal Xcompteur : unsigned(3 downto 0):= "0000";
    signal capteur_resynch : std_logic_vector(2 downto 0);-- pour resynchronisation et ainsi eviter des metastabilités
    
    begin
    process(reset, clk_10hz)
    begin
    if reset = '1' then
      compteur_start  <= false;
      compteur_stop   <= false;
      OutCapteur       <= '0';
      capteur_resynch <= (others =>'0');
      Xcompteur       <= (others => '0');  
    
    elsif CLK_10hz'EVENT and clk_10hz = '1' then
      capteur_resynch <= (capteur_resynch(1 downto 0)& Capteur);-- resynchronisation
      if capteur_resynch(2 downto 1) = "10" then -- c'est le front descendant
        compteur_start  <= true;
        OutCapteur       <= '0';
        Xcompteur       <= (others => '0');
      elsif Xcompteur   <  6 then
        Xcompteur       <= Xcompteur + 1;
        compteur_start  <= false;
        if Xcompteur   =  5 then
          compteur_stop <= true;
          OutCapteur     <='1';
        end if;
      else
        compteur_stop <= false;
      end if;
    end if;
    
    
    end process;
    end;
    JR
    l'électronique c'est pas du vaudou!

  15. #14
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Whaou super tes infos j'avais trouvé pour le unsigned mais le reste je ne savais pas comment faire, je vais essayer de comprendre ta correction et de mettre des commentaires histoire de bien assimiler les modifs pour pouvoir continuer.
    Merci beaucoup et j’espère que tu as passé un bon week-end en rando

  16. #15
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    (2 downto 0) 000 ici le poid fort est a droite

    et (2 downto 1) (0)[00] donc si on écrit sa on sélectionne juste le coté droit entre croché ?

    a l'inverse de l'expression (0 to 3) ?

  17. #16
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    bonjour,
    Citation Envoyé par dr4gon993 Voir le message
    (2 downto 0) 000 ici le poid fort est a droite

    et (2 downto 1) (0)[00] donc si on écrit sa on sélectionne juste le coté droit entre croché ?

    a l'inverse de l'expression (0 to 3) ?
    ??????????
    JR
    l'électronique c'est pas du vaudou!

  18. #17
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    En faite je comprend pas la partie ou tu te resynchronise sur capteur la concaténation je l'ai comprise mais pour moi tu detecte un front montant en attendant le resultat "10" ? ca peut pas être un front descendant

    Citation Envoyé par jiherve Voir le message
    bonjour,


    ??????????
    JR


    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;


    Entity caterham is
    port(
    reset : in std_logic; -- il faut TOUJOURS un reset
    Capteur : in Std_logic;
    Clk_10hz : in std_logic;
    OutCapteur : out std_logic;
    compteur_start : out boolean;
    compteur_stop : out boolean);
    end Entity;

    Architecture sydney of caterham is
    signal Xcompteur : unsigned(3 downto 0):= "0000";
    signal capteur_resynch : std_logic_vector(2 downto 0);-- pour resynchronisation et ainsi eviter des metastabilités

    begin
    process(reset, clk_10hz)
    begin
    if reset = '1' then -- si reset alors :
    compteur_start <= false; -- mon compteur start renvoièe faux
    compteur_stop <= false; -- mon compteur stop tenvoie faux
    OutCapteur <= '0'; -- ma sortie capteur renvoie 0
    capteur_resynch <= (others =>'0'); -- ma synchro sur l'entrée capteur est mise à 0
    Xcompteur <= (others => '0'); -- mon compteur est mis à 0

    elsif CLK_10hz'EVENT and clk_10hz = '1' then -- si non reset = 0 si j'ai un front montant sur la clock alors
    capteur_resynch <= (capteur_resynch(1 downto 0)& Capteur); -- je fais une concaténation d'un signal sur un bit [0 0]0 & 1 sa donne [0 1] 0
    if capteur_resynch(2 downto 1) = "10" then -- si 0 [0 0] cette parti = "10" ca veux dire que capteur est passé à 1 j'ai donc un front montant alors :
    compteur_start <= true; -- je mes compteur start a vrais
    OutCapteur <= '0'; -- je met la sortie capteur a 0
    Xcompteur <= (others => '0'); -- le compteur prend 0
    elsif Xcompteur < 6 then -- si je suis inferiieur à 6 alors :
    Xcompteur <= Xcompteur + 1; --j'incremente compteur
    compteur_start <= false; -- je met le compteur start a faux
    if Xcompteur = 5 then -- si je suis égale a 5 alors
    compteur_stop <= true; -- compteur stop passe a vrais
    OutCapteur <='1'; -- et out capteur passe a 1
    end if;
    else
    compteur_stop <= false; -- si non si le compteur est superieur ou égale a 6 je met compteur stop a false !

    end if;
    end if;
    end process;
    end;
    Dernière modification par dr4gon993 ; 02/09/2014 à 15h59.

  19. #18
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonsoir,
    le registre décale vers la gauche :capteur_resynch <= (capteur_resynch(1 downto 0) & Capteur) est equivalent à :
    capteur_resynch(2) <= capteur_resynch(1);
    capteur_resynch(1) <= capteur_resynch(0);
    capteur_resynch(0) <= capteur;
    lorsque capteur est à 1 depuis assez longtemps on a capteur_resynch = "111"
    donc quand capteur passe de 1 a 0 on a successivement :capteur_resynch = "110","100","000"
    donc capteur_resynch(2 dowto 1) = "10" c'est bien le front descendant.
    CQFD
    JR
    l'électronique c'est pas du vaudou!

  20. #19
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Citation Envoyé par jiherve Voir le message
    Bonsoir,
    le registre décale vers la gauche :capteur_resynch <= (capteur_resynch(1 downto 0) & Capteur) est equivalent à :
    capteur_resynch(2) <= capteur_resynch(1);
    capteur_resynch(1) <= capteur_resynch(0);
    capteur_resynch(0) <= capteur;
    lorsque capteur est à 1 depuis assez longtemps on a capteur_resynch = "111"
    donc quand capteur passe de 1 a 0 on a successivement :capteur_resynch = "110","100","000"
    donc capteur_resynch(2 dowto 1) = "10" c'est bien le front descendant.
    CQFD
    JR

    DacoDac merci pour l'information et toute ton aide c'est bien d'avoir un soutient quand on commence. J'ai écris un 2éme bloque qui commande mon L298N a partir du bloque précédent.
    je suis en train d'affecter les pins pour faire des testes si c'est pas concluant je vas essayer de comprendre pourquoi sur modelsim.

    Voici mon 2émé bloque :




    library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.numeric_std.all;

    Entity caterham_drive is

    port(
    reset : in std_logic;
    clk_10hz : in std_logic;
    Sig_capteur : in std_logic;
    start : in boolean;
    stop : in boolean;
    Sortie_L298 : out std_logic_vector(1 downto 0)
    );
    end entity;

    architecture Melbourne of caterham_drive is

    Signal Commande_L298 : std_logic_vector( 1 downto 0);

    begin
    process(reset ,CLK_10hz)
    begin
    If (reset = '1') then
    Sortie_L298 <= "01";
    commande_l298 <= "01";
    elsif clk_10hz'event and CLK_10hz = '1' then
    if (sig_capteur = '0' and start = true and stop = false) then
    -- je fais un stop
    Sortie_L298 <= "00";
    elsif (sig_capteur = '1' and start = false and stop = true) then
    --je fais inversion de sens moteur
    Sortie_L298 <= Not (Commande_L298);
    Commande_l298<= Not (Commande_L298);
    else
    Sortie_L298 <= Commande_L298;
    end if;
    end if;
    end process;
    end;



    AH oui j'ai une question comment tu génère une clock genre 10Hz, j'ai regardé magawizzard mais la PLL est grisé j'y ai pas accé apparament elle est pas dans les IP gratuites je dois écrire un bloque pour générer les fréquence que je veux ?

  21. #20
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    bonjour,
    toujours pas de balise code c'est pénible à lire.
    pour faire une horloge 10Hz il suffit de diviser l'horloge du FPGA par la bonne valeur, pour éviter une ripple clock( c'est à dire utiliser la sortie du diviseur comme horloge) il faut donc générer un pulse ayant la durée d'un coup d'horloge d'entrée à la période de l'horloge souhaitée qui sera utilisé comme enable sur un process utilisant l'horloge d'entrée.
    là j'ai la flemme d’écrire le code.
    JR
    l'électronique c'est pas du vaudou!

  22. #21
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    je suis en train de le faire pour la clock qu'appels-tu des balises code ?

  23. #22
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    test


    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    Entity Chronos_Vhdl is
    	port( 
    	Reset		: in 	std_logic; -- On reste la planète on se retrouve au temps de Jésus à L'heure 0  de l'année 0 du mois 0 LOOOOOL.
    	Clk_50Mhz 	: in  std_logic; -- 20 	ns -- c'est mon horloge de base sur ma carte.
    	Sortie_10Mhz	: out std_logic; -- 100	ns -- je dois compté 5 coups de ma base pour avoir cette Horloge.
    	sortie_1Mhz	: out std_logic; -- 1 	us -- je dois compté 50 coups de ma base.
    	sortie_100Khz	: out std_logic; -- 10	us -- je dois compté 500 coups de ma base.
    	sortie_10Khz	: out std_logic; -- 100	us -- je dois compté 5 000 coups de ma base. 
    	sortie_1Khz	: out std_logic; -- 1	ms -- je dois compté 50 000 coups de ma base.
    	sortie_100Hz	: out std_logic; -- 10	ms	-- je dois compté 500 000 coups de ma base.
    	sortie_10hz	: out std_logic; -- 100 ms -- je dois compté 5 000 000 coups de ma base.
    	sortie_1Hz		: out std_logic );-- 1	s  -- je dois compté 50 000 000 coups de ma base.
    end entity;
    Bon je m’améliore petit à petit désolé de te découragé , c'est très sympa de ta part de me répondre.
    Dernière modification par dr4gon993 ; 04/09/2014 à 15h34.

  24. #23
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Re
    bien, on ira plus vite maintenant.
    JR
    l'électronique c'est pas du vaudou!

  25. #24
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    re alors voila mon code pour créer diverse fréquence j'en ai fait plus que ce que nécessaire pour mon projet mais je me suis dit que je pourrai réutilisé le code pour d'autre application quand il marchera bien sur Alors j'ai écris ca :


    Ps: je travail sur la correction du code


    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    Entity Chronos_Vhdl is
    	port( 
    	Reset				: in 	std_logic; -- On reste la planète on se retrouve au temps de Jésus à L'heure 0  de l'année 0 du mois 0 LOOOOOL.
    	Clk_50Mhz 		: in  std_logic; -- 20 	ns -- c'est mon horloge de base sur ma carte.
    	Sortie_10Mhz	: out std_logic; -- 100	ns -- je dois compté 5 coups de ma base pour avoir cette Horloge.
    	sortie_1Mhz		: out std_logic; -- 1 	us -- je dois compté 50 coups de ma base.
    	sortie_100Khz	: out std_logic; -- 10	us -- je dois compté 500 coups de ma base.
    	sortie_10Khz	: out std_logic; -- 100	us -- je dois compté 5 000 coups de ma base. 
    	sortie_1Khz		: out std_logic; -- 1	ms -- je dois compté 50 000 coups de ma base.
    	sortie_100Hz	: out std_logic; -- 10	ms	-- je dois compté 500 000 coups de ma base.
    	sortie_10hz		: out std_logic; -- 100 ms -- je dois compté 5 000 000 coups de ma base.
    	sortie_1Hz		: out std_logic );-- 1	s  -- je dois compté 50 000 000 coups de ma base.
    end entity;
    
    -- je suppute qu'il est plus aisé d'avoir plusieur compteur de 10  à intercaler entre chaque saut de fréquence.  
    
    
    architecture Flic_Flac of chronos is
    
    	signal Cmpt_10Mhz		:	unsigned (2 downto 0):=(others => '0'); -- 2^(3) c'est un compteur qui peut compter jusqu'à 8coups !
    	signal Cmpt_1Mhz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_100Khz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_10Khz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_1Khz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_100hz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_10hz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_1hz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	
    	signal OUT_10Mhz		:std_logic;
    	signal OUT_1Mhz		:std_logic;
    	signal OUT_100Khz 	:std_logic;
    	signal OUT_10Khz 		:std_logic;
    	signal OUT_1Khz 		:std_logic;
    	signal OUT_100hz 		:std_logic;
    	signal OUT_10hz 		:std_logic;
    	signal OUT_1hz 		:std_logic;
    
    	
    	
    begin
    
    
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    
    	Process(Reset, Clk50_Mhz)
    	begin
    	if (Reste  = '1') then
    	
    		Sortie_10Mhz 	<= '0';
    		OUT_10Mhz	<= '0';
    		Cmpt_10Mhz <= (others => '0');
    		
    	elsif (rising_edge (Clk_50Mhz)) then
    		
    			if (Cmpt_10Mhz	 < '3' )then
    			
    				Sortie_10Mhz<= '0';
    				OUT_10Mhz	 <= '0';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + '1';
    				
    			elsif (Cmpt_10Mhz	 < '6' )then
    			
    				Sortie_10Mhz <= '1';
    				OUT_10Mhz	 <= '1';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + '1';
    				
    				else
    				
    				Cmpt_10Mhz <= '0';
    				
    				end if;
    			end if; 
    	end process;
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_10Mhz )
    	begin
    		if ( reste = '1' ) then
    				
    				Sortie_1Mhz 	<= '0';
    				OUT_1Mhz	<= '0';
    				Cmpt_1Mhz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10Mhz) then
    		
    				if (Cmpt_1Mhz	< '5' )then
    			
    					Sortie_1Mhz<= '0';
    					OUT_1Mhz	 <= '0';
    					Cmpt_1Mhz	 <= Cmpt_1Mhz	 + '1';
    				elsif (Cmpt_1Mhz < '10' ) then 
    				
    						Sortie_1Mhz<= '1';
    						OUT_1Mhz	 <= '1';
    						Cmpt_1Mhz	 <= Cmpt_1Mhz	 + '1';
    				else
    				
    					Cmpt_1Mhz <= '0';
    			
    				end if;
    		end if;
    end process;
    	
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_1Mhz )
    	begin
    			if ( reste = '1' ) then
    			
    				Sortie_100Khz 	<= '0';
    				OUT_100khz	<= '0';
    				Cmpt_100khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_1Mhz) then
    		
    				if (Cmpt_100khz	< '5' )then
    			
    					Sortie_100khz<= '0';
    					OUT_100khz	 <= '0';
    					Cmpt_100khz	 <= Cmpt_100khz	 + '1';
    				elsif (Cmpt_100khz < '10' ) then 
    				
    					Sortie_100khz<= '1';
    					OUT_100khz	 <= '1';
    					Cmpt_100khz	 <= Cmpt_100khz	 + '1';
    				
    				else
    				
    					Cmpt_100khz <= '0';
    			
    				end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_100Khz )
    	begin
    			if ( reste = '1' ) then
    		
    		
    				Sortie_10Khz 	<= '0';
    				OUT_10khz	<= '0';
    				Cmpt_10khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100khz) then
    		
    					if (Cmpt_10khz	< '5' )then
    			
    						Sortie_10khz<= '0';
    						OUT_10khz	 <= '0';
    						Cmpt_10khz	 <= Cmpt_10khz	 + '1';
    				
    					elsif (Cmpt_10khz < '10' ) then 
    				
    							Sortie_10khz<= '1';
    							OUT_10khz	 <= '1';
    							Cmpt_10khz	 <= Cmpt_10khz	 + '1';
    					else
    				
    							Cmpt_10khz <= '0';
    			
    					end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_10Khz )
    	begin
    		if ( reste = '1' ) then
    		
    			Sortie_1Khz 	<= '0';
    			OUT_1khz	<= '0';
    			Cmpt_1khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10khz) then
    		
    				if (Cmpt_1khz	< '5' )then
    			
    					Sortie_1khz<= '0';
    					OUT_1khz	 <= '0';
    					Cmpt_1khz	 <= Cmpt_1khz	 + '1';
    				elsif (Cmpt_1khz < '10' ) then 
    				
    						Sortie_1khz<= '1';
    						OUT_1khz	 <= '1';
    						Cmpt_1khz	 <= Cmpt_1khz	 + '1';
    				else
    				
    						Cmpt_1khz <= '0';
    			
    				end if;
    		end if;
    end process;
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_100hz )
    	begin
    			if ( reste = '1' ) then
    		
    		
    			Sortie_10hz 	<= '0';
    			OUT_10hz	<= '0';
    			Cmpt_10hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100hz) then
    		
    				if (Cmpt_10hz	< '5' )then
    			
    					Sortie_10hz<= '0';
    					OUT_10hz	 <= '0';
    					Cmpt_10hz	 <= Cmpt_10hz	 + '1';
    				
    				elsif (Cmpt_10hz < '10' ) then 
    				
    				Sortie_10hz<= '1';
    				OUT_10hz	 <= '1';
    				Cmpt_10hz	 <= Cmpt_10hz	 + '1';
    				
    				else
    				
    				Cmpt_10hz <= '0';
    			
    				end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_10hz )
    	begin
    			if ( reste = '1' ) then
    		
    				Sortie_1hz 	<= '0';
    				OUT_1hz	<= '0';
    				Cmpt_1hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10hz) then
    		
    				if (Cmpt_1hz	< '5' )then
    			
    					Sortie_1hz<= '0';
    					OUT_1hz	 <= '0';
    					Cmpt_1hz	 <= Cmpt_1hz	 + '1';
    				elsif (Cmpt_1hz < '10' ) then 
    				
    					Sortie_1hz<= '1';
    					OUT_1hz	 <= '1';
    					Cmpt_1hz	 <= Cmpt_1hz	 + '1';
    					
    				else
    				
    				Cmpt_1hz <= '0';
    			
    				end if;
    			end if;
    end process;	
    end;
    Dernière modification par dr4gon993 ; 05/09/2014 à 14h28.

  26. #25
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    je poste les corrections et modification au fur et a mesure



    L'erreur :

    Error (10327): VHDL error at Horloge.vhd(64): can't determine definition of operator ""<"" -- found 0 possible definitions







    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    Entity Chronos_Vhdl is
    	port( 
    	Reset				: in 	std_logic; -- On reste la planète on se retrouve au temps de Jésus à L'heure 0  de l'année 0 du mois 0 LOOOOOL.
    	Clk_50Mhz 		: in  std_logic; -- 20 	ns -- c'est mon horloge de base sur ma carte.
    	Sortie_10Mhz	: out std_logic; -- 100	ns -- je dois compté 5 coups de ma base pour avoir cette Horloge.
    	sortie_1Mhz		: out std_logic; -- 1 	us -- je dois compté 50 coups de ma base.
    	sortie_100Khz	: out std_logic; -- 10	us -- je dois compté 500 coups de ma base.
    	sortie_10Khz	: out std_logic; -- 100	us -- je dois compté 5 000 coups de ma base. 
    	sortie_1Khz		: out std_logic; -- 1	ms -- je dois compté 50 000 coups de ma base.
    	sortie_100Hz	: out std_logic; -- 10	ms	-- je dois compté 500 000 coups de ma base.
    	sortie_10hz		: out std_logic; -- 100 ms -- je dois compté 5 000 000 coups de ma base.
    	sortie_1Hz		: out std_logic );-- 1	s  -- je dois compté 50 000 000 coups de ma base.
    end entity;
    
    -- je suppute qu'il est plus aisé d'avoir plusieur compteur de 10  à intercaler entre chaque saut de fréquence.  
    
    
    architecture Flic_Flac of chronos_Vhdl is
    
    	signal Cmpt_10Mhz		:	std_logic_vector (2 downto 0):=(others => '0'); -- 2^(3) c'est un compteur qui peut compter jusqu'à 8coups !
    	signal Cmpt_1Mhz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_100Khz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_10Khz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_1Khz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_100hz 	:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_10hz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	signal Cmpt_1hz 		:	std_logic_vector (3 downto 0):=(others => '0');
    	
    	signal OUT_10Mhz		:std_logic;
    	signal OUT_1Mhz		:std_logic;
    	signal OUT_100Khz 	:std_logic;
    	signal OUT_10Khz 		:std_logic;
    	signal OUT_1Khz 		:std_logic;
    	signal OUT_100hz 		:std_logic;
    	signal OUT_10hz 		:std_logic;
    	signal OUT_1hz 		:std_logic;
    
    	
    	
    begin
    
    
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    
    	Process(Reset, Clk_50Mhz)
    	begin
    	if (Reset  = '1') then
    	
    		Sortie_10Mhz 	<= '0';
    		OUT_10Mhz	<= '0';
    		Cmpt_10Mhz <= (others => '0');
    		
    	elsif (rising_edge (Clk_50Mhz)) then
    		
    			if (Cmpt_10Mhz	 < 3 )then -- l'erreur est la  ...
    			
    				Sortie_10Mhz<= '0';
    				OUT_10Mhz	 <= '0';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + '1';
    				
    			elsif (Cmpt_10Mhz	 < 6 )then
    			
    				Sortie_10Mhz <= '1';
    				OUT_10Mhz	 <= '1';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + '1';
    				
    				else
    				
    				Cmpt_10Mhz <= '0';
    				
    				end if;
    			end if; 
    	end process;
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_10Mhz )
    	begin
    		if ( reste = '1' ) then
    				
    				Sortie_1Mhz 	<= '0';
    				OUT_1Mhz	<= '0';
    				Cmpt_1Mhz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10Mhz)) then
    		
    				if (Cmpt_1Mhz	< 5 )then
    			
    					Sortie_1Mhz<= '0';
    					OUT_1Mhz	 <= '0';
    					Cmpt_1Mhz	 <= Cmpt_1Mhz	 + '1';
    				elsif (Cmpt_1Mhz < 10 ) then 
    				
    						Sortie_1Mhz<= '1';
    						OUT_1Mhz	 <= '1';
    						Cmpt_1Mhz	 <= Cmpt_1Mhz	 + '1';
    				else
    				
    					Cmpt_1Mhz <= '0';
    			
    				end if;
    		end if;
    end process;
    	
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_1Mhz )
    	begin
    			if ( reste = '1' ) then
    			
    				Sortie_100Khz 	<= '0';
    				OUT_100khz	<= '0';
    				Cmpt_100khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_1Mhz)) then
    		
    				if (Cmpt_100khz	< 5 )then
    			
    					Sortie_100khz<= '0';
    					OUT_100khz	 <= '0';
    					Cmpt_100khz	 <= Cmpt_100khz	 + '1';
    				elsif (Cmpt_100khz < 10 ) then 
    				
    					Sortie_100khz<= '1';
    					OUT_100khz	 <= '1';
    					Cmpt_100khz	 <= Cmpt_100khz	 + '1';
    				
    				else
    				
    					Cmpt_100khz <= '0';
    			
    				end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_100Khz )
    	begin
    			if ( reste = '1' ) then
    		
    		
    				Sortie_10Khz 	<= '0';
    				OUT_10khz	<= '0';
    				Cmpt_10khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100khz)) then
    		
    					if (Cmpt_10khz	< 5 )then
    			
    						Sortie_10khz<= '0';
    						OUT_10khz	 <= '0';
    						Cmpt_10khz	 <= Cmpt_10khz	 + '1';
    				
    					elsif (Cmpt_10khz < 10 ) then 
    				
    							Sortie_10khz<= '1';
    							OUT_10khz	 <= '1';
    							Cmpt_10khz	 <= Cmpt_10khz	 + '1';
    					else
    				
    							Cmpt_10khz <= '0';
    			
    					end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reste, OUT_10Khz )
    	begin
    		if ( reste = '1' ) then
    		
    			Sortie_1Khz 	<= '0';
    			OUT_1khz	<= '0';
    			Cmpt_1khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10khz)) then
    		
    				if (Cmpt_1khz	< 5 )then
    			
    					Sortie_1khz<= '0';
    					OUT_1khz	 <= '0';
    					Cmpt_1khz	 <= Cmpt_1khz	 + '1';
    				elsif (Cmpt_1khz < 10 ) then 
    				
    						Sortie_1khz<= '1';
    						OUT_1khz	 <= '1';
    						Cmpt_1khz	 <= Cmpt_1khz	 + '1';
    				else
    				
    						Cmpt_1khz <= '0';
    			
    				end if;
    		end if;
    end process;
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_100hz )
    	begin
    			if ( reste = '1' ) then
    		
    		
    			Sortie_10hz 	<= '0';
    			OUT_10hz	<= '0';
    			Cmpt_10hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100hz)) then
    		
    				if (Cmpt_10hz	< 5 )then
    			
    					Sortie_10hz<= '0';
    					OUT_10hz	 <= '0';
    					Cmpt_10hz	 <= Cmpt_10hz	 + '1';
    				
    				elsif (Cmpt_10hz < 10 ) then 
    				
    				Sortie_10hz<= '1';
    				OUT_10hz	 <= '1';
    				Cmpt_10hz	 <= Cmpt_10hz	 + '1';
    				
    				else
    				
    				Cmpt_10hz <= '0';
    			
    				end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reste, OUT_10hz )
    	begin
    			if ( reste = '1' ) then
    		
    				Sortie_1hz 	<= '0';
    				OUT_1hz	<= '0';
    				Cmpt_1hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10hz)) then
    		
    				if (Cmpt_1hz	< 5 )then
    			
    					Sortie_1hz<= '0';
    					OUT_1hz	 <= '0';
    					Cmpt_1hz	 <= Cmpt_1hz	 + '1';
    				elsif (Cmpt_1hz < 10 ) then 
    				
    					Sortie_1hz<= '1';
    					OUT_1hz	 <= '1';
    					Cmpt_1hz	 <= Cmpt_1hz	 + '1';
    					
    				else
    				
    				Cmpt_1hz <= '0';
    			
    				end if;
    			end if;
    end process;	
    end;
    Dernière modification par dr4gon993 ; 05/09/2014 à 14h42.

  27. #26
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Alors il semble que ca soit la définitionen STD_LOGIC_VECTOR de mes compteurs qui cloche pourquoi ?

    en tous cas quand je remplace

    if (Cmpt_10Mhz < '3' )then


    par

    if (Cmpt_10Mhz < "011" )then

    ca crie plus

  28. #27
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonsoir,
    '3' cela ne signifie rien a priori pour le compilateur.
    Comme je te l'ai deja ecrit pour tout ce qui est arithmétique donc compteur compris utilise les unsigned c'est moins verbeux :
    compteur en std_logic_vector:
    ecriture correcte:
    cpt <= std_logic_vector(unsigned(cpt) +1);
    en unsigned
    cpt <= cpt+1;
    le seul travail supplémentaire sera au moment de l'affectation sur une sortie std_logic ou std_logic_vector
    toto : std_logic, x index
    toto <= std_logic(cpt(x));
    titi :std_logic_vector (a downto b) a-b = A-B mais a peut être différent de A de même pour b,B
    titi <= std_logic_vector(cpt(A downto B));
    il faut toujours faire les changement de type de manière explicite si tu comptes produire du code sérieux , oublier les cast sauvages implicites des guignols du C.
    JR
    l'électronique c'est pas du vaudou!

  29. #28
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Nom : numeric_std_conversions.gif
Affichages : 495
Taille : 37,3 Ko

    Je dois connaitre ceci donc, j'ai trouvé ça sur Google image mais je pense qu'il doit être correcte.


    je note qu'on peux tout convertir en une passe à l’exception d'un Integer <=> std_logic_vector ou on dois le faire en 2 fois


    ex:

    signal toto : integer;
    signal titi : std_logic_vector (3 downto 0) ;


    titi <=std_logic_vector (to_unsigned (toto)+1 );
    OU
    titi <= stdçlogic_vector(to_signed(tot o)+1);




    j'ai compris le principe chef ?
    Dernière modification par dr4gon993 ; 08/09/2014 à 09h03.

  30. #29
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Voila mon code pour crée plusieurs horloge je vais essayer d'utilisé Modelsim pour crée des stimulus afin de voir si ca marche vraiment j'y vais à taton sur modelsim mais je crois que j'ai juste besoin de crée une clock à 50mhz et un reset ?
    et faire tourné le tous au minimum 3s histoire d'avoir tout les signaux en graphique ?
    Bon j'espère que je m’améliore, j'ai toujours des questions de pourquoi cet erreur j'ai mis le bouzin en unsigned et il dit ceci :

    else
    -- Cmpt_10hz <= '0'; -- Error (10316): VHDL error at Horloge.vhd(248): character ''0'' used but not declared for type "UNSIGNED"

    -- Cmpt_10hz <= 0; -- Error (10517): VHDL type mismatch error at Horloge.vhd(249): UNSIGNED type does not match integer literal[/B][/COLOR]

    Cmpt_10hz <= (others => '0'); -- ceci marche mais pourquoi dediouuuu ?
    end if;








    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    Entity Chronos_Vhdl is
    	port( 
    	Reset			: in 	std_logic; -- On reste la planète on se retrouve au temps de Jésus à L'heure 0  de l'année 0 du mois 0 LOOOOOL.
    	Clk_50Mhz 		: in  std_logic; -- 20 	ns -- c'est mon horloge de base sur ma carte.
    	Sortie_10Mhz	        : out std_logic; -- 100	ns -- je dois compté 5 coups de ma base pour avoir cette Horloge.
    	sortie_1Mhz		: out std_logic; -- 1 	us -- je dois compté 50 coups de ma base.
    	sortie_100Khz	        : out std_logic; -- 10	us -- je dois compté 500 coups de ma base.
    	sortie_10Khz	        : out std_logic; -- 100	us -- je dois compté 5 000 coups de ma base. 
    	sortie_1Khz		: out std_logic; -- 1	ms -- je dois compté 50 000 coups de ma base.
    	sortie_100Hz	        : out std_logic; -- 10	ms	-- je dois compté 500 000 coups de ma base.
    	sortie_10hz		: out std_logic; -- 100 ms -- je dois compté 5 000 000 coups de ma base.
    	sortie_1Hz		        : out std_logic );-- 1	s  -- je dois compté 50 000 000 coups de ma base.
    end entity;
    
    -- je suppute qu'il est plus aisé d'avoir plusieurs compteur de 10  à intercaler entre chaque saut de fréquence.  
    
    
    architecture Flic_Flac of chronos_Vhdl is
    
    	signal Cmpt_10Mhz		:	unsigned (2 downto 0):=(others => '0'); -- 2^(3) c'est un compteur qui peut compter jusqu'à 8coups !
    	signal Cmpt_1Mhz 		:	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_100Khz 	        :	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_10Khz 	        :	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_1Khz 		:	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_100hz 	        :	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_10hz 		:	unsigned (3 downto 0):=(others => '0');
    	signal Cmpt_1hz 		:	unsigned (3 downto 0):=(others => '0');
    	
    	signal OUT_10Mhz		:std_logic;
    	signal OUT_1Mhz		:std_logic;
    	signal OUT_100Khz      	:std_logic;
    	signal OUT_10Khz 		:std_logic;
    	signal OUT_1Khz 		:std_logic;
    	signal OUT_100hz 		:std_logic;
    	signal OUT_10hz 		:std_logic;
    	
    	
    	
    begin
    
    
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    
    Process(Reset, Clk_50Mhz)
    	begin
    	if (Reset  = '1') then
    	
    		Sortie_10Mhz 	<= '0';
    		OUT_10Mhz	<= '0';
    		Cmpt_10Mhz <= (others => '0');
    		
    	elsif rising_edge (Clk_50Mhz) then
    		
    			if (Cmpt_10Mhz	< 3 )then
    			
    				Sortie_10Mhz<= '0';
    				OUT_10Mhz	 <= '0';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + 1;
    				
    			elsif (Cmpt_10Mhz	 < 6 )then
    			
    				Sortie_10Mhz <= '1';
    				OUT_10Mhz	 <= '1';
    				Cmpt_10Mhz	 <= Cmpt_10Mhz	 + 1;
    				
    				else
    				
    				Cmpt_10Mhz <= (others => '0'); -- ** 
    				
    				end if;
    			end if; 
    end process;
    
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (Reset, OUT_10Mhz )
    	begin
    		if ( Reset = '1' ) then
    				
    				Sortie_1Mhz <= '0';
    				OUT_1Mhz	<= '0';
    				Cmpt_1Mhz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10Mhz)) then
    		
    				if (Cmpt_1Mhz<5)then
    			
    					Sortie_1Mhz<= '0';
    					OUT_1Mhz	 <= '0';
    					Cmpt_1Mhz	 <= Cmpt_1Mhz	 + 1;
    				elsif (Cmpt_1Mhz < 10 ) then 
    				
    						Sortie_1Mhz<= '1';
    						OUT_1Mhz	 <= '1';
    						Cmpt_1Mhz	 <= Cmpt_1Mhz	 + 1;
    					else
    				
    					Cmpt_1Mhz <= (others => '0');
    			
    					end if;
    		end if;
    end process;
    	
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reset, OUT_1Mhz )
    	begin
    			if ( reset = '1' ) then
    			
    				Sortie_100Khz 	<= '0';
    				OUT_100khz	<= '0';
    				Cmpt_100khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_1Mhz)) then
    		
    				if (Cmpt_100khz	< 5 )then
    			
    					Sortie_100khz<= '0';
    					OUT_100khz	 <= '0';
    					Cmpt_100khz	 <= Cmpt_100khz + 1;
    					
    				elsif (Cmpt_100khz < 10 ) then 
    				
    					Sortie_100khz<= '1';
    					OUT_100khz	 <= '1';
    					Cmpt_100khz	 <= Cmpt_100khz	 + 1;
    				
    					else
    				
    					Cmpt_100khz <= (others => '0');
    			
    					end if;
    				end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reset, OUT_100Khz )
    	begin
    			if ( reset = '1' ) then
    		
    		
    				Sortie_10Khz 	<= '0';
    				OUT_10khz	<= '0';
    				Cmpt_10khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100khz)) then
    		
    					if (Cmpt_10khz	< 5 )then
    			
    						Sortie_10khz<= '0';
    						OUT_10khz	 <= '0';
    						Cmpt_10khz	 <= Cmpt_10khz	 + 1;
    				
    					elsif (Cmpt_10khz < 10 ) then 
    				
    							Sortie_10khz<= '1';
    							OUT_10khz	 <= '1';
    							Cmpt_10khz	 <= Cmpt_10khz	 + 1;
    					else
    				
    							Cmpt_10khz <= (others => '0');
    			
    					end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	
    process (reset, OUT_10Khz )
    	begin
    		if ( reset = '1' ) then
    		
    			Sortie_1Khz 	<= '0';
    			OUT_1khz	<= '0';
    			Cmpt_1khz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10khz)) then
    		
    				if (Cmpt_1khz	< 5 )then
    			
    					Sortie_1khz<= '0';
    					OUT_1khz	 <= '0';
    					Cmpt_1khz	 <= Cmpt_1khz	 + 1;
    				elsif (Cmpt_1khz < 10 ) then 
    				
    						Sortie_1khz<= '1';
    						OUT_1khz	 <= '1';
    						Cmpt_1khz	 <= Cmpt_1khz	 + 1;
    				else
    				
    --						Cmpt_1khz <= '0';                       *** ici ca crée une erreur pourquoi ?
    						Cmpt_1khz <= (others => '0');
    			
    				end if;
    		end if;
    end process;
    	
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reset, OUT_100hz )
    	begin
    			if ( reset = '1' ) then
    		
    		
    			Sortie_10hz 	<= '0';
    			OUT_10hz	<= '0';
    			Cmpt_10hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_100hz)) then
    		
    				if (Cmpt_10hz	< 5 )then
    			
    					Sortie_10hz<= '0';
    					OUT_10hz	 <= '0';
    					Cmpt_10hz	 <= Cmpt_10hz	 + 1;
    				
    				elsif (Cmpt_10hz < 10 ) then 
    				
    				Sortie_10hz<= '1';
    				OUT_10hz	 <= '1';
    				Cmpt_10hz	 <= Cmpt_10hz	 + 1;
    				
    				else
    				
    				-- Cmpt_10hz <= '0'; -- 	Error (10316): VHDL error at Horloge.vhd(248): character ''0'' used but not declared for type "UNSIGNED"
    
    				-- Cmpt_10hz <= 0;  --  Error (10517): VHDL type mismatch error at Horloge.vhd(249): UNSIGNED type does not match integer literal
    
    				Cmpt_10hz <= (others => '0');   -- ceci marche ?
    				end if;
    			end if;
    end process;
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    process (reset, OUT_10hz )
    	begin
    			if ( reset = '1' ) then
    		
    				Sortie_1hz 	<= '0';
    				Cmpt_1hz <= (others => '0');
    	
    			elsif ( rising_edge (OUT_10hz)) then
    		
    				if (Cmpt_1hz	< 5 )then
    			
    					Sortie_1hz<= '0';
    					Cmpt_1hz	 <= Cmpt_1hz	 + 1;
    				elsif (Cmpt_1hz < 10 ) then 
    				
    					Sortie_1hz<= '1';
    					Cmpt_1hz	 <= Cmpt_1hz	 + 1;
    					
    				else
    				
    				Cmpt_1hz <= (others => '0');
    			
    				end if;
    			end if;
    end process;	
    end;

  31. #30
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonjour,
    Cmpt_10hz <= '0'; fonctionnerait si Cmpt_10hz n'avait qu'un bit
    Cmpt_10hz <= 0; fonctionnerait en ecrivant Cmpt_10hz <= (to_unsigned(0),taille Cmpt_10hz);
    Cmpt_10hz <= (others => '0'); fonctionne car il y a association de la valeur '0' à tous les bits de Cmpt_10hz, c'est la bonne ecriture .
    autre solution:
    Cmpt_10hz <= "0000"; moins souple!
    JR
    l'électronique c'est pas du vaudou!

Page 1 sur 2 1 DernièreDernière

Discussions similaires

  1. besoin d'aide programme vhdl d'une horloge !!
    Par invite5bc98af5 dans le forum Électronique
    Réponses: 0
    Dernier message: 29/04/2012, 22h15
  2. [VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)
    Par Baboush93 dans le forum Électronique
    Réponses: 2
    Dernier message: 25/04/2012, 13h39
  3. langage VHDL débutant besoin d'une petite aide svp
    Par newtech1 dans le forum Électronique
    Réponses: 1
    Dernier message: 19/11/2011, 20h20
  4. VHDL : besoin d'aide !
    Par invite1af3caff dans le forum Logiciel - Software - Open Source
    Réponses: 3
    Dernier message: 08/05/2009, 11h11
  5. programme vhdl:besoin d aide
    Par invite165c4689 dans le forum Électronique
    Réponses: 2
    Dernier message: 18/05/2008, 22h56
Découvrez nos comparatifs produits sur l'informatique et les technologies.