• Aucun résultat trouvé

Aide VHDL

N/A
N/A
Protected

Academic year: 2022

Partager "Aide VHDL"

Copied!
4
0
0

Texte intégral

(1)

Aide VHDL

Dept GEII Année universitaire 2013-2014

SIN1 J. VILLEMEJANE - [email protected]

1. Structure d’un module VHDL

1.1. Ressources externes

l i b r a r y IEEE ;

u s e IEEE . STD_LOGIC_1164 .ALL;

u s e IEEE . STD_LOGIC_ARITH .ALL; u s e IEEE . STD_LOGIC_UNSIGNED .ALL;

1.2. Entité

e n t i t y n o m _ e n t i t e i s

p o r t( c l k : i n STD_LOGIC ; −− e n t r e e oe : i n STD_LOGIC ;

r a z : i n STD_LOGIC ;

s q : o u t STD_LOGIC ; −− s o r t i e

d a t a : o u t STD_LOGIC_VECTOR ( 3 DOWNTO 0 ) −− s o r t i e s ( b u s ) s d : o u t STD_LOGIC ;

) ;

end n o m _ e n t i t e ;

1.3. Architecture

a r c h i t e c t u r e B e h a v i o r a l o f n o m _ e n t i t e i s

s i g n a l conv , t o t a l : STD_LOGIC_VECTOR ( 3 DOWNTO 0 ) ; b e g i n

−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

−− p r o c e s s u s

c p t : p r o c e s s( c l k ) b e g i n

i f r a z = ’ 1 ’ t h e n t o t a l <= " 0000 " ; −− d e s c r i p t i o n a s y n c h r o n e e l s i f c l k ’ e v e n t and c l k=’1 ’ t h e n −− d e s c r i p t i o n s y n c h r o n e

s d <= n o t oe ; t o t a l <= t o t a l+1 ;

−− e t c end i f ; end p r o c e s s;

−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

s q <= t o t a l ( 3 ) ; −− h o r s p r o c e s s u s end B e h a v i o r a l ;

(2)

IUT Créteil - GEII - SIN1 Aide VHDL

2. Objets et types en VHDL

2.1. Objets

– signalobjet physique, associé à des évènements – variableintermédiaire de calcul, non physique – constant

2.2. Types

Types de base :bit,bit_vector,integer,boolean

Types IEEE :std_logic,std_logic_vector,signed,unsigned Types définis par l’utilisateur :

- type énuméré, exemple :type jour is (lu, ma, me, je, ve, sa, di);(souvent utilisé dans les ma- chines à état)

- sous-type :subtype octet is bit_vector(0 to 7);

2.3. Notations

bit :’0’ou’1’; bit_vector :"0100"; ASCII :"Texte"; Décimal :423; Hexadécimal :x"1A"

3. Opérateurs en VHDL

LOGIQUES:and,nand,or,nor,xor,xnor,not DÉCALAGE:sll,slr,sla,sra,rol,ror RELATIONNELS:=,/=,<,>,<=,>=

ARITHMÉTIQUES:+,-,*,/,MOD CONCATENATION:&

AFFECTATION:<=

4. Instructions en VHDL

4.1. Hors processus

Ces instructions décrivent le plus souvent des éléments combinatoires (concurrentes).

4.1.1 Affectation conditionnelle

s <= a when c o n d 1 e l s e b when c o n d 2 e l s e

. . .

z ;

4.1.2 Affectation sélective

w i t h e x p r s e l e c t s <= a when v a l 1 ,

b when v a l 2 , . . .

z when o t h e r s;

– 2 –

(3)

IUT Créteil - GEII - SIN1 Aide VHDL

4.2. Dans un processus

L’exécution des instructions s’effectue dans un ordre séquentiel (ordre d’écriture). Le processus est activé lorsqu’un des éléments de la liste de sensibilité est modifié.

La mise à jour des objets s’effectue simultanément à la fin du processus.

4.2.1 Syntaxe

l a b e l : p r o c e s s( l i s t e d e s s i g n a u x de s e n s i b i l i t e ) . . o b j e t s /s i g n a u x i n t e r n e s

b e g i n

. . d e s c r i p t i o n s e q u e n t i e l l e end p r o c e s s;

4.2.2 Test : SI

i f x=" 00 " t h e n y <= ’ 0 ’ ; e l s i f x=" 01 " t h e n

y <= ’ 1 ’ ; end i f;

4.2.3 Test : CAS

c a s e x i s

when " 00 " => y <= " 00 " ; when " 01 " => y <= " 10 " ; when o t h e r s => y <= " 11 " ; end c a s e;

4.3. Autres codes

4.3.1 Blocs répétitifs/Boucle spatiale

f o r i i n 0 t o 5 l o o p i n s t r u c t i o n s ; end l o o p;

w h i l e i < 5 l o o p i n s t r u c t i o n s ; end l o o p;

4.3.2 Temporisation

w a i t u n t i l CLK’ e v e n t and CLK=’ 1 ’ ; i n s t r u c t i o n s ;

– 3 –

(4)

IUT Créteil - GEII - SIN1 Aide VHDL

5. Tournures fréquentes en VHDL

5.1. Détection d’un front

i f c l k ’ e v e n t and c l k=’1 ’ t h e n . . . ; −− f r o n t m o n t a n t i f c l k ’ e v e n t and c l k=’0 ’ t h e n . . . ; −− f r o n t d e s c e n d a n t

5.2. Remplissage d’un vecteur (bit_vector)

x <= (o t h e r s => ’ 0 ’ ) ; −− t o u s l e s b i t s a 0 x <= (o t h e r s => ’ 1 ’ ) ; −− t o u s l e s b i t s a 1

6. Brochage de la carte d’étude

K=interrupteur LED=diode électroluminescente CLK=horloge an=commande des afficheurs 7 segments a..g=segments des afficheurs

élément broche type

K(0) p24 entrée

K(1) p25 entrée

K(2) p26 entrée

K(3) p27 entrée

K(4) p28 entrée

K(5) p29 entrée

K(6) p33 entrée

K(7) p34 entrée

élément broche type LED(0) p22 sortie LED(1) p20 sortie LED(2) p19 sortie LED(3) p18 sortie LED(4) p14 sortie LED(5) p13 sortie LED(6) p12 sortie LED(7) p11 sortie

élément broche type g, seg(0) p9 sortie f, seg(1) p35 sortie e, seg(2) p36 sortie d, seg(3) p37 sortie c, seg(4) p38 sortie b, seg(5) p43 sortie a, seg(6) p44 sortie dp, seg(7) p8 sortie

élément broche type

an(0) p4 commande anode gauche

an(1) p3 commande anode

an(2) p1 commande anode

an(3) p2 commande anode droite

élément broche fonction principale caractéristique CLK_1M p5 horloge fréquence 1MHz CLK_256 p6 horloge fréquence 256Hz CLK_SLOW p7 horloge pas à pas ou 2Hz

RESET p39 remise à zéro impulsion

– 4 –

Références

Documents relatifs

(UR = unité de représentation = digit = puissance de 10 du dernier chiffre lu). bilan des sources d’erreurs pour chaque mesurande ; 2. choix de la densité de probabilité associée

LIGUE Grade SHIAI 1 Junior à Vétéran masculin ceinture marro LIGUE Grade SHIAI 1 masculin ceinture noire (annulé) NORD Stage CFEB 3.. NORD Stage

De même, la cohorte des utilisateurs d’un DPP-4 a été formée en identifiant tous les utilisateurs de la population source ayant reçu une première ordonnance pour un DPP-4 entre

In short, MLGX marries type inference for Hindley and Milner’s type system with typechecking for generalized algebraic data types.. how about some local

« Borne inf » et « borne sup » (tq borne inf &lt;borne sup) appartenant à un type scalaire discret ordonnée (entier, caractère et scalaire énuméré). Activité: Définir le

Il y a pourtant des héros qui sont sympathiques et c’est plus agréable à lire quand on peut voir les personnages et ce qu’ils font sans être obligé de les imaginer… De

U ne femme, âgée de 46 ans, sans antécédent notable , consulte pour une baisse d’acuité visuelle bilatérale, des myodésopsies, une photophobie et une sensation de

The impact of sample variances on the degrees of freedom, the resultant critical value and the test statistic is considered, and hence gives an insight into why Welch’s test is Type