[29] | 1 | #ifndef morpheo_behavioural_Interface_h |
---|
| 2 | #define morpheo_behavioural_Interface_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id$ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #ifdef SYSTEMC |
---|
| 12 | #include "systemc.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | #include <stdint.h> |
---|
| 16 | #include <iostream> |
---|
| 17 | #include <list> |
---|
| 18 | #include "Behavioural/include/Signal.h" |
---|
| 19 | #include "Behavioural/include/Direction.h" |
---|
| 20 | #include "Behavioural/include/Localisation.h" |
---|
| 21 | #ifdef VHDL |
---|
| 22 | #include "Behavioural/include/Vhdl.h" |
---|
| 23 | #endif |
---|
| 24 | #ifdef VHDL_TESTBENCH |
---|
| 25 | #include "Behavioural/include/Vhdl_Testbench.h" |
---|
| 26 | #endif |
---|
| 27 | #include "Include/ToString.h" |
---|
[31] | 28 | #include "Include/ErrorMorpheo.h" |
---|
[29] | 29 | #include "Include/Debug.h" |
---|
| 30 | |
---|
| 31 | using namespace std; |
---|
| 32 | |
---|
| 33 | namespace morpheo { |
---|
| 34 | namespace behavioural { |
---|
| 35 | |
---|
| 36 | class Interface |
---|
| 37 | { |
---|
[31] | 38 | friend class Interfaces; |
---|
| 39 | |
---|
[29] | 40 | // -----[ fields ]---------------------------------------------------- |
---|
[40] | 41 | protected : const string _name ; |
---|
| 42 | protected : const direction_t _direction ; |
---|
| 43 | protected : const localisation_t _localisation ; |
---|
| 44 | protected : string _comment ; |
---|
[29] | 45 | |
---|
[40] | 46 | protected : list<Signal *> * _list_signal ; |
---|
[38] | 47 | |
---|
[31] | 48 | #ifdef POSITION |
---|
[40] | 49 | protected : bool _is_map ; |
---|
| 50 | protected : void * _entity_map ; // Entity -> erreur cyclique |
---|
| 51 | protected : void * _interface_map; // pour être homogène avec _entity_map |
---|
[31] | 52 | #endif |
---|
| 53 | |
---|
[40] | 54 | #ifdef VHDL_TESTBENCH |
---|
| 55 | private : list<string> * _list_cycle ; |
---|
| 56 | #endif |
---|
| 57 | |
---|
[29] | 58 | // -----[ methods ]--------------------------------------------------- |
---|
| 59 | public : Interface (string name , |
---|
| 60 | direction_t direction , |
---|
| 61 | localisation_t localisation); |
---|
| 62 | |
---|
[31] | 63 | public : Interface (const Interface & interface); |
---|
[29] | 64 | public : ~Interface (); |
---|
| 65 | |
---|
| 66 | public : void set_comment (string comment); |
---|
[40] | 67 | protected : string get_comment (void ); |
---|
[29] | 68 | |
---|
[40] | 69 | protected : string signal_name (string name_interface, |
---|
| 70 | string name_signal , |
---|
| 71 | direction_t direction ); |
---|
| 72 | |
---|
| 73 | protected : string get_signal (void); |
---|
[31] | 74 | public : Signal * set_signal (string name , |
---|
[29] | 75 | direction_t direction, |
---|
| 76 | uint32_t size , |
---|
| 77 | presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES); |
---|
| 78 | |
---|
| 79 | #ifdef SYSTEMC |
---|
| 80 | public : sc_in_clk * set_signal_clk (string name , |
---|
| 81 | uint32_t size , |
---|
| 82 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
| 83 | { |
---|
[38] | 84 | log_printf(FUNC,Behavioural,"set_signal_clk","Begin"); |
---|
| 85 | |
---|
[31] | 86 | Signal * sig = set_signal (name, IN , size, presence_port); |
---|
| 87 | sc_in_clk * signal = new sc_in_clk (sig->_name.c_str()); |
---|
[38] | 88 | |
---|
| 89 | log_printf(FUNC,Behavioural,"set_signal_clk","End"); |
---|
| 90 | |
---|
[29] | 91 | return signal; |
---|
| 92 | }; |
---|
| 93 | |
---|
| 94 | public : template <typename T> |
---|
| 95 | sc_in <T> * set_signal_in (string name , |
---|
| 96 | uint32_t size , |
---|
| 97 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
| 98 | { |
---|
[38] | 99 | log_printf(FUNC,Behavioural,"set_signal_in","Begin"); |
---|
| 100 | |
---|
[31] | 101 | Signal * sig = set_signal (name, IN , size, presence_port); |
---|
[38] | 102 | sc_in <T> * port = new sc_in <T> (sig->_name.c_str()); |
---|
| 103 | #ifdef VHDL_TESTBENCH |
---|
| 104 | sig->alloc<T> (static_cast<void *>(port)); |
---|
| 105 | #endif |
---|
| 106 | |
---|
| 107 | log_printf(FUNC,Behavioural,"set_signal_in","End"); |
---|
| 108 | |
---|
| 109 | return port; |
---|
[29] | 110 | }; |
---|
| 111 | |
---|
| 112 | public : template <typename T> |
---|
| 113 | sc_out <T> * set_signal_out (string name , |
---|
| 114 | uint32_t size , |
---|
| 115 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
| 116 | { |
---|
[38] | 117 | log_printf(FUNC,Behavioural,"set_signal_out","Begin"); |
---|
| 118 | |
---|
[31] | 119 | Signal * sig = set_signal (name, OUT , size, presence_port); |
---|
[38] | 120 | sc_out <T> * port = new sc_out <T> (sig->_name.c_str()); |
---|
| 121 | #ifdef VHDL_TESTBENCH |
---|
| 122 | sig->alloc<T> (static_cast<void *>(port)); |
---|
| 123 | #endif |
---|
| 124 | |
---|
| 125 | log_printf(FUNC,Behavioural,"set_signal_out","End"); |
---|
| 126 | |
---|
| 127 | return port; |
---|
[29] | 128 | }; |
---|
| 129 | #endif |
---|
| 130 | |
---|
| 131 | #ifdef VHDL |
---|
| 132 | public : void set_port (Vhdl * & vhdl); |
---|
| 133 | #endif |
---|
| 134 | #ifdef VHDL_TESTBENCH |
---|
| 135 | public : void set_port (Vhdl_Testbench * & vhdl_testbench); |
---|
| 136 | #endif |
---|
| 137 | |
---|
[31] | 138 | #ifdef POSITION |
---|
| 139 | public : void port_map (void * entity, |
---|
| 140 | void * interface); |
---|
| 141 | #endif |
---|
| 142 | |
---|
[38] | 143 | #ifdef VHDL_TESTBENCH |
---|
[40] | 144 | public : void testbench_cycle (void); |
---|
[38] | 145 | public : void testbench (Vhdl_Testbench * & vhdl_testbench); |
---|
| 146 | #endif |
---|
| 147 | |
---|
[29] | 148 | public : XML toXML (void); |
---|
[31] | 149 | #ifdef POSITION |
---|
| 150 | public : XML toXML_mapping (void); |
---|
| 151 | #endif |
---|
[29] | 152 | public : friend ostream& operator<< (ostream& output_stream, |
---|
| 153 | morpheo::behavioural::Interface & x); |
---|
| 154 | |
---|
| 155 | }; |
---|
| 156 | |
---|
| 157 | }; // end namespace behavioural |
---|
| 158 | }; // end namespace morpheo |
---|
| 159 | |
---|
| 160 | #endif |
---|