Ignore:
Timestamp:
Jan 15, 2009, 6:19:08 PM (15 years ago)
Author:
rosiere
Message:

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Address_management/SelfTest/src/test.cpp

    r88 r101  
    6767  ALLOC1_SC_SIGNAL( in_PREDICT_INSTRUCTION_ENABLE         ," in_PREDICT_INSTRUCTION_ENABLE         ",Tcontrol_t        ,_param->_nb_instruction);
    6868  ALLOC_SC_SIGNAL ( in_PREDICT_INST_IFETCH_PTR            ," in_PREDICT_INST_IFETCH_PTR            ",Tinst_ifetch_ptr_t);
     69//ALLOC_SC_SIGNAL ( in_PREDICT_BRANCH_IS_CURRENT          ," in_PREDICT_BRANCH_IS_CURRENT          ",Tcontrol_t        );
    6970  ALLOC_SC_SIGNAL ( in_PREDICT_BRANCH_STATE               ," in_PREDICT_BRANCH_STATE               ",Tbranch_state_t   );
    7071  ALLOC_SC_SIGNAL ( in_PREDICT_BRANCH_UPDATE_PREDICTION_ID," in_PREDICT_BRANCH_UPDATE_PREDICTION_ID",Tprediction_ptr_t );
     
    104105  if (_param->_have_port_inst_ifetch_ptr)
    105106  INSTANCE_SC_SIGNAL (_Address_management, in_PREDICT_INST_IFETCH_PTR            );
     107//INSTANCE_SC_SIGNAL (_Address_management, in_PREDICT_BRANCH_IS_CURRENT          );
    106108  INSTANCE_SC_SIGNAL (_Address_management, in_PREDICT_BRANCH_STATE               );
    107109  if (_param->_have_port_depth)
     
    129131  srand(seed);
    130132
    131   const  int32_t percent_transaction_address = 75;
    132   const  int32_t percent_transaction_predict = 75;
    133   const  int32_t percent_transaction_event   =  5;
     133  const  int32_t percent_transaction_address = 100;
     134  const  int32_t percent_transaction_predict = 100;
     135  const  int32_t percent_transaction_event   =  0;
    134136
    135137  SC_START(0);
     
    155157  uint32_t        nb_packet = 1;
    156158
     159  Tcontrol_t      a_val   = false;
    157160  Tcontrol_t      c_val   = false;
    158   Tcontrol_t      n_val   = false;
     161  Tcontrol_t      n_val   = true ;
    159162  Tcontrol_t      nn_val  = false;
    160163
     164  Tgeneral_data_t a_addr  = 0x100>>2;
    161165  Tgeneral_data_t c_addr  = 0x100>>2;
    162166  Tgeneral_data_t n_addr  = 0x100>>2;
    163167  Tgeneral_data_t nn_addr = 0x100>>2;
    164168
     169  Tcontrol_t      a_enable [_param->_nb_instruction];
    165170  Tcontrol_t      c_enable [_param->_nb_instruction];
    166171  Tcontrol_t      n_enable [_param->_nb_instruction];
    167172
     173  Tcontrol_t      a_is_ds_take   = 0;
    168174  Tcontrol_t      c_is_ds_take   = 0;
    169175  Tcontrol_t      n_is_ds_take   = 0;           
    170176  Tcontrol_t      nn_is_ds_take  = 0;
    171177
    172   c_enable [0] = 1;
     178  n_enable [0] = 1;
    173179  for (uint32_t i=1; i<_param->_nb_instruction; i++)
    174     c_enable [i] = 0;
     180    n_enable [i] = 0;
    175181
    176182  LABEL("Send Reset");
     
    216222        in_PREDICT_PC_NEXT_IS_DS_TAKE         ->write(take);
    217223        in_PREDICT_INST_IFETCH_PTR            ->write(0);
     224//      in_PREDICT_BRANCH_IS_CURRENT          ->write(0);
    218225        in_PREDICT_BRANCH_STATE               ->write(0);
    219226        in_PREDICT_BRANCH_UPDATE_PREDICTION_ID->write(0);
     
    251258          for (uint32_t i=0; i<_param->_nb_instruction; i++)
    252259          n_enable [i]  = in_PREDICT_INSTRUCTION_ENABLE [i]->read();
     260
     261          LABEL("  * nn_addr          : %.8x",nn_addr);
    253262        }
    254263 
     
    256265        {
    257266          LABEL("ADDRESS    : Transaction accepted");
    258           LABEL("  * address wait     : %.8x",c_addr);
    259 
    260           TEST(Tgeneral_address_t,out_ADDRESS_INSTRUCTION_ADDRESS        ->read(),c_addr);
     267          LABEL("  * address wait     : %.8x",a_addr);
     268
     269          TEST(Tgeneral_address_t,out_ADDRESS_INSTRUCTION_ADDRESS        ->read(),a_addr);
    261270          for (uint32_t i=0; i<_param->_nb_instruction; i++)
    262           TEST(Tcontrol_t        ,out_ADDRESS_INSTRUCTION_ENABLE     [i] ->read(),c_enable[i]);
     271          TEST(Tcontrol_t        ,out_ADDRESS_INSTRUCTION_ENABLE     [i] ->read(),a_enable[i]);
    263272          if (_param->_have_port_inst_ifetch_ptr)
    264273          TEST(Tinst_ifetch_ptr_t,out_ADDRESS_INST_IFETCH_PTR            ->read(),0);
     
    267276          TEST(Tprediction_ptr_t ,out_ADDRESS_BRANCH_UPDATE_PREDICTION_ID->read(),0);
    268277
    269           c_val = 0;
     278          a_val = 0;
    270279          nb_packet ++;
    271280        }
    272281
     282      {
     283        string str_a_enable = "";
     284        string str_c_enable = "";
     285        string str_n_enable = "";
     286
     287        for (uint32_t i=0; i<_param->_nb_instruction; i++)
     288          {
     289            str_a_enable += " " + toString(a_enable [i]);
     290            str_c_enable += " " + toString(c_enable [i]);
     291            str_n_enable += " " + toString(n_enable [i]);
     292          }
     293
     294        LABEL("----[ Before ]---------------------");
     295        LABEL("  * nb_packet : %d",nb_packet);
     296        LABEL("  * pc a : %d %d %.8x %s",a_val ,a_is_ds_take ,a_addr ,str_a_enable.c_str());
     297        LABEL("  * pc   : %d %d %.8x %s",c_val ,c_is_ds_take ,c_addr ,str_c_enable.c_str());
     298        LABEL("  * pc+4 : %d %d %.8x %s",n_val ,n_is_ds_take ,n_addr ,str_n_enable.c_str());
     299        LABEL("  * pc+8 : %d %d %.8x"   ,nn_val,nn_is_ds_take,nn_addr);
     300        LABEL("-----------------------------------");
     301      }
     302
     303      if (not a_val)
     304        {
     305          if (c_val and n_val and nn_val)
     306            {
     307              a_val        = 1;
     308              c_val        = 0;
     309              a_addr       = c_addr;
     310              a_is_ds_take = c_is_ds_take;
     311
     312              for (uint32_t i=0; i<_param->_nb_instruction; i++)
     313                a_enable [i] = c_enable [i];
     314            }
     315        }
    273316
    274317      if (not c_val)
    275         {
    276           if (n_val and nn_val)
    277             {
    278               c_val        = 1;
    279               c_addr       = n_addr;
    280               c_is_ds_take = n_is_ds_take;
    281 
    282               for (uint32_t i=0; i<_param->_nb_instruction; i++)
    283                 c_enable [i] = n_enable [i];
    284              
    285               n_val        = 1;
    286               n_addr       = nn_addr;
    287               n_is_ds_take = nn_is_ds_take;
    288              
    289               nn_val       = 0;
    290             }
    291         }
     318        {
     319          c_val        = n_val;
     320          if (n_val)
     321            {
     322              c_addr       = n_addr;
     323              c_is_ds_take = n_is_ds_take;
     324             
     325              for (uint32_t i=0; i<_param->_nb_instruction; i++)
     326                c_enable [i] = n_enable [i];
     327            }
     328          n_val        = 0;
     329        }
     330
     331      if (not n_val)
     332        {
     333          n_val        = nn_val;
     334          if (nn_val)
     335            {
     336              n_addr       = nn_addr;
     337              n_is_ds_take = nn_is_ds_take;
     338             
     339//            for (uint32_t i=0; i<_param->_nb_instruction; i++)
     340//              n_enable [i] = nn_enable [i];
     341            }
     342          nn_val       = 0;
     343        }
    292344
    293345      if (in_EVENT_VAL->read() and out_EVENT_ACK->read())
     
    295347          LABEL("EVENT      : Transaction accepted");
    296348
     349          a_val        = false;
    297350          c_val        = false;
    298351          n_val        = true;
     
    312365     
    313366      {
     367        string str_a_enable = "";
    314368        string str_c_enable = "";
    315369        string str_n_enable = "";
     
    317371        for (uint32_t i=0; i<_param->_nb_instruction; i++)
    318372          {
     373            str_a_enable += " " + toString(a_enable [i]);
    319374            str_c_enable += " " + toString(c_enable [i]);
    320375            str_n_enable += " " + toString(n_enable [i]);
    321376          }
    322377
    323         LABEL("-----------------------------------");
     378        LABEL("----[ After ]----------------------");
    324379        LABEL("  * nb_packet : %d",nb_packet);
    325         LABEL("  * pc   : %d %d %.8x %s",c_val  ,c_is_ds_take , c_addr ,str_c_enable.c_str());
    326         if (nn_val)
    327           {
    328         LABEL("  * pc+4 : %d %d %.8x %s",n_val  ,n_is_ds_take , n_addr ,str_n_enable.c_str());
    329           }
    330         else
    331           {
    332         LABEL("  * pc+4 : %d %d %.8x"   ,n_val  ,n_is_ds_take , n_addr );
    333           }
    334         LABEL("  * pc+8 : %d %d %.8x"   ,nn_val ,nn_is_ds_take, nn_addr);
     380        LABEL("  * pc a : %d %d %.8x %s",a_val ,a_is_ds_take ,a_addr ,str_a_enable.c_str());
     381        LABEL("  * pc   : %d %d %.8x %s",c_val ,c_is_ds_take ,c_addr ,str_c_enable.c_str());
     382        LABEL("  * pc+4 : %d %d %.8x %s",n_val ,n_is_ds_take ,n_addr ,str_n_enable.c_str());
     383        LABEL("  * pc+8 : %d %d %.8x"   ,nn_val,nn_is_ds_take,nn_addr);
    335384        LABEL("-----------------------------------");
    336385      }
     
    368417  delete []  in_PREDICT_INSTRUCTION_ENABLE         ;
    369418  delete     in_PREDICT_INST_IFETCH_PTR            ;
     419//delete     in_PREDICT_BRANCH_IS_CURRENT          ;
    370420  delete     in_PREDICT_BRANCH_STATE               ;
    371421  delete     in_PREDICT_BRANCH_UPDATE_PREDICTION_ID;
Note: See TracChangeset for help on using the changeset viewer.