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/Context_State/SelfTest/src/test.cpp

    r98 r101  
    213213  // Initialisation
    214214
     215  const bool test1  = true;
     216  const bool test2  = true;
     217  const bool test3  = true;
     218  const bool test4  = true;
     219  const bool test5  = true;
     220  const bool test6  = true;
     221  const bool test7  = true;
     222  const bool test8  = true;
     223  const bool test9  = true;
     224  const bool test10 = true;
     225  const bool test11 = true;
     226  const bool test12 = true;
     227
    215228  const uint32_t seed = 0;
    216229//const uint32_t seed = static_cast<uint32_t>(time(NULL));
     
    264277      uint32_t context    = rand()%_param->_nb_context;
    265278
    266       if (1)
     279      if (test1)
    267280        {
    268281          SC_START(3);
     
    285298          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    286299         
    287           do
    288             {
    289               in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
    290              
    291               SC_START(1);
    292             }
    293           while (not ( in_DECOD_EVENT_VAL [port]->read() and
    294                        out_DECOD_EVENT_ACK [port]->read()));
    295           in_DECOD_EVENT_VAL [port]->write(0);
     300          in_DECOD_EVENT_VAL           [port]->write(1);
     301
     302          SC_START(0);
     303          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     304          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
     305
     306          SC_START(1);
     307
     308          in_NB_INST_DECOD_ALL  [context]->write(0);
     309          in_NB_INST_COMMIT_ALL [context]->write(0);
     310          in_NB_INST_COMMIT_MEM [context]->write(0);
     311         
     312          LABEL("msync (send decod)");
     313          SC_START(0);
     314          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     315          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
     316
     317          SC_START(1);
     318
     319          in_DECOD_EVENT_VAL     [port]->write(0);
     320          in_NB_INST_COMMIT_ALL  [context]->write(1);
    296321         
    297322          LABEL("msync (wait end)");
     
    300325          SC_START(3);
    301326         
    302           in_NB_INST_DECOD_ALL  [context]->write(0);
    303           in_NB_INST_COMMIT_ALL [context]->write(1);
    304           in_NB_INST_COMMIT_MEM [context]->write(0);
    305          
    306           SC_START(1);
    307          
    308           LABEL("msync (send decod)");
    309           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    310          
    311           SC_START(3);
    312          
    313           in_NB_INST_DECOD_ALL  [context]->write(1);
    314           SC_START(1);
    315          
    316           LABEL("msync (wait end)");
    317           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    318           in_NB_INST_DECOD_ALL  [context]->write(0);
    319           in_NB_INST_COMMIT_MEM [context]->write(1);
    320          
    321           SC_START(3);
    322          
    323           in_NB_INST_COMMIT_MEM [context]->write(0);
     327          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     328          in_NB_INST_COMMIT_ALL [context]->write(0);
     329
    324330          SC_START(1);
    325331          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    326332        }
    327333     
    328       if (1)
     334      if (test2)
    329335        {
    330336          SC_START(3);
    331 
     337         
    332338          LABEL("psync (begin)");
    333           in_NB_INST_DECOD_ALL  [context]->write(1);
    334           in_NB_INST_COMMIT_ALL [context]->write(1);
    335           in_NB_INST_COMMIT_MEM [context]->write(1);
    336          
    337           uint32_t port = rand()%_param->_nb_decod_unit;
    338          
    339           in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
    340           in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
    341           in_DECOD_EVENT_ADDRESS       [port]->write(0x200);
    342           in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbebe);
    343           if (_param->_have_port_depth)
    344           in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    345           in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_PSYNC);
    346          
    347           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    348          
    349           do
    350             {
    351               in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
    352          
    353               SC_START(1);
    354             }
    355           while (not ( in_DECOD_EVENT_VAL [port]->read() and
    356                        out_DECOD_EVENT_ACK [port]->read()));
    357           in_DECOD_EVENT_VAL [port]->write(0);
    358          
    359           LABEL("psync (wait end)");
    360           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    361          
    362           SC_START(3);
    363          
    364           in_NB_INST_DECOD_ALL  [context]->write(0);
    365           in_NB_INST_COMMIT_ALL [context]->write(0);
    366           in_NB_INST_COMMIT_MEM [context]->write(0);
    367          
    368           SC_START(1);
    369 
    370           bool find = false;
    371           do
    372             {
    373               in_EVENT_ACK [context]->write(rand()%percent_transaction_event);
    374          
    375               SC_START(0);
    376          
    377               if (out_EVENT_VAL [context]->read() and in_EVENT_ACK [context]->read())
    378                 {
    379                   TEST(Taddress_t,out_EVENT_ADDRESS          [context]->read(),0x201);
    380                   TEST(Taddress_t,out_EVENT_ADDRESS_NEXT     [context]->read(),0xdeadbebe);
    381                   TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
    382                   TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
    383                  
    384                   find = true;
    385                 }
    386              
    387               SC_START(1);
    388             }
    389           while (not find);
    390 
    391           in_EVENT_ACK [context]->write(0);
    392           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    393         }
    394 
    395       if (1)
    396         {
    397           SC_START(3);
    398 
    399           LABEL("csync (begin)");
    400339          in_NB_INST_DECOD_ALL  [context]->write(1);
    401340          in_NB_INST_COMMIT_ALL [context]->write(1);
     
    410349          if (_param->_have_port_depth)
    411350          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    412           in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_CSYNC);
    413          
    414           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    415          
    416           do
    417             {
    418               in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
    419          
    420               SC_START(1);
    421             }
    422           while (not ( in_DECOD_EVENT_VAL [port]->read() and
    423                        out_DECOD_EVENT_ACK [port]->read()));
    424           in_DECOD_EVENT_VAL [port]->write(0);
    425          
    426           LABEL("csync (wait end)");
    427           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    428          
    429           SC_START(3);
    430          
     351          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_PSYNC);
     352         
     353          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     354         
     355          in_DECOD_EVENT_VAL           [port]->write(1);
     356
     357          SC_START(0);
     358          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     359          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
     360
     361          SC_START(1);
     362
    431363          in_NB_INST_DECOD_ALL  [context]->write(0);
    432364          in_NB_INST_COMMIT_ALL [context]->write(0);
    433365          in_NB_INST_COMMIT_MEM [context]->write(0);
    434          
     366         
     367          LABEL("psync (send decod)");
     368          SC_START(0);
     369          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     370          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
     371
     372          SC_START(1);
     373
     374          in_DECOD_EVENT_VAL     [port]->write(0);
     375          in_NB_INST_COMMIT_ALL  [context]->write(1);
     376         
     377          LABEL("psync (wait end)");
     378          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     379         
     380          SC_START(3);
     381         
     382          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     383          in_NB_INST_COMMIT_ALL [context]->write(0);
     384
    435385          SC_START(1);
    436386
     
    448398                  TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
    449399                  TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
    450          
    451                   find = true;
    452                 }
    453              
    454               SC_START(1);
    455             }
    456           while (not find);
     400                 
     401                  find = true;
     402                }
     403             
     404              SC_START(1);
     405            }
     406          while (not find);
     407
    457408          in_EVENT_ACK [context]->write(0);
     409          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    458410        }
    459411
    460       if (1)
     412      if (test3)
    461413        {
    462414          SC_START(3);
    463415         
    464           LABEL("spr (begin)");
     416          LABEL("csync (begin)");
    465417          in_NB_INST_DECOD_ALL  [context]->write(1);
    466418          in_NB_INST_COMMIT_ALL [context]->write(1);
     
    471423          in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
    472424          in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
    473           in_DECOD_EVENT_ADDRESS       [port]->write(0x100);
    474           in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbeef);
     425          in_DECOD_EVENT_ADDRESS       [port]->write(0x300);
     426          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdead0300);
     427          if (_param->_have_port_depth)
     428          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
     429          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_CSYNC);
     430         
     431          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     432         
     433          in_DECOD_EVENT_VAL           [port]->write(1);
     434
     435          SC_START(0);
     436          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     437          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
     438
     439          SC_START(1);
     440
     441          in_NB_INST_DECOD_ALL  [context]->write(0);
     442          in_NB_INST_COMMIT_ALL [context]->write(0);
     443          in_NB_INST_COMMIT_MEM [context]->write(0);
     444         
     445          LABEL("csync (send decod)");
     446          SC_START(0);
     447          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     448          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
     449
     450          SC_START(1);
     451
     452          in_DECOD_EVENT_VAL     [port]->write(0);
     453          in_NB_INST_COMMIT_ALL  [context]->write(1);
     454         
     455          LABEL("csync (wait end)");
     456          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     457         
     458          SC_START(3);
     459         
     460          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     461          in_NB_INST_COMMIT_ALL [context]->write(0);
     462
     463          SC_START(1);
     464
     465          bool find = false;
     466          do
     467            {
     468              in_EVENT_ACK [context]->write(rand()%percent_transaction_event);
     469         
     470              SC_START(0);
     471         
     472              if (out_EVENT_VAL [context]->read() and in_EVENT_ACK [context]->read())
     473                {
     474                  TEST(Taddress_t,out_EVENT_ADDRESS          [context]->read(),0x301);
     475                  TEST(Taddress_t,out_EVENT_ADDRESS_NEXT     [context]->read(),0xdead0300);
     476                  TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
     477                  TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
     478                 
     479                  find = true;
     480                }
     481             
     482              SC_START(1);
     483            }
     484          while (not find);
     485
     486          in_EVENT_ACK [context]->write(0);
     487          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     488
     489        }
     490
     491      if (test4)
     492        {
     493          SC_START(3);
     494         
     495          LABEL("spr_access (begin)");
     496          in_NB_INST_DECOD_ALL  [context]->write(1);
     497          in_NB_INST_COMMIT_ALL [context]->write(1);
     498          in_NB_INST_COMMIT_MEM [context]->write(1);
     499         
     500          uint32_t port = rand()%_param->_nb_decod_unit;
     501         
     502          in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
     503          in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
     504          in_DECOD_EVENT_ADDRESS       [port]->write(0x400);
     505          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdead0400);
    475506          if (_param->_have_port_depth)
    476507          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
     
    479510          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    480511         
    481           do
    482             {
    483               in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
    484              
    485               SC_START(1);
    486             }
    487           while (not ( in_DECOD_EVENT_VAL [port]->read() and
    488                        out_DECOD_EVENT_ACK [port]->read()));
    489           in_DECOD_EVENT_VAL [port]->write(0);
    490          
    491           LABEL("spr (wait end)");
    492           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    493          
    494           SC_START(3);
    495          
     512          in_DECOD_EVENT_VAL           [port]->write(1);
     513
     514          SC_START(0);
     515          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     516          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
     517
     518          SC_START(1);
     519
    496520          in_NB_INST_DECOD_ALL  [context]->write(0);
    497521          in_NB_INST_COMMIT_ALL [context]->write(0);
    498522          in_NB_INST_COMMIT_MEM [context]->write(0);
    499          
    500           SC_START(1);
    501          
    502           LABEL("spr (send decod)");
    503           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    504          
    505           SC_START(3);
    506          
    507           in_NB_INST_DECOD_ALL  [context]->write(1);
    508           SC_START(1);
    509          
    510           LABEL("spr (wait end)");
    511           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    512           in_NB_INST_DECOD_ALL  [context]->write(0);
    513           in_NB_INST_COMMIT_ALL [context]->write(1);
    514          
    515           SC_START(3);
    516          
    517           in_NB_INST_COMMIT_ALL [context]->write(0);
     523         
     524          LABEL("spr_access (send decod)");
     525          SC_START(0);
     526          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     527          TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
     528
     529          SC_START(1);
     530
     531          in_DECOD_EVENT_VAL     [port]->write(0);
     532          in_NB_INST_COMMIT_ALL  [context]->write(1);
     533         
     534          LABEL("spr_access (wait end)");
     535          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     536         
     537          SC_START(3);
     538         
     539          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
     540          in_NB_INST_COMMIT_ALL [context]->write(0);
     541
    518542          SC_START(1);
    519543          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    520544        }
    521545
    522       if (1)
     546      if (test5)
    523547        {
    524548          SC_START(3);
     
    610634        }
    611635
    612       if (1)
     636      if (test6)
    613637        {
    614638          SC_START(3);
     
    697721        }
    698722
    699       if (1)
     723      if (test7)
    700724        {
    701725          SC_START(3);
     
    791815        }
    792816
    793       if (1)
     817      if (test8)
    794818        {
    795819          SC_START(3);
     
    885909        }
    886910
    887       if (1)
     911      if (test9)
    888912        {
    889913          SC_START(3);
     
    9791003        }
    9801004     
    981       if (1)
     1005      if (test10)
    9821006        {
    9831007          SC_START(3);
     
    10731097        }
    10741098
    1075       if (1)
     1099      if (test11)
    10761100        {
    10771101          SC_START(3);
     
    11671191        }
    11681192     
    1169       if (1)
     1193      if (test12)
    11701194        {
    11711195          SC_START(3);
Note: See TracChangeset for help on using the changeset viewer.