Académique Documents
Professionnel Documents
Culture Documents
Rapport de TP
CARTE FPGA
PRG EN VHDL
Encadrée par :
Mr. ELKARI
REALISEE :
Mme : Khadija
Omayma maamouz
Rajae el waarabi
TP 1 : Développement d’un système numérique
Objectifs :
Structure d’un projet Un projet VHDL est très souvent décomposé en sous-structures, appelées
modules ou composants. Comme on pourrait le faire sur un circuit imprimé, il s’agit d’instancier
différents composants et de les relier entre eux par des fils (signaux en VHDL) pour réaliser le
système complet. Chacun de ces modules est alors décrit dans un fichier source indépendant. Chacun
de ces fichiers sources peut alors être testé indépendamment en lui associant un fichier de
simulation (ou testbench). Enfin des fichiers de contraintes permettent de faire le lien entre la
description logicielle et la structure matérielle de la cible et de son environnement (position des
entrées, des sorties...).
Une description en vhdl de schéma suivant :
Bascule D : Porte ET :
library ieee; Library IEEE ;
use ieee.std_logic_1164.all; use ieee.std_logic_1164.all ;
use ieee.std_logic_arith.all; use work.std_arith.all ;
use ieee.std_logic_signed.all; entity ET is
entity basculeD is port ( Port ( A, B : in std_logic ;
D: in std_logic; S : out std_logic ) ;
CE : in std_logic; end nand ;
H : in std_logic; architecture PORTE of and is
Q : out std_logic; begin
CLR : in std_logic); S<= A and B ;
end basculeD; end PORTE ;
architecture rtl of basculeD is
begin
process(CLR,CE,H)
begin
if CLR='1'then Q<='0'; else
if CE='1' and (H='0' and h'event) then Q<=D;
end if;
end if;
end process;
end rtl;
library ieee;
architecture rtl of CIRCUIT is
use ieee.std_logic_1164.all;
signal D_interne: std_logic;
use ieee.std_logic_arith.all;
component porteET
use ieee.std_logic_unsigned.all;
port(
entity CIRCUIT is port (
E1: in std_logic;
a: in std_logic;
E2: in std_logic;
b:in std_logic;
S: out std_logic);
clkEn : in std_logic;
end component;
clk : in std_logic;
component basculeD
clear: in std_logic;
port(
c :out std_logic);
D: in std_logic;
end CIRCUIT;
CE : in std_logic;
H : in std_logic;
Q : out std_logic;
CLR : in std_logic);
end component;
begin
etiq1: porteET port map ( E1 =>a,E2=>b,s=>D_Interne);
etiq2: basculeD port map (H=>clk,CE=>clkEn,clr=>clear,D=>d_interne,Q=>C);
end rtl;
Réalisation d’un compteur modulo 9
Septseg
Compteur 9
Library ieee;
Library ieee; use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all; use ieee.std_logic_arith.all;
use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all; entity septseg is
entity comptneuf is port(
port( b : in std_logic_vector( 3 downto 0);
a9,CLR: in std_logic ; seg : out std_logic_vector (6 downto
CARRY9 : out std_logic; 0));
end; begin
begin begin
process(a9,CLR) case b is
end case;
end process;
end behavioral;
Diviseur de fréquence
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity Div is
port(
clk_50: in std_logic ;
);
end;
begin
process(clk_50)
begin
if (compt=10000000) then
compt<=0 ; clk_1<='1' ;
else
compt<=compt+1 ; clk_1<='0';
end if;
end if;
end process;
end behavioral;
deviseur de fréquence avec afficheur 7SEG
library ieee; Q : inout std_logic_vector( 3
use ieee.std_logic_1164.all; downto 0);
component Div
port(
clk_50: in std_logic ;
clk_1: out std_logic
);
end component;
component septsegm
port(
H,CLR: in std_logic ;
Méthode 1 ( compteur sans diviseur de fréquence) :
Library ieee; process(Q)
use ieee.std_logic_1164.all; begin
use ieee.std_logic_arith.all; case Q is
use ieee.std_logic_unsigned.all; when "0000" =>
seg<="1000000" ;
end process ;
end process;
end behavioral;
Réalisation d’une horloge :
Compteur modulo 9 : Diviseur de fréquence :
Library ieee; Library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all; use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all; use ieee.std_logic_unsigned.all;
process(a,CLR) begin
begin process(clk_50)
end if;
end process;
end behavioral;
Septseg
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity septseg is
port(
b : in integer range 0 to 9 ;
seg : out std_logic_vector (6 downto 0) );
end;
architecture behavioral of septseg is
begin
process(b)
begin
case b is
when 0 => seg<="1000000" ;
when 1 => seg<="1111001" ;
end process;
end behavioral;
Programme principale
library ieee;
end component;
use ieee.std_logic_1164.all;
signal sin1,sin2,sin3,sin4,sin5,sin6,H_1:
use ieee.std_logic_arith.all; integer;
use ieee.std_logic_unsigned.all; signal r1,r2,r3,c1,c2,c3,c4,c5,c6,h,m,s:
std_logic;
entity timert is port (
begin
H_50,CLEAR:in std_logic;
etiq0 : div port map(H_50,s);
s1,s2,s3,s4,s5,s6:out std_logic_vector(6 downto 0));
process(cleAR,sin1,sin2,sin3,sin4,sin5,sin6
end timert;
)
architecture rtl of timert is
begin
end if;
component septseg
if (sin5=4) and (sin6=2) then r3<='1';
port(
else r3<='0';
b : in integer range 0 to 9 ;
end if;
seg : out std_logic_vector (6 downto 0)
end if;
);
end process;
end component;
);
end component;
begin
process(cleAR,sin1,sin2,sin3,sin4,sin5,sin6)
begin
else
else r1<='0';m<='0';
end if;
else r2<='0';h<='0';
end if;
else r3<='0';
end if;
end if;
end process;
end rtl;