[100] | 1 | %------------------------------------------------------------------------------ |
---|
| 2 | % $Id: document-morpheo-vhdl_generation-fr-03_vhdl_body.tex 113 2009-04-14 18:39:12Z rosiere $ |
---|
| 3 | %------------------------------------------------------------------------------ |
---|
| 4 | |
---|
| 5 | \Section{VHDL : comportement}\label{vhdl_body} |
---|
| 6 | |
---|
[113] | 7 | \subSection{Description du fichier {\it Component\_vhdl\_body.cpp}} |
---|
| 8 | |
---|
[100] | 9 | Le comportement du composant est défini dans le fichier {\it Component\_vhdl\_body.cpp}. |
---|
| 10 | |
---|
| 11 | Il n'y a pas de fonction aidant à l'écriture du Vhdl. |
---|
| 12 | La méthode {\it set\_body} permet de définir une ligne de code VHDL. Un retour à la ligne est automatiquement inséré. Le premier argument est pour l'indentation. |
---|
| 13 | \lstparam{C++} |
---|
| 14 | \begin{lstlisting} |
---|
| 15 | void set_body (uint32_t depth, |
---|
| 16 | std::string text ); |
---|
| 17 | void set_body (std::string text ); |
---|
| 18 | \end{lstlisting} |
---|
| 19 | |
---|
| 20 | Pour les commentaires, il y a la fonction {\it set\_comment}. |
---|
| 21 | \lstparam{C++} |
---|
| 22 | \begin{lstlisting} |
---|
| 23 | void set_comment (uint32_t depth, |
---|
| 24 | std::string text ); |
---|
| 25 | void set_comment (std::string text ); |
---|
| 26 | \end{lstlisting} |
---|
[113] | 27 | |
---|
| 28 | \subSection{Description du fichier {\it Component\_vhdl.cpp}} |
---|
| 29 | Nous allons décrire ici le fichier {\it Component\_vhdl.cpp}. |
---|
| 30 | |
---|
| 31 | \lstparam{C++} |
---|
| 32 | \begin{lstlisting}[caption={Component\_vhdl.cpp}, label=component_vhdl.cpp] |
---|
| 33 | void component::vhdl (void) |
---|
| 34 | { |
---|
| 35 | Vhdl * vhdl = new Vhdl (_name); |
---|
| 36 | |
---|
| 37 | _interfaces->set_port(vhdl); |
---|
| 38 | _component->vhdl_instance(vhdl); |
---|
| 39 | |
---|
| 40 | vhdl_declaration (vhdl); |
---|
| 41 | vhdl_body (vhdl); |
---|
| 42 | |
---|
| 43 | vhdl->generate_file(); |
---|
| 44 | |
---|
| 45 | delete vhdl; |
---|
| 46 | }; |
---|
| 47 | \end{lstlisting} |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | La première étape est d'éditer le fichier {\it Component\_vhdl.cpp}. Le listing \ref{component_vhdl.cpp} représente le contenu de ce fichier. |
---|
| 51 | \begin{itemize} |
---|
| 52 | \item Ligne 3 : Déclaration et construction de la variable {\it vhdl} qui est du type {\it Vhdl}. |
---|
| 53 | \item Ligne 5 : Ajout dans le modèle VHDL des interfaces présentes dans le modèle SystemC. (cf fichiers Component.h). |
---|
| 54 | \item Ligne 6 : Ajout dans le modèle VHDL des composants internes dans le modèle SystemC. (cf fichiers Component.h et Component\_allocation.cpp). |
---|
| 55 | \item Ligne 8 : Ajout dans le modèle VHDL des déclarations définit dans le fichiers Component\_vhdl\_declaration.cpp (cf section \ref{vhdl_declaration}). |
---|
| 56 | \item Ligne 9 : Ajout dans le modèle VHDL de la description comportemental définit dans le fichiers Component\_vhdl\_body.cpp (cf section \ref{vhdl_body}). |
---|
| 57 | \item Ligne 11 : Génération des fichiers VHDL. Le nom du fichier est construit à partir du nom fourni lors de la construction de la variable {\it vhdl}. |
---|
| 58 | \item Ligne 13 : Destruction de l'objet. |
---|
| 59 | \end{itemize} |
---|