10/08/2000yannick herve - ensps1 2 - introduction à vhdl-ams (1 à 23 = 1h45) structure générale...

72
10/08/2000 Yannick HERVE - ENSPS 1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs, Objets et typage. Opérateurs Instructions séquentielles, concurrentes, simultanées Notion d ’attributs et Synchronisation des noyaux

Upload: gorlois-josse

Post on 04-Apr-2015

107 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 1

2 - Introduction à VHDL-AMS(1 à 23 = 1h45)

Structure générale d'un modèle

Structuration en bibliothèques

Indentificateurs, Objets et typage. Opérateurs

Instructions séquentielles, concurrentes, simultanées

Notion d ’attributs et Synchronisation des noyaux

Critère de solvabilité et Exemples

Page 2: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 2

Structure générale d ’un modèle

Entity Déf. connexions

Architecture Déclaration Body Inst.concurrentes Inst.simultanées Instanciations

Vue interne du modèle

discret-eventcontinuous timestructurel/hiérarchie

Entity

Architecture

Interfaçage/netlist (port)signal : numériqueterminal : analogique, kirchoffquantity : analogique, signal flow

Page 3: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 3

Structure générale d ’un modèle : Exemple

ENTITY exemple IS port (signal sig_ext:in real; terminal vp,vm : electrical);

END exemple;

LIBRARY ressource_lib; USE ressources_lib.ressources_package.ALL;ARCHITECTURE archi1 OF exemple IS

TYPE list_ex IS (el1,el2,el2);CONSTANT cst1 : list_ex, k:REAL; SIGNAL sig1 : BIT, sig2 :INTEGER, sig3 : REAL; QUANTITY vbias ACROSS ibias THROUGH vp TO vm; QUANTITY free_quant : REAL;

BEGIN u1:ENTITY model_externe(archi_du_modele) GENERIC MAP(100.0e3,5.0) PORT MAP(vp,vm,sig1);

free_quant == 3.0*sinus( k * now ); ibias == free_quant’dot;

p1:PROCESSvariable x : real := 5.5;BEGIN wait on sig3 until sig2 > 3 for 25 ms; x := 2*x ; sig_ext <= sig3 after 1 ms;END PROCESS;

END archi1;

Exe

mpl

e il

lust

rati

f no

n co

mpi

labl

e

Page 4: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 4

Structure générale d ’un modèle :

Prise en charge par le simulateurEntity

Architecture

E+A E+A

E+A E+A

CS1CS2CS3...

CS1CS2

SS1SS2SS3...

SS1SS2SS3...

CS1CS2

SS1

Sim anal. Sim num.

{}Equa.DiffNL (SS)

{}Equa.Log (CS)

Tsim

Produit des ASP{valeurs i(t),v(t)}

Produit des événements

CS : concurrent statementSS : simultaneous statementE+A : Entity + Architecture

Page 5: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 5

Structuration en bibliothèques Pas de longue description Unités petites et hiérarchisées Partie compilable = Unité de conception Système complexe = équipe

Besoin de méthodologie rigoureuse

Une compilation qui aboutitMise à jour d ’une bibliothèque de travail (WORK)

Bibliothèque de ressources (de projet, d ’un fournisseur, de test, …)

LIBRARY ressource_lib;USE ressource_lib.pack_lib.ALL;

Page 6: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 6

Structuration en bibliothèque :

Les unités de conception Modèle : ENTITY (UC) + ARCHITECTURE (UC)

plusieurs ARCHITECTURE possibles par ENTITY Code souvent utilisé et partagé : paquetage

PACKAGE (UC) + PACKAGE BODY (UC)vue ext. : exportation vue interne : privé

Association effective d ’une instance et un modèle compilé : CONFIGURATION (UC)

Les bibliothèques contiennent des UC Méthode : Un fichier = Une Unité de Conception

Page 7: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 7

Identificateurs Noms des objets : identificateurs Suite de lettres et de chiffres Commence par une lettre, no case sensitive Possible de poser des traits bas : Rdf_232

Traits bas doubles, au début, à la fin : interdit

Commentaire : -- (jusqu’à la fin de la ligne)

Page 8: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 8

Littéraux (1) (Valeurs « dures » du langage)

Caractères : 95 des 128 ASCII (imprimables)‘ a ’, ‘ b ’, ’Q ’, …

Chaînes de caractères «C ’est »& --(«  » = guillemets)

«possible sur deux lignes»

Notations décimales1345, 1_345, 1e6, 1E61345.3, 1_345.1, 1.0e2 (attention x.0)

Page 9: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 9

Littéraux (2) Notations basées (entiers et réels exprimables)

2#01101# est un entier qui vaut 137#03630#, 16#FF3A#2#01101.0# est un réel qui vaut 13.016#FF.4A#e12

Notation par chaînes

B«000110» = (‘0’, ‘0’, ‘0’, ‘1’, ‘1’, ‘0’)0«06» = (‘0’, ‘0’, ‘0’, ‘1’, ‘1’, ‘0’)X«255» = (‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’)

Page 10: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 10

Typage Tous les objets sont typés (strong typing) Permet l’initialisation fiable et augmente le pouvoir de

vérification du compilateur Familles (définit les valeurs et opérations possibles):

– scalaires (un seul élément porté à la fois, ordonnés)

• integer, real, physical• énumérés

– composites (plusieurs éléments portés à la fois)• array, record

– access – fichiers

Types et sous-types utilisateurs possibles

Page 11: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 11

Typage :

Déclaration scalairestype_declaration ::= TYPE type_name IS type_definition;

Enuméré : TYPE enum_type IS (bleu, blanc, rouge) ; -- relation d ’ordre

Entiers : TYPE index IS RANGE -3 TO 27 ; TYPE rev_index IS RANGE 27 DOWNTO -3 ;

Flottants : TYPE ex_real IS RANGE -3.0 TO 27.0 ;

Physique : TYPE distance IS RANGE 0 TO 1e16 UNITS A ;

nm = 10 A ; -- espace obligatoiremil = 254_000 A ;inch = 1_000 mil ;ft = 12 inch ;yd = 3 ft ,cm = 10e7 nm ;

END UNITS ; -- facteurs conversion = integer !!!35 yd + 547 cm + 17 inch calculée en Angströms(35 yd + 547 cm)/mil sera calculé en mils.(103 nm) / nm est un entierA * nm transforme un entier en nm

Page 12: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 12

Typage :

Déclaration compositesVecteur : rassembler plusieurs valeurs de même type

index entier ou énuméré, ne peut contenir des fichiers

TYPE int_vec IS ARRAY(3 to 45) of integer ; Tableau d’entier contraintTYPE real_vec IS ARRAY(natural range <>) of real ; Tableau non contraint

TYPE enum_vec IS ARRAY(enum_type) of integer ; si A est de type enum_vec on a A(bleu),A(blanc) et A(rouge)

Record : rassembler plusieurs valeurs de types différents (champs) accès par notation pointée, ne peut contenir des fichiers

TYPE record_ex IS RECORD -- Record d’array ou de record possible champ_1 : bit ; champ_2 : real ;autre_champ : enum_type ;

END RECORD;Si A est de type record_ex : A.champ_1,A.champ_2 et A.autre_champ existent

Page 13: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 13

Typage :

Déclaration fichiers et pointeurs (notes)

Fichiers : TYPE file_type IS file OF string ;

Voir fonctions associées dans le paquetage STANDARDread / write /file_open / endfile / file_close

Pointeurs : TYPE index IS natural RANGE 0 TO 15 ;TYPE index_ptr IS ACCESS index ;

NEW index_ptr ; -- nouveau pointeurSi IPtr est de type index_ptr

IPtr.all à la valeur de l’objet pointé

Réservé aux variables

Page 14: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 14

Typage :

Types prédéfinis (notes)

Types prédéfinis– integer TYPE integer IS RANGE integer’low to integer’high;

– real TYPE real IS RANGE real’low to real’high ;

– bit TYPE bit IS (‘0’, ’1’) ;

– std_logic TYPE std_logic IS (‘U’,’0 ’,’1’,’Z’,’X’,’H’,’L’,’W’,’-’) ; (IEEE 1164)

– bit_vector TYPE bit_vector IS ARRAY (natural RANGE<>) of bit ;

– boolean TYPE boolean IS (false, true)

– severity_level TYPE severity_level IS (NOTE,WARNING,ERROR,FAILURE) ;

– character TYPE character IS (NUL, SOH,…, ’a’, ’b’, …, ‘~’,DEL) ;

– string TYPE string IS ARRAY (positive range <>) of character ;

– time TYPE time IS RANGE integer’low TO integer’high UNITS fs; ps = 1000 fs ; ns = 1000 ps ; us = 1000 ns ;ms = 1000 us ; sec = 1000 ms ; mn = 60 sec ; hr = 60

mn;END UNITS ;

Page 15: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 15

Typage :

Sous-typessubtype_declaration ::=

SUBTYPE subtype_name IS type_names [constraints];

Sous-types prédéfinis– natural SUBTYPE natural IS integer RANGE 0 to integer’high;

– positive SUBTYPE positive IS integer RANGE 1 to integer’high;

Dynamique SUBTYPE mot IS bit_vector (1 to max) ;(MAX variable)

Permet de définir des sous ensembles de valeurs en gardant la compatibilité avec le type de base

SUBTYPE signal_value IS real RANGE -15.0 to 15.0 ;

Permet de définir des fonctions de résolution(voir cours suivant)

SUBTYPE resolved_bit IS resolution_function bit ;

Page 16: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 16

Typage :

Initialisation des objets En VHDL-AMS tous les objets sont initialisés

implicitement ou explicitement

Un objet prend la valeur la plus à gauche de son typesignal A : bit ; -- A vaut ‘0’signal A : bit := ‘1’; -- A vaut ‘1’variable B : boolean ; -- B vaut falsequantity Q : real ; -- Q vaut 0.0

Un type peut être incomplètement définiTYPE cell ; -- type incomplètement définiTYPE link IS ACCESS cell ;TYPE cell is record -- définitions récursive de type

value : index ;succ : link ;

END RECORD ;

Page 17: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 17

Les 6 classes d’objets Les classes d ’objets (transport de l ’information)

CONSTANT (valeur fixe connue à l ’élaboration)

VARIABLE (séquentiel / dynamique)

modifiée par affectation ( := )SIGNAL (concurrent / statique)

modifié par affectation ( <= )TERMINAL

permet les connexions analogiquesbranch/free QUANTITY

participe aux simult.stat. ( == )est toujours d ’un type issu des real

FILE

Page 18: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 18

Classes d ’objets :

Constantes Permet de stocker des valeurs constantes

CONSTANT pi : real := 3.141592 ;CONSTANT clock_period : time := 20 ns ;

CONSTANT BV0 : bit_vector(15 DOWNTO 0) := (‘1’, ’0 ’,others=> ’0 ’) ; CONSTANT tt : truth_table := (other => (others => ‘ 0 ’)) ;CONSTANT mem_bus : memory_bus := (adrr =>X «00AA»,data=>X«FF»,

read => ‘0’, write => ’1 ’, enable => ’1 ’ ) ;

Peut être initialisée au moment de l ’utilisationCONSTANT cst_val : integer := 40 * N ; N ne peut être connu qu ’à l ’élaboration (paramètre générique)Si la déclaration de constante est dans une fonction N peut être un paramètre de celle-ci

Constante à valeur différéeCONSTANT cst_val : integer ; est valide (on ne connaît pas la valeur)déclaration dans la spécification paquetageaffectation dans le corps de paquetage (masquage d ’information)

Page 19: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 19

Classes d ’objets :

Variables Stockage et manipulation de valeurs

VARIABLE phase : real := 124.0 ;VARIABLE clock_period : time := 20 ns ;VARIABLE var1: integer := function_d_init(…) ;

Affectation et modification : A := B *C + 3.0;

N ’est utilisable que dans un contexte séquentielPROCESS uniquement

Il existe des variables partagées (shared)!!! Programmes non déterministes !!!

A manipuler avec circonspection

Page 20: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 20

Classes d ’objets :

Signal

Transporte les valeurs du simulateur event-drivenS <= 3 after 15 ns;

Modélise les fils entre les portes (symbolique)Inport <= Outport ;

Nom de fonction dans la déclaration: signal résolu plusieurs sources possible / résolution du conflit (voir cours suivant)

REGISTER ou BUS : signal gardé (guarded)ne pourra être affecté que si le signal GUARD est TRUE (vu plus loin)

Possède un passé, une valeur, un futur proposéle driver du signal

signal_declaration ::= SIGNAL signal_name : [fonc_resolution] type [contraintes][REGISTER|BUS] [:= init_value];

Page 21: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 21

Classes d ’objets :

Terminal

Permet de nommer des nœuds (ne porte pas de valeur !!!) Une nature est définie par deux types réels

NATURE name IS acr ACROSS thr THROUGH ref REFERENCE ;Across = effort / through = fluxv-i, °C-W, m-N, rad.s-1-N.m, n.A-Wb, Pa-l/s, ...

SUBTYPE v IS real ; SUBTYPE i IS real ;NATURE electrical IS v ACROSS i THROUGH gnd REFERENCE ;TERMINAL vp,vm : electrical ;

Vecteur de nature NATURE elec_vec IS ARRAY(natural RANGE <>) of electrical ;

Record de nature

terminal_declaration ::= terminal identifier_list : subnature_indication ;

Page 22: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 22

Classes d ’objets :

Quantity « Signaux continus » du simulateur analogique Free Quantity (n ’est pas attachée à un TERMINAL)

QUANTITY Q : real := expression;Valeur initiale implicite 0.0 (dépend de l’outil)

Branch QuantityQUANTITY [across_aspect] [through_aspect] terminal_aspect ;QUANTITY V12 across I1 through t1 to t2 ;QUANTITY V1,V2 across t1; -- aliasQUANTITY I1,I2 through t1; -- branches parallèles

Implicit QuantityQUANTITY Q : real := expression;Q’dot, Q’integ existent toujours et sont créées si besoinQUANTITY QV : real_vector (3  downto 0) ;QV’dot, QV’integ sont valides

Page 23: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 23

Classes d ’objets :

Terminal/Quantity : exemples terminal t1,t2 : electrical ;

terminal t3, t4 : electrical_vector (1 to 5);

quantity v12 across i1, i2 through t1 to t2 ;définit une tension et deux courants

quantity v31 across i3 through t3 to t2 ;

quantity v24 across i4 through t2 to t4 ;

quantity v34 across i5 through t3 to t4 ;

Définir un système étoile,un système triangle(terminaux scalaires)

Définir un système N-phases étoile, N-triangle(N inconnu)

Page 24: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 24

Sémantique de connexion Spécification d ’entité :

PORTS : classe, type et mode des connexions (et valeurs par défaut) GENERIC : constantes passées à l ’élaboration

ENTITY exemple IS generic (par1,par2,par3:real;par4:time:= 3 ns) port (signal sig :{in|out|inout|linkage|buffer} real;

quantity q: {in|out} real ; terminal vp,vm : electrical);

BEGIN {instructions passives = pas d’affectations de signal}END exemple;

Les comportements possibles (par port)event driven : port de classe signalsignal flow : port quantity ou terminal à une seule quantitéconservatif : port terminal et deux quantités définies

Page 25: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 25

Sémantique de connexion :

Event driven ENTITY exemple IS

port (signal sig :{in|out|inout|linkage|buffer} real);END exemple;

Un port de classe signal ne peut être branché que sur un signal ou sur un port de même type, les modes doivent être compatibles

Un port de mode OUT n ’est pas lisible dans l ’architecture LINKAGE, BUFFER : modes inutilisés en pratique Un port de mode INOUT est forcément résolu Le mot clef OPEN permet de laisser ouvert

Page 26: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 26

Sémantique de connexion :

Event driven : formal/actual portAvec :ENTITY source IS PORT (SIGNAL a : in real; b : out real);END; -- a et b sont les ports formels

On a:ENTITY testdetector IS PORT (SIGNAL extin : IN real; extout : OUT real);END;

LIBRARY disciplines; USE disciplines.Electromagnetic_system.ALL;ARCHITECTURE test OF testdetector IS SIGNAL pin,pout:real;BEGIN u1:ENTITY source(pulse_proba) PORT MAP (extin,extout); u2:ENTITY source(pulse_proba) PORT MAP (pin,pout);END; -- extin,extout,pin,pout sont des ports réels (actual)

Page 27: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 27

Sémantique de connexion :

Signal Flow ENTITY exemple IS

port (QUANTITY Q1 : in real, Q2 : out real); END exemple;

Support de l ’interconnexion à temps continu Permet de modéliser sous forme de schéma-blocs

Une entrée n ’influence pas une sortie(impédance d ’entrée infinie, impédance de sortie nulle)

Les quantité connectées doivent être de même type Les ports de classe Quantity connectés doivent être

compatibles Pas encore supporté par les outils

Page 28: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 28

Sémantique de connexion :

Signal Flow : exempleAvec :ENTITY block1 IS PORT (QUANTITY a : in real; b : out real);END;

On a:ENTITY black_boxes IS PORT (QUANTITY extin : IN real;QUANTITY extout : OUT real);END;

LIBRARY disciplines; USE disciplines.Electromagnetic_system.ALL;ARCHITECTURE test OF black_boxes IS QUANTITY ploc:real; -- Free QuantityBEGIN u1:ENTITY block1(beh) PORT MAP (extin,ploc); u2:ENTITY block1(beh) PORT MAP (ploc,extout);END;

Page 29: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 29

Sémantique de connexion :

Conservatif : Kirchoff généralisé ENTITY exemple IS

port (TERMINAL T1,T2 : electrical); --PAS DE MODE/VALEUREND exemple;

Interconnexions à temps continu conservatif Permet de tenir compte influences Entrées/Sorties TERMINAL connectés doivent être de même nature

KIRCHOFF LAW : Si T1 est branché sur T2 et si les aspects ACROSS et THROUGH sont définis alors

ACROSS( T1 ) = ACROSS( T2 )et THROUGH( T1 ) + THROUGH( T2 ) = 0

Quelle que soit la nature : multidiscipline

Page 30: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 30

Sémantique de connexion :

Conservatif : Netlist analogique ENTITY R IS

port (TERMINAL T1,T2 : electrical); END R;ENTITY C ISport (TERMINAL T1,T2 : electrical); END C;

ENTITY RC IS port (TERMINAL T1,T2 : electrical); END RC;ARCHITECTURE ONE OF RC IS

TERMINAL LocalT:electricalBEGIN

R:ENTITY R(beh) PORT MAP (T1 => T1,T2 => LocalT);C:ENTITY C(beh) PORT MAP (T1 => LocalT,T2 => T2);

END ; Association par nommage : Formal => Actual

Page 31: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 31

Opérateurs 6 classes d ’opérateurs et niveaux de priorité

(l ’évaluation d ’une expression commence par la priorité la plus haute)

– logic : and, or, nand, nor, xor, xnor, sll, sla, sra, srl, rol, ror (s ’appliquent à boolean et bit, surcharge sur IEEE_1164-MVL9)

– relationnels : =, /=, <, <=, >, >= (s ’appliquent à tout sauf fichiers, résultat de type BOOLEAN)

– addition : +, -, & (& : concaténation sur type STRING)

– signe : +, -– multiplication : *, /, mod, rem– divers : **, abs, not

Opérateurs surchargeables, pas de changement de priorités

Pri

orit

y

Page 32: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 32

Instructions du langage (les plus importantes)

Une architecture contientsimultaneous statements (doivent être évalués à chaque ASP)

f == g / procedural / if use / case use / null

concurrent statements (évalués si besoin à chaque LSP)process / affectation de signalinstanciationbreak, assertion

Un process contient séquential statements (évalués en séquence dans le process)

affectation signal, affectation variablewaitif, case, loop ...

Disponibles aussi en Procedural (sauf => et wait)

Page 33: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 33

Instructions séquentielles, concurrentes, simultanées :

Instructions séquentielles Permet de fabriquer des PROCESS (instruction concurrente utilisateur)

Flow control : test et boucles Gestion du temps : Wait Affectation variables Affectation signal et mécanismes temporels associés Auto test : Assert / report

Page 34: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 34

Affectation variables V := f (V|S|Q) (la valeur de l ’objet) tab1 := tab2; tableaux tab(3 to 5) := (1,2,4);

Affectation signal : proposition de transaction

[label :] target <= [transport | [reject time ] inertial] waveform ; avec target ::= name | aggregateet waveform ::= wf_element {,wf_element} | unaffected

lab1: S <= ’0’; -- affectation à délai deltaS <= ’0’ after 3 ns; -- transport par défaut

lab:(S1,S2)<= (’0’,’1’) after 3 ns, (’1’, ’0’) after 10 ns;

S1 <= inertial s2 after 4 ns; -- anti-physiqueS1 <= reject 10 ns inertial S2 after 4 ns; -- mieux

Instructions séquentielles, concurrentes, simultanées : Inst. Séqu. : affectations (1)

Page 35: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 35

Instructions séquentielles, concurrentes, simultanées : Inst. Séqu. : affectations (2)

Notion de forme d ’onde (waveform)s <= a after ta, b after tb, …, x after tx ;la liste (ta, tb, tc, …, tx) doit être ordonnée

Mécanisme temporel : transport, inertiel, réjection Sources possibles : constantes, variables, signaux, quantités

S <= objet

Notion de transaction et d’événementsi S vaut x et y /= x : S <= y after 3 ns; événement

S <= x after 3 ns; transaction sans event Notion de pilote (driver)

S <= x after 5 ns; ne modifie pas la valeur de SS sera éventuellement modifiée quand l ’horloge avancera à to+ 5 ns

Notion de source uniqueUn signal ne peut être affecté que par une seule source (sauf résolution : voir cours suivant)

Page 36: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 36

Instructions séquentielles, concurrentes, simultanées : Instructions séquentielles : WAIT

Instruction la plus importante de la partie numérique

wait [on signal_list] [until bool_cond] [for time] ;

Pour au plus timesi un événement survient sur un signal de la liste signal_list la condition booléenne bool_cond est évaluée :

si elle est fausse on se remet en attentesi elle est vraie on passe à la ligne suivante.

Tous les PROCESS sont sur un WAIT : blocageOn recherche le prochain event dans la liste

d ’événementOn avance l ’horloge de simulation, nouveau LSP

Formes simplifiées : wait; wait on a; wait on a,b;wait for 10 ns; -- time outwait until a=‘1’; -- front;

Page 37: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 37

Instructions séquentielles, concurrentes, simultanées : Inst. Séqu. : flow control - test / sélection

Test

[label:]if cond_bool then {séquence instructions séquentielles}

elsif cond2 then {séquence instructions séquentielles}

else {séquence instructions séquentielles}

end if ;

Sélection

[label:]case expression is when value_1 => {séq. Inst. Séqu. 1}

when value_2 => {séq. Inst. Séqu. 2}when others => {séq. Inst. Séqu.}

end case ;

Page 38: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 38

Instructions séquentielles, concurrentes, simultanées : Inst. Séqu. : flow control - boucles

[label:][schéma d ’itération] loop {séquence instructions séquentielles}

end loop [label] ;

Infinie : loopN :=N+1;

end loop;

Conditionnelle : Itérative :

while conditions loop for i in 1 to 100 loop {séqu. Instr. Séqu.} {séqu. Instr. Séqu.} [exit;] [exit;][next[label]]end loop ; end loop ;

Boucle : i déclaré de facto / «i in A’range» possible

next [label] when cond_bool / exit [label] when cond_bool

Page 39: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 39

Instructions séquentielles, concurrentes, simultanées : Instructions séquentielles : auto-test

Envoi d ’un message à la console

[lab:]report expr [severity note|warning|error|failure] ;

Surveillance d ’une condition

[lab:] assert cond_bool [report expression] [severity note|warning|error|failure] ;

Si cond_bool est fausse alors expression est envoyée à la console associé à un niveau d ’erreur.

assert teff<tsetup report «Set up violé» severity error ;

Page 40: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 40

Instructions séquentielles, concurrentes, simultanées :

Instructions concurrentes Support de la modélisation/simulation à temps discret

Ces instructions sont évaluées, si besoin, à chaque LSP

Process Affectation concurrente de signal Instanciation de composant Assertion concurrente Break (voir synchronisation des noyaux)

Prochain cours– Block– Concurrent procedure– Generate

Page 41: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 41

Instructions séquentielles, concurrentes, simultanées : Instructions concurrentes : Process

Instruction concurrente « Utilisateur »[label :][postponed]process -- postponed: vu plus tard

{zone de déclaration / pas de signaux} begin

{sequ. Instr. Sequ.} end[postponed]process [label] ;

Un PROCESS vit toujours (il est global)éventuellement suspendu sur un wait

Un PROCESS est itératif (boucle sans arrêt)sauf si wait

Variante : ancienne méthode (issue de VHDL 7.2) [label :] Process(signal_liste) -- liste de sensisbilité

{zone de déclaration} begin

{sequ. Instr. Sequ. sans wait} end process [label] ;

Page 42: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 42

Instructions séquentielles, concurrentes, simultanées : Instructions concurrentes : Process (exemple)process variable sp_res : integer_vector(0 to c_nb-1) := (others=>0); variable index_tab : integer;begin wait on vtest'dot'above(0.0),watchdog; if watchdog'event then for i in sp_res’range loop spectre <= real(sp_res(i)); wait for 1 us; end loop; spectre <= 0.0; end if;end process;

processbegin wait for analysis_time; watchdog <= not watchdog;end process;

Page 43: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 43

Instructions séquentielles, concurrentes, simultanées : Instructions concurrentes : Affectation Raccourci d’ écriture

toujours remplaçable par : process + affectation séquentielle + tests

Forme simple :[label:]nom_ou_aggregat <= [options] waveform ;

options ::= [guarded] [transport | [reject time ] inertial]

Forme conditionnelle : [label:]nom_ou_aggregat<=[options]waveform1 when cond1 else waveform2 when cond2 else

. . . waveformN when condN ;

Forme sélective : [label:] With expression select nom_ou_aggregat <= [options] waveform1 when list1, . . .

waveformN when listN ;

Page 44: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 44

Instructions séquentielles, concurrentes, simultanées : Instructions concurrentes : Instanciation

Prendre une copie (une instance) d ’un modèlela personnaliser, la configurer, la brancher

label : entity nom_du_compo(archi_compo) [generic map (formal => actual)] [port map(formal => actual)];

Recherche de l ’entité dans les « library » référencéessi archi_compo n ’apparaît pas : la dernière analysée (!!??outil)

Attention : label obligatoire (plusieurs instances d’un modèle)

Configuration : association composant / modèle de la basevue au cours suivant

Page 45: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 45

Instructions séquentielles, concurrentes, simultanées : Instr. Conc. : Instanciation (exemple)

entity RS isport (S,R : bit ; Q,Qb : out bit);

end entity;

architecture structural of RS is signal n1_out, n2_out : bit ;begin nand1: entity nandg port map(in1=>S, in2=>n2_out, outp=>n1_out); nand2: entity nandg generic map (5 ns)

port map(R,n1_out, n2_out); Q <= n1_out; Qb <= n2_out;end structural;

Page 46: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 46

Instructions séquentielles, concurrentes, simultanées : Instructions concurrentes : Assertion

Permet de surveiller en permanence une condition

[lab:] [postponed]assert cond_bool [report expression] [severity note|warning|error|failure] ;

Process équivalent :

[lab:] [postponed] Process (signaux_de la conditions)begin assert cond_bool

[report expression] [severity note|warning|error|failure] ;

end process [lab] ;

Page 47: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 47

Instructions séquentielles, concurrentes, simultanées :

Instructions simultanées

Support de la modélisation/simulation à temps continu Ces instructions sont évaluées à chaque ASP

Simple simultaneous statement : == Forme conditionelle : if cond use Forme sélective : case cond when Forme procédurale : Procedural

Page 48: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 48

Instructions séquentielles, concurrentes, simultanées : Instructions simultanées : Forme simple

Simple simultaneous statements (doivent être évalués à chaque ASP)

f == g f et g deux fonctions NL contenant des quantitésle simulateur s ’assure qu ’à chaque ASP f-g=0.0aux tolérances prêt (équation caractéristique)Ces équations sont explicites ou implicites

Exemple : Q**2 + Y ’dot == sqr(Y) - Q ’integ ; C*U == Q ; Q == I’integ;

ENTITY R IS generic (R_value : real := 1_000.0) port (TERMINAL vp,vm:electrical);END;ARCHITECTURE equ OF R IS

QUANTITY V ACROSS I THROUGH vp TO vm; BEGIN

V == R_value * I;END;

Page 49: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 49

Instructions séquentielles, concurrentes, simultanées : Instructions simultanées : Choix

Choix du jeu d ’équations en fonction de conditions La forme conditionelle :

label :IF cond_1 USE -- ASP = evaluation condx

{equations analogiques} -- !! BREAK ELSIF cond_2 USE

{equations analogiques} … ELSE {equations analogiques}END USE label;

La forme sélective : label : CASE expr USE WHEN value1 => {equations analogiques} WHEN value2 => {equations analogiques} END CASE label

Page 50: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 50

Instructions séquentielles, concurrentes, simultanées : Instructions simultanées : Procedural Fabriquer un « Simultaneous Statement » à partir de séquentiel[label :] PROCEDURAL [IS]

{declaration_part} -- NORME : réévalués /exécutionBEGIN -- (pas de mémoire ?) {sequential_statement} -- sauf wait, break, and <=END PROCEDURAL [label]

Sommateur analogique pondéré Avec beta:real_vector et vp(i) ACROSS T(i) to GND (taille identique inconnue)ARCHITECTURE …

BEGIN PROCEDURAL IS variable bvs : real := 0.0; BEGIN bvs := 0.0; -- si memorisation

FOR i IN beta’range loop -- Quantités externes bvs := bvs + beta(i) * vp(i); -- sont vues comme des END LOOP; -- variables Qout := bvs; END PROCEDURAL;END;

Page 51: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 51

Notion d’attribut (et exemples indispensables)

Fonctions à syntaxe spécifique(AB : attribut appliqué à A rend un objet B)

Array range : A’range Array value : A’length Signal signal : S’delayed(T), S’stable, S’quiet Signal fonction : S’event, S’last_event, S’last_value Quantité quantité : Q’dot, Q’integ, Quantité signal : Q’above(E) Nature terminal : N’reference Nature type : N’across, N’through Terminal quantité : T’contribution, T’reference

Page 52: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 52

Synchronisation des noyaux

Un événement sur un SIGNAL doit pouvoir provoquer une évaluation analogique :

Break on S; -- version simple

Force un ASP sur les événement de S Break [[for Q1] use Q2 => expression] [on S][when cond]; Force ASP et recalcule les conditions initiales Existe aussi en séquentiel

Une valeur sur une QUANTITY doit pouvoir fabriquer un événement :

Q’above(Value) crée un événement booléen quand Q « croise » value

Page 53: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 53

Synchronisation des noyaux : exemplesarchitecture ideal of comparator is

quantity vin across vp to ref;begin dout <= vin’above(seuil); -- dout est TRUE si vin > seuil -- dout est FALSE si vin < seuilend architecture ideal ;

architecture ideal of ball isquantity v:velocity;quantity s:displacement;constant G:real:= 9.31;constant fric :real := 0.1;begin

break v => 0.0, s => 10.0; -- conditions intialesbreak v => -v when not s’above(0.0);s ’dot == v;if v > 0.0 use V’dot == -G - v**2 * fric;

else V’dot == -G + v**2 * fric; end use ;end architecture ideal ;

Page 54: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 54

Critère de solvabilité (non de convergence)

Simulation analogique

Résoudre système d’équations à chaque pas de temps

Il faut assurer que le modèle contient autant d’équations que d ’inconnues

CRITERE DE SOLVABILITE : Le nombre d ’équations (simultaneous statements)

doit être égal au nombrede quantités THROUGH

augmenté du nombre de quantités FREEet du nombre de quantité d’interface en mode OUT.

Critère pouvant être assuré localementLes constructions de choix doivent être équilibrées

Page 55: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 55

Critère de solvabilité : exempleentity Vdc is generic (dc: REAL); port (terminal p, m: electrical);end entity Vdc;

architecture Bad of Vdc is NE COMPILE PAS quantity v across p to m;begin v == dc;end architecture Bad;

architecture Good of Vdc is quantity v across i through p to m;begin v == dc;end architecture Good;

Page 56: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 56

Mots clefs (en gras, ceux qui ont été abordés)

abs access across after alias all and architecture array assert attribute

begin block body break buffer bus case component configuration constant

disconnect downto else elsif end entity exit

file for function generate generic group guarded

if impure in inertial inout is library limit linkage loop

map mod nand nature new next noise nor not null

of on open or others out package port postponed procedural procedure process

pure quantity range record reference register reject rem report return rol ror

select severity signal shared sla sll spectrum sra srl subnature subtype

terminal then through to tolerance transport type unaffected units until use

variable wait when while with xnor xor

Page 57: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 57

Exemples simples Porte NAND Bascule D Résistance, Condensateur, Inductance RLC parallèle, RLC série Source sinus parfaite Diode avec comportement thermique Non linéarité : modèle par morceaux Modèle mixte (piloté par FSM)

Page 58: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

58

Porte NANDENTITY nandg IS GENERIC (tplh,tphl : time := 10 ns); PORT (SIGNAL inp1,inp2 : IN std_ulogic, outp : OUT std_ulogic);END;

LIBRARY IEEE;use ieee.math_real.all; ARCHITECTURE beh1 OF nandg ISBEGIN outp <= inp1 nand inp2 after ( tplh + tphl)/2;END;

ARCHITECTURE beh2 OF nandg ISBEGIN process variable loc : std_ulogic; begin wait on inp1, inp2; loc := inp1 nand inp2; if loc = ‘1’ then outp <= loc after tplh; else outp <= loc after tphl; end if; end process;END;

Page 59: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 59

Bascule D

ENTITY bascd IS GENERIC (tpd: time := 10 ns); PORT (SIGNAL D,CLK : IN std_ulogic; SIGNAL Q : OUT std_ulogic);END;

LIBRARY IEEE;use ieee.math_real.all; ARCHITECTURE beh1 OF bascd ISBEGIN Q <= D after tpd when (CLK’event and CLK=‘1’) else unaffected;END;

ARCHITECTURE beh2 OF bascd ISBEGIN process begin wait until CLK=‘1’; Q <= D after tpd; end process ;END;

Page 60: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 60

Résistance

ENTITY R IS generic (R_value : real := 1_000.0); port (TERMINAL a,b:electrical);END;

ARCHITECTURE equ OF R ISQUANTITY V ACROSS I THROUGH a TO b;

BEGINV == R_value * I;

END;

Page 61: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 61

Condensateur

ENTITY C IS generic (C_value : real := 1.0e-6); port (TERMINAL vp,vm:electrical);END;

ARCHITECTURE equ OF C ISQUANTITY V ACROSS I THROUGH vp TO vm;

BEGINI == C_value * V ’dot;

END;

Page 62: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 62

Inductance

ENTITY L IS generic (L_value : real := 1.0e-3); port (TERMINAL vp,vm:electrical);END;

ARCHITECTURE equ OF L ISQUANTITY V ACROSS I THROUGH vp TO vm;

BEGINV == L_value * I ’dot;

END;

Page 63: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 63

RLC parallèle

ENTITY RLCp IS generic (R,L,C : real); port (TERMINAL vp,vm:electrical);END;

ARCHITECTURE struct OF RLCp ISBEGIN lab_R: entity R generic map (R) port map (b => vm, a => vp); lab_C: entity C generic map (C) port map (vp, vm); lab_L: entity L generic map (L) port map (vp=>vp ,vm=>vm);END;

ARCHITECTURE equ OF RLCp IS quantity V across I1,I2,I3 through vp to vm;BEGIN V == R*I1 ; V == L*I2’dot V == I3’integ/C ; END;

Page 64: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 64

RLC série

ENTITY RLCs IS generic (R,L,C : real); port (TERMINAL vp,vm:electrical);END;

ARCHITECTURE struct OF RLCs ISTerminal RC,CL : electrical;BEGIN lab_R: entity R generic map (R) port map (vp,RC); lab_C: entity C generic map (C) port map (RC, CL); lab_L: entity L generic map (L) port map (CL, vm);END;

ARCHITECTURE equ OF RLCs IS quantity V across I through vp to vm;BEGIN V == R*I + L*I’dot + I’integ/C ; END;

Page 65: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 65

Source sinus idéale

library Disciplines;use Disciplines. electrical_ system. all;ENTITY gene_sinus IS generic (Ampl,freq,phase : real); port (TERMINAL vp,vm:electrical);END;

library ieee;use ieee.math_real.all;ARCHITECTURE beh OF gene_sinus IS quantity V across I through vp to vm;BEGIN V == Ampl * sin( 2.0 * math_pi * freq * now + phase) ;END;

Page 66: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 66

Diode paramétrée

ENTITY diode IS generic(Iss:real:=1.0e-14;n,af:real:=1.0;

tt,cjo,vj,rs,kf:real:=0.0); port (TERMINAL anode,cathode:electrical);END;

ARCHITECTURE level0 OF diode IS quantity Vd across id,ic through anode to cathode; quantity qc : charge; constant vt : real := 0.0258;BEGIN ic == qc ’dot; qc == tt * id - 2.0 * cjo * sqrt( vj**2 - vj * vd ); id == iss * exp(( vd - rs*id )/( n * vt )) - 1.0); END ARCHITECTURE level0;

1).(eII )/(n.vt)rs.I(vsd

dd

).vv-²v.2.C-(tt.Idt

dI djjjodc

Page 67: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 67

Diode : modèle électro-thermique

ENTITY diodth IS generic(Iss:real:=1.0e-14;n,af:real:=1.0;

tt,cjo,vj,rs,kf:real:=0.0); port (TERMINAL anode,cathode:electrical; TERMINAL junction:thermal);END;

ARCHITECTURE level0 OF diodth IS quantity Vd across id,ic through anode to cathode; quantity temp across power through thermal_ref to junction; quantity qc : charge; quantity vt : voltage;BEGIN ic == qc ’dot; qc == tt * id - 2.0 * cjo * sqrt( vj**2 - vj * vd ); id == iss * exp(( vd - rs*id )/( n * vt )) - 1.0); vt == temp * boltzmann / elec_charge ; power == vd * id; END ARCHITECTURE level0;

Page 68: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 68

Diode : modèle électro-thermique - Testbench

library Disciplines;use Disciplines. electrical_ system. all;use Disciplines. thermal_ system. all;entity TestBench is end entity TestBench;

architecture DiodeWithHeatSink of TestBench isterminal a, b: electrical; terminal j, h: thermal;beginv0: entity Vdc generic map (dc => 1.0)

port map (p => a, m => ground);r1: entity Resistor generic map (r => 1.0e3)

port map (p => a, m => b);d1: entity DiodeTh port map (anode => b,

cathode => ground, junction => j);heatres: entity ResistorTh generic map (r => 0.1) port map (p => j, m => h);heatsink: entity CapacitorTh generic map (c => 0.008) port map (p => h, m => thermal_ ref);rad: entity ResistorTh generic map (r => 10.0) port map (p => h, m => thermal_ ref);end architecture DiodeWithHeatSink;

Page 69: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 69

Modèle par morceaux : Mauvaise méthodelimiteur de tension

library Disciplines;use Disciplines. electrical_ system. all;entity VoltageLimiter is

generic (vlim: REAL); -- open loop gainport (terminal ip, im, op, om: electrical);

end entity VoltageLimiter;

architecture Bad of VoltageLimiter is quantity vin across ip to im; quantity vout across iout through op to om;begin

if vin > vlim usevout == vlim;

elsif vin < -vlim usevout == -vlim;

elsevout == vin;

end use;end architecture Bad;

C ’E

ST

MA

UV

AIS

Page 70: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 70

C ’E

ST

ME

ILL

EU

Rlibrary Disciplines;use Disciplines. electrical_ system. all;

architecture Good of VoltageLimiter is quantity vin across ip to im; quantity vout across iout through op to om;begin

if vin’Above( vlim) usevout == vlim;

elsif not vin’Above(- vlim) usevout == -vlim;

elsevout == vin;

end use;

-- break on vin’Above( vlim), vin’Above(- vlim);

end architecture Good;

Modèle par morceaux : Bonne méthodelimiteur de tension

Page 71: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 71

library IEEE, Disciplines; use IEEE. std_ logic_ 1164.all;use Disciplines. electrical_ system. all;entity ComparatorHyst is

generic (vlo, vhi: REAL; -- thresholds timeout: DELAY_ LENGTH);

port (terminal ain, ref: electrical; signal dout: out std_ logic);

end entity ComparatorHyst;

architecture Hysteresis of ComparatorHyst istype states is (unknown, zero, one, unstable);quantity vin across ain to ref;function level( vin, vlo, vhi: REAL) return states is begin

if vin < vlo then return zero;elsif vin > vhi then return one;else return unknown; end if;

end function level;begin. . .

Modèle mixte piloté par FSM : Comparateur à hystérésis (1)

Page 72: 10/08/2000Yannick HERVE - ENSPS1 2 - Introduction à VHDL-AMS (1 à 23 = 1h45) Structure générale d'un modèle Structuration en bibliothèques Indentificateurs,

10/08/2000 Yannick HERVE - ENSPS 72

. . . process variable state: states := level( vin, vlo, vhi); begin case state is when one => dout <= ’1’; wait on vin’Above( vhi); state := unstable; when zero => dout <= ’0’; wait on vin’Above( vlo); state := unstable; when unknown => dout <= ’X’; wait on vin’Above( vhi), vin’Above( vlo); state := level( vin, vlo, vhi); when unstable => wait on vin’Above( vhi), vin’Above( vlo) for timeout; state := level( vin, vlo, vhi); end case; end process;end architecture Hysteresis;

Modèle mixte piloté par FSM : Comparateur à hystérésis (2)