source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Dependency_checking_unit/src/Dependency_checking_unit_genMealy.cpp @ 123

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

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Dependency_checking_unit_genMealy.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Dependency_checking_unit/include/Dependency_checking_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace rename_unit {
17namespace register_translation_unit {
18namespace dependency_checking_unit {
19
20
21#undef  FUNCTION
22#define FUNCTION "Dependency_checking_unit::genMealy"
23  void Dependency_checking_unit::genMealy (void)
24  {
25    log_begin(Dependency_checking_unit,FUNCTION);
26    log_function(Dependency_checking_unit,FUNCTION,_name.c_str());
27
28    if (PORT_READ(in_NRESET))
29      {
30//     Tcontrol_t         val                [_param->_nb_inst_insert];
31//     Tcontrol_t         ack                [_param->_nb_inst_insert];
32    Tcontext_t         front_end_id       [_param->_nb_inst_insert];
33    Tcontext_t         context_id         [_param->_nb_inst_insert];
34    Tcontrol_t         read_ra            [_param->_nb_inst_insert];
35    Tgeneral_address_t num_reg_ra_log     [_param->_nb_inst_insert];
36    Tgeneral_address_t num_reg_ra_phy     [_param->_nb_inst_insert];
37    Tcontrol_t         read_rb            [_param->_nb_inst_insert];
38    Tgeneral_address_t num_reg_rb_log     [_param->_nb_inst_insert];
39    Tgeneral_address_t num_reg_rb_phy     [_param->_nb_inst_insert];
40    Tcontrol_t         read_rc            [_param->_nb_inst_insert];
41    Tspecial_address_t num_reg_rc_log     [_param->_nb_inst_insert];
42    Tspecial_address_t num_reg_rc_phy     [_param->_nb_inst_insert];
43    Tcontrol_t         write_rd           [_param->_nb_inst_insert];
44    Tgeneral_address_t num_reg_rd_log     [_param->_nb_inst_insert];
45    Tgeneral_address_t num_reg_rd_phy_old [_param->_nb_inst_insert];
46    Tgeneral_address_t num_reg_rd_phy_new [_param->_nb_inst_insert];
47    Tcontrol_t         write_re           [_param->_nb_inst_insert];
48    Tspecial_address_t num_reg_re_log     [_param->_nb_inst_insert];
49    Tspecial_address_t num_reg_re_phy_old [_param->_nb_inst_insert];
50    Tspecial_address_t num_reg_re_phy_new [_param->_nb_inst_insert];
51
52    // 4 dependency :
53    //  * Read  after Read  : it's a false dependency
54    //  * Write after Read  : it's inhibt by rename process
55    //  * Write after Write : for the num_reg_old
56    //  * Read  after Write : dependency
57    for (uint32_t i=0; i<_param->_nb_inst_insert; i++)
58      {
59        // =====[ Input ]==================================================
60//      val                [i] = PORT_READ(in_RENAME_IN_VAL                [i]);
61//      ack                [i] = PORT_READ(in_RENAME_OUT_ACK               [i]);
62        front_end_id       [i] = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [i]):0;
63        context_id         [i] = (_param->_have_port_context_id  )?PORT_READ(in_RENAME_IN_CONTEXT_ID   [i]):0;
64        read_ra            [i] = PORT_READ(in_RENAME_IN_READ_RA            [i]);
65        num_reg_ra_log     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RA_LOG     [i]);
66        num_reg_ra_phy     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RA_PHY     [i]);
67        read_rb            [i] = PORT_READ(in_RENAME_IN_READ_RB            [i]);
68        num_reg_rb_log     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RB_LOG     [i]);
69        num_reg_rb_phy     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RB_PHY     [i]);
70        read_rc            [i] = PORT_READ(in_RENAME_IN_READ_RC            [i]);
71        num_reg_rc_log     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RC_LOG     [i]);
72        num_reg_rc_phy     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RC_PHY     [i]);
73        write_rd           [i] = PORT_READ(in_RENAME_IN_WRITE_RD           [i]);
74        num_reg_rd_log     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RD_LOG     [i]);
75        num_reg_rd_phy_old [i] = PORT_READ(in_RENAME_IN_NUM_REG_RD_PHY_OLD [i]);
76        num_reg_rd_phy_new [i] = PORT_READ(in_RENAME_IN_NUM_REG_RD_PHY_NEW [i]);
77        write_re           [i] = PORT_READ(in_RENAME_IN_WRITE_RE           [i]);
78        num_reg_re_log     [i] = PORT_READ(in_RENAME_IN_NUM_REG_RE_LOG     [i]);
79        num_reg_re_phy_old [i] = PORT_READ(in_RENAME_IN_NUM_REG_RE_PHY_OLD [i]);
80        num_reg_re_phy_new [i] = PORT_READ(in_RENAME_IN_NUM_REG_RE_PHY_NEW [i]);
81       
82        log_printf(TRACE,Dependency_checking_unit,FUNCTION,"  * (before) [%d] %.2d %.2d, %.1d %.2d %.5d, %.1d %.2d %.5d, %.1d %.2d %.5d, %.1d %.2d %.5d -> %.5d, %.1d %.2d %.5d -> %.5d",
83                   i,
84                   front_end_id       [i],
85                   context_id         [i],
86                   read_ra            [i],
87                   num_reg_ra_log     [i],
88                   num_reg_ra_phy     [i],
89                   read_rb            [i],
90                   num_reg_rb_log     [i],
91                   num_reg_rb_phy     [i],
92                   read_rc            [i],
93                   num_reg_rc_log     [i],
94                   num_reg_rc_phy     [i],
95                   write_rd           [i],
96                   num_reg_rd_log     [i],
97                   num_reg_rd_phy_old [i],
98                   num_reg_rd_phy_new [i],
99                   write_re           [i],
100                   num_reg_re_log     [i],
101                   num_reg_re_phy_old [i],
102                   num_reg_re_phy_new [i]);
103
104        // ================================================================
105        // =====[ Write after Write ]======================================
106        // ================================================================
107        if (write_rd [i])
108          // Inverse scan : with x < y, instruction x is before in the sequential order program that the instruction y
109          for (int32_t j=i-1; j>=0; j--)
110            if ((write_rd       [j] == 1                 ) and
111                (num_reg_rd_log [j] == num_reg_rd_log [i]) and
112                (front_end_id   [j] == front_end_id   [i]) and
113                (context_id     [j] == context_id     [i]) )
114              {
115                log_printf(TRACE,Dependency_checking_unit,FUNCTION,"    * RD :  WAW dependency with inst[%d].RD",j);
116                num_reg_rd_phy_old [i] = num_reg_rd_phy_new [j];
117                break; // find the most recently dependency
118              }
119       
120        if (write_re [i])
121          // Inverse scan : with x < y, instruction x is before in the sequential order program that the instruction y
122          for (int32_t j=i-1; j>=0; j--)
123            if ((write_re       [j] == 1                 ) and
124                (num_reg_re_log [j] == num_reg_re_log [i]) and
125                (front_end_id   [j] == front_end_id   [i]) and
126                (context_id     [j] == context_id     [i]) )
127              {
128                log_printf(TRACE,Dependency_checking_unit,FUNCTION,"    * RE : WAW dependency with inst[%d].RE",j);
129                num_reg_re_phy_old [i] = num_reg_re_phy_new [j];
130                break; // find the most recently dependency
131              }
132        // ================================================================
133        // =====[ Read  after Write ]======================================
134        // ================================================================
135        if (read_ra [i])
136          // Inverse scan : with x < y, instruction x is before in the sequential order program that the instruction y
137          for (int32_t j=i-1; j>=0; j--)
138            if ((write_rd       [j] == 1                 ) and
139                (num_reg_rd_log [j] == num_reg_ra_log [i]) and
140                (front_end_id   [j] == front_end_id   [i]) and
141                (context_id     [j] == context_id     [i]) )
142              {
143                log_printf(TRACE,Dependency_checking_unit,FUNCTION,"    * RA :  RAW dependency with inst[%d].RD",j);
144                num_reg_ra_phy [i] = num_reg_rd_phy_new [j];
145                break; // find the most recently dependency
146              }
147
148        if (read_rb [i])
149          // Inverse scan : with x < y, instruction x is before in the sequential order program that the instruction y
150          for (int32_t j=i-1; j>=0; j--)
151            if ((write_rd       [j] == 1                 ) and
152                (num_reg_rd_log [j] == num_reg_rb_log [i]) and
153                (front_end_id   [j] == front_end_id   [i]) and
154                (context_id     [j] == context_id     [i]) )
155              {
156                log_printf(TRACE,Dependency_checking_unit,FUNCTION,"    * RB :  RAW dependency with inst[%d].RD",j);
157                num_reg_rb_phy [i] = num_reg_rd_phy_new [j];
158                break; // find the most recently dependency
159              }
160
161        if (read_rc [i])
162          // Inverse scan : with x < y, instruction x is before in the sequential order program that the instruction y
163          for (int32_t j=i-1; j>=0; j--)
164            if ((write_re       [j] == 1                 ) and
165                (num_reg_re_log [j] == num_reg_rc_log [i]) and
166                (front_end_id   [j] == front_end_id   [i]) and
167                (context_id     [j] == context_id     [i]) )
168              {
169                log_printf(TRACE,Dependency_checking_unit,FUNCTION,"    * RC :  RAW dependency with inst[%d].RE",j);
170                num_reg_rc_phy [i] = num_reg_re_phy_new [j];
171                break; // find the most recently dependency
172              }
173
174        log_printf(TRACE,Dependency_checking_unit,FUNCTION,"  * (after ) [%d] %.2d %.2d, %.1d %.2d %.5d, %.1d %.2d %.5d, %.1d %.2d %.5d, %.1d %.2d %.5d -> %.5d, %.1d %.2d %.5d -> %.5d",
175                   i,
176                   front_end_id       [i],
177                   context_id         [i],
178                   read_ra            [i],
179                   num_reg_ra_log     [i],
180                   num_reg_ra_phy     [i],
181                   read_rb            [i],
182                   num_reg_rb_log     [i],
183                   num_reg_rb_phy     [i],
184                   read_rc            [i],
185                   num_reg_rc_log     [i],
186                   num_reg_rc_phy     [i],
187                   write_rd           [i],
188                   num_reg_rd_log     [i],
189                   num_reg_rd_phy_old [i],
190                   num_reg_rd_phy_new [i],
191                   write_re           [i],
192                   num_reg_re_log     [i],
193                   num_reg_re_phy_old [i],
194                   num_reg_re_phy_new [i]);
195
196        // =====[ Output ]=================================================
197//      PORT_WRITE(out_RENAME_OUT_VAL                [i], val                [i]);
198//      PORT_WRITE(out_RENAME_IN_ACK                 [i], ack                [i]);
199        if (_param->_have_port_front_end_id)
200        PORT_WRITE(out_RENAME_OUT_FRONT_END_ID       [i], front_end_id       [i]);
201        if (_param->_have_port_context_id)
202        PORT_WRITE(out_RENAME_OUT_CONTEXT_ID         [i], context_id         [i]);
203        PORT_WRITE(out_RENAME_OUT_READ_RA            [i], read_ra            [i]);
204#ifdef DEBUG
205        PORT_WRITE(out_RENAME_OUT_NUM_REG_RA_LOG     [i], num_reg_ra_log     [i]);
206#endif
207        PORT_WRITE(out_RENAME_OUT_NUM_REG_RA_PHY     [i], num_reg_ra_phy     [i]);
208        PORT_WRITE(out_RENAME_OUT_READ_RB            [i], read_rb            [i]);
209#ifdef DEBUG
210        PORT_WRITE(out_RENAME_OUT_NUM_REG_RB_LOG     [i], num_reg_rb_log     [i]);
211#endif
212        PORT_WRITE(out_RENAME_OUT_NUM_REG_RB_PHY     [i], num_reg_rb_phy     [i]);
213        PORT_WRITE(out_RENAME_OUT_READ_RC            [i], read_rc            [i]);
214#ifdef DEBUG
215        PORT_WRITE(out_RENAME_OUT_NUM_REG_RC_LOG     [i], num_reg_rc_log     [i]);
216#endif
217        PORT_WRITE(out_RENAME_OUT_NUM_REG_RC_PHY     [i], num_reg_rc_phy     [i]);
218        PORT_WRITE(out_RENAME_OUT_WRITE_RD           [i], write_rd           [i]);
219        PORT_WRITE(out_RENAME_OUT_NUM_REG_RD_LOG     [i], num_reg_rd_log     [i]);
220        PORT_WRITE(out_RENAME_OUT_NUM_REG_RD_PHY_OLD [i], num_reg_rd_phy_old [i]);
221        PORT_WRITE(out_RENAME_OUT_NUM_REG_RD_PHY_NEW [i], num_reg_rd_phy_new [i]);
222        PORT_WRITE(out_RENAME_OUT_WRITE_RE           [i], write_re           [i]);
223        PORT_WRITE(out_RENAME_OUT_NUM_REG_RE_LOG     [i], num_reg_re_log     [i]);
224        PORT_WRITE(out_RENAME_OUT_NUM_REG_RE_PHY_OLD [i], num_reg_re_phy_old [i]);
225        PORT_WRITE(out_RENAME_OUT_NUM_REG_RE_PHY_NEW [i], num_reg_re_phy_new [i]);
226      }
227      }
228
229    log_end(Dependency_checking_unit,FUNCTION);
230  };
231
232}; // end namespace dependency_checking_unit
233}; // end namespace register_translation_unit
234}; // end namespace rename_unit
235}; // end namespace ooo_engine
236}; // end namespace multi_ooo_engine
237}; // end namespace core
238}; // end namespace behavioural
239}; // end namespace morpheo             
240#endif
Note: See TracBrowser for help on using the repository browser.