Vous êtes sur la page 1sur 5

Devoir VHDL-FPGA N°01

M1 Instrumentation

Exo 01 :
1. Il s’agit d’une machine MEALY car les sorties dépendent a la fois de
l’état présent et des entrées, donc elles sont indiquées sue les transitions
après une barre oblique.
2. On doit utiliser process.
3. On doit utiliser 1 seul process par ce que y a une CLOCK et le CLEAR.
4. Le code VHDL :
library ieee;

use ieee.std_logic_1164.all;

entity a is

port(clk,clr:in std_logic;

x:in std_logic_vector(1 downto 0);

g:out std_logic);

end a;

architecture b of a is

type etat is (s1,s2,s3,s4,s5,s6,s7,s8);

signal s: etat;

begin

process(clk,clr)

begin

if clr='1' then

s<=s1 ; g<='0';

elsif rising_edge(clk) then

case s is

when s1=>

if x="01" then

s<=s2; g<='0';

elsif x="10" then


s<=s5; g<='1';

end if;

when s2=>

if x="01" then

s<=s2; g<='0';

elsif x="11" then

s<=s3; g<='0';

elsif x="00" then

s<=s8; g<='1';

end if;

when s3=>

if x="11" then

s<=s3; g<='0';

elsif x="10" then

s<=s4; g<='0';

elsif x="01" then

s<=s7; g<='1';

end if;

when s4=>

if x="10" then

s<=s4; g<='0';

elsif x="00" then

s<=s1; g<='0';

elsif x="11" then

s<=s6; g<='1';

end if;

when s5=>

if x="10" then

s<=s5; g<='1';

elsif x="00" then

s<=s1; g<='0';

elsif x="11" then

s<=s6; g<='1';

end if;
when s6=>

if x="11" then

s<=s6; g<='1';

elsif x="10" then

s<=s4; g<='0';

elsif x="01" then

s<=s7; g<='1';

end if;

when s7=>

if x="01" then

s<=s7; g<='1';

elsif x="00" then

s<=s8; g<='1';

elsif x="11" then

s<=s3; g<='0';

end if;

when s8=>

if x="00" then

s<=s8; g<='1';

elsif x="01" then

s<=s2; g<='0';

elsif x="10" then

s<=s5; g<='1';

end if;

end case;

end if;

end process;

end b;

5. Tracer le chronogramme et les combinaison possible :


EXO2 :
1. Combien de components a-t-on besoin : 4.
Sont les portes logique (4OR,2NOT,16AND) et 4Bascule D.
2. Les entres sortie de chaque composent :
NOT (les entrées S1 ou S0 les Sorties S 1 ou S 0)
AND les entrées : RSI, (S1 ou S0 ou S 1 ou S 0) , Pn, LSI
Les sorties : RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
OR les entrées : RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
Les sorties : RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
Or RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
Or RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
Or RSI AND (S1 ou S0 ou S 1 ou S 0) and Pn and LSI
Bascule D l’entrée D sortie Q
3. Code VHDL d’une bascule D :
library ieee;

use ieee.std_logic_1164;

entity d is

port(clk,clr,d:in std_logic;

q:out std_logic);

end d;

architecture k of d is

begin

process(clr,clk)

begin

if clr = '1' then

q<=0;

elsif rising_edge(clk) then

q<=d;

end if

end process

end k;
4. Code VHDL de la partie combinatoire :
library ieee;
use ieee.std_logic_1164;
entity d is
port(s:in std_logic_vector(1 downto 0);
p:in std_logic_vecotr(3 downto 0);
q:in std_logic_vecotr(3 downto 0);
rsi:in std_logic;
d:out std_logic_vector(3 downto 0));
end d;

architecture k of d is
begin

d(3)<= (rsi and not(s(1)) and s(0)) or (p(3) and s(1) and s(0)) or (s(1) and not(s(0)) and q(2) or
(not(s(1)) and not(s(0)) and q(3))
d(2)<= (q(3) and not(s(1)) and s(0)) or (p(2) and s(1) and s(0)) or (s(1) and not(s(0)) and q(1) or
(not(s(1)) and not(s(0)) and q(1))
d(1)<= (q(2) and not(s(1)) and s(0)) or (p(1) and s(1) and s(0)) or (s(1) and not(s(0)) and q(0) or
(not(s(1)) and not(s(0)) and q(1))
d(0)<= (q(1) and not(s(1)) and s(0)) or (p(0) and s(1) and s(0)) or (s(1) and not(s(0)) and lsi or
(not(s(1)) and not(s(0)) and q(0))

end k;

Vous aimerez peut-être aussi