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

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

Modif for performance :
1) Load Store Unit : store send request to valid exeception
2) Commit_unit : retire can bypass store
3) Commit_unit : add stat to manage store instruction
4) Load Store Unit and Load Store Pointer Manager : add store_queue_ptr_read
5) Fix lot of bug

  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMealy_insert.cpp 122 2009-06-03 08: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    Tcontrol_t bank_full         [_param->_nb_bank];
27    Tcontrol_t insert_ack        [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
28#ifdef SYSTEMC_VHDL_COMPATIBILITY
29    Tpacket_t  insert_packet_id  [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
30#endif
31    bool       can_rename_select [_param->_nb_rename_unit];
32//     bool       event_stop;
33   
34//     //     Initialisation
35//     event_stop = false; // one signal for all context.
36//     for (uint32_t i=0; i<_param->_nb_front_end; ++i)
37//       for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
38//         event_stop |= reg_EVENT_STOP [i][j];   
39
40//     Initialisation
41    for (uint32_t i=0; i<_param->_nb_bank; i++)
42      {
43        internal_BANK_INSERT_VAL  [i] = false;
44        bank_full [i] = not (_rob[i].size() < _param->_size_bank); 
45      }
46    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
47      {
48        can_rename_select [i] = true;
49        for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
50          {
51            insert_ack       [i][j] = false;
52#ifdef SYSTEMC_VHDL_COMPATIBILITY
53            insert_packet_id [i][j] = false;
54#endif
55          }
56      }
57
58    // insert interface
59//     log_printf(TRACE,Commit_unit,FUNCTION,"  * reg_NUM_BANK_TAIL : %d",reg_NUM_BANK_TAIL);
60
61//     if (not event_stop)
62      {
63        std::list<generic::priority::select_t> * select_insert = _priority_insert ->select(); // same select for all insert
64        std::list<generic::priority::select_t>::iterator it=select_insert ->begin();
65       
66        // Scan all bank ...
67        for (uint32_t i=0; i<_param->_nb_bank; i++)
68          {
69            // compute the bank number (num_bank_tail is the older write slot)
70            uint32_t num_bank = (reg_NUM_BANK_TAIL+i)%_param->_nb_bank;
71     
72//          log_printf(TRACE,Commit_unit,FUNCTION,"  * BANK : %d", num_bank);
73//          log_printf(TRACE,Commit_unit,FUNCTION,"    * val  : %d", internal_BANK_INSERT_VAL [num_bank]);
74//          log_printf(TRACE,Commit_unit,FUNCTION,"    * full : %d", bank_full [num_bank]);
75     
76            // Scan all insert interface to find a valid transaction
77            while (it!=select_insert ->end())
78              {
79                uint32_t num_rename_unit = it->grp;
80                uint32_t num_inst_insert = it->elt;
81     
82                it++;
83     
84                log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d]", num_rename_unit,num_inst_insert);
85//                  log_printf(TRACE,Commit_unit,FUNCTION,"    * INSERT_VAL        : %d", PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert]));
86                log_printf(TRACE,Commit_unit,FUNCTION,"    * can_rename_select : %d", can_rename_select [num_rename_unit]);
87     
88                // Test if have instruction
89                //   -> rename_unit_glue test the in-order insert !!!!!
90                if (can_rename_select [num_rename_unit] // and
91//              PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert])
92                    )
93                  {
94                    log_printf(TRACE,Commit_unit,FUNCTION,"      * have instruction");
95                    log_printf(TRACE,Commit_unit,FUNCTION,"      * bank_full : %d",bank_full [num_bank]);
96                   
97                    // test if bank is not busy (full or previous access)
98                    if (not bank_full [num_bank])
99                      {
100                        // find !!!
101                        insert_ack       [num_rename_unit][num_inst_insert] = true;
102                       
103                        Tpacket_t packet_id = ((reg_BANK_PTR [num_bank] << _param->_shift_num_slot) | num_bank);
104                       
105#ifdef SYSTEMC_VHDL_COMPATIBILITY
106                        insert_packet_id [num_rename_unit][num_inst_insert] = packet_id;
107#else
108                        if (_param->_have_port_rob_ptr  )
109                        PORT_WRITE(out_INSERT_PACKET_ID [num_rename_unit][num_inst_insert],packet_id);
110#endif
111                        internal_BANK_INSERT_VAL             [num_bank] = true;
112                        internal_BANK_INSERT_NUM_RENAME_UNIT [num_bank] = num_rename_unit;
113                        internal_BANK_INSERT_NUM_INST        [num_bank] = num_inst_insert;
114                       
115                        break;
116                      }
117                  }
118               
119                // is a valid instruction, but it's not send at a bank
120                //  ... invalid this rename_unit (because, insert in_order)
121                can_rename_select [num_rename_unit] = false;
122              }
123          }
124      }
125   
126    // Write output
127    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
128      for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
129        {
130          PORT_WRITE(out_INSERT_ACK       [i][j],insert_ack       [i][j]);
131          log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d] -> ack %d",i,j,insert_ack[i][j]);
132
133#ifdef SYSTEMC_VHDL_COMPATIBILITY
134          if (_param->_have_port_rob_ptr  )
135          PORT_WRITE(out_INSERT_PACKET_ID [i][j],insert_packet_id [i][j]);
136#endif
137        }
138   
139    log_end(Commit_unit,FUNCTION);
140  };
141
142}; // end namespace commit_unit
143}; // end namespace ooo_engine
144}; // end namespace multi_ooo_engine
145}; // end namespace core
146}; // end namespace behavioural
147}; // end namespace morpheo             
148#endif
Note: See TracBrowser for help on using the repository browser.