source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Reexecute_unit/src/Reexecute_unit_genMealy_commit.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.4 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Reexecute_unit_genMealy_commit.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Reexecute_unit/include/Reexecute_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace reexecute_unit {
17
18#undef  FUNCTION
19#define FUNCTION "Reexecute_unit::genMealy_commit"
20  void Reexecute_unit::genMealy_commit (void)
21  {
22    log_begin(Reexecute_unit,FUNCTION);
23    log_function(Reexecute_unit,FUNCTION,_name.c_str());
24
25    if (PORT_READ(in_NRESET))
26      {
27    // Initialisation
28    Tcontrol_t execute_loop_ack [_param->_nb_execute_loop][_param->_max_nb_inst_execute];
29
30    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
31      for (uint32_t j=0; j<_param->_nb_inst_execute [i]; ++j)
32        execute_loop_ack [i][j] = false;
33
34    for (uint32_t i=0; i<_param->_nb_bank; i++)
35      internal_QUEUE_PUSH [i] = 0;
36
37    // execute_loop interface
38    std::list<generic::priority::select_t> * select_queue_in        = _priority_queue_in ->select();
39    std::list<generic::priority::select_t>::iterator it_queue_in    = select_queue_in    ->begin();
40
41    std::list<generic::priority::select_t> * select_execute_loop    = _priority_execute_loop ->select();
42    std::list<generic::priority::select_t>::iterator it_execute_loop= select_execute_loop ->begin();
43 
44    // For each nb_inst
45    for (uint32_t i=0; i<_param->_nb_inst_commit; ++i)
46      {
47        Tcontrol_t commit_val = false;
48
49        // find a executed instruction
50        for (;
51             (it_execute_loop!=select_execute_loop->end()) and (commit_val == false);
52             ++it_execute_loop)
53          {
54            // take num_execute_loop and num_inst_execute
55            uint32_t x = it_execute_loop->grp;
56            uint32_t y = it_execute_loop->elt;
57
58            // test id instruction is valid
59            if (PORT_READ(in_EXECUTE_LOOP_VAL [x][y]))
60              {
61                // Need spr_acces / reexecute ?
62                Texception_t    exception  = PORT_READ(in_EXECUTE_LOOP_EXCEPTION [x][y]);
63                Taddress_t      address    = PORT_READ(in_EXECUTE_LOOP_ADDRESS   [x][y]);
64                Tcontrol_t      spr_access = ((exception ==  EXCEPTION_ALU_SPR_ACCESS_MUST_READ ) or
65                                              (exception ==  EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE));
66                if (spr_access)
67                  {
68                    // find a not full bank
69                    bool find = false;
70                    for (;
71                         (it_queue_in!=select_queue_in->end()) and (find == false);
72                         ++it_queue_in)
73                      {
74                        uint32_t num_bank = it_queue_in->grp;
75                        if (_reexecute_queue [num_bank].size() < _param->_size_queue)
76                          {
77                            find = true;
78                           
79                            // this instruction don't need spr access. send at the re order buffer
80                            commit_val              = 1; // in_EXECUTE_LOOP_VAL = 1
81                            execute_loop_ack [x][y] = PORT_READ(in_COMMIT_ACK [i]);
82                           
83                            internal_QUEUE_PUSH                [num_bank] = execute_loop_ack [x][y]; // in_EXECUTE_LOOP_VAL = 1
84                            internal_QUEUE_NUM_EXECUTE_LOOP    [num_bank] = x;
85                            internal_QUEUE_NUM_INST_EXECUTE    [num_bank] = y;
86                            internal_QUEUE_NUM_INST_COMMIT     [num_bank] = i;
87                            internal_QUEUE_INFO                [num_bank].spr_wen = (exception ==  EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE);
88                           
89                            // if reexecute, don't commit, just read instruction information (num_reg_rd)
90                            PORT_WRITE(out_COMMIT_WEN          [i], not must_reexecute(address & 0xffff, internal_QUEUE_INFO[num_bank]));
91                          }
92                      }
93                  }
94                else
95                  {
96                    // this instruction don't need spr access. send at the re order buffer
97                    commit_val              = 1; // in_EXECUTE_LOOP_VAL = 1
98                    execute_loop_ack [x][y] = PORT_READ(in_COMMIT_ACK [i]);
99
100                    PORT_WRITE(out_COMMIT_WEN          [i], 1);
101                  }
102               
103                if (commit_val)
104                  {
105//                  if (_param->_have_port_context_id)
106//                  PORT_WRITE(out_COMMIT_CONTEXT_ID   [i], PORT_READ(in_EXECUTE_LOOP_CONTEXT_ID   [x][y]));
107//                  if (_param->_have_port_front_end_id)
108//                  PORT_WRITE(out_COMMIT_FRONT_END_ID [i], PORT_READ(in_EXECUTE_LOOP_FRONT_END_ID [x][y]));
109                    if (_param->_have_port_rob_ptr  )
110                    PORT_WRITE(out_COMMIT_PACKET_ID    [i], PORT_READ(in_EXECUTE_LOOP_PACKET_ID    [x][y]));
111                  //PORT_WRITE(out_COMMIT_OPERATION    [i], PORT_READ(in_EXECUTE_LOOP_OPERATION    [x][y]));
112                  //PORT_WRITE(out_COMMIT_TYPE         [i], PORT_READ(in_EXECUTE_LOOP_TYPE         [x][y]));
113                    PORT_WRITE(out_COMMIT_FLAGS        [i], PORT_READ(in_EXECUTE_LOOP_FLAGS        [x][y]));
114                    PORT_WRITE(out_COMMIT_EXCEPTION    [i], exception);
115                    PORT_WRITE(out_COMMIT_NO_SEQUENCE  [i], PORT_READ(in_EXECUTE_LOOP_NO_SEQUENCE  [x][y]));
116                    PORT_WRITE(out_COMMIT_ADDRESS      [i], address);
117                  }
118              }
119          }
120       
121#ifdef STATISTICS
122        internal_COMMIT_VAL [i] = commit_val;
123#endif
124        PORT_WRITE(out_COMMIT_VAL [i], commit_val);
125      }
126
127    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
128      for (uint32_t j=0; j<_param->_nb_inst_execute [i]; ++j)
129        PORT_WRITE(out_EXECUTE_LOOP_ACK [i][j], execute_loop_ack [i][j]);
130      }
131    else
132      {
133#ifdef STATISTICS
134        for (uint32_t i=0; i<_param->_nb_inst_commit; ++i)
135          internal_COMMIT_VAL [i] = 0;
136#endif
137        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
138          for (uint32_t j=0; j<_param->_nb_inst_execute [i]; ++j)
139            PORT_WRITE(out_EXECUTE_LOOP_ACK [i][j], 0);
140      }
141
142    log_end(Reexecute_unit,FUNCTION);
143  };
144 
145}; // end namespace reexecute_unit
146}; // end namespace ooo_engine
147}; // end namespace multi_ooo_engine
148}; // end namespace core
149
150}; // end namespace behavioural
151}; // end namespace morpheo             
152#endif
153
154
Note: See TracBrowser for help on using the repository browser.