[2] | 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> |
---|
[88] | 16 | #include "Common/include/Environment.h" |
---|
[25] | 17 | #include "Behavioural/include/Direction.h" |
---|
[44] | 18 | #include "Common/include/ToString.h" |
---|
| 19 | #include "Common/include/Debug.h" |
---|
[65] | 20 | #include "Common/include/ErrorMorpheo.h" |
---|
[2] | 21 | |
---|
| 22 | namespace morpheo { |
---|
[71] | 23 | namespace behavioural { |
---|
[2] | 24 | |
---|
[94] | 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); |
---|
[95] | 28 | std::string std_logic_cst (uint32_t size, uint32_t value); |
---|
[94] | 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); |
---|
[2] | 33 | |
---|
[71] | 34 | class Vhdl |
---|
| 35 | { |
---|
| 36 | // -----[ fields ]---------------------------------------------------- |
---|
| 37 | private : const std::string _name ; |
---|
[2] | 38 | |
---|
[71] | 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 ; |
---|
[2] | 45 | |
---|
[71] | 46 | // -----[ methods ]--------------------------------------------------- |
---|
| 47 | public : Vhdl (std::string name); |
---|
| 48 | public : ~Vhdl (); |
---|
[2] | 49 | |
---|
[71] | 50 | public : void generate_file (void); |
---|
| 51 | public : void generate_file (bool generate_package, |
---|
| 52 | bool generate_model ); |
---|
[2] | 53 | |
---|
[71] | 54 | private : void generate_file_package (void); |
---|
| 55 | private : void generate_file_model (void); |
---|
[88] | 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 , |
---|
[71] | 77 | direction_t direction , |
---|
[88] | 78 | std::string type ); |
---|
| 79 | public : void set_port (std::string name , |
---|
[71] | 80 | direction_t direction , |
---|
| 81 | uint32_t size ); |
---|
[88] | 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 , |
---|
[93] | 86 | uint32_t size ); |
---|
[88] | 87 | public : void set_signal (std::string name , |
---|
| 88 | std::string type , |
---|
| 89 | std::string init ); |
---|
| 90 | public : void set_signal (std::string name , |
---|
[71] | 91 | uint32_t size , |
---|
[88] | 92 | std::string init ); |
---|
| 93 | public : void set_signal (std::string name , |
---|
[71] | 94 | uint32_t size , |
---|
| 95 | uint32_t init ); |
---|
[88] | 96 | public : void set_constant (std::string name , |
---|
| 97 | std::string type , |
---|
| 98 | std::string init ); |
---|
| 99 | public : void set_constant (std::string name , |
---|
[71] | 100 | uint32_t size , |
---|
[88] | 101 | std::string init ); |
---|
| 102 | public : void set_constant (std::string name , |
---|
[71] | 103 | uint32_t size , |
---|
| 104 | uint32_t init ); |
---|
[2] | 105 | |
---|
[88] | 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 , |
---|
[71] | 115 | uint32_t size1 , |
---|
[88] | 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 ); |
---|
[2] | 125 | |
---|
[88] | 126 | private : std::string get_body (uint32_t depth ); |
---|
| 127 | public : void set_body (std::string text ); |
---|
[94] | 128 | public : void set_body (uint32_t depth , |
---|
| 129 | std::string text ); |
---|
| 130 | |
---|
| 131 | public : void set_body (uint32_t depth , |
---|
| 132 | Vhdl * vhdl ); |
---|
[88] | 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 ); |
---|
[2] | 141 | |
---|
[94] | 142 | public : void set_comment (std::string text ); |
---|
| 143 | public : void set_comment (uint32_t depth , |
---|
| 144 | std::string text ); |
---|
| 145 | |
---|
[88] | 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 ); |
---|
[2] | 149 | |
---|
[88] | 150 | private : std::string direction_toString (direction_t direction ); |
---|
[71] | 151 | }; |
---|
| 152 | |
---|
| 153 | }; // end namespace behavioural |
---|
[2] | 154 | }; // end namespace morpheo |
---|
| 155 | |
---|
| 156 | #endif |
---|
| 157 | #endif |
---|