source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_insert.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: 5.9 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMealy_insert.cpp 123 2009-06-08 20:43:30Z 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,"      * bank_full : %d",bank_full [num_bank]);
98                   
99                    // test if bank is not busy (full or previous access)
100                    if (not bank_full [num_bank])
101                      {
102                        // find !!!
103                        insert_ack       [num_rename_unit][num_inst_insert] = true;
104                       
105                        Tpacket_t packet_id = ((reg_BANK_PTR [num_bank] << _param->_shift_num_slot) | num_bank);
106                       
107#ifdef SYSTEMC_VHDL_COMPATIBILITY
108                        insert_packet_id [num_rename_unit][num_inst_insert] = packet_id;
109#else
110                        if (_param->_have_port_rob_ptr  )
111                        PORT_WRITE(out_INSERT_PACKET_ID [num_rename_unit][num_inst_insert],packet_id);
112#endif
113                        internal_BANK_INSERT_VAL             [num_bank] = true;
114                        internal_BANK_INSERT_NUM_RENAME_UNIT [num_bank] = num_rename_unit;
115                        internal_BANK_INSERT_NUM_INST        [num_bank] = num_inst_insert;
116                       
117                        break;
118                      }
119                  }
120               
121                // is a valid instruction, but it's not send at a bank
122                //  ... invalid this rename_unit (because, insert in_order)
123                can_rename_select [num_rename_unit] = false;
124              }
125          }
126      }
127   
128    // Write output
129    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
130      for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
131        {
132          PORT_WRITE(out_INSERT_ACK       [i][j],insert_ack       [i][j]);
133          log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d] -> ack %d",i,j,insert_ack[i][j]);
134
135#ifdef SYSTEMC_VHDL_COMPATIBILITY
136          if (_param->_have_port_rob_ptr  )
137          PORT_WRITE(out_INSERT_PACKET_ID [i][j],insert_packet_id [i][j]);
138#endif
139        }
140      }   
141    else
142      {
143        for (uint32_t i=0; i<_param->_nb_bank; i++)
144          internal_BANK_INSERT_VAL  [i] = false;
145        for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
146          for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
147            PORT_WRITE(out_INSERT_ACK       [i][j],0);
148
149      }
150
151    log_end(Commit_unit,FUNCTION);
152  };
153
154}; // end namespace commit_unit
155}; // end namespace ooo_engine
156}; // end namespace multi_ooo_engine
157}; // end namespace core
158}; // end namespace behavioural
159}; // end namespace morpheo             
160#endif
Note: See TracBrowser for help on using the repository browser.