source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/Register_unit_Glue/src/Register_unit_Glue_vhdl_body.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 15 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 15.1 KB
Line 
1#ifdef VHDL
2/*
3 * $Id: Register_unit_Glue_vhdl_body.cpp 88 2008-12-10 18:31:39Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/Register_unit_Glue/include/Register_unit_Glue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_execute_loop {
15namespace execute_loop {
16namespace register_unit {
17namespace register_unit_glue {
18
19
20#undef  FUNCTION
21#define FUNCTION "Register_unit_Glue::vhdl_body"
22  void Register_unit_Glue::vhdl_body (Vhdl * & vhdl)
23  {
24    log_printf(FUNC,Register_unit_Glue,FUNCTION,"Begin");
25
26    vhdl->set_body("out_CONST_0 <= '0';");
27    vhdl->set_body("out_CONST_1 <= '1';");
28
29    //-----------------------------------
30    // GPR_READ
31    //-----------------------------------
32
33    vhdl->set_body ("");
34    for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
35      {
36        vhdl->set_body ("out_GPR_READ_"+toString(j)+"_ACK <=");
37        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
38          {
39            vhdl->set_body ("\tin_GPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK and in_GPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
40          }
41        vhdl->set_body ("\tin_GPR_READ_REGISTERFILE_0_"+toString(j)+"_ACK and in_GPR_READ_STATUS_0_"+toString(j)+"_ACK;");
42      }
43
44    vhdl->set_body ("");
45    for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
46      {
47        vhdl->set_body ("out_GPR_READ_"+toString(j)+"_DATA <=");
48        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
49          {
50            vhdl->set_body ("\tin_GPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_DATA when in_GPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
51          }
52        vhdl->set_body ("\tin_GPR_READ_REGISTERFILE_0_"+toString(j)+"_DATA;");
53      }
54
55    vhdl->set_body ("");
56    for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
57      {
58        vhdl->set_body ("out_GPR_READ_"+toString(j)+"_DATA_VAL <=");
59        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
60          {
61            vhdl->set_body ("\tin_GPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_DATA_VAL when in_GPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
62          }
63        vhdl->set_body ("\tin_GPR_READ_STATUS_0_"+toString(j)+"_DATA_VAL;");
64      }
65
66    if (_param->_have_port_ooo_engine_id == true)
67      {
68        vhdl->set_body ("");
69        for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
70          {
71            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
72              {
73                vhdl->set_body ("out_GPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_VAL <= in_GPR_READ_"+toString(j)+"_VAL and in_GPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
74              }
75          }
76       
77        vhdl->set_body ("");
78        for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
79          {
80            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
81              {
82                vhdl->set_body ("out_GPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <= in_GPR_READ_"+toString(j)+"_VAL and in_GPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
83              }
84          }
85      }
86    else
87      {
88        for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
89          vhdl->set_body ("out_GPR_READ_REGISTERFILE_0_"+toString(j)+"_VAL <= in_GPR_READ_"+toString(j)+"_VAL and in_GPR_READ_STATUS_0_"+toString(j)+"_ACK;");
90        for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
91          vhdl->set_body ("out_GPR_READ_STATUS_0_"+toString(j)+"_VAL <= in_GPR_READ_"+toString(j)+"_VAL and in_GPR_READ_REGISTERFILE_0_"+toString(j)+"_ACK;");
92      }
93
94    //-----------------------------------
95    // GPR_WRITE
96    //-----------------------------------
97
98    vhdl->set_body ("");
99    for (uint32_t j=0; j<_param->_nb_gpr_write; j++)
100      {
101        vhdl->set_body ("out_GPR_WRITE_"+toString(j)+"_ACK <=");
102        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
103          {
104            vhdl->set_body ("\tin_GPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK and in_GPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
105          }
106        vhdl->set_body ("\tin_GPR_WRITE_REGISTERFILE_0_"+toString(j)+"_ACK and in_GPR_WRITE_STATUS_0_"+toString(j)+"_ACK;");
107      }
108
109    if (_param->_have_port_ooo_engine_id == true)
110      {
111        vhdl->set_body ("");
112        for (uint32_t j=0; j<_param->_nb_gpr_write; j++)
113          {
114            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
115              {
116                vhdl->set_body ("out_GPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_VAL <= in_GPR_WRITE_"+toString(j)+"_VAL and in_GPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
117              }
118          }
119       
120        vhdl->set_body ("");
121        for (uint32_t j=0; j<_param->_nb_gpr_write; j++)
122          {
123            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
124              {
125                vhdl->set_body ("out_GPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <= in_GPR_WRITE_"+toString(j)+"_VAL and in_GPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK when in_GPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
126              }
127          }
128      }
129    else
130      {
131        for (uint32_t j=0; j<_param->_nb_gpr_write; j++)
132          vhdl->set_body ("out_GPR_WRITE_REGISTERFILE_0_"+toString(j)+"_VAL <= in_GPR_WRITE_"+toString(j)+"_VAL and in_GPR_WRITE_STATUS_0_"+toString(j)+"_ACK;");
133        for (uint32_t j=0; j<_param->_nb_gpr_write; j++)
134          vhdl->set_body ("out_GPR_WRITE_STATUS_0_"+toString(j)+"_VAL <= in_GPR_WRITE_"+toString(j)+"_VAL and in_GPR_WRITE_REGISTERFILE_0_"+toString(j)+"_ACK;");
135      }
136
137    //-----------------------------------
138    // SPR_READ
139    //-----------------------------------
140
141    vhdl->set_body ("");
142    for (uint32_t j=0; j<_param->_nb_spr_read; j++)
143      {
144        vhdl->set_body ("out_SPR_READ_"+toString(j)+"_ACK <=");
145        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
146          {
147            vhdl->set_body ("\tin_SPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK and in_SPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
148          }
149        vhdl->set_body ("\tin_SPR_READ_REGISTERFILE_0_"+toString(j)+"_ACK and in_SPR_READ_STATUS_0_"+toString(j)+"_ACK;");
150      }
151
152    vhdl->set_body ("");
153    for (uint32_t j=0; j<_param->_nb_spr_read; j++)
154      {
155        vhdl->set_body ("out_SPR_READ_"+toString(j)+"_DATA <=");
156        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
157          {
158            vhdl->set_body ("\tin_SPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_DATA when in_SPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
159          }
160        vhdl->set_body ("\tin_SPR_READ_REGISTERFILE_0_"+toString(j)+"_DATA;");
161      }
162
163    vhdl->set_body ("");
164    for (uint32_t j=0; j<_param->_nb_spr_read; j++)
165      {
166        vhdl->set_body ("out_SPR_READ_"+toString(j)+"_DATA_VAL <=");
167        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
168          {
169            vhdl->set_body ("\tin_SPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_DATA_VAL when in_SPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
170          }
171        vhdl->set_body ("\tin_SPR_READ_STATUS_0_"+toString(j)+"_DATA_VAL;");
172      }
173
174    if (_param->_have_port_ooo_engine_id == true)
175      {
176        vhdl->set_body ("");
177        for (uint32_t j=0; j<_param->_nb_spr_read; j++)
178          {
179            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
180              {
181                vhdl->set_body ("out_SPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_VAL <= in_SPR_READ_"+toString(j)+"_VAL and in_SPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
182              }
183          }
184       
185        vhdl->set_body ("");
186        for (uint32_t j=0; j<_param->_nb_spr_read; j++)
187          {
188            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
189              {
190                vhdl->set_body ("out_SPR_READ_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <= in_SPR_READ_"+toString(j)+"_VAL and in_SPR_READ_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_READ_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
191              }
192          }
193      }
194    else
195      {
196        for (uint32_t j=0; j<_param->_nb_spr_read; j++)
197          vhdl->set_body ("out_SPR_READ_REGISTERFILE_0_"+toString(j)+"_VAL <= in_SPR_READ_"+toString(j)+"_VAL and in_SPR_READ_STATUS_0_"+toString(j)+"_ACK;");
198        for (uint32_t j=0; j<_param->_nb_spr_read; j++)
199          vhdl->set_body ("out_SPR_READ_STATUS_0_"+toString(j)+"_VAL <= in_SPR_READ_"+toString(j)+"_VAL and in_SPR_READ_REGISTERFILE_0_"+toString(j)+"_ACK;");
200      }
201
202    //-----------------------------------
203    // SPR_WRITE
204    //-----------------------------------
205
206    vhdl->set_body ("");
207    for (uint32_t j=0; j<_param->_nb_spr_write; j++)
208      {
209        vhdl->set_body ("out_SPR_WRITE_"+toString(j)+"_ACK <=");
210        for (uint32_t i=_param->_nb_ooo_engine-1; i>=1; i--)
211          {
212            vhdl->set_body ("\tin_SPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK and in_SPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else");
213          }
214        vhdl->set_body ("\tin_SPR_WRITE_REGISTERFILE_0_"+toString(j)+"_ACK and in_SPR_WRITE_STATUS_0_"+toString(j)+"_ACK;");
215      }
216
217    if (_param->_have_port_ooo_engine_id == true)
218      {
219        vhdl->set_body ("");
220        for (uint32_t j=0; j<_param->_nb_spr_write; j++)
221          {
222            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
223              {
224                vhdl->set_body ("out_SPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_VAL <= in_SPR_WRITE_"+toString(j)+"_VAL and in_SPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
225              }
226          }
227       
228        vhdl->set_body ("");
229        for (uint32_t j=0; j<_param->_nb_spr_write; j++)
230          {
231            for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
232              {
233                vhdl->set_body ("out_SPR_WRITE_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <= in_SPR_WRITE_"+toString(j)+"_VAL and in_SPR_WRITE_REGISTERFILE_"+toString(i)+"_"+toString(j)+"_ACK when in_SPR_WRITE_"+toString(j)+"_OOO_ENGINE_ID = "+std_logic_conv(_param->_size_ooo_engine_id,i)+" else '0';");
234              }
235          }
236      }
237    else
238      {
239        for (uint32_t j=0; j<_param->_nb_spr_write; j++)
240          vhdl->set_body ("out_SPR_WRITE_REGISTERFILE_0_"+toString(j)+"_VAL <= in_SPR_WRITE_"+toString(j)+"_VAL and in_SPR_WRITE_STATUS_0_"+toString(j)+"_ACK;");
241        for (uint32_t j=0; j<_param->_nb_spr_write; j++)
242          vhdl->set_body ("out_SPR_WRITE_STATUS_0_"+toString(j)+"_VAL <= in_SPR_WRITE_"+toString(j)+"_VAL and in_SPR_WRITE_REGISTERFILE_0_"+toString(j)+"_ACK;");
243      }
244
245
246    //-----------------------------------
247    // INSERT_ROB
248    //-----------------------------------
249
250    vhdl->set_body ("");
251    for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
252      {
253        uint32_t x=_param->_nb_inst_insert_rob [i];
254        for (uint32_t j=0; j<x; j++)
255          {
256            vhdl->set_body ("out_INSERT_ROB_"+toString(i)+"_"+toString(j)+"_ACK <=");
257            vhdl->set_body ("\tin_INSERT_ROB_GPR_STATUS_"+toString(i)+"_"+toString(j)+"_ACK and");
258            vhdl->set_body ("\tin_INSERT_ROB_SPR_STATUS_"+toString(i)+"_"+toString(j)+"_ACK;");
259
260            vhdl->set_body ("out_INSERT_ROB_GPR_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <=");
261            vhdl->set_body ("\tin_INSERT_ROB_"+toString(i)+"_"+toString(j)+"_VAL            and");
262            vhdl->set_body ("\tin_INSERT_ROB_"+toString(i)+"_"+toString(j)+"_RD_USE         and");
263            vhdl->set_body ("\tin_INSERT_ROB_SPR_STATUS_"+toString(i)+"_"+toString(j)+"_ACK;");
264
265            vhdl->set_body ("out_INSERT_ROB_SPR_STATUS_"+toString(i)+"_"+toString(j)+"_VAL <=");
266            vhdl->set_body ("\tin_INSERT_ROB_"+toString(i)+"_"+toString(j)+"_VAL            and");
267            vhdl->set_body ("\tin_INSERT_ROB_"+toString(i)+"_"+toString(j)+"_RE_USE         and");
268            vhdl->set_body ("\tin_INSERT_ROB_GPR_STATUS_"+toString(i)+"_"+toString(j)+"_ACK;");
269          }
270      }
271
272    //-----------------------------------
273    // RETIRE_ROB
274    //-----------------------------------
275    vhdl->set_body ("");
276    for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
277      {
278        uint32_t x=_param->_nb_inst_retire_rob [i];
279        for (uint32_t j=0; j<x; j++)
280          {
281            vhdl->set_body ("out_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_ACK <=");
282            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
283            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK and");
284            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
285            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK;");
286
287            vhdl->set_body ("out_RETIRE_ROB_GPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_VAL <=");
288            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_VAL                and");
289            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_RD_OLD_USE         and");
290            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK and");
291            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
292            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK;");
293
294            vhdl->set_body ("out_RETIRE_ROB_GPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_VAL <=");
295            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_VAL                and");
296            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_RD_NEW_USE         and");
297            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
298            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
299            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK;");
300
301            vhdl->set_body ("out_RETIRE_ROB_SPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_VAL <=");
302            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_VAL                and");
303            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_RE_OLD_USE         and");
304            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
305            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK and");
306            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK;");
307
308            vhdl->set_body ("out_RETIRE_ROB_SPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_VAL <=");
309            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_VAL                and");
310            vhdl->set_body ("\tin_RETIRE_ROB_"+toString(i)+"_"+toString(j)+"_RE_NEW_USE         and");
311            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK and");
312            vhdl->set_body ("\tin_RETIRE_ROB_GPR_STATUS_NEW_"+toString(i)+"_"+toString(j)+"_ACK and");
313            vhdl->set_body ("\tin_RETIRE_ROB_SPR_STATUS_OLD_"+toString(i)+"_"+toString(j)+"_ACK;");
314          }
315      }
316
317    log_printf(FUNC,Register_unit_Glue,FUNCTION,"End");
318  };
319
320}; // end namespace register_unit_glue
321}; // end namespace register_unit
322}; // end namespace execute_loop
323}; // end namespace multi_execute_loop
324}; // end namespace core
325}; // end namespace behavioural
326}; // end namespace morpheo             
327#endif
Note: See TracBrowser for help on using the repository browser.