Ignore:
Timestamp:
Dec 16, 2008, 5:24:26 PM (16 years ago)
Author:
rosiere
Message:

1) Update Prediction Table - New architecture (systemC) done (and tested) -> need change interface in top level
2) Change documentation on VHDL generation
3) Change VHDL constant (case std_logic and std_logic_vector)

File:
1 edited

Legend:

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

    r94 r95  
    77 */
    88
    9 #define NB_ITERATION  8
    10 #define CYCLE_MAX     (128*NB_ITERATION)
     9#define NB_ITERATION  16
     10#define CYCLE_MAX     (1024*NB_ITERATION)
    1111
    1212#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/include/test.h"
     
    136136  ALLOC1_SC_SIGNAL(out_UPDATE_RAS_INDEX               ,"out_UPDATE_RAS_INDEX               ",Tptr_t             ,_param->_nb_inst_update);
    137137  ALLOC1_SC_SIGNAL(out_UPDATE_RAS_PREDICTION_IFETCH   ,"out_UPDATE_RAS_PREDICTION_IFETCH   ",Tcontrol_t         ,_param->_nb_inst_update);
     138
     139  ALLOC1_SC_SIGNAL( in_EVENT_STATE                    ," in_EVENT_STATE                    ",Tevent_state_t     ,_param->_nb_context);
     140  ALLOC1_SC_SIGNAL( in_EVENT_TYPE                     ," in_EVENT_TYPE                     ",Tevent_type_t      ,_param->_nb_context);
     141  ALLOC1_SC_SIGNAL( in_EVENT_DEPTH                    ," in_EVENT_DEPTH                    ",Tdepth_t           ,_param->_nb_context);
     142
    138143  ALLOC1_SC_SIGNAL(out_DEPTH_CURRENT                  ,"out_DEPTH_CURRENT                  ",Tdepth_t           ,_param->_nb_context);
    139144  ALLOC1_SC_SIGNAL(out_DEPTH_MIN                      ,"out_DEPTH_MIN                      ",Tdepth_t           ,_param->_nb_context);
     
    225230  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_INDEX               ,_param->_nb_inst_update);
    226231  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_PREDICTION_IFETCH   ,_param->_nb_inst_update);
     232  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_EVENT_STATE                    ,_param->_nb_context);
     233  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_EVENT_TYPE                     ,_param->_nb_context);
    227234  if (_param->_have_port_depth)
    228235    {
     236  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_EVENT_DEPTH                    ,_param->_nb_context);
    229237  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_CURRENT                  ,_param->_nb_context);
    230238  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_MIN                      ,_param->_nb_context);
     
    253261  const  int32_t percent_transaction_branch_event    = 75;
    254262
    255   const bool     test1 = false;
    256   const bool     test2 = false;
    257   const bool     test3 = false;
     263  const bool     test1 = true;
     264  const bool     test2 = true;
     265  const bool     test3 = true;
    258266  const bool     test4 = true;
    259267
     
    270278  in_NRESET->write(1); 
    271279
    272   Tdepth_t ufpt_bottom [_param->_nb_context];
    273   Tdepth_t ufpt_top    [_param->_nb_context];
    274 
    275   Tdepth_t upt_bottom  [_param->_nb_context];
    276   Tdepth_t upt_top     [_param->_nb_context];
     280  Tdepth_t ufpt_bottom  [_param->_nb_context];
     281  Tdepth_t ufpt_top     [_param->_nb_context];
     282                       
     283  Tdepth_t upt_bottom   [_param->_nb_context];
     284  Tdepth_t upt_top      [_param->_nb_context];
     285  Tdepth_t upt_top_event[_param->_nb_context];
    277286
    278287  for (uint32_t i=0; i<_param->_nb_context; ++i)
    279288    {
    280       ufpt_bottom [i] = 0;
    281       ufpt_top    [i] = 0;
    282       upt_bottom  [i] = 0;
    283       upt_top     [i] = 0;
     289      ufpt_bottom  [i] = 0;
     290      ufpt_top     [i] = 0;
     291      upt_bottom   [i] = 0;
     292      upt_top      [i] = 0;
     293      upt_top_event[i] = 0;
    284294    }
    285295
     
    305315      for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
    306316        in_UPDATE_ACK          [i]->write(0);
    307 
     317      for (uint32_t i=0; i<_param->_nb_context; ++i)
     318        {
     319        in_EVENT_STATE [i]->write(EVENT_STATE_NO_EVENT);
     320        in_EVENT_TYPE  [i]->write(EVENT_TYPE_NONE     );
     321        }
    308322      //---------------------------------------------------------------------
    309323      //---------------------------------------------------------------------
     
    913927          }
    914928        }
    915 
     929 
     930        {
     931          LABEL("EVENT_STATE");
     932         
     933          SC_START(1);
     934          in_EVENT_STATE [context]->write(EVENT_STATE_END            );
     935          in_EVENT_TYPE  [context]->write(EVENT_TYPE_MISS_SPECULATION);
     936
     937          SC_START(1);
     938          in_EVENT_STATE [context]->write(EVENT_STATE_NO_EVENT       );
     939          in_EVENT_TYPE  [context]->write(EVENT_TYPE_NONE            );
     940        }
    916941
    917942        // Wait Garbage Collector
     
    13371362        }
    13381363
     1364        {
     1365          LABEL("EVENT_STATE");
     1366         
     1367          SC_START(1);
     1368          in_EVENT_STATE [context]->write(EVENT_STATE_END            );
     1369          in_EVENT_TYPE  [context]->write(EVENT_TYPE_MISS_SPECULATION);
     1370
     1371          SC_START(1);
     1372          in_EVENT_STATE [context]->write(EVENT_STATE_NO_EVENT       );
     1373          in_EVENT_TYPE  [context]->write(EVENT_TYPE_NONE            );
     1374        }
     1375
    13391376        // Wait Garbage Collector
    13401377        {
     
    13781415                request.take_good        = 1;                                             
    13791416                request.flag             = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good);
    1380                 request.is_accurate      = false;
     1417                request.is_accurate      = true ;
    13811418                request.miss_ifetch      = false;
    13821419                request.miss_decod       = false;
     
    14721509                    LABEL("DECOD           [%d] %d - %d",
    14731510                          port,
    1474                           in_PREDICT_VAL [port]->read(),
    1475                           out_PREDICT_ACK [port]->read());
     1511                          in_DECOD_VAL [port]->read(),
     1512                          out_DECOD_ACK [port]->read());
    14761513                   
    14771514                    if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read())
     
    15201557                request.take_good        = 1;                                             
    15211558                request.flag             = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good);
    1522                 request.is_accurate      = false;
     1559                request.is_accurate      = true ;
    15231560                request.miss_ifetch      = false;
    15241561                request.miss_decod       = false;
     
    15831620          std::list<request_t>::iterator it_event;
    15841621          {
    1585             LABEL("BRANCH_COMPLETE - hit ifetch");
     1622            LABEL("BRANCH_COMPLETE - Miss ifetch");
    15861623           
    15871624            uint32_t port = rand() % _param->_nb_inst_branch_complete;
     
    16001637
    16011638            if (update_ras(it_event->condition))
    1602               it_event->address_good = ~(it_event->address_dest);
     1639              {
     1640                it_event->address_good = ~(it_event->address_dest);
     1641              }
    16031642            else
    16041643              {
     
    16491688                      TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_event->address_good);
    16501689
    1651                       upt_top [it_event->context] = it_event->upt_ptr;
     1690                      upt_top_event [it_event->context] = upt_top [it_event->context];
     1691                      upt_top       [it_event->context] = it_event->upt_ptr;
     1692                    }
     1693                 
     1694                  SC_START(1);
     1695                } while (not have_transaction);
     1696             
     1697              in_BRANCH_COMPLETE_VAL [port]->write(0);
     1698             
     1699              if (_param->_have_port_depth)
     1700              TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]);
     1701              TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]);
     1702            }
     1703          }
     1704
     1705          {
     1706            LABEL("BRANCH_COMPLETE - Hit ifetch");
     1707           
     1708            uint32_t port = rand() % _param->_nb_inst_branch_complete;
     1709           
     1710            LABEL("  * port    : %d",port);
     1711           
     1712            std::list<request_t>::iterator it_upt = upt.begin();
     1713           
     1714            while (it_upt != it_event)
     1715            {
     1716              bool have_transaction = false;
     1717             
     1718              do
     1719                {
     1720                  in_BRANCH_COMPLETE_VAL        [port]->write((rand()%100)<percent_transaction_branch_complete);
     1721                  in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(it_upt->context     );
     1722                  in_BRANCH_COMPLETE_DEPTH      [port]->write(it_upt->upt_ptr     );
     1723                  in_BRANCH_COMPLETE_ADDRESS    [port]->write(it_upt->address_dest);
     1724                  in_BRANCH_COMPLETE_FLAG       [port]->write(it_upt->flag        );
     1725
     1726                  if (_param->_have_port_depth)
     1727                  TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]);
     1728                  TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]);
     1729                 
     1730                  SC_START(0);
     1731                 
     1732                  LABEL("BRANCH_COMPLETE [%d] %d - %d.",port,in_BRANCH_COMPLETE_VAL [port]->read(),out_BRANCH_COMPLETE_ACK [port]->read());
     1733                 
     1734                  if (in_BRANCH_COMPLETE_VAL [port]->read() and out_BRANCH_COMPLETE_ACK [port]->read())
     1735                    {
     1736                      LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port);
     1737                      LABEL("  * CONTEXT_ID %d"  ,it_upt->context     );
     1738                      LABEL("  * DEPTH      %d"  ,it_upt->upt_ptr     );
     1739                      LABEL("  * CONDITION  %d"  ,it_upt->condition   );
     1740                      LABEL("  * ADDRESS    %.8x",it_upt->address_dest);
     1741                      LABEL("  * FLAG       %d"  ,it_upt->flag        );
     1742
     1743                      have_transaction = true;
     1744                     
     1745                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
     1746                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take        );
     1747                      it_upt->take_good = it_upt->take;
     1748                      TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     1749                      TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_dest);
     1750
     1751                      it_upt++;
    16521752                    }
    16531753                 
     
    17401840
    17411841          {
    1742             LABEL("UPDATE - upt");
     1842            LABEL("UPDATE - upt (after event)");
    17431843           
    17441844            uint32_t port = 0;
     
    17461846            LABEL("  * port    : %d",port);
    17471847            std::list<request_t>::iterator it_upt = upt.end();
    1748             --it_upt;
    17491848
    17501849//             for (uint32_t i=0; i<upt.size(); i++)
    1751             while (it_upt != it_event)
     1850            do
    17521851              {
     1852                --it_upt;
     1853               
    17531854                bool have_transaction = false;
    17541855               
     1856                if (need_update(it_upt->condition))
    17551857                do
    17561858                  {
     
    17681870                      {
    17691871                        LABEL("UPDATE [%d] - Transaction accepted",port);
     1872                        LABEL("  * address_src                : %.8x",it_upt->address_src);
     1873                        LABEL("  * out_UPDATE_BTB_ADDRESS_SRC : %.8x",out_UPDATE_BTB_ADDRESS_SRC[port]->read());
     1874
    17701875                        have_transaction = true;
    17711876                       
     1877                        bool btb_val = ((it_upt == it_event) and
     1878                                        (update_btb(it_upt->condition)));
     1879                        bool dir_val = ((it_upt == it_event) and
     1880                                        update_dir(it_upt->condition) and
     1881                                        not (it_upt->miss_ifetch or it_upt->miss_decod));
     1882                        bool ras_val = update_ras(it_upt->condition);
     1883
    17721884                        if (_param->_have_port_context_id)
    17731885                        TEST(Tcontext_t         ,out_UPDATE_CONTEXT_ID            [port]->read(),it_upt->context);
    17741886                        TEST(Tcontrol_t         ,out_UPDATE_MISS_PREDICTION       [port]->read(),it_upt->miss_commit);
    1775                         TEST(Tcontrol_t         ,out_UPDATE_DIRECTION_GOOD        [port]->read(),it_upt->take_good);
    1776                         TEST(Tcontrol_t         ,out_UPDATE_BTB_VAL               [port]->read(),update_btb(it_upt->condition));
    1777                         if (update_btb(it_upt->condition))
     1887                        TEST(Tcontrol_t         ,out_UPDATE_BTB_VAL               [port]->read(),btb_val);
     1888
     1889                        if (btb_val)
    17781890                          {
    17791891                        TEST(Taddress_t         ,out_UPDATE_BTB_ADDRESS_SRC       [port]->read(),it_upt->address_src);
     
    17811893                        TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION         [port]->read(),it_upt->condition);
    17821894                          }
    1783                         TEST(Tcontrol_t         ,out_UPDATE_DIR_VAL               [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod));
     1895                        TEST(Tcontrol_t         ,out_UPDATE_DIR_VAL               [port]->read(),dir_val);
    17841896                       
    1785                         if (update_dir(it_upt->condition))
     1897                        if (dir_val)
     1898                          {
     1899                        TEST(Tcontrol_t         ,out_UPDATE_DIRECTION_GOOD        [port]->read(),it_upt->take_good);
    17861900                        if (_param->_have_port_history)
    17871901                        TEST(Thistory_t         ,out_UPDATE_DIR_HISTORY           [port]->read(),it_upt->history);
    1788                         TEST(Tcontrol_t         ,out_UPDATE_RAS_VAL               [port]->read(),update_ras(it_upt->condition));
    1789                         if (update_ras(it_upt->condition))
     1902                          }
     1903                        TEST(Tcontrol_t         ,out_UPDATE_RAS_VAL               [port]->read(),ras_val);
     1904
     1905                        if (ras_val)
    17901906                          {
    17911907//                      TEST(Tcontrol_t         ,out_UPDATE_RAS_FLUSH             [port]->read(),0);
     
    17961912                          }
    17971913
    1798                         -- it_upt;
     1914//                         -- it_upt;
    17991915                      }
    18001916                   
     
    18081924//               TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]);
    18091925              }
     1926            while (it_upt != it_event);
     1927
    18101928          }
    1811 //           upt.clear(); // Not yet
    1812 
     1929         
    18131930          {
    18141931            LABEL("BRANCH_EVENT - have miss decod");
     
    18521969            }
    18531970          }
    1854          
     1971
    18551972          {
    1856             LABEL("UPDATE - upt");
     1973            LABEL("EVENT_STATE");
     1974           
     1975            SC_START(1);
     1976            in_EVENT_STATE [context]->write(EVENT_STATE_END            );
     1977            in_EVENT_TYPE  [context]->write(EVENT_TYPE_MISS_SPECULATION);
     1978           
     1979            SC_START(1);
     1980            in_EVENT_STATE [context]->write(EVENT_STATE_NO_EVENT       );
     1981            in_EVENT_TYPE  [context]->write(EVENT_TYPE_NONE            );
     1982          }
     1983
     1984          {
     1985            LABEL("UPDATE - upt (before event)");
    18571986           
    18581987            uint32_t port = 0;
    18591988           
    18601989            LABEL("  * port    : %d",port);
     1990            LABEL("  * size    : %d",upt.size());
    18611991            std::list<request_t>::iterator it_upt = upt.begin();
    18621992
     
    19082038                          }
    19092039
    1910                         -- it_upt;
     2040                        ++ it_upt;
    19112041                      }
    19122042                   
     
    19202050              }
    19212051          }
    1922           upt.clear(); // Not yet
     2052          upt.clear();
    19232053
    19242054          // Wait Garbage Collector
    19252055          {
    1926             upt_bottom [context] = (upt_bottom [context]+1)%_param->_size_upt_queue[context];
    1927 //        upt_top    [context] = (upt_top    [context]);
     2056            LABEL("GARBAGE COLLECTOR");
     2057            LABEL(" * upt bottom : %d",upt_bottom [context]);
     2058            LABEL(" * upt top    : %d",upt_top    [context]);
     2059
     2060            upt_top    [context] = (upt_top_event [context]);
     2061            upt_bottom [context] = (upt_top       [context]);
    19282062
    19292063            while ((upt_bottom [context] != out_DEPTH_MIN [context]->read()) or
    19302064                   (upt_top    [context] != out_DEPTH_MAX [context]->read()))
    1931               SC_START(1);
     2065              {
     2066                SC_START(1);
     2067              }
    19322068           
    19332069          }
     
    19932129  delete [] out_BRANCH_EVENT_VAL            ;
    19942130  delete []  in_BRANCH_EVENT_ACK            ;
    1995 //   delete []  in_BRANCH_EVENT_CONTEXT_ID     ;
    1996 //   delete []  in_BRANCH_EVENT_DEPTH          ;
    1997 //   delete [] out_BRANCH_EVENT_MISS_PREDICTION;
     2131//delete []  in_BRANCH_EVENT_CONTEXT_ID     ;
     2132//delete []  in_BRANCH_EVENT_DEPTH          ;
     2133//delete [] out_BRANCH_EVENT_MISS_PREDICTION;
    19982134  delete [] out_BRANCH_EVENT_ADDRESS_SRC    ;
    19992135  delete [] out_BRANCH_EVENT_ADDRESS_DEST_VAL;
     
    20192155  delete [] out_UPDATE_RAS_PREDICTION_IFETCH;
    20202156
     2157  DELETE1_SC_SIGNAL( in_EVENT_STATE                    ,_param->_nb_context);
     2158  DELETE1_SC_SIGNAL( in_EVENT_TYPE                     ,_param->_nb_context);
     2159  DELETE1_SC_SIGNAL( in_EVENT_DEPTH                    ,_param->_nb_context);
     2160
    20212161  // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    20222162  delete [] out_DEPTH_CURRENT;
Note: See TracChangeset for help on using the changeset viewer.