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 | #ifdef POSITION |
---|
47 | private : bool _is_map ; |
---|
48 | private : void * _entity_map ; // Entity -> erreur cyclique |
---|
49 | private : void * _interface_map; // pour être homogène avec _entity_map |
---|
50 | #endif |
---|
51 | private : list<Signal> * _list_signal ; |
---|
52 | |
---|
53 | // -----[ methods ]--------------------------------------------------- |
---|
54 | public : Interface (string name , |
---|
55 | direction_t direction , |
---|
56 | localisation_t localisation); |
---|
57 | |
---|
58 | public : Interface (const Interface & interface); |
---|
59 | public : ~Interface (); |
---|
60 | |
---|
61 | public : void set_comment (string comment); |
---|
62 | private : string get_comment (void ); |
---|
63 | |
---|
64 | private : string get_signal (void); |
---|
65 | public : Signal * set_signal (string name , |
---|
66 | direction_t direction, |
---|
67 | uint32_t size , |
---|
68 | presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES); |
---|
69 | |
---|
70 | #ifdef SYSTEMC |
---|
71 | public : sc_in_clk * set_signal_clk (string name , |
---|
72 | uint32_t size , |
---|
73 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
74 | { |
---|
75 | Signal * sig = set_signal (name, IN , size, presence_port); |
---|
76 | sc_in_clk * signal = new sc_in_clk (sig->_name.c_str()); |
---|
77 | return signal; |
---|
78 | }; |
---|
79 | |
---|
80 | public : template <typename T> |
---|
81 | sc_in <T> * set_signal_in (string name , |
---|
82 | uint32_t size , |
---|
83 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
84 | { |
---|
85 | Signal * sig = set_signal (name, IN , size, presence_port); |
---|
86 | sc_in <T> * signal = new sc_in <T> (sig->_name.c_str()); |
---|
87 | return signal; |
---|
88 | }; |
---|
89 | |
---|
90 | public : template <typename T> |
---|
91 | sc_out <T> * set_signal_out (string name , |
---|
92 | uint32_t size , |
---|
93 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
94 | { |
---|
95 | Signal * sig = set_signal (name, OUT , size, presence_port); |
---|
96 | sc_out <T> * signal = new sc_out <T> (sig->_name.c_str()); |
---|
97 | return signal; |
---|
98 | }; |
---|
99 | #endif |
---|
100 | |
---|
101 | #ifdef VHDL |
---|
102 | public : void set_port (Vhdl * & vhdl); |
---|
103 | #endif |
---|
104 | #ifdef VHDL_TESTBENCH |
---|
105 | public : void set_port (Vhdl_Testbench * & vhdl_testbench); |
---|
106 | #endif |
---|
107 | |
---|
108 | #ifdef POSITION |
---|
109 | public : void port_map (void * entity, |
---|
110 | void * interface); |
---|
111 | #endif |
---|
112 | |
---|
113 | public : XML toXML (void); |
---|
114 | #ifdef POSITION |
---|
115 | public : XML toXML_mapping (void); |
---|
116 | #endif |
---|
117 | public : friend ostream& operator<< (ostream& output_stream, |
---|
118 | morpheo::behavioural::Interface & x); |
---|
119 | |
---|
120 | }; |
---|
121 | |
---|
122 | }; // end namespace behavioural |
---|
123 | }; // end namespace morpheo |
---|
124 | |
---|
125 | #endif |
---|