Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_Glue_genMealy_issue.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_Glue_genMealy_issue.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Core_Glue/src/Core_Glue_genMealy_issue.cpp	(revision 120)
@@ -119,105 +119,118 @@
 //       }
 
-    for (uint32_t num_ooo_engine=0; num_ooo_engine<_param->_nb_ooo_engine; ++num_ooo_engine)
-      for (uint32_t num_inst_issue_queue=0; num_inst_issue_queue<_param->_nb_inst_issue_queue[num_ooo_engine]; ++num_inst_issue_queue)
-        {
-          bool find = false;
-
-          Tcontrol_t val  = PORT_READ(in_ISSUE_OOO_ENGINE_VAL  [num_ooo_engine][num_inst_issue_queue]);
-          Ttype_t    type = PORT_READ(in_ISSUE_OOO_ENGINE_TYPE [num_ooo_engine][num_inst_issue_queue]);
-
-          log_printf(TRACE,Core_Glue,FUNCTION,"  * num_ooo_engine                : %d",num_ooo_engine      );
-          log_printf(TRACE,Core_Glue,FUNCTION,"  * num_inst_issue_queue          : %d",num_inst_issue_queue);
-          log_printf(TRACE,Core_Glue,FUNCTION,"    * val                         : %d",val);
-          log_printf(TRACE,Core_Glue,FUNCTION,"    * type                        : %d",type);
-
-          if (val)
-            for (uint32_t num_inst_issue_slot=0; num_inst_issue_slot<_param->_nb_inst_issue_slot[num_ooo_engine]; ++num_inst_issue_slot)
+//     for (uint32_t num_ooo_engine=0; num_ooo_engine<_param->_nb_ooo_engine; ++num_ooo_engine)
+
+    std::list<generic::priority::select_t> * select_ooo_engine = _priority_ooo_engine->select();
+    for (std::list<generic::priority::select_t>::iterator it_ooo_engine=select_ooo_engine->begin();
+         it_ooo_engine!=select_ooo_engine->end();
+         ++it_ooo_engine)
+      {
+        uint32_t num_ooo_engine      = it_ooo_engine->grp;
+
+        for (uint32_t num_inst_issue_queue=0; num_inst_issue_queue<_param->_nb_inst_issue_queue[num_ooo_engine]; ++num_inst_issue_queue)
+          {
+            bool find = false;
+            
+            Tcontrol_t val  = PORT_READ(in_ISSUE_OOO_ENGINE_VAL  [num_ooo_engine][num_inst_issue_queue]);
+            Ttype_t    type = PORT_READ(in_ISSUE_OOO_ENGINE_TYPE [num_ooo_engine][num_inst_issue_queue]);
+            
+            log_printf(TRACE,Core_Glue,FUNCTION,"  * num_ooo_engine                : %d",num_ooo_engine      );
+            log_printf(TRACE,Core_Glue,FUNCTION,"  * num_inst_issue_queue          : %d",num_inst_issue_queue);
+            log_printf(TRACE,Core_Glue,FUNCTION,"    * val                         : %d",val);
+            log_printf(TRACE,Core_Glue,FUNCTION,"    * type                        : %d",type);
+            
+            if (val)
+              for (uint32_t num_inst_issue_slot=0; num_inst_issue_slot<_param->_nb_inst_issue_slot[num_ooo_engine]; ++num_inst_issue_slot)
+                {
+                  log_printf(TRACE,Core_Glue,FUNCTION,"    * num_inst_issue_slot         : %d",num_inst_issue_slot);
+                  
+                  // scan all read_unit
+                  
+                  if (SLOT_ENABLE [num_ooo_engine][num_inst_issue_slot])
+                    for (uint32_t num_execute_loop=0; num_execute_loop<_param->_nb_execute_loop; ++num_execute_loop)
+                      {
+                        std::list<generic::priority::select_t> * select_read_unit = _priority_read_unit[num_execute_loop]->select();
+                        for (std::list<generic::priority::select_t>::iterator it_read_unit=select_read_unit->begin();
+                             it_read_unit!=select_read_unit->end();
+                             ++it_read_unit)
+                          {
+                            // get the most priotary ...
+                            uint32_t num_read_unit = it_read_unit->grp;
+                            Tcontrol_t ack = READ_UNIT_ENABLE [num_execute_loop][num_read_unit];
+                            
+                            log_printf(TRACE,Core_Glue,FUNCTION,"      * num_execute_loop          : %d",num_execute_loop);
+                            log_printf(TRACE,Core_Glue,FUNCTION,"      * num_read_unit             : %d",num_read_unit   );
+                            log_printf(TRACE,Core_Glue,FUNCTION,"        * read_unit_enable        : %d",ack             );
+                            
+                            // test if :
+                            //  * read_unit can accept an instruction (valid and no previous instruction)
+                            //  * slot can issue an instruction at this read_unit
+                            //  * read_unit can accept this type
+                            if (ack and
+                                _param->_table_dispatch [num_ooo_engine][num_inst_issue_slot][num_execute_loop][num_read_unit] and
+                                _param->_table_issue_type [num_execute_loop][num_read_unit][type])
+                              {
+                                log_printf(TRACE,Core_Glue,FUNCTION,"  * find !!!");
+                                
+                                // find !
+                                // Transaction
+                                READ_UNIT_ENABLE       [num_execute_loop][num_read_unit] = false; // now, this read_unit is busy
+                                ISSUE_EXECUTE_LOOP_VAL [num_execute_loop][num_read_unit] = 1; // = val
+                                ISSUE_OOO_ENGINE_ACK   [num_ooo_engine][num_inst_issue_queue] = 1; // = ack
+                                SLOT_ENABLE            [num_ooo_engine][num_inst_issue_slot]  = false; // now this slot is used
+                                      
+                                if (_param->_have_port_context_id)
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_CONTEXT_ID            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [num_ooo_engine][num_inst_issue_queue]));
+			        if (_param->_have_port_front_end_id)
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_FRONT_END_ID          [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [num_ooo_engine][num_inst_issue_queue]));
+			        if (_param->_have_port_ooo_engine_id)
+                                  {
+                                Tcontext_t ooo_engine_id = _param->_translate_num_ooo_engine_to_execute_loop_ooo_engine_id [num_ooo_engine][num_execute_loop];
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OOO_ENGINE_ID         [num_execute_loop][num_read_unit],ooo_engine_id);
+                                  }
+			        if (_param->_have_port_rob_ptr)
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_PACKET_ID             [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_PACKET_ID             [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OPERATION             [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_OPERATION             [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_TYPE                  [num_execute_loop][num_read_unit],type);
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_STORE_QUEUE_PTR_WRITE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [num_ooo_engine][num_inst_issue_queue]));
+			        if (_param->_have_port_load_queue_ptr)
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_LOAD_QUEUE_PTR_WRITE  [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_HAS_IMMEDIAT          [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_IMMEDIAT              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_IMMEDIAT              [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RA               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RA               [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RA            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RB               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RB               [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RB            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RC               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RC               [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RC            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RD              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RD              [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RD            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RE              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RE              [num_ooo_engine][num_inst_issue_queue]));
+			        PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RE            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [num_ooo_engine][num_inst_issue_queue]));
+                              
+                                
+                                find = true;
+                                break;
+                              }
+                            //if (find)
+                            //  break;
+                          }
+                        if (find)
+                          break;
+                      }
+                  if (find)
+                    break;
+                }
+            
+            if (_param->_issue_queue_in_order [num_ooo_engine] and
+                not find and 
+                (num_inst_issue_queue >= _param->_nb_inst_reexecute [num_ooo_engine]))
               {
-                log_printf(TRACE,Core_Glue,FUNCTION,"    * num_inst_issue_slot         : %d",num_inst_issue_slot);
+                log_printf(TRACE,Core_Glue,FUNCTION,"  * stop scan !!!");
                 
-                // scan all read_unit
-                
-                if (SLOT_ENABLE [num_ooo_engine][num_inst_issue_slot])
-                  for (uint32_t num_execute_loop=0; num_execute_loop<_param->_nb_execute_loop; ++num_execute_loop)
-                    {
-                      for (uint32_t _num_read_unit=0; _num_read_unit<_param->_nb_read_unit[num_execute_loop]; ++_num_read_unit)
-                        {
-                          uint32_t num_read_unit = (_num_read_unit+reg_PRIORITY)%_param->_nb_read_unit[num_execute_loop];
-                          Tcontrol_t ack = READ_UNIT_ENABLE [num_execute_loop][num_read_unit];
-                          
-                          log_printf(TRACE,Core_Glue,FUNCTION,"      * num_execute_loop          : %d",num_execute_loop);
-                          log_printf(TRACE,Core_Glue,FUNCTION,"      * num_read_unit             : %d",num_read_unit   );
-                          log_printf(TRACE,Core_Glue,FUNCTION,"        * read_unit_enable        : %d",ack             );
-                          
-                          // test if :
-                          //  * read_unit can accept an instruction (valid and no previous instruction)
-                          //  * slot can issue an instruction at this read_unit
-                          //  * read_unit can accept this type
-                          if (ack and
-                              _param->_table_dispatch [num_ooo_engine][num_inst_issue_slot][num_execute_loop][num_read_unit] and
-                              _param->_table_issue_type [num_execute_loop][num_read_unit][type])
-                            {
-                              log_printf(TRACE,Core_Glue,FUNCTION,"  * find !!!");
-
-                              // find !
-                              // Transaction
-                              READ_UNIT_ENABLE       [num_execute_loop][num_read_unit] = false; // now, this read_unit is busy
-                              ISSUE_EXECUTE_LOOP_VAL [num_execute_loop][num_read_unit] = 1; // = val
-                              ISSUE_OOO_ENGINE_ACK   [num_ooo_engine][num_inst_issue_queue] = 1; // = ack
-                              SLOT_ENABLE            [num_ooo_engine][num_inst_issue_slot]  = false; // now this slot is used
-                                      
-			      if (_param->_have_port_context_id)
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_CONTEXT_ID            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_CONTEXT_ID            [num_ooo_engine][num_inst_issue_queue]));
-			      if (_param->_have_port_front_end_id)
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_FRONT_END_ID          [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_FRONT_END_ID          [num_ooo_engine][num_inst_issue_queue]));
-			      if (_param->_have_port_ooo_engine_id)
-                                {
-                              Tcontext_t ooo_engine_id = 0;
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OOO_ENGINE_ID         [num_execute_loop][num_read_unit],ooo_engine_id);
-                                }
-			      if (_param->_have_port_rob_ptr)
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_PACKET_ID             [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_PACKET_ID             [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OPERATION             [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_OPERATION             [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_TYPE                  [num_execute_loop][num_read_unit],type);
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_STORE_QUEUE_PTR_WRITE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [num_ooo_engine][num_inst_issue_queue]));
-			      if (_param->_have_port_load_queue_ptr)
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_LOAD_QUEUE_PTR_WRITE  [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE  [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_HAS_IMMEDIAT          [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT          [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_IMMEDIAT              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_IMMEDIAT              [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RA               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RA               [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RA            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RA            [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RB               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RB               [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RB            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RB            [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RC               [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RC               [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RC            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RC            [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RD              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RD              [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RD            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RD            [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RE              [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RE              [num_ooo_engine][num_inst_issue_queue]));
-			      PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RE            [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RE            [num_ooo_engine][num_inst_issue_queue]));
-                              
-                              
-                              find = true;
-                              break;
-                            }
-                          //if (find)
-                          //  break;
-                        }
-                      if (find)
-                        break;
-                    }
-                if (find)
-                  break;
+                break; // stop scan
               }
-          
-          if (_param->_issue_queue_in_order [num_ooo_engine] and
-              not find and 
-              (num_inst_issue_queue >= _param->_nb_inst_reexecute [num_ooo_engine]))
-            {
-              log_printf(TRACE,Core_Glue,FUNCTION,"  * stop scan !!!");
-              
-              break; // stop scan
-            }
-        }
+          }
+      }
 
     // Write output
