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/Debug.h" |
---|
29 | |
---|
30 | using namespace std; |
---|
31 | |
---|
32 | namespace morpheo { |
---|
33 | namespace behavioural { |
---|
34 | |
---|
35 | class Interface |
---|
36 | { |
---|
37 | // -----[ fields ]---------------------------------------------------- |
---|
38 | private : const string _name ; |
---|
39 | private : const direction_t _direction ; |
---|
40 | private : const localisation_t _localisation ; |
---|
41 | private : string _comment ; |
---|
42 | private : list<Signal> _list_signal ; |
---|
43 | |
---|
44 | // -----[ methods ]--------------------------------------------------- |
---|
45 | public : Interface (string name , |
---|
46 | direction_t direction , |
---|
47 | localisation_t localisation); |
---|
48 | |
---|
49 | public : ~Interface (); |
---|
50 | |
---|
51 | public : void set_comment (string comment); |
---|
52 | public : string get_comment (void ); |
---|
53 | |
---|
54 | public : string set_signal (Signal signal ); |
---|
55 | public : string set_signal (string name , |
---|
56 | direction_t direction, |
---|
57 | uint32_t size , |
---|
58 | presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES); |
---|
59 | |
---|
60 | #ifdef SYSTEMC |
---|
61 | public : sc_in_clk * set_signal_clk (string name , |
---|
62 | uint32_t size , |
---|
63 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
64 | { |
---|
65 | string str = set_signal (name, IN , size, presence_port); |
---|
66 | sc_in_clk * signal = new sc_in_clk (str.c_str()); |
---|
67 | return signal; |
---|
68 | }; |
---|
69 | |
---|
70 | public : template <typename T> |
---|
71 | sc_in <T> * set_signal_in (string name , |
---|
72 | uint32_t size , |
---|
73 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
74 | { |
---|
75 | string str = set_signal (name, IN , size, presence_port); |
---|
76 | sc_in <T> * signal = new sc_in <T> (str.c_str()); |
---|
77 | return signal; |
---|
78 | }; |
---|
79 | |
---|
80 | public : template <typename T> |
---|
81 | sc_out <T> * set_signal_out (string name , |
---|
82 | uint32_t size , |
---|
83 | presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES) |
---|
84 | { |
---|
85 | string str = set_signal (name, OUT , size, presence_port); |
---|
86 | sc_out <T> * signal = new sc_out <T> (str.c_str()); |
---|
87 | return signal; |
---|
88 | }; |
---|
89 | #endif |
---|
90 | |
---|
91 | public : string get_signal (void); |
---|
92 | |
---|
93 | #ifdef VHDL |
---|
94 | public : void set_port (Vhdl * & vhdl); |
---|
95 | #endif |
---|
96 | #ifdef VHDL_TESTBENCH |
---|
97 | public : void set_port (Vhdl_Testbench * & vhdl_testbench); |
---|
98 | #endif |
---|
99 | |
---|
100 | public : XML toXML (void); |
---|
101 | |
---|
102 | public : friend ostream& operator<< (ostream& output_stream, |
---|
103 | morpheo::behavioural::Interface & x); |
---|
104 | |
---|
105 | }; |
---|
106 | |
---|
107 | }; // end namespace behavioural |
---|
108 | }; // end namespace morpheo |
---|
109 | |
---|
110 | #endif |
---|