[2] | 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> |
---|
[25] | 16 | #include "Behavioural/include/Direction.h" |
---|
[2] | 17 | #include "Include/ToString.h" |
---|
| 18 | #include "Include/Debug.h" |
---|
| 19 | |
---|
| 20 | using namespace std; |
---|
| 21 | |
---|
| 22 | namespace morpheo { |
---|
| 23 | namespace behavioural { |
---|
| 24 | |
---|
| 25 | string std_logic (uint32_t size); |
---|
| 26 | string std_logic_conv (uint32_t size, string value); |
---|
| 27 | string std_logic_conv (uint32_t size, uint32_t value); |
---|
| 28 | string std_logic_range (uint32_t max , uint32_t min ); |
---|
| 29 | string std_logic_range (uint32_t size); |
---|
| 30 | string std_logic_others (uint32_t size, uint32_t cst ); |
---|
| 31 | |
---|
| 32 | class Vhdl |
---|
| 33 | { |
---|
| 34 | // -----[ fields ]---------------------------------------------------- |
---|
| 35 | private : const string _name ; |
---|
| 36 | |
---|
| 37 | private : list<string> _list_library_work ; |
---|
| 38 | private : list<string> _list_signal ; |
---|
| 39 | private : list<string> _list_type ; |
---|
| 40 | private : list<string> _list_alias ; |
---|
| 41 | private : list<string> _list_port ; |
---|
| 42 | private : list<string> _list_body ; |
---|
| 43 | |
---|
| 44 | // -----[ methods ]--------------------------------------------------- |
---|
| 45 | public : Vhdl (string name); |
---|
| 46 | public : virtual ~Vhdl (); |
---|
| 47 | |
---|
| 48 | public : void generate_file (void); |
---|
| 49 | public : void generate_file (bool generate_package, |
---|
| 50 | bool generate_model ); |
---|
| 51 | |
---|
| 52 | private : void generate_file_package (void); |
---|
| 53 | private : void generate_file_model (void); |
---|
| 54 | |
---|
| 55 | private : string get_package (uint32_t depth , |
---|
| 56 | string filename , |
---|
| 57 | string package_name , |
---|
| 58 | string entity_name ); |
---|
| 59 | private : string get_model (uint32_t depth , |
---|
| 60 | string filename , |
---|
| 61 | string entity_name , |
---|
| 62 | string architecture_name ); |
---|
| 63 | private : string get_header (uint32_t depth , |
---|
| 64 | string filename ); |
---|
| 65 | private : string get_entity (uint32_t depth , |
---|
| 66 | string name ); |
---|
| 67 | private : string get_architecture (uint32_t depth , |
---|
| 68 | string name , |
---|
| 69 | string entity_name ); |
---|
| 70 | private : string get_component (uint32_t depth , |
---|
| 71 | string name ); |
---|
| 72 | |
---|
| 73 | private : string get_port (uint32_t depth ); |
---|
| 74 | public : void set_port (string name , |
---|
| 75 | direction_t direction , |
---|
| 76 | string type ); |
---|
| 77 | public : void set_port (string name , |
---|
| 78 | direction_t direction , |
---|
| 79 | uint32_t size ); |
---|
| 80 | private : string get_signal (uint32_t depth ); |
---|
| 81 | public : void set_signal (string name , |
---|
| 82 | string type ); |
---|
| 83 | public : void set_signal (string name , |
---|
| 84 | uint32_t signal ); |
---|
| 85 | public : void set_signal (string name , |
---|
| 86 | string type , |
---|
| 87 | string init ); |
---|
| 88 | public : void set_signal (string name , |
---|
| 89 | uint32_t size , |
---|
| 90 | string init ); |
---|
| 91 | public : void set_signal (string name , |
---|
| 92 | uint32_t size , |
---|
| 93 | uint32_t init ); |
---|
| 94 | public : void set_constant (string name , |
---|
| 95 | string type , |
---|
| 96 | string init ); |
---|
| 97 | public : void set_constant (string name , |
---|
| 98 | uint32_t size , |
---|
| 99 | string init ); |
---|
| 100 | public : void set_constant (string name , |
---|
| 101 | uint32_t size , |
---|
| 102 | uint32_t init ); |
---|
| 103 | |
---|
| 104 | private : string get_type (uint32_t depth ); |
---|
| 105 | public : void set_type (string name , |
---|
| 106 | string type ); |
---|
| 107 | private : string get_alias (uint32_t depth ); |
---|
| 108 | public : void set_alias (string name1 , |
---|
| 109 | string type1 , |
---|
| 110 | string name2 , |
---|
| 111 | string range2 ); |
---|
| 112 | |
---|
| 113 | public : string get_list (list<string> liste , |
---|
| 114 | uint32_t depth , |
---|
| 115 | string separator , |
---|
| 116 | bool last_separator ); |
---|
| 117 | public : void set_list (list<string> & liste , |
---|
| 118 | string text ); |
---|
| 119 | |
---|
| 120 | private : string get_body (uint32_t depth ); |
---|
| 121 | public : void set_body (string text ); |
---|
| 122 | |
---|
| 123 | public : void set_body_component (string name_instance , |
---|
| 124 | string name_component , |
---|
| 125 | list<string> list_port_map ); |
---|
| 126 | public : void set_body_component_port_map (list<string> & list_port_map , |
---|
| 127 | string name_port , |
---|
| 128 | string name_signal ); |
---|
| 129 | |
---|
| 130 | private : string get_library_ieee (uint32_t depth ); |
---|
| 131 | private : string get_library_work (uint32_t depth ); |
---|
| 132 | public : void set_library_work (string package_name ); |
---|
| 133 | |
---|
| 134 | private : string direction_toString (direction_t direction); |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | }; // end namespace behavioural |
---|
| 138 | }; // end namespace morpheo |
---|
| 139 | |
---|
| 140 | #endif |
---|
| 141 | #endif |
---|