VHDL besoin d'aide niveau débutant - Page 2
Répondre à la discussion
Page 2 sur 2 PremièrePremière 2
Affichage des résultats 31 à 38 sur 38

VHDL besoin d'aide niveau débutant



  1. #31
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant


    ------

    Cmpt_10hz <= 0;

    fonctionnerait en ecrivant :


    Cmpt_10hz <= (to_unsigned(0),taille Cmpt_10hz);

    To_ unsigned(0) sa signifie que 0 est un integer ? mais qu'est-ce qu'un integer au juste je regarde le tableau des conversion que j'ai posé plus haut j'essaye de comprendre ppour plus faire d'erreur


    un std_logic_vector : sa reprensente des valeur sous forme de bits 0/1 voir des "bus" ( on a pas le droit au operateur +.-.*./.....ect)
    Unsigned c'est un nombre 0.1.2.3.4.5.6.7.8.9 qui na pas de signe + ou - ( on a le droit au operateur +.-.*./.....ect)
    signed c'est la meme chose que unsigned sauf que la on a un signe +ou -( on a le droit au operateur +.-.*./.....ect)
    integer je sais pas il fait partie des "fonction call"

    -----

  2. #32
    jiherve

    Re : VHDL besoin d'aide niveau débutant

    Bonsoir,
    j'ai commis une erreur de parenthèses c'est : to_unsigned(0, taille)
    Un integer en VHDL c'est un nombre entier qui appartient à [-32767,+32767] soit [0x80000001,0x07FFFFFF] paradoxalement la valeur -1 du complément à deux (0x80000000) est exclue, c'est là un piège redoutable.
    Le VHDL manipule très bien les integer si l'on a prit soin d'en définir le range, par défaut c'est 32 bits, il sont synthétisés sous la forme de signaux/variables ayant un nombre de bits N tel que 2^(N-1) > =|integer| car il faudra un bit de signe.
    Le tableau est correct.
    JR
    l'électronique c'est pas du vaudou!

  3. #33
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    coucou désolé je me suis mis sur autre chose du coup je reprend ou j'en était ce matin.

    J'en suis à l'écriture du test bench j'ai crée un fichier toto_TB en extension VHDL et j'ai écris ceci


    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    
    
    entity horloge is
    end;
    
    architecture Bench of horloge is
    
    
    begin
    
    
    component horloge
    	port ( reset : in std_logic;
    			 Clkl_50Mhz
    		
    		
    		
    		
    end;

    Mais je suis super confus car dans certain exemple il utilsie

    UUT: entity work.Rotator(RTL)
    En faite je voie pas comment architecturer le test bench en gros il faut que je crée une horloge a 50Mhz un reset et que je test les sortie de mon bloque horloge ....

  4. #34
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Pourquoi quand on lit des test bench sur le net on voie écrit

    M: entity ....work

    ca veux dire quoi ?

  5. #35
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    voila mon test bench pour la fonction chronos mon diviseur de fréquence ... mais ca marche pas comme je voudrai j'essaye de débug


    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    entity test is 
    end entity;
    
    
    architecture chronos of test is 
    
    signal reset, Clk_50Mhz : std_logic;
    constant CLK_period : time :=20ns;
    
    begin
    
    component chronos is
    	port(
    		reset		: in  std_logic;
    		Clk_50Mhz 	: in  std_logic;
    		Sortie_10Mhz	: out std_logic;
    		sortie_1Mhz	: out std_logic;
    		sortie_100Khz	: out std_logic; 
    		sortie_10Khz	: out std_logic; 
    		sortie_1Khz	: out std_logic; 
    		sortie_100Hz	: out std_logic; 
    		sortie_10hz	: out std_logic; 
    		sortie_1Hz	: out std_logic
    		);
    end component
    
    
    
    inst_chronos_vhdl_test : chronos map(reset, clk_50Mhz, Sortie_10Mhz, sortie_1Mhz, sortie_100Khz, sortie_10Khz, sortie_1Khz, sortie_100Hz, sortie_10hz, sortie_1Hz);
    
     process
    	begin
    		Clk<='0';
    		wait for clk_period/2;
    		clk<='1';
    		wait for clk_period/2;
    	end process;
     process 
     begin 
    	reset<= '1';
    	 wait for 60ns 
    	reset <= '0'
    	 wait
    	end process;
    end arc;

  6. #36
    indri

    Re : VHDL besoin d'aide niveau débutant

    Alors en vrac:
    -un component utilisé avec un tas de signaux non déclarés (les sorties)
    -tu appelle ca un diviseur de fréquence, mais tu ne divise rien du tout..u attends! Je doute que cette manière de faire sois judicieuse. Pour diviser, on compte un certain nombre de flanc (montant ou descendant) et après on change l'état de la sortie (ou alors tu peux utilisé une pll)
    _ton deuxieme process il est censé faire quoi?

    -question perso: "end arc" ???
    Là où va le vent...

  7. #37
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Citation Envoyé par indri Voir le message
    Alors en vrac:
    -un component utilisé avec un tas de signaux non déclarés (les sorties)
    -tu appelle ca un diviseur de fréquence, mais tu ne divise rien du tout..u attends! Je doute que cette manière de faire sois judicieuse. Pour diviser, on compte un certain nombre de flanc (montant ou descendant) et après on change l'état de la sortie (ou alors tu peux utilisé une pll)
    _ton deuxieme process il est censé faire quoi?

    -question perso: "end arc" ???

    Pardon de te contredire Indri mais si tu prend la dernière page sans lire avant .... je peux pas t'aider ( regarde page 2 tout en bas ) il y a ma fonction diviseur de fréquence .
    ceci dit ici je crée un test bench pour model sim afin de crée les stimulus pour simuler un bloque de mon projet et regardé son fonctionnement .

    Hors dans un test bench component sert a crée une structure autonome ne renvoyant rien pour instancié la structure lors de sa compilation ....

  8. #38
    dr4gon993

    Re : VHDL besoin d'aide niveau débutant

    Ci dessous mon bloque horloge on voie que il y a 2 stimulus "RESET et CLK_50Mhz"
    Donc je dois écrire un test bench pour c'est deux signaux. c'est le bute du VHDL d'utilisé la simulation quand même ?

    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		:	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;
    	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
    			
    				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';
    				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 <= (others => '0');
    			
    				end if;
    			end if;
    end process;	
    end;

    Bon je sais pas si mon programme va marché ou pas je sais même pas si j'ai écris quelque chose de cohérent, pour voir si ca fait ce que je veux je dois simuler les 2 signaux d'entrée et regarder les sorties sur modelsim.
    Bon meme si le programme ci dessus c'est le deuxième que j'ai écris dans ma vie le test bench pour modelsim ca sera le premier je regarde des tuto sur le net ou des cours et je suis les structures d'écriture qu'il propose.

    - Appartement un TB s'écrit dans un fichier VHDL classique
    - il ne d'écrit rien dans l'entity
    - de mon expérience précédente dans l'écriture des deux premiers codes on a le doit au boucle while for d'écrire des wait xx ns ect ...

    Mon code pour créer le signal reset actif au démarrage et la clock_50mhz resembble a ceci :


    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.all;
    use IEEE.numeric_std.all;
    
    entity test is 
    end entity;
    
    
    architecture chronos of test is 
    
    signal reset, Clk_50Mhz : std_logic;
    constant CLK_period : time :=40ns;
    
    begin
    
    component chronos is
    	port(
    		
    		reset				: in  std_logic;
    		Clk_50Mhz 		: in  std_logic;
    		Sortie_10Mhz	: out std_logic;
    		sortie_1Mhz		: out std_logic;
    		sortie_100Khz	: out std_logic; 
    		sortie_10Khz	: out std_logic; 
    		sortie_1Khz		: out std_logic; 
    		sortie_100Hz	: out std_logic; 
    		sortie_10hz		: out std_logic; 
    		sortie_1Hz		: out std_logic
    		);
    end component
    
    
    
    inst_chronos_vhdl_test : chronos map(reset, clk_50Mhz, Sortie_10Mhz, sortie_1Mhz, sortie_100Khz, sortie_10Khz, sortie_1Khz, sortie_100Hz, sortie_10hz, sortie_1Hz);
    
     process
    	begin
    		Clk<='0';
    		wait for clk_period/2;
    		clk<='1';
    		wait for clk_period/2;
    	end process;
     process 
     begin 
    	reset<= '1';
    	 wait for 60ns 
    	reset <= '0'
    	 wait
    	end process;
    end ;
    après je suis pas du tout sur de moi en ce qui concerne l'écriture de ce TB j'essaye juste de faire en fonction des exemple que j'ai trouvé sur internet.
    On ma toujours dit discuté sa sert a rien il faut écrire pour avancer.
    Dernière modification par dr4gon993 ; 25/09/2014 à 09h34.

Page 2 sur 2 PremièrePremière 2

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 invite7debac6e 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 invite7dc03981 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
Dans la rubrique Tech de Futura, découvrez nos comparatifs produits sur l'informatique et les technologies : imprimantes laser couleur, casques audio, chaises gamer...