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

Last change on this file since 95 was 95, checked in by rosiere, 16 years ago

1) Update Prediction Table - New architecture (systemC) done (and tested) -> need change interface in top level
2) Change documentation on VHDL generation
3) Change VHDL constant (case std_logic and std_logic_vector)

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