1 | #ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_write_unit_write_unit_execute_queue_Execute_queue_h |
---|
2 | #define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_write_unit_write_unit_execute_queue_Execute_queue_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include <iostream> |
---|
16 | #include <queue> |
---|
17 | #include "Common/include/ToString.h" |
---|
18 | #include "Common/include/Debug.h" |
---|
19 | #include "Behavioural/include/Types.h" |
---|
20 | |
---|
21 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/include/Parameters.h" |
---|
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 | namespace morpheo { |
---|
32 | namespace behavioural { |
---|
33 | |
---|
34 | namespace core { |
---|
35 | namespace multi_execute_loop { |
---|
36 | namespace execute_loop { |
---|
37 | namespace multi_write_unit { |
---|
38 | namespace write_unit { |
---|
39 | namespace execute_queue { |
---|
40 | |
---|
41 | |
---|
42 | class execute_queue_entry_t |
---|
43 | { |
---|
44 | public : Tcontext_t _context_id ; |
---|
45 | public : Tcontext_t _front_end_id ; |
---|
46 | public : Tcontext_t _ooo_engine_id; |
---|
47 | public : Tpacket_t _packet_id ; |
---|
48 | //public : Toperation_t _operation ; |
---|
49 | //public : Ttype_t _type ; |
---|
50 | public : Tspecial_data_t _flags ; |
---|
51 | public : Texception_t _exception ; |
---|
52 | public : Tcontrol_t _no_sequence ; |
---|
53 | public : Tgeneral_data_t _address ; |
---|
54 | |
---|
55 | public : execute_queue_entry_t (Tcontext_t context_id , |
---|
56 | Tcontext_t front_end_id , |
---|
57 | Tcontext_t ooo_engine_id, |
---|
58 | Tpacket_t packet_id , |
---|
59 | //Toperation_t operation , |
---|
60 | //Ttype_t type , |
---|
61 | Tspecial_data_t flags , |
---|
62 | Texception_t exception , |
---|
63 | Tcontrol_t no_sequence , |
---|
64 | Tgeneral_data_t address ) |
---|
65 | { |
---|
66 | _context_id = context_id ; |
---|
67 | _front_end_id = front_end_id ; |
---|
68 | _ooo_engine_id = ooo_engine_id; |
---|
69 | _packet_id = packet_id ; |
---|
70 | //_operation = operation ; |
---|
71 | //_type = type ; |
---|
72 | _flags = flags ; |
---|
73 | _exception = exception ; |
---|
74 | _no_sequence = no_sequence ; |
---|
75 | _address = address ; |
---|
76 | }; |
---|
77 | }; |
---|
78 | |
---|
79 | |
---|
80 | class Execute_queue |
---|
81 | #if SYSTEMC |
---|
82 | : public sc_module |
---|
83 | #endif |
---|
84 | { |
---|
85 | // -----[ fields ]---------------------------------------------------- |
---|
86 | // Parameters |
---|
87 | protected : const std::string _name; |
---|
88 | protected : const Parameters * _param; |
---|
89 | private : const Tusage_t _usage; |
---|
90 | |
---|
91 | #ifdef STATISTICS |
---|
92 | private : Stat * _stat; |
---|
93 | |
---|
94 | private : counter_t * _stat_use_queue; |
---|
95 | private : counter_t * _stat_average_use_queue; |
---|
96 | private : counter_t * _stat_percent_use_queue; |
---|
97 | #endif |
---|
98 | |
---|
99 | public : Component * _component; |
---|
100 | private : Interfaces * _interfaces; |
---|
101 | |
---|
102 | #ifdef SYSTEMC |
---|
103 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
104 | // Interface |
---|
105 | public : SC_CLOCK * in_CLOCK ; |
---|
106 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
107 | |
---|
108 | // -----[ Interface "Execute_queue_in" ]------------------------------ |
---|
109 | public : SC_IN (Tcontrol_t ) * in_EXECUTE_QUEUE_IN_VAL ; |
---|
110 | public : SC_OUT(Tcontrol_t ) * out_EXECUTE_QUEUE_IN_ACK ; |
---|
111 | public : SC_IN (Tcontext_t ) * in_EXECUTE_QUEUE_IN_CONTEXT_ID ; |
---|
112 | public : SC_IN (Tcontext_t ) * in_EXECUTE_QUEUE_IN_FRONT_END_ID ; |
---|
113 | public : SC_IN (Tcontext_t ) * in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID ; |
---|
114 | public : SC_IN (Tpacket_t ) * in_EXECUTE_QUEUE_IN_PACKET_ID ; |
---|
115 | //public : SC_IN (Toperation_t ) * in_EXECUTE_QUEUE_IN_OPERATION ; |
---|
116 | //public : SC_IN (Ttype_t ) * in_EXECUTE_QUEUE_IN_TYPE ; |
---|
117 | public : SC_IN (Tspecial_data_t ) * in_EXECUTE_QUEUE_IN_FLAGS ; |
---|
118 | public : SC_IN (Texception_t ) * in_EXECUTE_QUEUE_IN_EXCEPTION ; |
---|
119 | public : SC_IN (Tcontrol_t ) * in_EXECUTE_QUEUE_IN_NO_SEQUENCE ; |
---|
120 | public : SC_IN (Tgeneral_data_t ) * in_EXECUTE_QUEUE_IN_ADDRESS ; |
---|
121 | |
---|
122 | // -----[ Interface "Execute_queue_out" ]----------------------------- |
---|
123 | public : SC_OUT(Tcontrol_t ) * out_EXECUTE_QUEUE_OUT_VAL ; |
---|
124 | public : SC_IN (Tcontrol_t ) * in_EXECUTE_QUEUE_OUT_ACK ; |
---|
125 | public : SC_OUT(Tcontext_t ) * out_EXECUTE_QUEUE_OUT_CONTEXT_ID ; |
---|
126 | public : SC_OUT(Tcontext_t ) * out_EXECUTE_QUEUE_OUT_FRONT_END_ID ; |
---|
127 | public : SC_OUT(Tcontext_t ) * out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID; |
---|
128 | public : SC_OUT(Tpacket_t ) * out_EXECUTE_QUEUE_OUT_PACKET_ID ; |
---|
129 | //public : SC_OUT(Toperation_t ) * out_EXECUTE_QUEUE_OUT_OPERATION ; |
---|
130 | //public : SC_OUT(Ttype_t ) * out_EXECUTE_QUEUE_OUT_TYPE ; |
---|
131 | public : SC_OUT(Tspecial_data_t ) * out_EXECUTE_QUEUE_OUT_FLAGS ; |
---|
132 | public : SC_OUT(Texception_t ) * out_EXECUTE_QUEUE_OUT_EXCEPTION ; |
---|
133 | public : SC_OUT(Tcontrol_t ) * out_EXECUTE_QUEUE_OUT_NO_SEQUENCE ; |
---|
134 | public : SC_OUT(Tgeneral_data_t ) * out_EXECUTE_QUEUE_OUT_ADDRESS ; |
---|
135 | |
---|
136 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
137 | |
---|
138 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
139 | private : queue<execute_queue_entry_t *> * _queue; |
---|
140 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
141 | private : Tcontrol_t internal_EXECUTE_QUEUE_IN_ACK ; |
---|
142 | private : Tcontrol_t internal_EXECUTE_QUEUE_OUT_VAL; |
---|
143 | #endif |
---|
144 | |
---|
145 | // -----[ Methods ]--------------------------------------------------- |
---|
146 | |
---|
147 | #ifdef SYSTEMC |
---|
148 | SC_HAS_PROCESS (Execute_queue); |
---|
149 | #endif |
---|
150 | public : Execute_queue |
---|
151 | ( |
---|
152 | #ifdef SYSTEMC |
---|
153 | sc_module_name name, |
---|
154 | #else |
---|
155 | std::string name, |
---|
156 | #endif |
---|
157 | #ifdef STATISTICS |
---|
158 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
159 | #endif |
---|
160 | Parameters * param, |
---|
161 | morpheo::behavioural::Tusage_t usage=USE_ALL |
---|
162 | ); |
---|
163 | public : ~Execute_queue (void); |
---|
164 | |
---|
165 | private : void allocation (void); |
---|
166 | private : void deallocation (void); |
---|
167 | |
---|
168 | #ifdef SYSTEMC |
---|
169 | public : void transition (void); |
---|
170 | public : void genMoore (void); |
---|
171 | #endif |
---|
172 | #ifdef STATISTICS |
---|
173 | public : void statistics_declaration (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
174 | public : std::string statistics_print (uint32_t depth); |
---|
175 | #endif |
---|
176 | |
---|
177 | #if VHDL |
---|
178 | public : void vhdl (void); |
---|
179 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
180 | private : void vhdl_body (Vhdl * & vhdl); |
---|
181 | #endif |
---|
182 | |
---|
183 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
184 | private : void end_cycle (void); |
---|
185 | #endif |
---|
186 | }; |
---|
187 | |
---|
188 | }; // end namespace execute_queue |
---|
189 | }; // end namespace write_unit |
---|
190 | }; // end namespace multi_write_unit |
---|
191 | }; // end namespace execute_loop |
---|
192 | }; // end namespace multi_execute_loop |
---|
193 | }; // end namespace core |
---|
194 | |
---|
195 | }; // end namespace behavioural |
---|
196 | }; // end namespace morpheo |
---|
197 | |
---|
198 | #endif |
---|