1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Reservation_station.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_execute_loop { |
---|
15 | namespace execute_loop { |
---|
16 | namespace multi_read_unit { |
---|
17 | namespace read_unit { |
---|
18 | namespace reservation_station { |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | #undef FUNCTION |
---|
23 | #define FUNCTION "Reservation_station::allocation" |
---|
24 | void Reservation_station::allocation (void) |
---|
25 | { |
---|
26 | string rename; |
---|
27 | |
---|
28 | log_printf(FUNC,Reservation_station,FUNCTION,"Begin"); |
---|
29 | |
---|
30 | _component = new Component (); |
---|
31 | |
---|
32 | Entity * entity = _component->set_entity (_name |
---|
33 | ,"Reservation_station" |
---|
34 | #ifdef POSITION |
---|
35 | ,COMBINATORY |
---|
36 | #endif |
---|
37 | ); |
---|
38 | |
---|
39 | _interfaces = entity->set_interfaces(); |
---|
40 | |
---|
41 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
42 | |
---|
43 | Interface * interface = _interfaces->set_interface("" |
---|
44 | #ifdef POSITION |
---|
45 | ,IN |
---|
46 | ,SOUTH, |
---|
47 | "Generalist interface" |
---|
48 | #endif |
---|
49 | ); |
---|
50 | |
---|
51 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
52 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
53 | |
---|
54 | // ~~~~~[ Interface : "reservation_station_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
55 | { |
---|
56 | Interface_fifo * interface = _interfaces->set_interface("reservation_station_in" |
---|
57 | #ifdef POSITION |
---|
58 | ,IN |
---|
59 | ,EAST |
---|
60 | ,"Input of reservation_station" |
---|
61 | #endif |
---|
62 | ); |
---|
63 | |
---|
64 | in_RESERVATION_STATION_IN_VAL = interface->set_signal_valack_in (VAL); |
---|
65 | out_RESERVATION_STATION_IN_ACK = interface->set_signal_valack_out (ACK); |
---|
66 | in_RESERVATION_STATION_IN_CONTEXT_ID = interface->set_signal_in <Tcontext_t > ("context_id" ,_param->_size_context_id ); |
---|
67 | in_RESERVATION_STATION_IN_PACKET_ID = interface->set_signal_in <Tpacket_t > ("packet_id" ,_param->_size_packet_id ); |
---|
68 | in_RESERVATION_STATION_IN_OPERATION = interface->set_signal_in <Toperation_t > ("operation" ,_param->_size_operation ); |
---|
69 | in_RESERVATION_STATION_IN_TYPE = interface->set_signal_in <Ttype_t > ("type" ,_param->_size_type ); |
---|
70 | in_RESERVATION_STATION_IN_HAS_IMMEDIAT = interface->set_signal_in <Tcontrol_t > ("has_immediat",1 ); |
---|
71 | in_RESERVATION_STATION_IN_IMMEDIAT = interface->set_signal_in <Tgeneral_data_t > ("immediat" ,_param->_size_general_data ); |
---|
72 | // in_RESERVATION_STATION_IN_READ_RA = interface->set_signal_in <Tcontrol_t > ("read_ra" ,1 ); |
---|
73 | in_RESERVATION_STATION_IN_NUM_REG_RA = interface->set_signal_in <Tgeneral_address_t> ("num_reg_ra" ,_param->_size_general_register ); |
---|
74 | in_RESERVATION_STATION_IN_DATA_RA_VAL = interface->set_signal_in <Tcontrol_t > ("data_ra_val" ,1 ); |
---|
75 | in_RESERVATION_STATION_IN_DATA_RA = interface->set_signal_in <Tgeneral_data_t > ("data_ra" ,_param->_size_general_data ); |
---|
76 | // in_RESERVATION_STATION_IN_READ_RB = interface->set_signal_in <Tcontrol_t > ("read_rb" ,1 ); |
---|
77 | in_RESERVATION_STATION_IN_NUM_REG_RB = interface->set_signal_in <Tgeneral_address_t> ("num_reg_rb" ,_param->_size_general_register ); |
---|
78 | in_RESERVATION_STATION_IN_DATA_RB_VAL = interface->set_signal_in <Tcontrol_t > ("data_rb_val" ,1 ); |
---|
79 | in_RESERVATION_STATION_IN_DATA_RB = interface->set_signal_in <Tgeneral_data_t > ("data_rb" ,_param->_size_general_data ); |
---|
80 | // in_RESERVATION_STATION_IN_READ_RC = interface->set_signal_in <Tcontrol_t > ("read_rc" ,1 ); |
---|
81 | in_RESERVATION_STATION_IN_NUM_REG_RC = interface->set_signal_in <Tspecial_address_t> ("num_reg_rc" ,_param->_size_special_register ); |
---|
82 | in_RESERVATION_STATION_IN_DATA_RC_VAL = interface->set_signal_in <Tcontrol_t > ("data_rc_val" ,1 ); |
---|
83 | in_RESERVATION_STATION_IN_DATA_RC = interface->set_signal_in <Tspecial_data_t > ("data_rc" ,_param->_size_special_data ); |
---|
84 | in_RESERVATION_STATION_IN_WRITE_RD = interface->set_signal_in <Tcontrol_t > ("write_rd" ,1 ); |
---|
85 | in_RESERVATION_STATION_IN_NUM_REG_RD = interface->set_signal_in <Tgeneral_address_t> ("num_reg_rd" ,_param->_size_general_register ); |
---|
86 | in_RESERVATION_STATION_IN_WRITE_RE = interface->set_signal_in <Tcontrol_t > ("write_re" ,1 ); |
---|
87 | in_RESERVATION_STATION_IN_NUM_REG_RE = interface->set_signal_in <Tspecial_address_t> ("num_reg_re" ,_param->_size_special_register ); |
---|
88 | } |
---|
89 | |
---|
90 | // ~~~~~[ Interface : "reservation_station_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
91 | out_RESERVATION_STATION_OUT_VAL = new SC_OUT(Tcontrol_t ) * [_param->_size_queue]; |
---|
92 | in_RESERVATION_STATION_OUT_ACK = new SC_IN (Tcontrol_t ) * [_param->_size_queue]; |
---|
93 | out_RESERVATION_STATION_OUT_CONTEXT_ID = new SC_OUT(Tcontext_t ) * [_param->_size_queue]; |
---|
94 | out_RESERVATION_STATION_OUT_PACKET_ID = new SC_OUT(Tpacket_t ) * [_param->_size_queue]; |
---|
95 | out_RESERVATION_STATION_OUT_OPERATION = new SC_OUT(Toperation_t ) * [_param->_size_queue]; |
---|
96 | out_RESERVATION_STATION_OUT_TYPE = new SC_OUT(Ttype_t ) * [_param->_size_queue]; |
---|
97 | out_RESERVATION_STATION_OUT_HAS_IMMEDIAT= new SC_OUT(Tcontrol_t ) * [_param->_size_queue]; |
---|
98 | out_RESERVATION_STATION_OUT_IMMEDIAT = new SC_OUT(Tgeneral_data_t ) * [_param->_size_queue]; |
---|
99 | out_RESERVATION_STATION_OUT_DATA_RA = new SC_OUT(Tgeneral_data_t ) * [_param->_size_queue]; |
---|
100 | out_RESERVATION_STATION_OUT_DATA_RB = new SC_OUT(Tgeneral_data_t ) * [_param->_size_queue]; |
---|
101 | out_RESERVATION_STATION_OUT_DATA_RC = new SC_OUT(Tspecial_data_t ) * [_param->_size_queue]; |
---|
102 | out_RESERVATION_STATION_OUT_WRITE_RD = new SC_OUT(Tcontrol_t ) * [_param->_size_queue]; |
---|
103 | out_RESERVATION_STATION_OUT_NUM_REG_RD = new SC_OUT(Tgeneral_address_t) * [_param->_size_queue]; |
---|
104 | out_RESERVATION_STATION_OUT_WRITE_RE = new SC_OUT(Tcontrol_t ) * [_param->_size_queue]; |
---|
105 | out_RESERVATION_STATION_OUT_NUM_REG_RE = new SC_OUT(Tspecial_address_t) * [_param->_size_queue]; |
---|
106 | |
---|
107 | for (uint32_t i=0; i<_param->_size_queue; i++) |
---|
108 | { |
---|
109 | Interface_fifo * interface = _interfaces->set_interface("reservation_station_out_"+toString(i) |
---|
110 | #ifdef POSITION |
---|
111 | ,OUT |
---|
112 | ,WEST |
---|
113 | ,"Output of reservation_station" |
---|
114 | #endif |
---|
115 | ); |
---|
116 | out_RESERVATION_STATION_OUT_VAL [i] = interface->set_signal_valack_out(VAL); |
---|
117 | in_RESERVATION_STATION_OUT_ACK [i] = interface->set_signal_valack_in (ACK); |
---|
118 | out_RESERVATION_STATION_OUT_CONTEXT_ID [i] = interface->set_signal_out<Tcontext_t > ("context_id" ,_param->_size_context_id); |
---|
119 | out_RESERVATION_STATION_OUT_PACKET_ID [i] = interface->set_signal_out<Tpacket_t > ("packet_id" ,_param->_size_packet_id); |
---|
120 | out_RESERVATION_STATION_OUT_OPERATION [i] = interface->set_signal_out<Toperation_t > ("operation" ,_param->_size_operation); |
---|
121 | out_RESERVATION_STATION_OUT_TYPE [i] = interface->set_signal_out<Ttype_t > ("type" ,_param->_size_type); |
---|
122 | out_RESERVATION_STATION_OUT_HAS_IMMEDIAT [i] = interface->set_signal_out<Tcontrol_t > ("has_immediat",1); |
---|
123 | out_RESERVATION_STATION_OUT_IMMEDIAT [i] = interface->set_signal_out<Tgeneral_data_t > ("immediat" ,_param->_size_general_data); |
---|
124 | out_RESERVATION_STATION_OUT_DATA_RA [i] = interface->set_signal_out<Tgeneral_data_t > ("data_ra" ,_param->_size_general_data); |
---|
125 | out_RESERVATION_STATION_OUT_DATA_RB [i] = interface->set_signal_out<Tgeneral_data_t > ("data_rb" ,_param->_size_general_data); |
---|
126 | out_RESERVATION_STATION_OUT_DATA_RC [i] = interface->set_signal_out<Tspecial_data_t > ("data_rc" ,_param->_size_special_data); |
---|
127 | out_RESERVATION_STATION_OUT_WRITE_RD [i] = interface->set_signal_out<Tcontrol_t > ("write_rd" ,1); |
---|
128 | out_RESERVATION_STATION_OUT_NUM_REG_RD [i] = interface->set_signal_out<Tgeneral_address_t> ("num_reg_rd" ,_param->_size_general_register); |
---|
129 | out_RESERVATION_STATION_OUT_WRITE_RE [i] = interface->set_signal_out<Tcontrol_t > ("write_re" ,1); |
---|
130 | out_RESERVATION_STATION_OUT_NUM_REG_RE [i] = interface->set_signal_out<Tspecial_address_t> ("num_reg_re" ,_param->_size_special_register); |
---|
131 | } |
---|
132 | |
---|
133 | // ~~~~~[ Interface : "gpr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
134 | in_GPR_WRITE_VAL = new SC_IN (Tcontrol_t ) * [_param->_nb_gpr_write]; |
---|
135 | in_GPR_WRITE_CONTEXT_ID= new SC_IN (Tcontext_t ) * [_param->_nb_gpr_write]; |
---|
136 | in_GPR_WRITE_NUM_REG = new SC_IN (Tgeneral_address_t) * [_param->_nb_gpr_write]; |
---|
137 | in_GPR_WRITE_DATA = new SC_IN (Tgeneral_data_t ) * [_param->_nb_gpr_write]; |
---|
138 | |
---|
139 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
140 | { |
---|
141 | Interface_fifo * interface = _interfaces->set_interface("gpr_write_"+toString(i) |
---|
142 | #ifdef POSITION |
---|
143 | , IN |
---|
144 | ,SOUTH |
---|
145 | , "Interface with write queue to bypass the write in the RegisterFile." |
---|
146 | #endif |
---|
147 | ); |
---|
148 | |
---|
149 | in_GPR_WRITE_VAL [i] = interface->set_signal_valack_in (VAL); |
---|
150 | in_GPR_WRITE_CONTEXT_ID [i] = interface->set_signal_in <Tcontext_t > ("context_id",_param->_size_context_id); |
---|
151 | in_GPR_WRITE_NUM_REG [i] = interface->set_signal_in <Tgeneral_address_t> ("num_reg" ,_param->_size_general_register); |
---|
152 | in_GPR_WRITE_DATA [i] = interface->set_signal_in <Tgeneral_data_t > ("data" ,_param->_size_general_data); |
---|
153 | } |
---|
154 | |
---|
155 | // ~~~~~[ Interface : "spr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
156 | in_SPR_WRITE_VAL = new SC_IN (Tcontrol_t ) * [_param->_nb_spr_write]; |
---|
157 | in_SPR_WRITE_CONTEXT_ID= new SC_IN (Tcontext_t ) * [_param->_nb_spr_write]; |
---|
158 | in_SPR_WRITE_NUM_REG = new SC_IN (Tspecial_address_t) * [_param->_nb_spr_write]; |
---|
159 | in_SPR_WRITE_DATA = new SC_IN (Tspecial_data_t ) * [_param->_nb_spr_write]; |
---|
160 | |
---|
161 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
162 | { |
---|
163 | Interface_fifo * interface = _interfaces->set_interface("spr_write_"+toString(i) |
---|
164 | #ifdef POSITION |
---|
165 | , IN |
---|
166 | ,SOUTH |
---|
167 | , "Interface with write queue to bypass the write in the RegisterFile." |
---|
168 | #endif |
---|
169 | ); |
---|
170 | |
---|
171 | in_SPR_WRITE_VAL [i] = interface->set_signal_valack_in (VAL); |
---|
172 | in_SPR_WRITE_CONTEXT_ID [i] = interface->set_signal_in <Tcontext_t > ("context_id",_param->_size_context_id); |
---|
173 | in_SPR_WRITE_NUM_REG [i] = interface->set_signal_in <Tspecial_address_t> ("num_reg" ,_param->_size_special_register); |
---|
174 | in_SPR_WRITE_DATA [i] = interface->set_signal_in <Tspecial_data_t > ("data" ,_param->_size_special_data); |
---|
175 | } |
---|
176 | |
---|
177 | // ~~~~~[ Interface : "bypass_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
178 | in_BYPASS_WRITE_CONTEXT_ID = new SC_IN (Tcontext_t ) * [_param->_nb_bypass_write]; |
---|
179 | in_BYPASS_WRITE_GPR_VAL = new SC_IN (Tcontrol_t ) * [_param->_nb_bypass_write]; |
---|
180 | in_BYPASS_WRITE_GPR_NUM_REG = new SC_IN (Tgeneral_address_t) * [_param->_nb_bypass_write]; |
---|
181 | in_BYPASS_WRITE_GPR_DATA = new SC_IN (Tgeneral_data_t ) * [_param->_nb_bypass_write]; |
---|
182 | in_BYPASS_WRITE_SPR_VAL = new SC_IN (Tcontrol_t ) * [_param->_nb_bypass_write]; |
---|
183 | in_BYPASS_WRITE_SPR_NUM_REG = new SC_IN (Tspecial_address_t) * [_param->_nb_bypass_write]; |
---|
184 | in_BYPASS_WRITE_SPR_DATA = new SC_IN (Tspecial_data_t ) * [_param->_nb_bypass_write]; |
---|
185 | |
---|
186 | for (uint32_t i=0; i<_param->_nb_bypass_write; i++) |
---|
187 | { |
---|
188 | Interface_fifo * interface = _interfaces->set_interface("bypass_write_"+toString(i) |
---|
189 | #ifdef POSITION |
---|
190 | , IN |
---|
191 | ,NORTH |
---|
192 | , "Interface with write queue to bypass the write in the RegisterFile." |
---|
193 | #endif |
---|
194 | ); |
---|
195 | |
---|
196 | in_BYPASS_WRITE_CONTEXT_ID [i] = interface->set_signal_in <Tcontext_t > ("context_id" ,_param->_size_context_id); |
---|
197 | in_BYPASS_WRITE_GPR_VAL [i] = interface->set_signal_valack_in ("gpr_val",VAL); |
---|
198 | in_BYPASS_WRITE_GPR_NUM_REG[i] = interface->set_signal_in <Tgeneral_address_t> ("gpr_num_reg",_param->_size_general_register); |
---|
199 | in_BYPASS_WRITE_GPR_DATA [i] = interface->set_signal_in <Tgeneral_data_t > ("gpr_data" ,_param->_size_general_data); |
---|
200 | in_BYPASS_WRITE_SPR_VAL [i] = interface->set_signal_valack_in ("spr_val",VAL); |
---|
201 | in_BYPASS_WRITE_SPR_NUM_REG[i] = interface->set_signal_in <Tspecial_address_t> ("spr_num_reg",_param->_size_general_register); |
---|
202 | in_BYPASS_WRITE_SPR_DATA [i] = interface->set_signal_in <Tspecial_data_t > ("spr_data" ,_param->_size_general_data); |
---|
203 | } |
---|
204 | |
---|
205 | // ~~~~~[ Interface : "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
206 | in_BYPASS_MEMORY_VAL = new SC_IN (Tcontrol_t ) * [_param->_nb_bypass_memory]; |
---|
207 | in_BYPASS_MEMORY_CONTEXT_ID = new SC_IN (Tcontext_t ) * [_param->_nb_bypass_memory]; |
---|
208 | in_BYPASS_MEMORY_NUM_REG = new SC_IN (Tgeneral_address_t) * [_param->_nb_bypass_memory]; |
---|
209 | in_BYPASS_MEMORY_DATA = new SC_IN (Tgeneral_data_t ) * [_param->_nb_bypass_memory]; |
---|
210 | |
---|
211 | for (uint32_t i=0; i<_param->_nb_bypass_memory; i++) |
---|
212 | { |
---|
213 | Interface_fifo * interface = _interfaces->set_interface("bypass_memory_"+toString(i) |
---|
214 | #ifdef POSITION |
---|
215 | , IN |
---|
216 | , NORTH |
---|
217 | , "Interface with load/store unit to bypass the write in the RegisterFile." |
---|
218 | #endif |
---|
219 | ); |
---|
220 | |
---|
221 | in_BYPASS_MEMORY_VAL [i] = interface->set_signal_valack_in (VAL); |
---|
222 | in_BYPASS_MEMORY_CONTEXT_ID [i] = interface->set_signal_in <Tcontext_t > ("context_id" ,_param->_size_context_id); |
---|
223 | in_BYPASS_MEMORY_NUM_REG [i] = interface->set_signal_in <Tgeneral_address_t> ("num_reg" ,_param->_size_general_register); |
---|
224 | in_BYPASS_MEMORY_DATA [i] = interface->set_signal_in <Tgeneral_data_t > ("data" ,_param->_size_general_data); |
---|
225 | } |
---|
226 | |
---|
227 | |
---|
228 | // ~~~~~[ internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
229 | internal_RESERVATION_STATION_OUT_VAL = new Tcontrol_t [_param->_size_queue]; |
---|
230 | |
---|
231 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
232 | |
---|
233 | #ifdef POSITION |
---|
234 | _component->generate_file(); |
---|
235 | #endif |
---|
236 | _queue_control = new morpheo::behavioural::generic::queue_control::Queue_Control::Queue_Control(_param->_size_queue); |
---|
237 | _queue = new Treservation_station_entry_t [_param->_size_queue]; |
---|
238 | |
---|
239 | log_printf(FUNC,Reservation_station,FUNCTION,"End"); |
---|
240 | }; |
---|
241 | |
---|
242 | }; // end namespace reservation_station |
---|
243 | }; // end namespace read_unit |
---|
244 | }; // end namespace multi_read_unit |
---|
245 | }; // end namespace execute_loop |
---|
246 | }; // end namespace multi_execute_loop |
---|
247 | }; // end namespace core |
---|
248 | |
---|
249 | }; // end namespace behavioural |
---|
250 | }; // end namespace morpheo |
---|
251 | #endif |
---|