1 | #ifdef VHDL |
---|
2 | |
---|
3 | #ifndef morpheo_behavioural_Vhdl_h |
---|
4 | #define morpheo_behavioural_Vhdl_h |
---|
5 | |
---|
6 | /* |
---|
7 | * $Id$ |
---|
8 | * |
---|
9 | * [ Description ] |
---|
10 | * |
---|
11 | */ |
---|
12 | |
---|
13 | #include <stdint.h> |
---|
14 | #include <iostream> |
---|
15 | #include <list> |
---|
16 | #include "Behavioural/include/Environnement.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 | |
---|
22 | namespace 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 ); |
---|
29 | std::string std_logic_range (uint32_t max , uint32_t min ); |
---|
30 | std::string std_logic_range (uint32_t size); |
---|
31 | std::string std_logic_others (uint32_t size, uint32_t 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 signal ); |
---|
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 | |
---|
128 | public : void set_body_component (std::string name_instance , |
---|
129 | std::string name_component , |
---|
130 | std::list<std::string> list_port_map ); |
---|
131 | public : void set_body_component_port_map (std::list<std::string> & list_port_map , |
---|
132 | std::string name_port , |
---|
133 | uint32_t size_port , |
---|
134 | std::string name_signal , |
---|
135 | uint32_t size_signal ); |
---|
136 | |
---|
137 | private : std::string get_library_ieee (uint32_t depth ); |
---|
138 | private : std::string get_library_work (uint32_t depth ); |
---|
139 | public : void set_library_work (std::string package_name ); |
---|
140 | |
---|
141 | private : std::string direction_toString (direction_t direction); |
---|
142 | }; |
---|
143 | |
---|
144 | }; // end namespace behavioural |
---|
145 | }; // end namespace morpheo |
---|
146 | |
---|
147 | #endif |
---|
148 | #endif |
---|