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 ...)

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State
Files:
6 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);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h

    r98 r101  
    197197  public  : void        transition                (void);
    198198  public  : void        genMoore                  (void);
     199  public  : void        genMealy_decod_event      (void);
    199200#endif                                         
    200201
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Types.h

    r83 r101  
    2929      CONTEXT_STATE_KO_EXCEP_ADDR   , // update address manager
    3030      CONTEXT_STATE_KO_EXCEP_SPR    , // update spr (epc, esr, sr[DSX])
    31       CONTEXT_STATE_KO_MISS         , // wait end of event (miss (branch, load))
    3231      CONTEXT_STATE_KO_MISS_ADDR    , // update address manager
    33       CONTEXT_STATE_KO_MSYNC        , // wait completion of all memory operation
    34       CONTEXT_STATE_KO_MSYNC_ISSUE  , // issue msync operation
     32      CONTEXT_STATE_KO_MISS_WAITEND , // wait end of event (miss (branch, load))
     33//    CONTEXT_STATE_KO_MSYNC        , // wait completion of all memory operation
     34//    CONTEXT_STATE_KO_MSYNC_ISSUE  , // issue msync operation
    3535      CONTEXT_STATE_KO_MSYNC_EXEC   , // wait completion of     msync  operation
    36       CONTEXT_STATE_KO_PSYNC        , // wait completion of all        operation and after flush pipeline
     36//    CONTEXT_STATE_KO_PSYNC        , // wait completion of all        operation and after flush pipeline
    3737      CONTEXT_STATE_KO_PSYNC_FLUSH  , // wait completion of all
    3838      CONTEXT_STATE_KO_PSYNC_ADDR   , // wait completion of all
    39       CONTEXT_STATE_KO_CSYNC        , // wait completion of all        operation and after flush pipeline and flush ALL units (MMU, cache ...)
     39//    CONTEXT_STATE_KO_CSYNC        , // wait completion of all        operation and after flush pipeline and flush ALL units (MMU, cache ...)
    4040      CONTEXT_STATE_KO_CSYNC_FLUSH  ,
    4141      CONTEXT_STATE_KO_CSYNC_ADDR   ,
    42       CONTEXT_STATE_KO_SPR          , // wait completion of all        operation
    43       CONTEXT_STATE_KO_SPR_ISSUE    , // issue spr's access
     42//    CONTEXT_STATE_KO_SPR          , // wait completion of all        operation
     43//    CONTEXT_STATE_KO_SPR_ISSUE    , // issue spr's access
    4444      CONTEXT_STATE_KO_SPR_EXEC       // wait completion of all        operation (spr access)
    4545    } context_state_t;
     
    6060      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_EXCEP_ADDR   : return "context_state_ko_excep_addr"  ; break;
    6161      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_EXCEP_SPR    : return "context_state_ko_excep_spr"   ; break;
    62       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MISS         : return "context_state_ko_miss"        ; break;
    6362      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MISS_ADDR    : return "context_state_ko_miss_addr"   ; break;
    64       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MSYNC        : return "context_state_ko_msync"       ; break;
    65       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MSYNC_ISSUE  : return "context_state_ko_msync_issue" ; break;
     63      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MISS_WAITEND : return "context_state_ko_miss_waitend"; break;
     64//       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MSYNC        : return "context_state_ko_msync"       ; break;
     65//    case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MSYNC_ISSUE  : return "context_state_ko_msync_issue" ; break;
    6666      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_MSYNC_EXEC   : return "context_state_ko_msync_exec"  ; break;
    67       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_PSYNC        : return "context_state_ko_psync"       ; break;
     67//    case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_PSYNC        : return "context_state_ko_psync"       ; break;
    6868      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_PSYNC_FLUSH  : return "context_state_ko_psync_flush" ; break;
    6969      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_PSYNC_ADDR   : return "context_state_ko_psync_addr"  ; break;
    70       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_CSYNC        : return "context_state_ko_csync"       ; break;
     70//    case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_CSYNC        : return "context_state_ko_csync"       ; break;
    7171      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_CSYNC_FLUSH  : return "context_state_ko_csync_flush" ; break;
    7272      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_CSYNC_ADDR   : return "context_state_ko_csync_addr"  ; break;
    73       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_SPR          : return "context_state_ko_spr"         ; break;
    74       case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_SPR_ISSUE    : return "context_state_ko_spr_issue"   ; break;
     73//    case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_SPR          : return "context_state_ko_spr"         ; break;
     74//    case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_SPR_ISSUE    : return "context_state_ko_spr_issue"   ; break;
    7575      case morpheo::behavioural::core::multi_front_end::front_end::context_state::CONTEXT_STATE_KO_SPR_EXEC     : return "context_state_ko_spr_exec"    ; break;
    7676      default    : return ""      ; break;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp

    r88 r101  
    8282          }
    8383
    84         for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
    85           {
    86             internal_DECOD_EVENT_ACK [i] = 1;
    87             PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
    88           }
     84//      for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
     85//        {
     86//          internal_DECOD_EVENT_ACK [i] = 1;
     87//          PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
     88//        }
    8989
    9090        internal_COMMIT_EVENT_ACK = 1;
     
    112112        dont_initialize ();
    113113        sensitive << (*(in_CLOCK)).neg(); // use internal register
     114       
     115# ifdef SYSTEMCASS_SPECIFIC
     116        // List dependency information
     117# endif   
     118
     119        log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_decod_event"));
     120
     121        SC_METHOD (genMealy_decod_event);
     122        dont_initialize ();
     123        sensitive << (*(in_CLOCK)).neg(); // use internal register
     124        for (uint32_t i=0; i<_param->_nb_decod_unit; ++i)
     125          {
     126            sensitive << (*(in_DECOD_EVENT_VAL        [i])) // not necessary
     127                      << (*(in_DECOD_EVENT_TYPE       [i]));
     128            if (_param->_have_port_context_id)                                 
     129            sensitive << (*(in_DECOD_EVENT_CONTEXT_ID [i]));
     130          }
     131        for (uint32_t i=0; i<_param->_nb_context; ++i)
     132          {
     133            sensitive << (*(in_NB_INST_DECOD_ALL      [i]))
     134                      << (*(in_NB_INST_COMMIT_ALL     [i]))
     135                      << (*(in_NB_INST_COMMIT_MEM     [i]));
     136          }
    114137       
    115138# ifdef SYSTEMCASS_SPECIFIC
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp

    r97 r101  
    105105        context_state_t state = reg_STATE [i];
    106106
    107         PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], ((state==CONTEXT_STATE_OK            ) or
    108                                                   (state==CONTEXT_STATE_KO_MSYNC_ISSUE) or
    109                                                   (state==CONTEXT_STATE_KO_SPR_ISSUE  )));
     107//      PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], ((state==CONTEXT_STATE_OK            ) or
     108//                                                (state==CONTEXT_STATE_KO_MSYNC_ISSUE) or
     109//                                                (state==CONTEXT_STATE_KO_SPR_ISSUE  )));
     110        PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], (state==CONTEXT_STATE_OK));
    110111      }
    111112
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp

    r98 r101  
    3535      {
    3636        // -------------------------------------------------------------------
     37        // -----[ next state ]------------------------------------------------
     38        // -------------------------------------------------------------------
     39        for (uint32_t i=0; i<_param->_nb_context; i++)
     40          {
     41//             uint32_t x = _param->_link_context_to_decod_unit    [i];
     42
     43            Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
     44//          Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
     45
     46            context_state_t state = reg_STATE [i];
     47
     48            switch (state)
     49              {
     50              case CONTEXT_STATE_OK              :
     51                {
     52                  // nothing, wait an event
     53                  break;
     54                }
     55              case CONTEXT_STATE_KO_EXCEP        :
     56                {
     57                  // Wait end of all instruction
     58                  if (inst_all == 0)
     59                    state = CONTEXT_STATE_KO_EXCEP_ADDR;
     60                  break;
     61                }
     62              case CONTEXT_STATE_KO_EXCEP_ADDR   :
     63                {
     64                  // nothing, wait the update of internal register (pc)
     65                  break;
     66                }
     67              case CONTEXT_STATE_KO_MISS_WAITEND :
     68                {
     69                  // Wait end of all instruction
     70                  if (inst_all == 0)
     71                   
     72//                  state = CONTEXT_STATE_OK; // @@@ TODO : make MISS fast (miss decod)
     73                    state = CONTEXT_STATE_KO_MISS_ADDR;
     74                  break;
     75                }
     76              case CONTEXT_STATE_KO_EXCEP_SPR    :
     77                {
     78                  // nothing, wait the update of internal register (epcr, eear, sr, esr)
     79                  break;
     80                }
     81              case CONTEXT_STATE_KO_MISS_ADDR    :
     82                {
     83                  // nothing, wait the update of internal register (pc)
     84                  break;
     85                }
     86//               case CONTEXT_STATE_KO_PSYNC        :
     87//                 {
     88//                   // Wait end of all instruction
     89//                   if (inst_all == 0)
     90//                     state = CONTEXT_STATE_KO_PSYNC_FLUSH;
     91//                   break;
     92//                 }
     93              case CONTEXT_STATE_KO_PSYNC_FLUSH  :
     94                {
     95                  // nothing, wait end of flush (ifetch)
     96                  if (inst_all == 0)
     97//                  state = CONTEXT_STATE_KO_PSYNC_ADDR;
     98                    state = CONTEXT_STATE_OK;
     99                   
     100                  break;
     101                }
     102              case CONTEXT_STATE_KO_PSYNC_ADDR   :
     103                {
     104                  // nothing, wait the pc write
     105                  break;
     106                }
     107//               case CONTEXT_STATE_KO_CSYNC        :
     108//                 {
     109//                   // Wait end of all instruction
     110//                   if (inst_all == 0)
     111//                     state = CONTEXT_STATE_KO_CSYNC_FLUSH;
     112//                   break;
     113//                 }
     114              case CONTEXT_STATE_KO_CSYNC_FLUSH  :
     115                {
     116                  // nothing, wait end of flush (all internal structure)
     117                  if (inst_all == 0)
     118                    state = CONTEXT_STATE_KO_CSYNC_ADDR;
     119                  break;
     120                }
     121              case CONTEXT_STATE_KO_CSYNC_ADDR   :
     122                {
     123                  // nothing, wait the pc write
     124                  break;
     125                }
     126//               case CONTEXT_STATE_KO_MSYNC        :
     127//                 {
     128//                   // Wait end of memory instruction
     129//                   if (inst_mem == 0)
     130//                     state = CONTEXT_STATE_KO_MSYNC_ISSUE;
     131//                   break;
     132//                 }
     133//               case CONTEXT_STATE_KO_MSYNC_ISSUE  :
     134//                 {
     135//                   // Wait the msync issue
     136//                   if (inst_mem != 0)
     137//                     state = CONTEXT_STATE_KO_MSYNC_EXEC;
     138//                   break;
     139//                 }
     140              case CONTEXT_STATE_KO_MSYNC_EXEC   :
     141                {
     142                  // Wait the end of msync
     143                  if (inst_all == 0)
     144                    state = CONTEXT_STATE_OK;
     145                  break;
     146                }
     147//               case CONTEXT_STATE_KO_SPR          :
     148//                 {
     149//                   // Wait end of all instruction
     150//                   if (inst_all == 0)
     151//                     state = CONTEXT_STATE_KO_SPR_ISSUE;
     152//                   break;
     153//                 }
     154//               case CONTEXT_STATE_KO_SPR_ISSUE    :
     155//                 {
     156//                   // Wait the spr_access issue
     157//                   if (inst_all != 0)
     158//                     state = CONTEXT_STATE_KO_SPR_EXEC;
     159//                   break;
     160//                 }
     161              case CONTEXT_STATE_KO_SPR_EXEC     :
     162                {
     163                  // Wait the spr_access execution
     164                  if (inst_all == 0)
     165                    state = CONTEXT_STATE_OK;
     166                  break;
     167                }
     168
     169              default :
     170                {
     171                  throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
     172                }
     173              }
     174            reg_STATE [i] = state;
     175          }
     176
     177        // -------------------------------------------------------------------
    37178        // -----[ BRANCH_EVENT ]----------------------------------------------
    38179        // -------------------------------------------------------------------
     
    57198
    58199              // priority : miss > excep > spr/sync
    59               uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
     200              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
    60201              uint8_t    priority1  = 2; // miss
    61202
     
    71212                {
    72213                  Tcontrol_t dest_val = PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST_VAL[i]);
    73                   reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS;
     214//                reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_ADDR;
     215                  reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_WAITEND; //@@@ TODO : make MISS fast (miss decod)
    74216                  reg_EVENT_ADDRESS          [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_SRC  [i])+1; // address delay slot
    75217                  reg_EVENT_ADDRESS_EPCR     [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST [i]);   // address_next
     
    107249             
    108250              // miss > excep > spr/sync
    109               uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     251              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    110252              uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:0;
    111253
     
    120262              if (is_valid)
    121263                {
     264                  log_printf(TRACE,Context_State,FUNCTION,"    * is_valid");
     265
    122266                  // decod :
    123267                  // type : csync, psync, msync, spr_access (l.mac, l.maci, l.macrc, l.msb, l.mfspr, l.mtspr), exception (l.sys)
     
    130274                    case EVENT_TYPE_EXCEPTION          :
    131275                      {
     276                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_EXCEPTION");
     277
    132278                        state_next = CONTEXT_STATE_KO_EXCEP;
    133279
     
    136282                    case EVENT_TYPE_SPR_ACCESS         :
    137283                      {
    138                         state_next = CONTEXT_STATE_KO_SPR  ;
     284                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_SPR_ACCESS");
     285
     286//                      state_next = CONTEXT_STATE_KO_SPR  ;
     287                        state_next = CONTEXT_STATE_KO_SPR_EXEC;
    139288                        address++; // take next address
    140                         if (is_delay_slot)
    141                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     289//                         if (is_delay_slot)
     290//                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
    142291                        break;
    143292                      }
    144293                    case EVENT_TYPE_MSYNC              :
    145294                      {
    146                         state_next = CONTEXT_STATE_KO_MSYNC;
     295                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_MSYNC");
     296
     297//                      state_next = CONTEXT_STATE_KO_MSYNC;
     298                        state_next = CONTEXT_STATE_KO_MSYNC_EXEC;
    147299                        address++;  // take next address
    148                         if (is_delay_slot)
    149                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     300//                         if (is_delay_slot)
     301//                           throw ERRORMORPHEO(FUNCTION,"MSYNC in delay slot, not supported.\n");
    150302                        break;
    151303                      }
    152304                    case EVENT_TYPE_PSYNC              :
    153305                      {
    154                         state_next = CONTEXT_STATE_KO_PSYNC;
     306                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_PSYNC");
     307
     308//                      state_next = CONTEXT_STATE_KO_PSYNC;
     309                        state_next = CONTEXT_STATE_KO_PSYNC_FLUSH;
    155310                        address++;  // take next address
    156311                        if (is_delay_slot)
    157                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     312                          throw ERRORMORPHEO(FUNCTION,"PSYNC in delay slot, not supported.\n");
    158313                        break;
    159314                      }
    160315                    case EVENT_TYPE_CSYNC              :
    161316                      {
    162                         state_next = CONTEXT_STATE_KO_CSYNC;
     317                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_CSYNC");
     318
     319//                      state_next = CONTEXT_STATE_KO_CSYNC;
     320                        state_next = CONTEXT_STATE_KO_CSYNC_FLUSH;
    163321                        address++;  // take next address
    164322                        if (is_delay_slot)
    165                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     323                          throw ERRORMORPHEO(FUNCTION,"CSYNC in delay slot, not supported.\n");
    166324                        break;
    167325                      }               
     
    210368           
    211369            // miss > excep > spr/sync
    212             uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     370            uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    213371            uint8_t    priority1  = 1; // exception
    214372
     
    277435                 
    278436//                   // miss > excep > spr/sync
    279 //                   uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     437//                   uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    280438//                   uint8_t    priority1  = 2; // miss
    281439                 
     
    323481                  }
    324482                case CONTEXT_STATE_KO_MISS_ADDR  :
     483//                   {
     484//                     reg_STATE [i] = CONTEXT_STATE_KO_MISS_WAITEND; //@@@ TODO : make MISS fast (miss decod)
     485//                     break;
     486//                   }
    325487                case CONTEXT_STATE_KO_PSYNC_ADDR :
    326488                case CONTEXT_STATE_KO_CSYNC_ADDR :
     
    357519              reg_STATE [i] = CONTEXT_STATE_OK;
    358520            }
    359 
    360         // -------------------------------------------------------------------
    361         // -----[ next state ]------------------------------------------------
    362         // -------------------------------------------------------------------
    363         for (uint32_t i=0; i<_param->_nb_context; i++)
    364           {
    365 //             uint32_t x = _param->_link_context_to_decod_unit    [i];
    366 
    367             Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
    368             Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
    369 
    370             context_state_t state = reg_STATE [i];
    371 
    372             switch (state)
    373               {
    374               case CONTEXT_STATE_OK              :
    375                 {
    376                   // nothing, wait an event
    377                   break;
    378                 }
    379               case CONTEXT_STATE_KO_EXCEP        :
    380                 {
    381                   // Wait end of all instruction
    382                   if (inst_all == 0)
    383                     state = CONTEXT_STATE_KO_EXCEP_ADDR;
    384                   break;
    385                 }
    386               case CONTEXT_STATE_KO_MISS         :
    387                 {
    388                   // Wait end of all instruction
    389                   if (inst_all == 0)
    390                     state = CONTEXT_STATE_KO_MISS_ADDR;
    391                   break;
    392                 }
    393               case CONTEXT_STATE_KO_EXCEP_ADDR   :
    394                 {
    395                   // nothing, wait the update of internal register (pc)
    396                   break;
    397                 }
    398               case CONTEXT_STATE_KO_EXCEP_SPR    :
    399                 {
    400                   // nothing, wait the update of internal register (epcr, eear, sr, esr)
    401                   break;
    402                 }
    403               case CONTEXT_STATE_KO_MISS_ADDR    :
    404                 {
    405                   // nothing, wait the update of internal register (pc)
    406                   break;
    407                 }
    408               case CONTEXT_STATE_KO_PSYNC        :
    409                 {
    410                   // Wait end of all instruction
    411                   if (inst_all == 0)
    412 //                  state = CONTEXT_STATE_KO_PSYNC_FLUSH;
    413                     state = CONTEXT_STATE_KO_PSYNC_ADDR ;
    414                   break;
    415                 }
    416 //            case CONTEXT_STATE_KO_PSYNC_FLUSH  :
    417 //              {
    418 //                // nothing, wait end of flush (ifetch)
    419 //                break;
    420 //              }
    421               case CONTEXT_STATE_KO_PSYNC_ADDR   :
    422                 {
    423                   // nothing, wait the pc write
    424                   break;
    425                 }
    426               case CONTEXT_STATE_KO_CSYNC        :
    427                 {
    428                   // Wait end of all instruction
    429                   if (inst_all == 0)
    430                     state = CONTEXT_STATE_KO_CSYNC_ADDR ;
    431 //                  state = CONTEXT_STATE_KO_CSYNC_FLUSH;
    432                   break;
    433                 }
    434 //            case CONTEXT_STATE_KO_CSYNC_FLUSH  :
    435 //              {
    436 //                // nothing, wait end of flush (all internal structure)
    437 //                break;
    438 //              }
    439               case CONTEXT_STATE_KO_CSYNC_ADDR   :
    440                 {
    441                   // nothing, wait the pc write
    442                   break;
    443                 }
    444               case CONTEXT_STATE_KO_MSYNC        :
    445                 {
    446                   // Wait end of memory instruction
    447                   if (inst_mem == 0)
    448                     state = CONTEXT_STATE_KO_MSYNC_ISSUE;
    449                   break;
    450                 }
    451               case CONTEXT_STATE_KO_MSYNC_ISSUE  :
    452                 {
    453                   // Wait the msync issue
    454                   if (inst_mem != 0)
    455                     state = CONTEXT_STATE_KO_MSYNC_EXEC;
    456                   break;
    457                 }
    458               case CONTEXT_STATE_KO_MSYNC_EXEC   :
    459                 {
    460                   // Wait the end of msync
    461                   if (inst_mem == 0)
    462                     state = CONTEXT_STATE_OK;
    463                   break;
    464                 }
    465               case CONTEXT_STATE_KO_SPR          :
    466                 {
    467                   // Wait end of all instruction
    468                   if (inst_all == 0)
    469                     state = CONTEXT_STATE_KO_SPR_ISSUE;
    470                   break;
    471                 }
    472               case CONTEXT_STATE_KO_SPR_ISSUE    :
    473                 {
    474                   // Wait the spr_access issue
    475                   if (inst_all != 0)
    476                     state = CONTEXT_STATE_KO_SPR_EXEC;
    477                   break;
    478                 }
    479               case CONTEXT_STATE_KO_SPR_EXEC     :
    480                 {
    481                   // Wait the spr_access execution
    482                   if (inst_all == 0)
    483                     state = CONTEXT_STATE_OK;
    484                   break;
    485                 }
    486 
    487               default :
    488                 {
    489                   throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
    490                 }
    491               }
    492             reg_STATE [i] = state;
    493           }
    494521
    495522        for (uint32_t i=0; i<_param->_nb_context; ++i)
Note: See TracChangeset for help on using the changeset viewer.