Académique Documents
Professionnel Documents
Culture Documents
Introduction
Dans ce type de description, on utilise des composants (component)
étant des blocs logiques qui existent déjà dans une libraire de travail
(WORK) sous forme d’entité de conception.
Exemple :
--Description structurelle
architecture struct of multiplexeur2_1 is
component inverseur
port ( a : in std_logic ;
s : out std_logic );
end component;
component et
port ( a, b : in std_logic ;
s : out std_logic );
end component;
component ou
port ( a, b : in std_logic;
s : out std_logic );
end component;
begin
complem : inverseur port map (sel, nonsel);
choix0 : et port map (nonsel, e0, sel0);
choix1 : et port map (sel, e1, sel1);
result : OU port map (sel0, sel1, s);
end struct;
entity OU is
port (E1, E2 : in std_logic;
S1 : out std_logic);
end OU;
architecture A_OU of OU is
begin
S1 <= E1 OR E2;
end A_OU;
entity ET is
port (E3, E4 : in std_logic;
S2 : out std_logic);
end ET;
architecture A_ET of ET is
begin
S2 <= E3 AND E4;
end A_ET;
component ET
port (E1, E2 : in std_logic; S : out std_logic);
end component;
end XOUET;
entity XOU is
port (E1, E2 : in std_logic;
S1 : out std_logic);
end XOU;
entity ET is
port (E3, E4 : in std_logic;
S2 : out std_logic);
end ET;
architecture A_ET of ET is
begin
S2 <= E3 AND E4;
end A_ET;
entity add is
port (A, B : in bit; Som, Ret : out std_logic);
end add;
component XOU
port (E1, E2 : in std_logic; S : out std_logic);
end component;
component ET
port (E1, E2 : in std_logic; S : out std_logic);
end component;
begin
U1 : XOU port map (A, B, Som);
U2 : ET port map (A, B, Ret);
end arch_structurelle;
component inverseur
port ( e : in std_logic; -- les entrees
s : out std_logic); -- les sorties
end component;
component et
port ( e1, e2 : in std_logic;
s : out std_logic );
end component;
component ou
port ( e1, e2 : in std_logic ;
s : out std_logic);
end component;
Par M. JAROU 10 | P a g e
Chapitre 5 : Description structurelle
component et
port ( e1, e2 : in std_logic ;
s : out std_logic);
end component;
component ou
port ( e1, e2 : in std_logic ;
s : out std_logic );
end component;
end portelem;
-- operateur inverseur
entity inverseur is
port ( e : in std_logic ;
s : out std_logic );
end inverseur;
-- operateur et
entity et is
port ( e1, e2 : in std_logic ;
s : out std_logic );
end et;
architecture arch_et of et is
begin
s <= e1 and e2;
end arch_et;
-- operateur ou
entity ou is
port ( e1, e2 : in std_logic ;
s : out std_logic );
end ou;
architecture arch_ou of ou is
begin
s <= e1 or e2;
end arch_ou;
Par M. JAROU 11 | P a g e
Chapitre 5 : Description structurelle
Par M. JAROU 12 | P a g e
Chapitre 5 : Description structurelle
port (a : in std_logic_vector(0 to 3) ;
s : out std_logic );
end ouex4;
component ouex4
port ( a : in std_logic_vector(0 to 3) ;
s : out bit );
end component;
begin
par16 : for i in 0 to 3 generate
g1 : ouex4 port map (e(4*i to 4*i + 3),inter(i));
end generate;
g2 : ouex4 port map (inter,s16);
s <= inter;
end struct;
Par M. JAROU 13 | P a g e
Chapitre 5 : Description structurelle
Par M. JAROU 14 | P a g e
Chapitre 5 : Description structurelle
3. Déclaration GENERIC
Au sein de la description VHDL d’une structure logique, il est
possible de rajouter une déclaration GENERIC pour déclarer des
paramètres.
Exemple 1 :
--Porte OU
entity OU is
generic (TP : time := 20 ns);
port (E1, E2 : in std_logic;
S1 : out std_logic);
end OU;
architecture OU of OU is
begin
S1 <= E1 or E2 after TP;
end OU;
--Porte ET
entity ET is
GENERIC (TP : time := 0 ns);
port (E1, E2 : in std_logic;
S1 : out std_logic);
end ET;
architecture ET of ET is
begin
S1 <= E1 and E2 after TP;
end ET;
Par M. JAROU 15 | P a g e
Chapitre 5 : Description structurelle
--Porte ET_OU
Entity ET_OU is
port (A, B : in std_logic;
X, Y : out std_logic);
end ET_OU;
component OU
generic (TP : time);
port (E1, E2 : in std_logic;
S1 : out std_logic);
end component;
component ET
generic (TP : time);
port (E1, E2 : in std_logic;
S1 : out std_logic);
end component;
begin
U1 : OU generic map ( TP => 5 ns )port map(A, B, X);
U2 : ET generic map ( TP => 15 ns )port map(A, B, Y);
end ET_OU;
Exemple 2:
entity UAL_generique is
generic ( width : integer := 4);
port (op : in std_logic_vector (1 downto 0);
a : in std_logic_vector (width-1 downto 0);
b : in std_logic_vector (width-1 downto 0);
...
end UAL_generique;
Par M. JAROU 16 | P a g e
Chapitre 5 : Description structurelle
Exemple 3:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all; -- for the unsigned type
entity COUNTER is
generic (
WIDTH : in natural := 32);
port (
RST : in std_logic;
CLK : in std_logic;
LOAD : in std_logic;
DATA : in std_logic_vector(WIDTH-1 downto 0);
Q : out std_logic_vector(WIDTH-1 downto 0));
end entity COUNTER;
Par M. JAROU 17 | P a g e
Chapitre 5 : Description structurelle
Par M. JAROU 18 | P a g e
Chapitre 5 : Description structurelle
5. Application:
Concevoir un compteur BCD 4 bits comme bloc logique cntbcd et
le définir comme un composant.
-- Entité/architecture du composant
entity c_cntbcd is port (
rst, clk, en : in std_logic;
co : out std_logic;
q : out std_logic_vector(3 downto 0) );
end c_cntbcd;
Par M. JAROU 19 | P a g e
Chapitre 5 : Description structurelle
-- Entité/architecture utilisatrice
begin
en0 <= '1';
bcd0: c_cntbcd port map (rst, clk, en0, co0, sq0);
en1 <= co0;
bcd1: c_cntbcd port map (rst, clk, en1, co1, sq1);
q0 <= sq0;
q1 <= sq1;
end archcounter;
Par M. JAROU 20 | P a g e
Chapitre 5 : Description structurelle
end pack_cnt;
entity c_cntbcd is
Port(
…);
end c_cntbcd;
use work.pack_cnt.all
begin
en0 <= '1';
bcd0: c_cntbcd port map (rst, clk, en0, co0, sq0);
en1 <= co0;
bcd1: c_cntbcd port map (rst, clk, en1, co1, sq1);
q0 <= sq0;
q1 <= sq1;
end archcounter;
Par M. JAROU 21 | P a g e
Chapitre 5 : Description structurelle
end pack_cnt;
-- Entité/architecture du composant
entity c_cntbcd is
Port ( rst, clk, en : in std_logic;
co : out std_logic;
q : out std_logic_vector (3 downto 0));
end c_cntbcd;
Par M. JAROU 22 | P a g e
Chapitre 5 : Description structurelle
library Lib_cnt
use Lib_cnt.pack_cnt.all;
-- Entité/architecture utilisatrice
entity counter is port(
clk, rst : in std_logic;
q0, q1 : out std_logic_vector(3 downto 0));
end counter;
begin
en0 <= '1';
bcd0: c_cntbcd port map (rst, clk, en0, co0, sq0);
en1 <= co0;
bcd1: c_cntbcd port map (rst, clk, en1, co1, sq1);
q0 <= sq0;
q1 <= sq1;
end archcounter;
Par M. JAROU 23 | P a g e
Chapitre 5 : Description structurelle
Exemple :
Description de l'architecture
entity SN_95 is
port ( SERIAL : in bit;
D : in bit_vector (1 to 4) ;
MODE : in bit;
SHIFT : in bit;
LOAD : in bit;
Q : inout bit_vector (1 to 4 )) ;
end SN_95 ;
use WORK.SN_COMPONENTS.all;
begin
G1 : INV port map (MODE,W1);
G2 : INV port map (W1,W2);
G3 : AND2 port map (SHIFT,W1,W3);
G4 : AND2 port map (LOAD,MODE,W4);
G5 : OR2 port map (W3,W4,CK);
REG : for i in 1 to 4 generate
PREM : if i = 1 generate
G6 : AND2 port map (SERIAL, W1,W6(i));
G7 : AND2 port map (D(i), W2,W7(i));
G8 : NOR2 port map (W6(i), W7(i),R(i));
G9 : INV port map (R(i),S(i));
GRS : RS port map (R(i),S(i),CK,Q(i),open);
end generate;
autre : if i/= 1 generate
G6 : AND2 port map (Q(i-1), W1,W6(i));
G7 : AND2 port map (D(i), W2,W7(i));
Par M. JAROU 24 | P a g e
Chapitre 5 : Description structurelle
library TTL;
configuration config_1 of SN_95 is
for structurelle
for all : AND2 use entity TTL.AND2(FAST); end for;
for all : OR2 use entity TTL.OR2(FAST); end for;
for G1,G2 : INV use entity TTL.INVERTER(MU07); end for;
for REG
for all : NOR2 use entity TTL.NOR2(FAST); end for;
for all : RS use entity TTL.BASC_RS(BEH); end for;
for PREM
for G9 : INV use entity TTL.INVERTER(FAST); end for;
end for;
for AUTRE
for G9 : INV use entity WORK.INVERSEUR(le_mien); end
for;
end for;
end for;
end structurelle;
Par M. JAROU 25 | P a g e