Beruflich Dokumente
Kultur Dokumente
1/47
Denis Giacona
ENSISA
cole Nationale Suprieure d'Ingnieur Sud Alsace
12, rue des frres Lumire
68 093 MULHOUSE CEDEX
FRANCE
Tl.
33 (0)3 89 33 69 00
D.Giacona
2/47
D.Giacona
3/47
D.Giacona
4/47
D.Giacona
5/47
D.Giacona
6/47
Les instructions ressemblent celles dun langage impratif, mais, alors que
pour certaines, lordre dcriture est dterminant, pour dautres, lordre na pas
dimportance.
D.Giacona
7/47
D.Giacona
8/47
D.Giacona
9/47
: clk
: rst
: sr
: ar
: sp
: ap
: nsr
: nrw
: dec1of8
: mux2to1
: reg4
: shreg4
: count8, cnt8
: up_count8, up_cnt8
: co_count8, co_cnt8
: bcdcount, bcdcnt
: count_int, count_i
: count_proc
D.Giacona
10/47
tempo1ms
Signal externe
control
rst
cnt10
ar
ar
up_cnt10
sr_cnt10
clk
en
cnt(9:0)
sr
clk
clk
compare
cnt10(9:0)
max_cnt10
(d = max)
d(9:0)
Signal interne
D.Giacona
11/47
D.Giacona
12/47
D.Giacona
13/47
D.Giacona
14/47
integer
natural
positive
: entier positif
bit
bit_vector
boolean
real
D.Giacona
1.9.2.
15/47
: non initialis**
: niveau inconnu, forage fort**
: niveau 0, forage fort
: niveau 1, forage fort
: haute impdance *
: niveau inconnu, forage faible**
: niveau 0, forage faible
: niveau 1, forage faible
: quelconque (dont care) *
std_logic_vector
: vecteur de std_logic
Pour utiliser ces types il faut inclure les directives suivantes dans le code source.
library ieee;
use ieee.std_logic_1164.all;
D.Giacona
16/47
D.Giacona
1.9.3.
17/47
D.Giacona
1.9.4.
18/47
Conversions de type
1.9.5.
19/47
D.Giacona
20/47
0, 1
0, 1 ,U, X, H, L, W, Z, -
-- type bit
-- type std_logic
Les bits
-- reprsentation binaire
-- reprsentation octale
-- reprsentation hexadcimale
Les caractres
a
21/47
Les oprateurs arithmtiques sont dfinis pour les types entiers et rels
+
*
/
**
mod
rem
abs
rol
D.Giacona
22/47
nom_variable := expression ;
Association de signaux
nom_signal_formel => nom_signal_effectif ;
o connecteur de signaux dans une instanciation de composant
D.Giacona
23/47
droite
LSB ( droite)
a(0)
a(1)
a(2)
a(3)
a(4)
a(5)
a(6)
a(7)
LSB ( droite)
b(7)
b(6)
b(5)
b(4)
b(3)
b(2)
b(1)
b(0)
D.Giacona
24/47
Oprateur + prdfini
pour les entiers
Oprateur + dfini
par le concepteur
D.Giacona
25/47
D.Giacona
26/47
D.Giacona
27/47
library ieee;
use ieee.std_logic_1164.all;
entity attributs is port(
vector_dwn
: in std_logic_vector(15 downto 0);
vector_up : in std_logic_vector(0 to 7);
x
: out std_logic_vector(7 downto 0);
y
: out std_logic_vector(0 to 11);
z
: out std_logic_vector(7 downto 0));
end attributs;
architecture arch_attributs of attributs is
begin
x(0) <= vector_dwn(vector_dwn'left);
x(1) <= vector_dwn(vector_dwn'right);
x(2) <= vector_up(vector_up'left);
x(3) <= vector_up(vector_up'right);
x(4) <= vector_dwn(vector_dwn'high);
x(5) <= vector_dwn(vector_dwn'low);
x(6) <= vector_up(vector_up'high);
x(7) <= vector_up(vector_up'low);
y(vector_up'range)
<= "00001111";
z(vector_up'reverse_range)
<= "00110011";
x(0)
x(1)
x(2)
x(3)
x(4)
x(5)
x(6)
x(7)
=
=
=
=
=
=
=
=
vector_dwn(15)
vector_dwn(0)
vector_up(0)
vector_up(7)
vector_dwn(15)
vector_dwn(0)
vector_up(7)
vector_up(0)
y(0)
y(1)
y(2)
y(3)
y(4)
y(5)
y(6)
y(7)
=
=
=
=
=
=
=
=
GND
GND
GND
GND
VCC
VCC
VCC
VCC
z(0)
z(1)
z(2)
z(3)
z(4)
z(5)
z(6)
z(7)
=
=
=
=
=
=
=
=
VCC
VCC
GND
GND
VCC
VCC
GND
GND
end arch_attributs;
D.Giacona
28/47
2. La dclaration d'entit
La dclaration dentit dcrit une interface externe, unique, la manire des entressorties dune bote noire
La dclaration comprend :
o ventuellement, une liste de paramtres gnriques
o la dfinition des ports, c.--d. une liste de signaux dentre et de signaux de
sortie ; chaque signal possde un nom, un mode et un type
D.Giacona
29/47
tempo1ms
Signal externe
control
rst
cnt10
ar
ar
up_cnt10
sr_cnt10
clk
en
cnt(9:0)
sr
clk
clk
compare
cnt10(9:0)
max_cnt10
(d = max)
d(9:0)
Signal interne
D.Giacona
Mode du signal
Nom de lentit
entity tempo1ms is
Nom du signal
30/47
port (
a
rst, clk
t
: in
: in
: out
Type de signal
std_logic;
std_logic;
std_logic);
end tempo1ms;
D.Giacona
31/47
D.Giacona
32/47
opposite_3
inverse
b
a(0)
HA
s
co
y(0)
c(0)
x(0)
b
a(1)
HA
s
co
y(1)
c(1)
x(1)
b
a(2)
HA
s
co
y(2)
c(2)
x(2)
D.Giacona
33/47
Paramtre gnrique
entity opposite_n is
Valeur par dfaut
D.Giacona
34/47
out
buffer
inout
D.Giacona
35/47
In
Out
Buffer
In
Inout
In
Out
D.Giacona
36/47
3. Le corps d'architecture
Le corps darchitecture dcrit le fonctionnement interne du bloc logique
3.1. Syntaxe
architecture nom_architecture of nom_entit is
{ dclaration_de_composant
| dclaration_de_constante
| dclaration_de_signal_interne
| dclaration_de_type
| dclaration_d'alias}
begin
{ instruction_concurrente_d'assignation_de_signal
| instruction_concurrente_d'instanciation_de_composant
| instruction_concurrente_de_processus
| instruction_de_gnration}
end [architecture] [nom_architecture];
D.Giacona
37/47
opposite_3
inverse
b
a(0)
HA
s
co
lsb
y(0)
c(0)
x(0)
b
a(1)
HA
s
co
y(1)
c(1)
x(1)
b
a(2)
HA
s
co
msb
y(2)
c(2)
x(2)
D.Giacona
38/47
begin
...
end behavioral ;
D.Giacona
39/47
Proprits
D.Giacona
3.3.2.
40/47
D.Giacona
41/47
D.Giacona
42/47
3.3.3.
43/47
D.Giacona
44/47
end process;
-- B3 (Description structurelle)
B3 : composant_B3 port map (x, y,...);
end arch_systeme;
D.Giacona
3.3.4.
45/47
mux4_1 is
"00") else
"01") else
"10") else
and
and
and
and
a)
b)
c)
d);
D.Giacona
46/47
Rsultat de compilation
Dans cet exemple, quel que soit le style de description employ, les quations gnres par le
compilateur sont les mmes.
x
d * s(0) * s(1)
+ c * /s(0) * s(1)
+ b * s(0) * /s(1)
+ a * /s(0) * /s(1)
D.Giacona
3.3.5.
47/47
b
a(0)
HA
s
co
y(0)
c(0)
x(0)
b
a(1)
HA
s
co
y(1)
c(1)
x(1)
b
a(2)
HA
s
co
y(2)
c(2)
x(2)
begin
a(0) <= x(0) xor inverse;
ha0 : ha port map (a(0),inverse,c(0),y(0));
haloop : for i in 1 to n-1 generate
a(i) <= x(i) xor inverse;
han : ha port map (a(i),c(i-1),c(i),y(i));
end generate;
end Behavioral;
D.Giacona