Ignore:
Timestamp:
Feb 9, 2009, 11:55:26 PM (15 years ago)
Author:
rosiere
Message:

1) RAT : Fix bug when update and event in same cycle
2) Context State : Compute depth
3) Load Store Unit : In check logic, translate all access in little endian. More easy to check
4) UFPT : End Event

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp

    r105 r106  
    196196              log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_EVENT [%d]",i);
    197197
    198 //               throw ERRORMORPHEO(FUNCTION,_("Not yet implemented (Comming Soon).\n"));
    199 
    200198              context_state_t state = reg_STATE [i];
    201199
     
    203201              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [i];
    204202              Tdepth_t   depth_min  = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [i]):0;
    205               Tdepth_t   depth_max  = _param->_array_size_depth [i];
     203              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [i];
    206204             
    207 //               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
    208 //               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
    209               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
    210               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     205              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     206              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     207//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     208//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
    211209
    212210              // priority : miss > excep > spr/sync
    213               uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR) or (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR) or (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND))?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
     211              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR   ) or
     212                                       (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR     ) or
     213                                       (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or
     214                                       (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND  ))?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
    214215              uint8_t    priority1  = 2; // miss
    215216
     
    217218              //   if context_state_ok : yes
    218219              //   if context_state_ko : test the depth, and the priority of event
    219 
    220220              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    221221                                       (depth1< depth0) or
    222222                                       ((depth1==depth0) and (priority1>=priority0))); // >= because another branch can be a miss prediction with same depth
     223
     224              log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
     225              log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
     226              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
     227              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
     228              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
     229              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
     230              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
     231              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
     232              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
    223233
    224234              if (is_valid)
     
    251261              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    252262              Tdepth_t   depth_min = (_param->_have_port_depth      )?PORT_READ(in_DEPTH_MIN [context]):0;
    253               Tdepth_t   depth_max  = _param->_array_size_depth [context];
     263              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [context];
    254264             
    255 //               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
    256 //               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
    257               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
    258               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     265              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     266              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     267//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     268//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
    259269
    260270              context_state_t state = reg_STATE [context];
     
    262272             
    263273              // miss > excep > spr/sync
    264               uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR) or (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR) or (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     274              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR   ) or
     275                                       (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR     ) or
     276                                       (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or
     277                                       (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND  ))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    265278              uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:0;
    266279
     
    272285                                       (depth1< depth0) or
    273286                                       ((depth1==depth0) and (priority1>=priority0)));
     287
     288              log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
     289              log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
     290              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
     291              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
     292              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
     293              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
     294              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
     295              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
     296              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
    274297
    275298              if (is_valid)
     
    371394            Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    372395            Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
    373             Tdepth_t   depth_max  = _param->_array_size_depth [context];
     396            Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [context];
    374397           
    375 //          Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
    376 //          Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
    377             Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
    378             Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     398            Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     399            Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     400//             Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     401//             Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
    379402
    380403            context_state_t state = reg_STATE [context];
     
    382405           
    383406            // miss > excep > spr/sync
    384             uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR) or (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR) or (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     407            uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR   ) or
     408                                     (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR     ) or
     409                                     (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or
     410                                     (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND  ))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    385411            uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:2; // else load_miss_speculation (EVENT_TYPE_MISS_SPECULATION)
    386412
     
    392418                                     (depth1< depth0) or
    393419                                     ((depth1==depth0) and (priority1>=priority0)));
     420
     421            log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
     422            log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
     423            log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
     424            log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
     425            log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
     426            log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
     427            log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
     428            log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
     429            log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
    394430
    395431            if (is_valid)
     
    427463
    428464        // -------------------------------------------------------------------
    429         // -----[ BRANCH_COMPLETE ]-------------------------------------------
    430         // -------------------------------------------------------------------
    431 
    432 //         for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    433 //           if (PORT_READ(in_BRANCH_COMPLETE_VAL [i]) and internal_BRANCH_COMPLETE_ACK [i])
    434 //             {
    435 //               log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_COMPLETE [%d]",i);
    436 //               if (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
    437 //                 {
    438 //                   Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
    439 //                   Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
    440 //                   Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    441 //                   Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
    442 //                   Tdepth_t   depth_max  = _param->_array_size_depth [context];
    443                  
    444 // //                   Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
    445 // //                   Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
    446 //                   Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
    447 //                   Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
    448                  
    449 //                   context_state_t state = reg_STATE [context];
    450                  
    451 //                   // miss > excep > spr/sync
    452 //                   uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_BRANCH_ADDR) or (state == CONTEXT_STATE_KO_MISS_LOAD_ADDR) or (state == CONTEXT_STATE_KO_MISS_BRANCH_WAITEND) or (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    453 //                   uint8_t    priority1  = 2; // miss
    454                  
    455 //                   // is_valid = can modify local information
    456 //                   //  if context_state_ok : yes
    457 //                   //  if context_state_ko : test the depth, and the priority of envent
    458                  
    459 //                   bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    460 //                                            (depth1< depth0) or
    461 //                                            ((depth1==depth0) and (priority1>=priority0)));
    462                  
    463 //                   if (is_valid)
    464 //                     {
    465 //                       // commit
    466 //                       Tcontrol_t take = PORT_READ(in_BRANCH_COMPLETE_TAKE [i]);
    467 //                       reg_STATE                  [context] = CONTEXT_STATE_KO_MISS;
    468 //                       reg_EVENT_ADDRESS          [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_SRC  [i])+1; //DELAY_SLOT
    469 //                       reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_DEST [i]);
    470 //                       reg_EVENT_ADDRESS_EPCR_VAL [context] = take; // if not take : in sequence
    471 //                     //reg_EVENT_ADDRESS_EEAR     [context];
    472 //                       reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
    473 //                       reg_EVENT_IS_DELAY_SLOT    [context] = take;
    474 //                       reg_EVENT_IS_DS_TAKE       [context] = take;
    475 //                       reg_EVENT_DEPTH            [context] = depth;
    476 //                     }
    477 //                 }
    478 //             }
    479 
    480         // -------------------------------------------------------------------
    481465        // -----[ EVENT ]-----------------------------------------------------
    482466        // -------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.