Académique Documents
Professionnel Documents
Culture Documents
Cours VHDL
Cours VHDL
PLD : Programmable Logic Device, CPLD : Complex PLD, PAL: Programmable Array Logic, GAL: Generic Array Logic,
FPGA : Field Programmable Gate Array, ASIC : application-specific integrated circuit
Formation VHDL
Introduction
Vahid MEGHDADI
Circuit fig
Circuit imprim difficile
modifier
Intgration limite
Cot lev
Justifi pour de petits
circuits
Formation VHDL
Introduction
Vahid MEGHDADI
Microprocesseur
Mmoire
Pr
iph
ri
que
Introduction
Vahid MEGHDADI
Introduction
Vahid MEGHDADI
Les ASIC
Formation VHDL
Introduction
Vahid MEGHDADI
ASIC ou FPGA ?
ASICs
FPGAs
High performance
Low development cost
Low power
Short time to market
Low cost in
high volumes
Formation VHDL
Reconfigurability
Introduction
Vahid MEGHDADI
Introduction
Vahid MEGHDADI
Dmonstrateurs
Circuit de dveloppement SpartanIII
Formation VHDL
Introduction
Vahid MEGHDADI
Exemple
Une carte polyvalente et reconfigurable
Extension
JTAG
Formation VHDL
Introduction
Vahid MEGHDADI
Vitesse
Possibilit de paralllisme (calcul dans lespace ou dans le temps)
Exemple y=Ax+Bx+C
FPGA
DSP
Formation VHDL
Introduction
Vahid MEGHDADI
10
peu
Paralllisme trs limit par software
Formation VHDL
Introduction
Vahid MEGHDADI
11
Fonction combinatoires
Utilisation dun PLA (Programmable Logic Array) ou PLD
I
I1
I
2
PLA1
PLA2
PLA3
O0
O1
O2
O3
Introduction
Vahid MEGHDADI
12
PLA
Formation VHDL
Vahid MEGHDADI
13
CPLD
Complex Programmable Logic Device
Les CPLD contiennent un grand nombre de PLD
interconnects par des liaisons programmables
I/O
I/O
I/O
PLD
PLD
PLD
Global
Interconnection
PLD
Formation VHDL
PLD
Matrix
I/O
I/O
I/O
PLD
Introduction
Vahid MEGHDADI
14
Formation VHDL
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
CLB
Introduction
Vahid MEGHDADI
15
Programmable
IO
K
LUT
Out
D FF
Clock
Programmable
Logic (CLB)
BLE
#1
N
Outputs
I
I
Inputs
BLE
#N
Clock
Programmable
Routing
Formation VHDL
Introduction
Vahid MEGHDADI
16
Architecture de CLB
Inputs
Look-Up
Table
(LUT)
Out
State
Clock
Enable
Formation VHDL
Introduction
Vahid MEGHDADI
17
FPGA Xilinx
Formation VHDL
Introduction
Vahid MEGHDADI
18
Spartan
Formation VHDL
Introduction
Vahid MEGHDADI
19
Spartan II
Ajout de la RAM
Formation VHDL
Introduction
Vahid MEGHDADI
20
La famille Spartan II
Formation VHDL
Introduction
Vahid MEGHDADI
21
La famille Virtex
Formation VHDL
Introduction
Vahid MEGHDADI
22
La famille Virtex
Formation VHDL
Introduction
Vahid MEGHDADI
23
Formation VHDL
Introduction
Vahid MEGHDADI
24
Conception circuit
o
o
EPROM
Formation VHDL
Introduction
Vahid MEGHDADI
25
Design flow
HDL
(VHDL /
Verilog)
Synthesize
Netlist
Map
Place
Route
Bitstream
Formation VHDL
Introduction
Vahid MEGHDADI
26
Synthse HDL
HDL
process(clk, reset)
(VHDL /
Verilog)
begin
if reset = 1 then
output <= 0;
elsif rising_edge(clk) then
output <= a XOR b;
end if;
Synthesize
Netlist
end process;
Map
Place
Route
Register
a
b
D
clk
Bitstream
output
clear
reset
Formation VHDL
Introduction
Vahid MEGHDADI
27
Technology Mapping
Register
HDL
(VHDL /
Verilog)
a
b
D
clk
Synthesize
output
clear
reset
Netlist
Map
Place
Route
Bitstream
Formation VHDL
Introduction
Vahid MEGHDADI
28
HDL
(VHDL /
Verilog)
Synthesize
Netlist
Map
Place
Route
Bitstream
Formation VHDL
Introduction
Vahid MEGHDADI
29
MicroBlaze
Block RAM
Configuration
18 bit
Multipliers
Logic Block
(CLB)
Digital Clock
Manager
Formation VHDL
Programmable I/Os
Introduction
Vahid MEGHDADI
30
Ethernet
MAC
Audio
Codec
Power Supply
CLK
CLK
Interrupt
Controller
GP I/O
Address
Decode
Unit
CPU
UART
(uP / DSP)
CLK
SRAM
Memory
Controller
SRAM
SRAM
SDRAM
Timer
CoProc.
SDRAM
custom
IF-logic
L
C
Display
Controller
Images by H.Walder
Formation VHDL
Introduction
Vahid MEGHDADI
31
Ethernet
MAC
Audio
FPGA Codec
Power Supply
CLK
CLK
Interrupt
Controller
GP I/O
Address
Decode
Unit
CPU
UART
(uP / DSP)
CLK
SRAM
Memory
Controller
SRAM
SRAM
SDRAM
Timer
CoProc.
SDRAM
custom
IF-logic
L
C
Display
Controller
Images by H.Walder
Formation VHDL
Introduction
Vahid MEGHDADI
32
Audio
Codec
EPROM
Power Supply
L
C
SRAM
SRAM
SRAM
SDRAM
SDRAM
Images by H.Walder
Formation VHDL
Introduction
Vahid MEGHDADI
33
Avantages
Formation VHDL
Introduction
Vahid MEGHDADI
34
CPUs Embarqus
Formation VHDL
Introduction
Vahid MEGHDADI
35
Architecture de MicroBlaze
Formation VHDL
Introduction
Vahid MEGHDADI
36
Netlist
Synthesize
Generation
dans un netlist
Soit, il est map, plac et rout dans le
FPGA
Netlist
Netlist
VHDL
Map
Place
XST
(Map, Place & Route)
Route
Bitstream
Formation VHDL
Xilinx ISE
(VHDL Edit, Map,
Place & Route)
Introduction
Vahid MEGHDADI
37
Platform
Description
*.h
*.h
*.c
Compile &
Link
Netlist
Generation
Netlist
User sources
*.a
Library
Generation
Update
Bitstream
*.elf
XST or ISE
(Map, Place & Route)
Bitstream
Formation VHDL
Bitstream
with
executable
Code
Introduction
Program
Vahid MEGHDADI
38
Circuit de dveloppement
Formation VHDL
Introduction
Vahid MEGHDADI
39
Formation VHDL
Vahid MEGHDADI
40
Introduction au langage
VHDL
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
41
VHDL
V
H
D
L
Formation VHDL
VHSIC
(Very High Speed Integradted Circuit)
Hardware
Description
Language
Introduction A VHDL
Vahid MEGHDADI
42
Un peu dhistoire
Dbut des annes 80
la ncessit dun langage non ambigu des systmes
matriels pour intgration grande chelle
normalisation pour tre indpendant du fournisseur
Norme dfinitive adopte en 1987 : IEEE Std 1076
La norme a t revue en 93, 2000 et 2002
Les premiers outils de synthse en 1995
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
43
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
44
Introduction A VHDL
Vahid MEGHDADI
45
Dmarche de synthse
Spec matrielles
Spec logicielles
ASIC
CPLD
Cartes
Software
Discret
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
46
Niveau dabstraction
Synthse
comportemental
Synthse
logique
Placement
routage
Comportemental
RTL
VHDL
Logique
Layout
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
47
Formation VHDL
Introduction A VHDL
Vahid MEGHDADI
48
Vahid MEGHDADI
49
Structure du VHDL
Vahid MEGHDADI
50
Classes dobjets
Structure du VHDL
Vahid MEGHDADI
51
Types dobjets
Formation VHDL
Structure du VHDL
Vahid MEGHDADI
52
Les oprateurs
Par ordre de priorit croissante
Oprateur logique : and, or, nand, nor, xor, xnor,
sll, srl, sra, rol, ror
Oprateur de comparaison : =, /=, <, <=, >, >=
Oprateur daddition : +, -, &
Oprateur mathmatique : *, /, mod, rem
Oprateur de signe : Oprateur divers : **, abs, not
Formation VHDL
Structure du VHDL
Vahid MEGHDADI
53
Programmer en VHDL
Structure du VHDL
Vahid MEGHDADI
54
Formation VHDL
Structure du VHDL
Vahid MEGHDADI
55
Formation VHDL
Vahid MEGHDADI
56
Chapitre : Entit
L'entit dfinit les ports (vue externe) et leur mode (in, out,
inout, buffer)
Paramtrer le modle (paramtres gnriques)
Syntaxe:
entity nom_de_l_entite is
{generic(liste_des_parametres)}
{port(liste_des_port_avec_leutr_mode)}
end {nom_de_l_entite}
Formation VHDL
Entit
Vahid MEGHDADI
57
Entit
Entity name
Port names
Port type
ENTITY nand_gate IS
PORT(
a
: IN STD_LOGIC;
b
: IN STD_LOGIC;
z
: OUT STD_LOGIC
);
END nand_gate;
Reserved words
Semicolon
No Semicolon
after last port
Entit
Vahid MEGHDADI
58
Exemples dentit
entity NAND2 is
port(E1,E2: in std_logic;
S: out std_logic);
end NAND2;
entity COMPT is
generic(N : integer := 20);
port(E1: in std_logic;
S: out std_logic_vector(4 downto 0));
end COMPT;
Formation VHDL
Entit
E1
E2
S
/N
Vahid MEGHDADI
59
Exemple dentit
Bascule D
entity BASCULE_D is
port (D,EN
: in std_logic;
Q, Q_B : out std_logic);
End BASCULE_D
Formation VHDL
Entit
D
EN
Q
Q_B
Vahid MEGHDADI
60
Chapitre : Architecture
Architecture
Vahid MEGHDADI
61
A <= not B ;
B <= 1 ;
C <= A and B ;
Formation VHDL
Architecture
Vahid MEGHDADI
62
Structure de l'architecture
entity circuit is
port (CLK, RST: in std_logic;
B_DAT: inout std_logic_vector(7 downto 0);
);
end circuit;
architecture comport of circuit is
{partie dclarative de l'architecture}
begin
{zone des instructions concurrentes }
{comme des affectations, des process; }
end comport;
Formation VHDL
Architecture
Vahid MEGHDADI
63
Exemple darchitecture 1
SUM
Demiadditionneur
B
A
SUM
B
C
Formation VHDL
Architecture
C
A
SUM
Vahid MEGHDADI
64
entity DEMI_ADD is
port (A,B: in std_logic;
SUM,C: out std_logic);
end DEMI_ADD;
Formation VHDL
Architecture
Vahid MEGHDADI
65
QB
Formation VHDL
Architecture
Vahid MEGHDADI
66
Formation VHDL
Types en VHDL
Vahid MEGHDADI
67
Dclaration de type
Formation VHDL
Types en VHDL
Vahid MEGHDADI
68
Type scalaire
numr
type T_FEU is (ROUGE, ORANGE, VERT);
signal FEU : T_FEU;
entier
signal COMPT : integer range 0 to 15;
flottante
Formation VHDL
Types en VHDL
Vahid MEGHDADI
69
Type numr
Formation VHDL
Types en VHDL
Vahid MEGHDADI
70
Formation VHDL
Types en VHDL
Vahid MEGHDADI
71
Types en VHDL
Vahid MEGHDADI
72
Le type std_logic
Le type std_logic :
U
non initialis
X
non connu
0
logique 0
Strong drive
1
logique 1
Z
haute impdance
W
non connu
L
logique 0
weak drive
H
logique 1
-
dont care
Formation VHDL
VDD
Types en VHDL
Vahid MEGHDADI
73
Type composite
Formation VHDL
Types en VHDL
Vahid MEGHDADI
74
Dclaration:
A,B: std_logic_vector(15 downto 0);
Directement:
A(3) <= 1;
B(15) <= 0;
Par tranches
A(15 downto 12) <= "1011";
B(0 to 2) <= "111" ; -- erreur
A(10 downto 2) <= B(15 downto 7);
Formation VHDL
Types en VHDL
Vahid MEGHDADI
75
Par concatnation
signal A,B,C,D : std_logic;
signal BYTE : std_logic_vector(7 downto 0);
signal Z_BUS,A_BUS : std_logic_vector(3 downto 0);
Z_BUS <= A & C & D & B;
BYTE <= Z_BUS & A_BUS;
Formation VHDL
Types en VHDL
Vahid MEGHDADI
76
Exemples
SIGNAL a: STD_LOGIC;
SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL d: STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL e: STD_LOGIC_VECTOR(15 DOWNTO 0);
SIGNAL f: STD_LOGIC_VECTOR(8 DOWNTO 0);
.
a <= 1;
b <= 0000;
c <= B0000;
d <= 0110_0111;
e <= XAF67;
-- Base Hexadecimale
f <= O723;
-- Base Octale
Formation VHDL
Types en VHDL
Vahid MEGHDADI
77
Exemples
type MY_WORD is array (15 downto 0) of std_logic;
signal MEM_ADDR: MY_WORD;
MEM_ADDR(10 downto 5) <="101010";
type YOUR_WORD is array (0 to 15) of std_logic;
signal DATA_WORD: YOUR_WORD := 1101100101010110;
type VAR is array (0 to 7) of integer;
constant SETTING: VAR := (2,4,6,8,10,12,14,16);
type MY_MATRIX is array (0 to 3, 1 to 2) of natural;
variable DATA_ARR: MY_MATRIX :=((0,2), (1,3), (4,6), (5,7));
DATA_ARR(0,2) := 12;
type array_name is array (type range <>) of element_type;-- taille est
-- dfinie quand on dclare l'objet
type MATRIX is array (integer range <>) of integer;
variable MATRIX8: MATRIX (2 downto -8) := (3, 5, 1, 4, 7, 9, 12, 14, 20, 18);
Formation VHDL
Types en VHDL
Vahid MEGHDADI
78
Record
Ensemble d'lments de types diffrents
type NAME is
record
identifier : type_indication;
:
identifier : type_indication;
end record;
type PAQUET is
record
mot_unique : std_logic_vector (7 downto 0);
data : std_logic_vector (23 downto 0);
CRC : std_logic_vector( 5 downto 0);
num : integer range 0 to 1023;
end record;
signal paq_rec : PAQUET;
paq_rec.CRC <= "111000";
Formation VHDL
Types en VHDL
Vahid MEGHDADI
79
Formation VHDL
Vahid MEGHDADI
80
Formation VHDL
I <= A or B;
S <= I and C
S <= I and C
I <= A or B;
Zone concurrente
Vahid MEGHDADI
81
Instruction with
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
"0001",
"0010",
"0011",
"0100",
"0101",
"0110",
"0111",
"1000",
"1001",
"1010",
"1011",
"1100",
"1101",
"1110",
"1111",
others;
--1
--2
--3
--4
--5
--6
--7
--8
--9
--A
--b
--C
--d
--E
--F
--0
Zone concurrente
Circuit
combinatoire
4
Vahid MEGHDADI
82
Instruction when
LABEL1:
-- optional label
REG1
8
ENA2
REG2
Formation VHDL
Zone concurrente
Vahid MEGHDADI
83
Exemple
entity CIR is
port (A,B,C,D : in std_logic;
s : out std_logic);
end CIR;
Formation VHDL
Zone concurrente
Vahid MEGHDADI
84
Exemple ALU
entity ADDER
port (A,B
SEL
S :
end ADDER;
is
:in std_logic_vector(7 downto 0);
: in std_logic;
out std_logic_vector(7 downto 0));
Formation VHDL
Zone concurrente
Vahid MEGHDADI
85
Formation VHDL
Vahid MEGHDADI
86
Formation VHDL
Vahid MEGHDADI
87
Formation VHDL
Vahid MEGHDADI
88
Formation VHDL
Zone squentielle
Vahid MEGHDADI
89
Process
Process
Vahid MEGHDADI
90
Syntaxe de process
Syntaxe de process :
label : -- optionnel
process (liste de sensibilit)
{partie dclarative}
begin
suite dinstructions squentielles
end process;
Formation VHDL
Process
Vahid MEGHDADI
91
Instructions squentielles
Formation VHDL
Process
Vahid MEGHDADI
92
Instructions wait
Formation VHDL
Process
Vahid MEGHDADI
93
Instructions if
if condition then
sequential statements
[elsif condition then
sequential statements ]
[elsif condition then
sequential statements ]
[else
sequential statements ]
end if;
Formation VHDL
Process
Vahid MEGHDADI
94
Instruction case
Process
Vahid MEGHDADI
95
Instruction for
for I in 0 to 3 loop
Synthse
logique
-- logique
logique
end loop;
Formation VHDL
Logique
Process
logique
Vahid MEGHDADI
96
Exemple
Multiplexeur 4 voies
S1
S0
A
B
C
D
Formation VHDL
M
U
X
4
Process
Vahid MEGHDADI
97
entity MUX_4 is
port (S1, S0, A, B, C, D: in std_logic;
Z: out std_logic);
end MUX_4;
architecture behav_MUX_4 of MUX_4 is
begin
P1: process (S1, S0, A, B, C, D) - - la liste de sensibilit
begin
if (( not S1 and not S0 )=1) then
Z <= A;
elsif (( not S1 and S0) = 1) then
Z <=B;
elsif ((S1 and not S0) =1) then
Z <=C;
else
Z <=D;
end if;
end process P1;
end behav_MUX_4;
Formation VHDL
Process
Vahid MEGHDADI
98
entity MUX_4 is
port (
end MUX_4;
architecture behav_MUX_4 of MUX_4 is
begin
P1: process (S, A, B, C, D) - - la liste de sensibilit
begin
case S is
when "00" => Z <= A;
when "01" => Z <= B;
when "10" => Z <= C;
when "11" => Z <= D; -- ou when others => Z <= D;
end case;
end process P1;
end behav_MUX_4;
Formation VHDL
Process
Vahid MEGHDADI
99
entity MUX_4 is
port (S : in integer range 0 to 3;
A: in std_logic_vector(0 to 3); Z: out std_logic );
end MUX_4;
architecture behav_MUX_4 of MUX_4 is
begin
P1: process (S, A) - - la liste de sensibilit
begin
For I in 0 to 3 loop
if S = I then
Z <= A(I);
end if;
end loop;
end process P1;
end behav_MUX_4;
Formation VHDL
Process
Vahid MEGHDADI
100
Formation VHDL
Process
Vahid MEGHDADI
101
end CONCUR;
A
B
D
Formation VHDL
Process
Vahid MEGHDADI
102
begin
Z <= A and B;
Z <= C and D;
Process
Vahid MEGHDADI
103
Attention !
Le process ci-dessous ne
produira pas le signal cicontre
SIG
Process (x)
begin
SIG <= '0';
SIG <= '1';
SIG <= '0';
end process;
Formation VHDL
SIG
Process
Vahid MEGHDADI
104
A:0
B:0
M:0
Z :0
Formation VHDL
Process
A:0
B:1
M:0
Z :0
Y:0
M:1
Z :0
Vahid MEGHDADI
105
A:0
B:1
M:1
Z :0
Y:0
M:1
Z :1
Process
Vahid MEGHDADI
106
Les variables
Formation VHDL
Process
Vahid MEGHDADI
107
Formation VHDL
Vahid MEGHDADI
108
Chapitre : Hirarchisation
Formation VHDL
Hirarchisation
Vahid MEGHDADI
109
Dclaration du component
entity DEMI_ADD is
port (A,B: in std_logic;
SUM,C: out std_logic);
end DEMI_ADD;
component DEMI_ADD
port(A,B : in std_logic;
SUM,C: out std_logic);
end component;
Formation VHDL
Hirarchisation
Vahid MEGHDADI
110
Instantiation du component
Deux
faons
de faire
Formation VHDL
Prfrable
Hirarchisation
Vahid MEGHDADI
111
Exemple addition
A
B
SUM
Demiadditionneur C
SUM
B
C
Formation VHDL
Hirarchisation
SUM
Vahid MEGHDADI
112
entity DEMI_ADD is
port (A,B: in std_logic;
SUM,C: out std_logic);
end DEMI_ADD;
architecture COMPORT of DEMI_ADD is
begin
SUM <= A xor B; --instruction concurrente
C <= A and B; --instruction concurrente
end COMPORT;
Formation VHDL
Hirarchisation
Vahid MEGHDADI
113
Exemple darchitecture 2
A
B
N1
DEMI_ADD N2
SUM
SUM
SUM
DEMI_ADD
N3
Cout
CIN
entity ADD_COMPLET is
port (A,B,CIN : in std_logic;
SUM,COUT : out std_logic);
end ADD_COMPLET;
Formation VHDL
Hirarchisation
Vahid MEGHDADI
114
Instantiation
Dclaration de
component
Instantiation
Hirarchisation
Vahid MEGHDADI
115
process
process
Signal x,y
process
Formation VHDL
Signal t,u
Vahid MEGHDADI
116
Droulement de simulation
Vahid MEGHDADI
117
Vahid MEGHDADI
118
Dsigner les
signaux changs
File
signal
Formation VHDL
Dsigner les
process rveiller
File
process
Vahid MEGHDADI
119
File
signal
File
process
File
signal
File
process
temps
En simulation, les vnements sont galement sur une liste.
Wait for 5 ns, ou A <= Z after 7 ns crent des vnements
dans l'ordre sur cette liste.
Formation VHDL
Vahid MEGHDADI
120
Formation VHDL
Vahid MEGHDADI
121
Formation VHDL
Vahid MEGHDADI
122
Formation VHDL
Vahid MEGHDADI
123
Circuits combinatoires
Vahid MEGHDADI
124
Formation VHDL
Circuits combinatoires
Vahid MEGHDADI
125
Exemple
Formation VHDL
A(1)
0
0
1
1
0
0
1
1
A(0)
0
1
0
1
0
1
0
1
S(2)
0
0
0
0
1
1
1
1
S(1)
0
0
1
1
1
1
0
0
Circuits combinatoires
S(0)
0
1
1
0
0
1
1
0
Vahid MEGHDADI
126
Affectation avec if
Circuits combinatoires
Vahid MEGHDADI
127
end case
end process;
end AVEC_CASE;
Formation VHDL
Circuits combinatoires
Vahid MEGHDADI
128
Affectation slective
Dans une zone concurrente (architecture)
Architecture AVEC_WITH of CIRCUIT
signal A,S : std_logic_vector (2 downto 0);
begin
with A select
S <= "000" when "000" ,
"001" when "001" ,
"011" when "010" ,
"110" when "100" ,
Formation VHDL
Circuits combinatoires
Vahid MEGHDADI
129
Formation VHDL
Circuits combinatoires
Vahid MEGHDADI
130
Circuits combinatoires
Vahid MEGHDADI
131
Exemple : ALU
entity ALU is
port(A : in std_logic_vector(7 downto 0);
B : in std_logic_vector(7 downto 0);
Sel: in std_logic_vector(1 downto 0);
Res: out std_logic_vector(7 downto 0));
end ALU;
-- Sel="00" => Addition
-- Sel="01" => Soustraction
-- Sel="00" => et logique bit bit
-- Sel="00" => ou logique bit bit
architecture behv of ALU is
begin
process(A,B,Sel)
.
end process;
end behv;
Formation VHDL
Vahid MEGHDADI
132
Formation VHDL
Vahid MEGHDADI
133
Exemple : Multiplieur
Le but est de raliser un multiplieur 4 bits fois 4 bits
A
1001
B
*1101
--------0000 1001
+0000 0000
+0010 0100
+0100 1000
---------0111 0101
0
0
B(0)
4
4
B(1)
0
4
B(2)
0
4
res(0)
(4 downto 1)
res(1)
B(3)
5
(4 downto 1)
res(2)
5
(4 downto 1)
res(7 downto 3)
Formation VHDL
Vahid MEGHDADI
134
entity main is
Port ( A : in std_logic_vector(3 downto 0);
B : in std_logic_vector(3 downto 0);
RES : out std_logic_vector(7 downto 0));
end main;
architecture Behavioral of main is
begin
process (A,B)
variable result : std_logic_vector(7 downto 0);
begin
result := (others => '0');
for I in 0 to 3 loop
if B(I)='1' then
result(I+4 downto I) := result(I+4 downto I) + ('0' & A);
end if;
end loop;
RES <= result;
end process;
end Behavioral;
Formation VHDL
Vahid MEGHDADI
135
Formation VHDL
Vahid MEGHDADI
136
Formation VHDL
Vahid MEGHDADI
137
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
138
Latch
Bascule verrouillage
entity L is
port (D,G : in std_logic;
Q : out std_logic);
end L;
architecture A of L is
begin
process
begin
wait on D,G;
if G='1' then Q <= D;
end if;
end process;
end A;
Formation VHDL
architecture A of L is
begin
process (D,G)
begin
if G='1' then Q <= D;
end if;
end process;
end A;
Circuits squentiels
Vahid MEGHDADI
139
process
begin
wait until CLK'event and CLK='1';
Q <= D;
end process;
process (CLK)
begin
if CLK'event and CLK='1' then
Q <= D;
end if
end process;
Circuits squentiels
Vahid MEGHDADI
140
architecture A of R is
begin -- set synchrone
process (CLK)
begin
if CLK'event and CLK='1' then
if SET = '1' then Q <= '1';
else Q <= D;
end if;
end if;
end process;
end A;
Circuits squentiels
Vahid MEGHDADI
141
Exemple 1
E2
E1
D
E0
D
CLK QB
CLK QB
CLK QB
H
RAZ
S2
Formation VHDL
S1
Circuits squentiels
S0
Vahid MEGHDADI
142
Exemple 1 (suite)
entity REG is
port (E : in std_logic_vector(2 downto 0);
H,RAZ : in std_logic;
S: out std_logic_vector(2 downto 0));
end REG;
architecture A of REG is
begin
TAMPON : process (H,RAZ)
begin
if RAZ = 0 then
S <= "000";
elsif Hevent and H = 1 then
S <= E;
end if;
end process;
end A;
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
143
Entree
E2
CLK QB
S2
E1
CLK QB
S1
E0
S0
Sortie
CLK QB
H
RAZ
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
144
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
145
Entree
CLK QB
REG2
CLK QB
REG1
REG0
Sortie
CLK QB
H
RAZ
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
146
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
147
E2
Entree
E1
D
E0
REG2
CLK QB
CLK QB
D
REG1
Sortie
REG0
CLK QB
H
RAZ
LOAD
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
148
Formation VHDL
Circuits squentiels
Vahid MEGHDADI
149
Attention !
Formation VHDL
Circuits
Attention
squentiels
!
+1
Vahid MEGHDADI
150
Correction
On utilise un process
synchronis sur un front
process (CLK)
begin
if rising_edge(CLK) then
A <= not A;
-- CMPT <= CMPT + 1;
-- etc;
end if;
end process;
Formation VHDL
CLK
+1
CLK
Circuits
Attention
squentiels
!
Vahid MEGHDADI
151
process (CLK)
begin
if CLK'event and CLK='1' then
Q <= D;
end if
if TOTO=1 then TRUC;
end if
end process;
Formation VHDL
process (CLK)
begin
if CLK'event and CLK='1' then
Q <= D;
end if
end process;
process (TOTO)
begin
if TOTO=1 then TRUC;
end if
End process
Circuits squentiels
Vahid MEGHDADI
152
E1E2= "11"
les sorties
s0
E1E2= "10"
E1E2= "0x"
s1
s2
E1E2= "1x"
Formation VHDL
Vahid MEGHDADI
153
Vahid MEGHDADI
154
CLK
Vahid MEGHDADI
155
E1
Fonction
combinatoire
E2
S1
S2
Fonction
combinatoire
ETAT_FUTUR
ETAT_COUR
Registre
d'tats
H
RAZ
Formation VHDL
Vahid MEGHDADI
156
Vahid MEGHDADI
157
Vahid MEGHDADI
158
Vahid MEGHDADI
159
Rappels (1)
Vahid MEGHDADI
160
Rappels (2)
Formation VHDL
Vahid MEGHDADI
161
Vahid MEGHDADI
162
Formation VHDL
Vahid MEGHDADI
163
Formation VHDL
Vahid MEGHDADI
164
Chapitre : Exemples
Exemple 1
CLK
Down counter
Vcc
D
IRQ*
Q*
D_FF
CLK
RSET*
Formation VHDL
Exemples
Vahid MEGHDADI
165
Exemple 1 : Bascule D
entity D_FF is
Port ( CLK : in std_logic;
RESET : in std_logic;
D : in std_logic;
Q_BAR : out std_logic);
end D_FF;
architecture FPGA of D_FF is
begin
process (CLK, RESET)
begin
if RESET = '0' then --asynchronous RESET active High
Q_BAR <= '0';
elsif (CLK'event and CLK='1') then --CLK rising edge
Q_BAR <= not D;
end if;
end process;
end FPGA;
Formation VHDL
Exemples
Vahid MEGHDADI
166
entity DOWN_COUNTER is
Port ( CLK,RESET : in std_logic;
COUNT : buffer std_logic_vector(3 downto 0));
end DOWN_COUNTER;
architecture FPGA of DOWN_COUNTER is
begin
process (CLK, RESET)
begin
if RESET='1' then
COUNT <= "0000";
elsif CLK='1' and CLK'event then
COUNT <= COUNT - 1;
end if;
end process;
end FPGA;
Formation VHDL
Exemples
Vahid MEGHDADI
167
Dclaration
des components
Formation VHDL
Exemples
Vahid MEGHDADI
168
Instantiation
des components
begin
FLIP_FLOP: D_FF port map (
CLK => OR_OUT,
RESET => ACK,
D => '1',
Q_BAR => IRQ
);
DOWN : DOWN_COUNTER port map(
CLK => CLK_IN,
RESET => RESET,
COUNT => COUNT
);
OR_OUT <= COUNT(0) or COUNT(1) or COUNT(2) or COUNT(3);
end Behavioral;
Formation VHDL
Exemples
Vahid MEGHDADI
169
Exemple 2
-------------
Formation VHDL
HEX-to-seven-segment decoder
HEX:
in
STD_LOGIC_VECTOR (3 downto 0);
LED:
out
STD_LOGIC_VECTOR (6 downto 0);
segment encoding
0
--5 |
| 1
--<- 6
4 |
| 2
--3
Exemples
Vahid MEGHDADI
170
Programmation concurrente
Exemples
--1
--2
--3
--4
--5
--6
--7
--8
--9
--A
--b
--C
--d
--E
--F
--0
Vahid MEGHDADI
171
Utilisation de fonction
Exemples
Vahid MEGHDADI
172
Exemple 3
Formation VHDL
Exemples
Vahid MEGHDADI
173
Entit
entity FEU3COL is
Port ( CLK : in std_logic;
RAZ : in std_logic;
R : out std_logic;
V : out std_logic;
O : out std_logic);
end FEU3COL;
Formation VHDL
Exemples
Vahid MEGHDADI
174
Architecture (1)
architecture COMPORT of FEU3COL is
type T_ETAT is (ROUGE, ORANGE, VERT);
signal ETAT : T_ETAT;
begin
process (CLK, RAZ)
variable CMPT : integer range 0 to 31;
begin
if RAZ='1' then CMPT := 0;
ETAT <= ROUGE;
elsif CLK'event and CLK='1' then
CMPT := CMPT+1;
case ETAT is
when ROUGE =>
if CMPT = 30 then
CMPT := 0;
ETAT <= VERT;
else ETAT <= ROUGE;
end if;
Formation VHDL
Exemples
Vahid MEGHDADI
175
Architecture (2)
when VERT =>
if CMPT = 26 then
CMPT := 0;
ETAT <= ORANGE;
else ETAT <= VERT;
end if;
when ORANGE =>
if CMPT = 5 then
CMPT := 0;
ETAT <= ROUGE;
else ETAT <= ORANGE;
end if;
when others =>
ETAT <= ROUGE;
end case;
end if;
end process;
R <= '1' when ETAT=ROUGE else '0';
O <= '1' when ETAT=ORANGE else '0';
V <= '1' when ETAT=VERT else '0';
end COMPORT;
Formation VHDL
Exemples
Vahid MEGHDADI
176
Rapport de mapping
Formation VHDL
of
of
of
of
of
Slices:
Slice Flip Flops:
4 input LUTs:
bonded IOBs:
GCLKs:
Exemples
11
8
18
4
1
out
out
out
out
out
of
of
of
of
of
2352
4704
4704
146
4
0%
0%
0%
2%
25%
Vahid MEGHDADI
177
Exemple 4
Gestion dun clavier
Clavier
FPGA
LIN
CODE
COL
Formation VHDL
Exemples
Vahid MEGHDADI
178
Entit
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity main is
Port ( RESET, CLK : in std_logic;
COL : in std_logic_vector(2 downto 0);
LIN : buffer std_logic_vector(3 downto 0);
CODE : out std_logic_vector(6 downto 0));
end main;
architecture Behavioral of main is
type T_ETAT is (LIN1, LIN2, LIN3, LIN4);
signal ETAT, NEXT_ETAT : T_ETAT;
signal COMB : std_logic_vector(6 downto 0);
Formation VHDL
Exemples
Vahid MEGHDADI
179
Partie combinatoire
begin
process (ETAT)
begin
case ETAT is
when LIN1 => NEXT_ETAT <= LIN2;
LIN <= "0111";
when LIN2 => NEXT_ETAT <= LIN3;
LIN <= "1011";
when LIN3 => NEXT_ETAT <= LIN4;
LIN <= "1101";
when LIN4 => NEXT_ETAT <= LIN1;
LIN <= "1110";
end case;
end process;
COMB <= LIN & COL;
Formation VHDL
Exemples
Vahid MEGHDADI
180
Formation VHDL
Exemples
Vahid MEGHDADI
181
Partie dcodage
DECODE: process (COMB)
begin
case COMB is
when "0111011" => CODE <= "0000110";
when "0111101" => CODE <= "1011011";
when "0111110" => CODE <= "1001111";--3
when "1011011" => CODE <= "1100110";
when "1011101" => CODE <= "1101101";
when "1011110" => CODE <= "1111101";--6
when "1101011" => CODE <= "0000111";
when "1101101" => CODE <= "1111111"; --8
when "1101110" => CODE <= "1101111";--9
when "1110011" => CODE <= "1110110";
when "1110101" => CODE <= "0111111";--0
when "1110110" => CODE <= "1110110";
when others => CODE <= "0000000";
end case;
end process;
Formation VHDL
Exemples
--1
--2
--4
--5
--7
--#
--*
Vahid MEGHDADI
182
Exemple 5
Exemple dun additionneur 8 bits utilisant des
additionneurs complets
00111100
10011010
+ 10110110
01010000
Optimisation vitesse
y
y0
y1
x0
x
0
x1
a1
b1
Cin
Cout
s
z
Formation VHDL
y7
x7
a1
b1
Cin
Cout
s
z0
a1
b1
Cin
Cout
z1
Exemples
z7
Vahid MEGHDADI
183
En VHDL
component FULL_ADD
port(A,B,CIN : in std_logic;
S,COUT : out std_logic);
end component;
BIT0 : FULL_ADD port map (X(0) , Y(0) , 0 , Z(0) , C(0));
BIT1 : FULL_ADD port map (X(1) , Y(1) , C(0) , Z(1) , C(1));
.
BIT7 : FULL_ADD port map (X(7) , Y(7) , C(6) , Z(7) , C(7));
Exemples
Vahid MEGHDADI
184
LOAD
Reg dcal
Reg dcal
a1
b1
Cin
s
Cout
CLK
Reg dcal
z
CLK
Formation VHDL
Exemples
Vahid MEGHDADI
185
Solution
entity test is
Port ( X,Y : in STD_LOGIC_VECTOR (7 downto 0);
Z : out STD_LOGIC_VECTOR (7 downto 0);
CLK, LOAD : in STD_LOGIC);
end test;
architecture Behavioral of test is
component full_add
port(A,B,CIN : in std_logic;
S,COUT : out std_logic);
end component;
signal reg_x, reg_y, reg_z : std_logic_vector(7 downto 0):=(others => '0');
signal reg_z_in : std_logic:='0';
signal d:std_logic:='0';
signal q:std_logic:='0';
begin
FULL_ADDER: full_add port map(
reg_x(0), reg_y(0), q, reg_z_in, d);
Formation VHDL
Vahid MEGHDADI
186
Solution (suite)
process(CLK, LOAD)
begin
if CLK'event and CLK='1' then
if LOAD = '1' then
reg_x <= X; reg_y <= y;
else reg_x <= '0' & reg_x(7 downto 1);
reg_y <= '0' & reg_y(7 downto 1);
end if;
end if;
end process;
process (CLK)
begin
if CLK'event and CLK='1' then q <= d;
end if;
end process;
process(CLK)
begin
if CLK'event and CLK='1' then
reg_z <= reg_z_in & reg_z(7 downto 1);
end if;
end process;
Z <= reg_z;
end Behavioral;
Formation VHDL
Vahid MEGHDADI
187
Chronogramme
Vahid MEGHDADI
188
Vahid MEGHDADI
189
Le systme fonctionnel
8
IRQ*
EN
EN
Registre
ACK*
CLK
CLK_50M
8
SO
/n
1 1 P
Registre dc.
FCLK=50 MHz
Formation VHDL
Vahid MEGHDADI
190
D_BUS
EN
reg
CLK_50M
Clk_19200
busy
charg
/n
CLK_50M
reg_a_dec
reg_a_dec
1
charg
FF
IRQ*
busy
charg
Compte_bit
ACK*
Formation VHDL
SO
Clk_19600
Vahid MEGHDADI
191
Programmation Diviseur
DIV_CLK:process(CLK_50M)
begin
if CLK_50M'event and CLK_50M='1' then
compt <= compt + 1;
if compt = 1301 then -- = (50 000 000 /19200 *2 )-1=1301
clk_19200 <= not clk_19200;
compt <= 0;
end if;
CLK_50M
Clk_19200
/n
end if;
end process;
Formation VHDL
Vahid MEGHDADI
192
Programmation chargement
REGISTRE:process(CLK_50M)
begin
if CLK_50M'event and CLK_50M='1' then
if EN = '1' then
D_BUS
EN
reg
else
if busy='0' and reg_plein='1' then
busy
charg
CLK_50M
reg_a_dec
reg_a_dec
end if;
end if;
end process;
Formation VHDL
Vahid MEGHDADI
193
Programmation dcalage
DECALAGE_CIRCUIT:process(CLK_19200)
begin
if CLK_19200'event and CLK_19200='1' then
case etat_decal is
when repos =>
SO <= '1';
busy <= '0';
if charge='1' then
charg
etat_decal <= decalage;
busy <= '1';
compt_bit <= 0;
Clk_19200
end if;
when decalage =>
SO <= reg_a_dec(compt_bit);
compt_bit <= compt_bit + 1;
if compt_bit = 11 then
etat_decal <= repos;
busy <= '0';
end if;
end case;
end if;
end process;
Formation VHDL
busy
Compte_bit
SO
Vahid MEGHDADI
194
Programmation interruption
INTERRUPT:process(charge, ACK)
begin
charg
FF
IRQ*
ACK*
end if;
end process;
Formation VHDL
Vahid MEGHDADI
195
Entity
entity uart is
Port ( CLK_50M : in STD_LOGIC;
ACK : in STD_LOGIC;
IRQ : out STD_LOGIC;
SO : out STD_LOGIC;
D_BUS : in STD_LOGIC_VECTOR (7 downto 0);
EN : in STD_LOGIC);
end uart;
Formation VHDL
Vahid MEGHDADI
196
Vahid MEGHDADI
197
Formation VHDL
Vahid MEGHDADI
198
Formation VHDL
Vahid MEGHDADI
199
Formation VHDL
Vahid MEGHDADI
200
Notions
avancs
Formation VHDL
Vahid MEGHDADI
201
Gnricit
Formation VHDL
Gnricit
Vahid MEGHDADI
202
Exemple
Porte ET N entres :
entity PORTE_ET is
generic(N : integer := 2);
port(ENTREE : in std_logic_vector(1 to N);
SORTIE : out std_logic);
end entity;
process (ENTREE)
variable V : std_logic;
begin
V := '1';
for I in 1 to N loop
V := V and ENTREE(I);
end loop;
SORTIE <= V;
end process;
Formation VHDL
Gnricit
Vahid MEGHDADI
203
component PORTE_ET
generic(N :integer := 2);
port(ENTREES : in std_logic_vector(1 to N);
SORTIE : out std_logic);
end component;
architecture A of B is
begin
INST : PORTE_ET generic map(N => 5)
port map(ENTREES => A,
SORTIE => Z);
end A;
Formation VHDL
Gnricit
Vahid MEGHDADI
204
Paquetage
Formation VHDL
Paquetage
Vahid MEGHDADI
205
Syntaxe de Paquetage
Package <nom_de_paquetage> is
suite de dclarations>
end {<nom_de_paquetage>};
package pak_test is
Exemple:
Formation VHDL
Paquetage
Vahid MEGHDADI
206
Paquetage de composants
Paquetage
Vahid MEGHDADI
207
Corps de Paquetage
Formation VHDL
Paquetage
Vahid MEGHDADI
208
Paquetage
Vahid MEGHDADI
209
Utilisation de paquetage
Paquetage
Vahid MEGHDADI
210
Configuration
Une entit peut avoir plusieurs architectures
Un rle de configuration : choisir l'architecture
correspondante
Exemple : Pour l'entit additionneur on peut
envisager 3 architectures diffrentes : A, B et C
ADDITIONNEUR(A)
ADDITIONNEUR(B)
ADDITIONNEUR(C)
A chaque instanciation de l'entit, un seul couple
entit/architecture peut tre compil.
Formation VHDL
Configuration
Vahid MEGHDADI
211
Choix de l'architecture
Formation VHDL
Configuration
Vahid MEGHDADI
212
Exemple de Configuration
Entity ADD is
port (A,B : in integer;
S : out integer);
end ADD;
architecture FONCTION of ADD is
begin
S <= A+B;
end FONCTION;
Formation VHDL
Vahid MEGHDADI
213
Entity ADD is
port (A,B : in integer;
S : out integer);
end ADD;
architecture FONCTION of ADD is
begin
S <= A+B;
end FONCTION;
Formation VHDL
Vahid MEGHDADI
214
Formation VHDL
Vahid MEGHDADI
215
Formation VHDL
Vahid MEGHDADI
216
Les sous-programmes
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
217
Procdure
Mot cl procedure
L'appel d'une procdure est une instruction (concurrente
ou squentielle)
Peut retourner plusieurs valeurs
Peut agir sur les signaux globaux
Peut se synchroniser (avec wait dedans)
Corps d'une procdure est une zone squentielle
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
218
Fonction
Mot cl function
L'appel est droite d'une affectation
L'appel peut se faire dans la zone concurrente ou
squentielle
Retourne une seule valeur
Rend immdiatement sa valeur
Corps d'une fonction est une zone squentielle
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
219
Syntaxe de la dclaration
procedure <nom> (liste des paramtre);
function <nom> (liste des paramtre) return type_du_rsultat;
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
220
Liste_des_paramtre :
{classe_d'objet} PARAM1 :{mode} type{:=valeur_par_dfaut}
class_d'objet : signal, variable, constant
mode : in, out, inout
Restriction
pas de paramtres out ou inout dans la dclaration d'une
fonction
pas de variable transmise une fonction
classe d'objet par dfaut est "constant" pour les "in" et
"variable" pour les "out" et "inout"
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
221
Corps de sous-programme
Entte is -- function ou procedure
{zone de dclarations}
begin
{partie instruction squentielle}
end {nom_de_sous-programme}
Exemple
function MIN (signal A,B : integer) return integer is
begin
if A < B then return A
else return B
end if;
end MIN;
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
222
Appel de sous-programme
Formation VHDL
Les sous-programmes
Vahid MEGHDADI
223
Les Attributs
Formation VHDL
Les Attributs
Vahid MEGHDADI
224
Alias
Intrt
Donne un nom diffrent un objet
l'ancien nom reste utilisable
Syntaxe
alias nouveau_nom : type_ou_sous_type is ancien_nom
Exemple
variable V32 : std_logic_vector (0 to 31);
alias P_8 : std_logic_vector (0 to 7) is V23(0 to 7);
alias D_8 : std_logic_vector (0 to 7) is V32(24 to 31);
alias SIGNE : std_logic is V32(0);
...
SIGNE := '1'; -- identique que V32(0) <= 1;
Formation VHDL
Alias
Vahid MEGHDADI
225
Formation VHDL
Vahid MEGHDADI
226
Codage one-hot
Formation VHDL
Vahid MEGHDADI
227
If Generate
If-generate permet de
synthtiser un circuit
suivant une condition
Exemple :
entity generate_test is
generic ( CLK_DIV : boolean :=TRUE);
Port ( CLK : in std_logic;
sortie : out std_logic);
end generate_test;
architecture A of generate_test is
signal clk_r : std_logic:= '1';
begin
U1: if CLK_DIV generate
process(CLK)
begin
if CLK'event and CLK='1' then
clk_r <= not clk_r;
end if;
end process;
end generate;
U2: if not CLK_DIV generate clk_r <= clk;
end generate;
sortie <= clk_r;
end A;
Formation VHDL
If generate
Vahid MEGHDADI
228
for Generate
for-generate permet de rpter un circuit plusieurs fois.
Exemple :
BIT0 : FULL_ADD port map (X(0) , Y(0) , 0 , Z(0) , C(0));
BIT1 : FULL_ADD port map (X(1) , Y(1) , C(0) , Z(1) , C(1));
.
BIT7 : FULL_ADD port map (X(7) , Y(7) , C(6) , Z(7) , C(7));
For generate
Vahid MEGHDADI
229
Formation VHDL
Vahid MEGHDADI
230
Formation VHDL
Vahid MEGHDADI
231
Formation VHDL
Vahid MEGHDADI
232
Conseils de synthse
Conseils de synthse
Vahid MEGHDADI
233
Conseils (2)
Ne jamais utiliser des signaux ou des variables pour des
constantes. (cela gaspille les ressources normment)
Conseils de synthse
Vahid MEGHDADI
234
Conseils (3)
Privilgier l'utilisation des signaux par rapport aux
variables
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
235
ADD
A1
A2
A3
ADD
A4
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
236
entity if_ex is
port (SEL: in std_logic_vector(1 downto 0);
A,B,C,D: in std_logic;
MUX_OUT: out std_logic);
end if_ex;
Formation VHDL
architecture A of if_ex is
begin
IF_PRO: process (SEL,A,B,C,D)
begin
if (SEL=00) then MUX_OUT <= A;
elsif (SEL=01) then MUX_OUT <= B;
elsif (SEL=10) then MUX_OUT <= C;
elsif (SEL=11) then MUX_OUT <= D;
else MUX_OUT <= '0';
end if;
end process; --END IF_PRO
end BEHAV;
Conseils de synthse
Vahid MEGHDADI
237
Circuit rsultant
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
238
Utilisant "case"
entity case_ex is
port (SEL: in std_logic_vector
(1 downto 0);
A,B,C,D: in std_logic;
MUX_OUT: out std_logic);
end case_ex;
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
239
Circuit rsultant
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
240
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
241
COND
B
A
C
COND
B
C
A
Conseils de synthse
Vahid MEGHDADI
242
Validation d'horloge
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
243
Formation VHDL
Conseils de synthse
Vahid MEGHDADI
244
CLB
Chane de
retenue
Spartan-II, Virtex
I3
I2
I1
I0
Spartan-III, Virtex-II
SET
CE
D
Q
RST
LUT
I3
I2
I1
I0
Formation VHDL
SET
CE
D
Q
RST
Vahid MEGHDADI
245
Registre dcalage
Utilisation des bascules
4
Z-1
Z-1
Z-1
Z-1
Z-1
Z-1
Formation VHDL
Vahid MEGHDADI
246
A
B
SEL1
SEL2
A
B
I3
I2
I1
I0
SEL1 SEL2
Vahid MEGHDADI
247
Additionneur complet
A
B
Cin
Cout
I3
I2
I1
I0
sum
Sum=f(A,B,Cin)
Cout=g(A,B,Cin)
Cin
I3
I2
I1
I0
Cout
Sum
Un slice.
Formation VHDL
Vahid MEGHDADI
248
LUT
A
Cout
Sum
Cin
Vahid MEGHDADI
249
La chane de retenu
Connexion rapide
I3
I2
I1
I0
SET
CE
D
Q
RST
LUT
I3
I2
I1
I0
Formation VHDL
SET
CE
D
Q
RST
Vahid MEGHDADI
250
Addition 8 bits
S8
B7
A7
B6
A6
B5
A5
B4
A4
B3
A3
B2
A2
B1
A1
B0
A0
Formation VHDL
S7
S6
S5
S4
S3
S2
S1
S0
Vahid MEGHDADI
251
Exercice
Bit de start
RX
CLK=16*bit rate
Formation VHDL
8 bits de data
Interface
UART
Bit de stop
Data suivant
DOUT
STRB
Vahid MEGHDADI
252