1 | #ifndef morpheo_Morpheo_h |
---|
2 | #define morpheo_Morpheo_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Morpheo.h 88 2008-12-10 18:31:39Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include "Behavioural/Core/include/Core.h" |
---|
16 | #include "Behavioural/Custom/include/Custom.h" |
---|
17 | #include "Behavioural/Core/include/Parameters.h" |
---|
18 | #include "Behavioural/Configuration/include/Configuration.h" |
---|
19 | |
---|
20 | #include "TopLevel/include/Types.h" |
---|
21 | |
---|
22 | #ifdef STATISTICS |
---|
23 | #include "Behavioural/include/Stat.h" |
---|
24 | #endif |
---|
25 | #include "Behavioural/include/Component.h" |
---|
26 | #ifdef VHDL |
---|
27 | #include "Behavioural/include/Vhdl.h" |
---|
28 | #endif |
---|
29 | #include "Behavioural/include/Usage.h" |
---|
30 | |
---|
31 | #include "Common/include/ToString.h" |
---|
32 | #include "Common/include/Debug.h" |
---|
33 | |
---|
34 | |
---|
35 | #include <iostream> |
---|
36 | |
---|
37 | namespace morpheo { |
---|
38 | |
---|
39 | class Morpheo |
---|
40 | #if SYSTEMC |
---|
41 | : public sc_module |
---|
42 | #endif |
---|
43 | { |
---|
44 | // -----[ fields ]---------------------------------------------------- |
---|
45 | // Parameters |
---|
46 | private : std::string _name; |
---|
47 | private : behavioural::Tusage_t _usage; |
---|
48 | private : morpheo::behavioural::configuration::Configuration * _config; |
---|
49 | private : morpheo::behavioural::core::Parameters * _param_core; |
---|
50 | #ifdef STATISTICS |
---|
51 | private : morpheo::behavioural::Parameters_Statistics * _param_statistics; |
---|
52 | private : behavioural::Stat * _stat; |
---|
53 | #endif |
---|
54 | |
---|
55 | private : behavioural::Component * _component; |
---|
56 | private : behavioural::Interfaces * _interfaces; |
---|
57 | |
---|
58 | // -----[ interface parameters ]-------------------------------------- |
---|
59 | public : uint32_t _nb_thread ; |
---|
60 | |
---|
61 | public : uint32_t _nb_icache_port ; |
---|
62 | public : uint32_t _size_icache_thread_id ; |
---|
63 | public : uint32_t _size_icache_packet_id ; |
---|
64 | public : uint32_t _size_icache_address ; |
---|
65 | public : uint32_t _size_icache_type ; |
---|
66 | public : uint32_t _size_icache_error ; |
---|
67 | public : uint32_t * _icache_nb_instruction ;//[nb_icache_port] |
---|
68 | public : uint32_t _size_icache_instruction ; |
---|
69 | |
---|
70 | public : uint32_t _nb_dcache_port ; |
---|
71 | public : uint32_t _size_dcache_thread_id ; |
---|
72 | public : uint32_t _size_dcache_packet_id ; |
---|
73 | public : uint32_t _size_dcache_address ; |
---|
74 | public : uint32_t _size_dcache_data ; |
---|
75 | public : uint32_t _size_dcache_type ; |
---|
76 | public : uint32_t _size_dcache_error ; |
---|
77 | |
---|
78 | public : bool _have_port_icache_thread_id; |
---|
79 | public : bool _have_port_icache_packet_id; |
---|
80 | public : bool _have_port_dcache_thread_id; |
---|
81 | public : bool _have_port_dcache_packet_id; |
---|
82 | |
---|
83 | #ifdef SYSTEMC |
---|
84 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
85 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | public : SC_CLOCK * in_CLOCK ; |
---|
87 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
88 | |
---|
89 | // ~~~~~[ Interface "icache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
90 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_REQ_VAL ;//[nb_icache_port] |
---|
91 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_REQ_ACK ;//[nb_icache_port] |
---|
92 | public : SC_OUT(Ticache_context_t ) ** out_ICACHE_REQ_THREAD_ID ;//[nb_icache_port] |
---|
93 | public : SC_OUT(Ticache_packet_t ) ** out_ICACHE_REQ_PACKET_ID ;//[nb_icache_port] |
---|
94 | public : SC_OUT(Ticache_address_t ) ** out_ICACHE_REQ_ADDRESS ;//[nb_icache_port] |
---|
95 | public : SC_OUT(Ticache_type_t ) ** out_ICACHE_REQ_TYPE ;//[nb_icache_port] |
---|
96 | |
---|
97 | // ~~~~~[ Interface "icache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
98 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_RSP_VAL ;//[nb_icache_port] |
---|
99 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_RSP_ACK ;//[nb_icache_port] |
---|
100 | public : SC_IN (Ticache_context_t ) ** in_ICACHE_RSP_THREAD_ID ;//[nb_icache_port] |
---|
101 | public : SC_IN (Ticache_packet_t ) ** in_ICACHE_RSP_PACKET_ID ;//[nb_icache_port] |
---|
102 | public : SC_IN (Ticache_instruction_t) *** in_ICACHE_RSP_INSTRUCTION ;//[nb_icache_port][icache_nb_instruction] |
---|
103 | public : SC_IN (Ticache_error_t ) ** in_ICACHE_RSP_ERROR ;//[nb_icache_port] |
---|
104 | |
---|
105 | // ~~~~~[ Interface "dcache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
106 | public : SC_OUT(Tcontrol_t ) ** out_DCACHE_REQ_VAL ;//[nb_dcache_port] |
---|
107 | public : SC_IN (Tcontrol_t ) ** in_DCACHE_REQ_ACK ;//[nb_dcache_port] |
---|
108 | public : SC_OUT(Tdcache_context_t ) ** out_DCACHE_REQ_THREAD_ID ;//[nb_dcache_port] |
---|
109 | public : SC_OUT(Tdcache_packet_t ) ** out_DCACHE_REQ_PACKET_ID ;//[nb_dcache_port] |
---|
110 | public : SC_OUT(Tdcache_address_t ) ** out_DCACHE_REQ_ADDRESS ;//[nb_dcache_port] |
---|
111 | public : SC_OUT(Tdcache_data_t ) ** out_DCACHE_REQ_WDATA ;//[nb_dcache_port] |
---|
112 | public : SC_OUT(Tdcache_type_t ) ** out_DCACHE_REQ_TYPE ;//[nb_dcache_port] |
---|
113 | |
---|
114 | // ~~~~~[ Interface "dcache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
115 | public : SC_IN (Tcontrol_t ) ** in_DCACHE_RSP_VAL ;//[nb_dcache_port] |
---|
116 | public : SC_OUT(Tcontrol_t ) ** out_DCACHE_RSP_ACK ;//[nb_dcache_port] |
---|
117 | public : SC_IN (Tdcache_context_t ) ** in_DCACHE_RSP_THREAD_ID ;//[nb_dcache_port] |
---|
118 | public : SC_IN (Tdcache_packet_t ) ** in_DCACHE_RSP_PACKET_ID ;//[nb_dcache_port] |
---|
119 | public : SC_IN (Tdcache_data_t ) ** in_DCACHE_RSP_RDATA ;//[nb_dcache_port] |
---|
120 | public : SC_IN (Tdcache_error_t ) ** in_DCACHE_RSP_ERROR ;//[nb_dcache_port] |
---|
121 | |
---|
122 | // ~~~~~[ Interface : "interrupt" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
123 | public : SC_IN (Tcontrol_t ) ** in_INTERRUPT_ENABLE ;//[nb_thread] - Interrupt Exception |
---|
124 | |
---|
125 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
126 | private : morpheo::behavioural::core::Core * _component_core ; |
---|
127 | |
---|
128 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
129 | |
---|
130 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
131 | #endif |
---|
132 | |
---|
133 | // -----[ Methods ]--------------------------------------------------- |
---|
134 | |
---|
135 | #ifdef SYSTEMC |
---|
136 | SC_HAS_PROCESS (Morpheo); |
---|
137 | #endif |
---|
138 | public : Morpheo |
---|
139 | ( |
---|
140 | #ifdef SYSTEMC |
---|
141 | sc_module_name name, |
---|
142 | #else |
---|
143 | std::string name, |
---|
144 | #endif |
---|
145 | std::string filename_simulator, |
---|
146 | std::string filename_generator, |
---|
147 | std::string filename_instance , |
---|
148 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void) |
---|
149 | ); |
---|
150 | public : ~Morpheo (void); |
---|
151 | |
---|
152 | private : std::string header (void); |
---|
153 | |
---|
154 | private : void configuration (std::string filename_simulator, |
---|
155 | std::string filename_generator, |
---|
156 | std::string filename_instance , |
---|
157 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void)); |
---|
158 | |
---|
159 | private : void allocation ( |
---|
160 | #ifdef STATISTICS |
---|
161 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
162 | #else |
---|
163 | void |
---|
164 | #endif |
---|
165 | ); |
---|
166 | private : void deallocation (void); |
---|
167 | |
---|
168 | #ifdef SYSTEMC |
---|
169 | # if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
170 | private : void transition (void); |
---|
171 | # endif |
---|
172 | #endif |
---|
173 | |
---|
174 | #if VHDL |
---|
175 | private : void vhdl (void); |
---|
176 | #endif |
---|
177 | |
---|
178 | #ifdef STATISTICS |
---|
179 | private : void statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
180 | private : void statistics_deallocation (void); |
---|
181 | #endif |
---|
182 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
183 | private : void end_cycle (void); |
---|
184 | #endif |
---|
185 | |
---|
186 | #ifdef SYSTEMC |
---|
187 | public : bool simulation_end (void); |
---|
188 | #endif |
---|
189 | }; |
---|
190 | |
---|
191 | }; // end namespace morpheo |
---|
192 | |
---|
193 | #endif |
---|