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