Ignore:
Timestamp:
Dec 31, 2008, 11:18:08 AM (16 years ago)
Author:
rosiere
Message:

1) Fix bug (read unit, RAT -> write in R0, SPR desallocation ...)
2) Change VHDL Execute_queue -> use Generic/Queue?
3) Complete document on VHDL generation
4) Add soc test

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

    r95 r98  
    4040          if (PORT_READ(in_BRANCH_EVENT_VAL [i]) and internal_BRANCH_EVENT_ACK [i])
    4141            {
     42              log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_EVENT [%d]",i);
     43
    4244//               throw ERRORMORPHEO(FUNCTION,_("Not yet implemented (Comming Soon).\n"));
    4345
    4446              context_state_t state = reg_STATE [i];
    4547
    46               Tdepth_t   depth      = // (_param->_have_port_depth)?PORT_READ(in_BRANCH_EVENT_DEPTH [i]):
    47                 0;
     48              Tdepth_t   depth      = (_param->_have_port_depth)?PORT_READ(in_BRANCH_EVENT_DEPTH [i]):0;
    4849              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [i];
    4950              Tdepth_t   depth_min  = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [i]):0;
     
    6162              // is_valid = can modify local information
    6263              //   if context_state_ok : yes
    63               //   if context_state_ko : test the depth, and the priority of envent
     64              //   if context_state_ko : test the depth, and the priority of event
    6465
    6566              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    6667                                       (depth1< depth0) or
    67                                        ((depth1==depth0) and (priority1>priority0)));
     68                                       ((depth1==depth0) and (priority1>=priority0))); // >= because another branch can be a miss prediction with same depth
    6869
    6970              if (is_valid)
     
    7677                //reg_EVENT_ADDRESS_EEAR     [i] =  0;
    7778                  reg_EVENT_ADDRESS_EEAR_VAL [i] =  0;
    78                   reg_EVENT_IS_DELAY_SLOT    [i] =  dest_val;
     79                  reg_EVENT_IS_DELAY_SLOT    [i] =  1;
    7980                  reg_EVENT_IS_DS_TAKE       [i] =  dest_val;
    8081                  reg_EVENT_DEPTH            [i] =  depth;
     
    8990          if (PORT_READ(in_DECOD_EVENT_VAL [i]) and internal_DECOD_EVENT_ACK [i])
    9091            {
     92              log_printf(TRACE,Context_State,FUNCTION,"  * DECOD_EVENT [%d]",i);
     93
    9194              Tcontext_t context    = (_param->_have_port_context_id )?PORT_READ(in_DECOD_EVENT_CONTEXT_ID [i]):0;
    9295              Tdepth_t   depth      = (_param->_have_port_depth      )?PORT_READ(in_DECOD_EVENT_DEPTH      [i]):0;
     
    190193        if (PORT_READ(in_COMMIT_EVENT_VAL ) and internal_COMMIT_EVENT_ACK )
    191194          {
     195            log_printf(TRACE,Context_State,FUNCTION,"  * COMMIT_EVENT");
     196
    192197            Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_COMMIT_EVENT_CONTEXT_ID ):0;
    193198            Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_COMMIT_EVENT_DEPTH      ):0;
     
    252257        // -------------------------------------------------------------------
    253258
    254         for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    255           if (PORT_READ(in_BRANCH_COMPLETE_VAL [i]) and internal_BRANCH_COMPLETE_ACK [i])
    256             {
    257               if (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
    258                 {
    259                   Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
    260                   Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
    261                   Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    262                   Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
    263                   Tdepth_t   depth_max  = _param->_array_size_depth [context];
     259//         for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
     260//           if (PORT_READ(in_BRANCH_COMPLETE_VAL [i]) and internal_BRANCH_COMPLETE_ACK [i])
     261//             {
     262//               log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_COMPLETE [%d]",i);
     263//               if (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
     264//                 {
     265//                   Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
     266//                   Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
     267//                   Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
     268//                   Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
     269//                   Tdepth_t   depth_max  = _param->_array_size_depth [context];
    264270                 
    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));
     271// //                   Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     272// //                   Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     273//                   Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     274//                   Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
    269275                 
    270                   context_state_t state = reg_STATE [context];
     276//                   context_state_t state = reg_STATE [context];
    271277                 
    272                   // miss > excep > spr/sync
    273                   uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    274                   uint8_t    priority1  = 2; // miss
     278//                   // miss > excep > spr/sync
     279//                   uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     280//                   uint8_t    priority1  = 2; // miss
    275281                 
    276                   // is_valid = can modify local information
    277                   //  if context_state_ok : yes
    278                   //  if context_state_ko : test the depth, and the priority of envent
     282//                   // is_valid = can modify local information
     283//                   //  if context_state_ok : yes
     284//                   //  if context_state_ko : test the depth, and the priority of envent
    279285                 
    280                   bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    281                                            (depth1< depth0) or
    282                                            ((depth1==depth0) and (priority1>priority0)));
     286//                   bool       is_valid   = ((state == CONTEXT_STATE_OK) or
     287//                                            (depth1< depth0) or
     288//                                            ((depth1==depth0) and (priority1>priority0)));
    283289                 
    284                   if (is_valid)
    285                     {
    286                       // commit
    287                       Tcontrol_t take = PORT_READ(in_BRANCH_COMPLETE_TAKE [i]);
    288                       reg_STATE                  [context] = CONTEXT_STATE_KO_MISS;
    289                       reg_EVENT_ADDRESS          [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_SRC  [i])+1; //DELAY_SLOT
    290                       reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_DEST [i]);
    291                       reg_EVENT_ADDRESS_EPCR_VAL [context] = take; // if not take : in sequence
    292                     //reg_EVENT_ADDRESS_EEAR     [context];
    293                       reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
    294                       reg_EVENT_IS_DELAY_SLOT    [context] = take;
    295                       reg_EVENT_IS_DS_TAKE       [context] = take;
    296                       reg_EVENT_DEPTH            [context] = depth;
    297                     }
    298                 }
    299             }
     290//                   if (is_valid)
     291//                     {
     292//                       // commit
     293//                       Tcontrol_t take = PORT_READ(in_BRANCH_COMPLETE_TAKE [i]);
     294//                       reg_STATE                  [context] = CONTEXT_STATE_KO_MISS;
     295//                       reg_EVENT_ADDRESS          [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_SRC  [i])+1; //DELAY_SLOT
     296//                       reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_DEST [i]);
     297//                       reg_EVENT_ADDRESS_EPCR_VAL [context] = take; // if not take : in sequence
     298//                     //reg_EVENT_ADDRESS_EEAR     [context];
     299//                       reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
     300//                       reg_EVENT_IS_DELAY_SLOT    [context] = take;
     301//                       reg_EVENT_IS_DS_TAKE       [context] = take;
     302//                       reg_EVENT_DEPTH            [context] = depth;
     303//                     }
     304//                 }
     305//             }
    300306
    301307        // -------------------------------------------------------------------
     
    305311          if (internal_EVENT_VAL [i] and PORT_READ(in_EVENT_ACK [i]))
    306312            {
     313              log_printf(TRACE,Context_State,FUNCTION,"  * EVENT [%d]",i);
    307314              // Write pc
    308315              context_state_t state = reg_STATE [i];
     
    338345          if (internal_SPR_EVENT_VAL [i] and PORT_READ(in_SPR_EVENT_ACK [i]))
    339346            {
     347              log_printf(TRACE,Context_State,FUNCTION,"  * SPR_EVENT [%d]",i);
     348
    340349              // Write spr
    341350#ifdef DEBUG_TEST
Note: See TracChangeset for help on using the changeset viewer.