Vous êtes sur la page 1sur 8

TP2 conception VHDL

LP Electronique des Systèmes Embarqué

Semestre : 6
MODULE : Conception VHDL
Réalise par : OUBARDAN MAROUANE
Encadre par P.LACHEHAB A
Programme de exercice
Schéma

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity BascDex is
port (X,Reset,CLK:in std_logic;
Z:out std_logic);
end BascDex ;
architecture archBascDex of BascDex is
signal A,B:std_logic ;
begin
process(CLK,RESET)
begin
if(Reset='0') then
A<='0';
B<='0';
elsif(rising_edge(CLK))
then
A<=A xor B;
B<= X or not (B);
end if;
end process;
Z<=not (A or B);
end archBascDex;

Programme diviseur de fréquence par 2


Schéma

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
entity JKexe is
port( reset,clk:in std_logic;
Q:out std_logic);
end JKexe;
architecture archJK of JKexe is
signal T:std_logic;
begin
process(clk,reset)
begin
if(reset='0')
then T<='0';
elsif(rising_edge(clk))then
T<=not(T);
end if ;
end process;
Q<=T;
end archJK;

Programme de diviseur de fréquence par 4


Schéma

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;

entity JKexe4 is
port( reset,clk1,CLK2:in std_logic;
Q1,Q2:out std_logic);
end JKexe4;
architecture archJK4 of JKexe4 is
signal T1,T2:std_logic;
begin
process(clk1,reset)
begin
if(reset='0')
then T1<='0';
elsif(rising_edge(clk1))then
T1<=not(T1);
end if;
end process;
Q1<=T1;
process(T1)
begin
if(rising_edge(T1))then
T2<=not(T2);
end if ;
end process;
Q2<=T2;
end archJK4;
Les compteurs
Ce sont des circuits logiques séquentiels qui assurent la fonction de comptage. Ils sont
constitués d'une suite de bascules raccordées en cascade (série ou parallèle) dont le nombre
représente le nombre des bits du compteur. Un état logique d'un compteur est composé de
tous les états logiques des bascules du compteur.
Programme de compteur 0 a 5
Table de vérité

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
entity cm2 is
port( clk:in std_logic;
Q:out std_logic_vector(3 downto 0));
end cm2;
architecture arcm2 of cm2 is
signal T:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1') then
T<=std_logic_vector(T+1);
if T="0101" then T<="0000";
end if;
end if;
end process;
Q<=T;
end arcm2;

Programme compteur mod 10


Table de vérité

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
entity cm10 is
port( clk:in std_logic;
Q:out std_logic_vector(3 downto 0));
end cm10;
architecture arcm10 of cm10 is
signal T:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1') then
T<=std_logic_vector(T+1);
if T="1010" then T<="0000";
end if;
end if;
end process;
Q<=T;
end arcm10;

Vous aimerez peut-être aussi