[2] | 1 | #ifdef VHDL |
---|
| 2 | |
---|
| 3 | #ifndef morpheo_behavioural_Vhdl_h |
---|
| 4 | #define morpheo_behavioural_Vhdl_h |
---|
| 5 | |
---|
| 6 | /* |
---|
| 7 | * $Id: Vhdl.h 88 2008-12-10 18:31:39Z 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 | |
---|
[71] | 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 ); |
---|
[2] | 32 | |
---|
[71] | 33 | class Vhdl |
---|
| 34 | { |
---|
| 35 | // -----[ fields ]---------------------------------------------------- |
---|
| 36 | private : const std::string _name ; |
---|
[2] | 37 | |
---|
[71] | 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 ; |
---|
[2] | 44 | |
---|
[71] | 45 | // -----[ methods ]--------------------------------------------------- |
---|
| 46 | public : Vhdl (std::string name); |
---|
| 47 | public : ~Vhdl (); |
---|
[2] | 48 | |
---|
[71] | 49 | public : void generate_file (void); |
---|
| 50 | public : void generate_file (bool generate_package, |
---|
| 51 | bool generate_model ); |
---|
[2] | 52 | |
---|
[71] | 53 | private : void generate_file_package (void); |
---|
| 54 | private : void generate_file_model (void); |
---|
[88] | 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 , |
---|
[71] | 76 | direction_t direction , |
---|
[88] | 77 | std::string type ); |
---|
| 78 | public : void set_port (std::string name , |
---|
[71] | 79 | direction_t direction , |
---|
| 80 | uint32_t size ); |
---|
[88] | 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 , |
---|
[71] | 85 | uint32_t signal ); |
---|
[88] | 86 | public : void set_signal (std::string name , |
---|
| 87 | std::string type , |
---|
| 88 | std::string init ); |
---|
| 89 | public : void set_signal (std::string name , |
---|
[71] | 90 | uint32_t size , |
---|
[88] | 91 | std::string init ); |
---|
| 92 | public : void set_signal (std::string name , |
---|
[71] | 93 | uint32_t size , |
---|
| 94 | uint32_t init ); |
---|
[88] | 95 | public : void set_constant (std::string name , |
---|
| 96 | std::string type , |
---|
| 97 | std::string init ); |
---|
| 98 | public : void set_constant (std::string name , |
---|
[71] | 99 | uint32_t size , |
---|
[88] | 100 | std::string init ); |
---|
| 101 | public : void set_constant (std::string name , |
---|
[71] | 102 | uint32_t size , |
---|
| 103 | uint32_t init ); |
---|
[2] | 104 | |
---|
[88] | 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 , |
---|
[71] | 114 | uint32_t size1 , |
---|
[88] | 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 ); |
---|
[2] | 124 | |
---|
[88] | 125 | private : std::string get_body (uint32_t depth ); |
---|
| 126 | public : void set_body (std::string text ); |
---|
| 127 | |
---|
| 128 | public : void set_body (Vhdl * vhdl ); |
---|
| 129 | |
---|
| 130 | public : void set_body_component (std::string name_instance , |
---|
| 131 | std::string name_component , |
---|
| 132 | std::list<std::string> list_port_map); |
---|
| 133 | public : void set_body_component_port_map (std::list<std::string> & list_port_map, |
---|
| 134 | std::string name_port , |
---|
| 135 | uint32_t size_port , |
---|
| 136 | std::string name_signal , |
---|
| 137 | uint32_t size_signal ); |
---|
[2] | 138 | |
---|
[88] | 139 | private : std::string get_library_ieee (uint32_t depth ); |
---|
| 140 | private : std::string get_library_work (uint32_t depth ); |
---|
| 141 | public : void set_library_work (std::string package_name ); |
---|
[2] | 142 | |
---|
[88] | 143 | private : std::string direction_toString (direction_t direction ); |
---|
[71] | 144 | }; |
---|
| 145 | |
---|
| 146 | }; // end namespace behavioural |
---|
[2] | 147 | }; // end namespace morpheo |
---|
| 148 | |
---|
| 149 | #endif |
---|
| 150 | #endif |
---|