source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_insert.cpp @ 145

Last change on this file since 145 was 145, checked in by rosiere, 14 years ago

1) add test with SPECINT2K
2) new config of Selftest
3) modif RAT to support multiple depth_save ... but not finish (need fix Update Prediction Table)
4) add Function_pointer but need fix

  • Property svn:keywords set to Id
File size: 7.7 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMealy_insert.cpp 145 2010-10-13 18:15:51Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace commit_unit {
17
18
19#undef  FUNCTION
20#define FUNCTION "Commit_unit::genMealy_insert"
21  void Commit_unit::genMealy_insert (void)
22  {
23    log_begin(Commit_unit,FUNCTION);
24    log_function(Commit_unit,FUNCTION,_name.c_str());
25
26    if (PORT_READ(in_NRESET))
27      {
28    Tcontrol_t bank_full         [_param->_nb_bank];
29    Tcontrol_t insert_ack        [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
30#ifdef SYSTEMC_VHDL_COMPATIBILITY
31    Tpacket_t  insert_packet_id  [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
32#endif
33    bool       can_rename_select [_param->_nb_rename_unit];
34//     bool       event_stop;
35   
36//     //     Initialisation
37//     event_stop = false; // one signal for all context.
38//     for (uint32_t i=0; i<_param->_nb_front_end; ++i)
39//       for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
40//         event_stop |= reg_EVENT_STOP [i][j];   
41
42//     Initialisation
43    for (uint32_t i=0; i<_param->_nb_bank; i++)
44      {
45        internal_BANK_INSERT_VAL  [i] = false;
46        bank_full [i] = not (_rob[i].size() < _param->_size_bank); 
47      }
48    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
49      {
50        can_rename_select [i] = true;
51        for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
52          {
53            insert_ack       [i][j] = false;
54#ifdef SYSTEMC_VHDL_COMPATIBILITY
55            insert_packet_id [i][j] = false;
56#endif
57          }
58      }
59
60    // insert interface
61//     log_printf(TRACE,Commit_unit,FUNCTION,"  * reg_NUM_BANK_TAIL : %d",reg_NUM_BANK_TAIL);
62
63//     if (not event_stop)
64      {
65        std::list<generic::priority::select_t> * select_insert = _priority_insert ->select(); // same select for all insert
66        std::list<generic::priority::select_t>::iterator it=select_insert ->begin();
67       
68        // Scan all bank ...
69        for (uint32_t i=0; i<_param->_nb_bank; i++)
70          {
71            // compute the bank number (num_bank_tail is the older write slot)
72            uint32_t num_bank = (reg_NUM_BANK_TAIL+i)%_param->_nb_bank;
73     
74//          log_printf(TRACE,Commit_unit,FUNCTION,"  * BANK : %d", num_bank);
75//          log_printf(TRACE,Commit_unit,FUNCTION,"    * val  : %d", internal_BANK_INSERT_VAL [num_bank]);
76//          log_printf(TRACE,Commit_unit,FUNCTION,"    * full : %d", bank_full [num_bank]);
77     
78            // Scan all insert interface to find a valid transaction
79            while (it!=select_insert ->end())
80              {
81                uint32_t num_rename_unit = it->grp;
82                uint32_t num_inst_insert = it->elt;
83     
84                it++;
85     
86                log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d]", num_rename_unit,num_inst_insert);
87//                  log_printf(TRACE,Commit_unit,FUNCTION,"    * INSERT_VAL        : %d", PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert]));
88                log_printf(TRACE,Commit_unit,FUNCTION,"    * can_rename_select : %d", can_rename_select [num_rename_unit]);
89     
90                // Test if have instruction
91                //   -> rename_unit_glue test the in-order insert !!!!!
92                if (can_rename_select [num_rename_unit] // and
93//              PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert])
94                    )
95                  {
96                    log_printf(TRACE,Commit_unit,FUNCTION,"      * have instruction");
97                    log_printf(TRACE,Commit_unit,FUNCTION,"      * num_bank  : %d",num_bank);
98                    log_printf(TRACE,Commit_unit,FUNCTION,"      * bank_full : %d",bank_full [num_bank]);
99                   
100                    // test if bank is not busy (full or previous access)
101                    if (not bank_full [num_bank])
102                      {
103                        bool cond = true;
104
105                        if (_param->_rat_scheme[num_rename_unit] == RAT_DEPTH_SAVE)
106                          {
107                            Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_INSERT_FRONT_END_ID [num_rename_unit][num_inst_insert]):0;
108                            Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_INSERT_CONTEXT_ID   [num_rename_unit][num_inst_insert]):0;
109                            Tdepth_t   depth        = (_param->_have_port_depth       )?PORT_READ(in_INSERT_DEPTH        [num_rename_unit][num_inst_insert]):0;
110                            Tcontrol_t save_rat     =                                   PORT_READ(in_INSERT_SAVE_RAT     [num_rename_unit][num_inst_insert]);
111
112                            cond = not (save_rat and (reg_NB_INST_DEPTH[front_end_id][context_id][depth]>0));
113
114                            log_printf(TRACE,Commit_unit,FUNCTION,"        * front_end_id : %d",front_end_id);
115                            log_printf(TRACE,Commit_unit,FUNCTION,"        * context_id   : %d",context_id  );
116                            log_printf(TRACE,Commit_unit,FUNCTION,"        * depth        : %d",depth       );
117                            log_printf(TRACE,Commit_unit,FUNCTION,"        * save_rat     : %d",save_rat    );
118                            log_printf(TRACE,Commit_unit,FUNCTION,"        * cond         : %d",cond        );
119                           
120                          }
121                       
122                        if (cond)
123                          {
124                            // find !!!
125                            insert_ack       [num_rename_unit][num_inst_insert] = true;
126                           
127                            Tpacket_t packet_id = ((reg_BANK_PTR [num_bank] << _param->_shift_num_slot) | num_bank);
128                           
129#ifdef SYSTEMC_VHDL_COMPATIBILITY
130                            insert_packet_id [num_rename_unit][num_inst_insert] = packet_id;
131#else
132                            if (_param->_have_port_rob_ptr  )
133                              PORT_WRITE(out_INSERT_PACKET_ID [num_rename_unit][num_inst_insert],packet_id);
134#endif
135                            internal_BANK_INSERT_VAL             [num_bank] = true;
136                            internal_BANK_INSERT_NUM_RENAME_UNIT [num_bank] = num_rename_unit;
137                            internal_BANK_INSERT_NUM_INST        [num_bank] = num_inst_insert;
138                           
139                            break;
140                          }
141                      }
142                  }
143               
144                // is a valid instruction, but it's not send at a bank
145                //  ... invalid this rename_unit (because, insert in_order)
146                can_rename_select [num_rename_unit] = false;
147              }
148          }
149      }
150   
151    // Write output
152    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
153      for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
154        {
155          PORT_WRITE(out_INSERT_ACK       [i][j],insert_ack       [i][j]);
156          log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d] -> ack %d",i,j,insert_ack[i][j]);
157
158#ifdef SYSTEMC_VHDL_COMPATIBILITY
159          if (_param->_have_port_rob_ptr  )
160          PORT_WRITE(out_INSERT_PACKET_ID [i][j],insert_packet_id [i][j]);
161#endif
162        }
163      }   
164    else
165      {
166        for (uint32_t i=0; i<_param->_nb_bank; i++)
167          internal_BANK_INSERT_VAL  [i] = false;
168        for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
169          for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
170            PORT_WRITE(out_INSERT_ACK       [i][j],0);
171
172      }
173
174    log_end(Commit_unit,FUNCTION);
175  };
176
177}; // end namespace commit_unit
178}; // end namespace ooo_engine
179}; // end namespace multi_ooo_engine
180}; // end namespace core
181}; // end namespace behavioural
182}; // end namespace morpheo             
183#endif
Note: See TracBrowser for help on using the repository browser.