source: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Vhdl.h @ 94

Last change on this file since 94 was 94, checked in by rosiere, 15 years ago

Update document on Vhdl generation.

  • Property svn:keywords set to Id
File size: 9.4 KB
Line 
1#ifdef VHDL
2
3#ifndef morpheo_behavioural_Vhdl_h
4#define morpheo_behavioural_Vhdl_h
5
6/*
7 * $Id: Vhdl.h 94 2008-12-15 11:04:03Z rosiere $
8 *
9 * [ Description ]
10 *
11 */
12
13#include <stdint.h>
14#include <iostream>
15#include <list>
16#include "Common/include/Environment.h"
17#include "Behavioural/include/Direction.h"
18#include "Common/include/ToString.h"
19#include "Common/include/Debug.h"
20#include "Common/include/ErrorMorpheo.h"
21
22namespace morpheo              {
23  namespace behavioural          {
24
25    std::string std_logic          (uint32_t size);
26    std::string std_logic_conv     (uint32_t size, std::string   value);
27    std::string std_logic_conv     (uint32_t size, uint32_t value);
28    std::string std_logic_range    (uint32_t size, uint32_t max , uint32_t min , bool force=false);
29    std::string std_logic_range    (               uint32_t max , uint32_t min , bool force=false);
30    std::string std_logic_range    (uint32_t size,                               bool force=false);
31    std::string std_logic_others   (uint32_t size, bool cst);
32
33    class Vhdl
34    {
35      // -----[ fields ]----------------------------------------------------
36    private   : const std::string     _name                         ;
37
38    private   : std::list<std::string>     _list_library_work            ;
39    private   : std::list<std::string>     _list_signal                  ;
40    private   : std::list<std::string>     _list_type                    ;
41    private   : std::list<std::string>     _list_alias                   ;
42    private   : std::list<std::string>     _list_port                    ;
43    private   : std::list<std::string>     _list_body                    ;
44
45      // -----[ methods ]---------------------------------------------------
46    public    :                  Vhdl                        (std::string name);
47    public    :                  ~Vhdl                       ();
48
49    public    : void             generate_file               (void);
50    public    : void             generate_file               (bool generate_package,
51                                                              bool generate_model  );
52
53    private   : void             generate_file_package       (void);
54    private   : void             generate_file_model         (void);
55     
56    private   : std::string      get_package                 (uint32_t    depth                 ,
57                                                              std::string filename              ,
58                                                              std::string package_name          ,
59                                                              std::string entity_name           );
60    private   : std::string      get_model                   (uint32_t    depth                 ,
61                                                              std::string filename              ,
62                                                              std::string entity_name           ,
63                                                              std::string architecture_name     );
64    private   : std::string      get_header                  (uint32_t    depth                 ,
65                                                              std::string filename              );
66    private   : std::string      get_entity                  (uint32_t    depth                 ,
67                                                              std::string name                  );
68    private   : std::string      get_architecture            (uint32_t    depth                 , 
69                                                              std::string name                  ,
70                                                              std::string entity_name           );
71    private   : std::string      get_component               (uint32_t    depth                 ,
72                                                              std::string name                  );
73     
74    private   : std::string      get_port                    (uint32_t    depth                 );
75    public    : void             set_port                    (std::string name                  ,
76                                                              direction_t direction             ,
77                                                              std::string type                  );
78    public    : void             set_port                    (std::string name                  ,
79                                                              direction_t direction             ,
80                                                              uint32_t    size                  );
81    private   : std::string      get_signal                  (uint32_t    depth                 );
82    public    : void             set_signal                  (std::string name                  ,
83                                                              std::string type                  );
84    public    : void             set_signal                  (std::string name                  ,
85                                                              uint32_t    size                  );
86    public    : void             set_signal                  (std::string name                  ,
87                                                              std::string type                  ,
88                                                              std::string init                  );
89    public    : void             set_signal                  (std::string name                  ,
90                                                              uint32_t    size                  ,
91                                                              std::string init                  );
92    public    : void             set_signal                  (std::string name                  ,
93                                                              uint32_t    size                  ,
94                                                              uint32_t    init                  );
95    public    : void             set_constant                (std::string name                  ,
96                                                              std::string type                  ,
97                                                              std::string init                  );
98    public    : void             set_constant                (std::string name                  ,
99                                                              uint32_t    size                  ,
100                                                              std::string init                  );
101    public    : void             set_constant                (std::string name                  ,
102                                                              uint32_t    size                  ,
103                                                              uint32_t    init                  );
104
105    private   : std::string      get_type                    (uint32_t    depth                 );
106    public    : void             set_type                    (std::string name                  ,
107                                                              std::string type                  );
108    private   : std::string      get_alias                   (uint32_t    depth                 );
109    public    : void             set_alias                   (std::string name1                 ,
110                                                              std::string type1                 ,
111                                                              std::string name2                 ,
112                                                              std::string range2                );
113    public    : void             set_alias                   (std::string name1                 ,
114                                                              uint32_t    size1                 ,
115                                                              std::string name2                 ,
116                                                              std::string range2                );
117     
118    public    : std::string      get_list                    (std::list<std::string> liste      ,
119                                                              uint32_t     depth                ,
120                                                              std::string  separator            ,
121                                                              bool         last_separator       );
122    public    : void             set_list                    (std::list<std::string> & liste    ,
123                                                              std::string  text                 );
124
125    private   : std::string      get_body                    (uint32_t     depth                );
126    public    : void             set_body                    (std::string  text                 );
127    public    : void             set_body                    (uint32_t     depth                ,
128                                                              std::string  text                 );
129                                                                                   
130    public    : void             set_body                    (uint32_t     depth                ,
131                                                              Vhdl *       vhdl                 );
132    public    : void             set_body_component          (std::string  name_instance        ,
133                                                              std::string  name_component       ,
134                                                              std::list<std::string>   list_port_map);
135    public    : void             set_body_component_port_map (std::list<std::string> & list_port_map,
136                                                              std::string  name_port            ,
137                                                              uint32_t     size_port            ,
138                                                              std::string  name_signal          ,
139                                                              uint32_t     size_signal          );
140
141    public    : void             set_comment                 (std::string  text                 );
142    public    : void             set_comment                 (uint32_t     depth                ,
143                                                              std::string  text                 );
144
145    private   : std::string      get_library_ieee            (uint32_t     depth                );
146    private   : std::string      get_library_work            (uint32_t     depth                );
147    public    : void             set_library_work            (std::string  package_name         );
148
149    private   : std::string      direction_toString          (direction_t  direction            );
150    };
151
152  }; // end namespace behavioural         
153}; // end namespace morpheo             
154
155#endif
156#endif
Note: See TracBrowser for help on using the repository browser.