Ignore:
Timestamp:
Mar 27, 2008, 11:04:49 AM (16 years ago)
Author:
rosiere
Message:

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic
Files:
87 added
38 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Parameters.h

    r75 r78  
    3232  public : ~Parameters () ;
    3333
    34   public :        std::string  msg_error  (void);
     34  public :        Parameters_test msg_error  (void);
    3535
    3636  public :        std::string   print      (uint32_t depth);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters_msg_error.cpp

    r75 r78  
    1717#undef  FUNCTION
    1818#define FUNCTION "Queue::msg_error"
    19   std::string Parameters::msg_error(void)
     19  Parameters_test Parameters::msg_error(void)
    2020  {
    2121    log_printf(FUNC,Queue,FUNCTION,"Begin");
    2222
    23     std::string msg = "";
    24 
    25     return msg;
     23    Parameters_test test("Queue");
    2624
    2725    log_printf(FUNC,Queue,FUNCTION,"End");
     26
     27    return test;
    2828  };
    2929
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp

    r71 r78  
    77 */
    88
    9 #define NB_ITERATION 1
     9#define NB_ITERATION 16
    1010
    1111#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h"
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h

    r75 r78  
    3737  public : ~Parameters () ;
    3838
    39   public :        std::string  msg_error  (void);
     39  public :        Parameters_test msg_error  (void);
    4040  public :        std::string   print      (uint32_t depth);
    4141  public : friend std::ostream& operator<< (std::ostream& output_stream,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h

    r75 r78  
    5252  private   : counter_t                      * _stat_nb_read;
    5353  private   : counter_t                      * _stat_nb_write;
    54   private   : counter_t                      * _stat_average_read ;
    55   private   : counter_t                      * _stat_average_write;
    56   private   : counter_t                      * _stat_percent_use_read ;
    57   private   : counter_t                      * _stat_percent_use_write;
    5854#endif
    5955
     
    8884
    8985    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    90   private   : SC_REGISTER (Tdata_t)        ** reg_DATA         ;
     86  private   : Tdata_t * reg_DATA;
    9187
    9288    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_msg_error.cpp

    r75 r78  
    1717namespace registerfile_monolithic    {
    1818
    19   std::string Parameters::msg_error(void)
     19  Parameters_test Parameters::msg_error(void)
    2020  {
    21     std::string msg = "";
     21    Parameters_test test("RegisterFile_Monolithic");
    2222
    2323    if ((8*sizeof(Tdata_t)) < _size_word)
    24       {
    25         msg += "  - type \"Tdata_t\" is too little to the size defined by size_word\n";
    26         msg += "    * size_word                       : " + toString(_size_word) + "\n";
    27         msg += "    * Tdata_t                   (bits): " + toString(8*(sizeof(Tdata_t))) + "\n";
    28       }
     24      test.error("Type \"Tdata_t\" is too little to the size defined by size_word");
    2925
    3026    if ((8*sizeof(Taddress_t)) < log2(_nb_word))
    31       {
    32         msg += "  - type \"Taddress_t\" is too little to the size defined by nb_word\n";
    33         msg += "    * nb_word                         : " + toString(_nb_word)    + "\n";
    34         msg += "      > size                   (bits) : " + toString(log2(_nb_word)) + "\n";
    35         msg += "    * Taddress_t               (bits) : " + toString(8*(sizeof(Taddress_t))) + "\n";
    36       }
     27      test.error("type \"Taddress_t\" is too little to the size defined by nb_word");
    3728
    3829    if ((_nb_port_read + _nb_port_read_write) < 1)
    39       {
    40         msg += "  - you need a read port\n";
    41         msg += "    * nb_port_read                    : " + toString(_nb_port_read)       + "\n";
    42         msg += "    * nb_port_read_write              : " + toString(_nb_port_read_write) + "\n";
    43       }
     30      test.error("you need a read port");
    4431
    4532    if ((_nb_port_write + _nb_port_read_write) < 1)
    46       {
    47         msg += "  - you need a write port\n";
    48         msg += "    * nb_port_write                   : " + toString(_nb_port_write)      + "\n";
    49         msg += "    * nb_port_read_write              : " + toString(_nb_port_read_write) + "\n";
    50       }
    51 //     if (_nb_word < 2)
    52 //       {
    53 //         msg += "  - nb_word must be >= 2\n";
    54 //         msg += "    * nb_word                         : " + toString(_nb_word)    + "\n";
    55 //       }
     33      test.error("you need a write port");
    5634
    57     return msg;
     35    return test;
    5836  };
    5937
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_allocation.cpp

    r75 r78  
    120120
    121121    // ----- Register
    122     reg_DATA = new SC_REGISTER (Tdata_t) * [_param->_nb_word];
     122    reg_DATA = new Tdata_t [_param->_nb_word];
    123123   
    124     for (uint32_t i=0; i<_param->_nb_word; i++)
    125       {
    126         std::string rename = "reg_DATA["  + toString(i) + "]";
    127         reg_DATA [i]  = new SC_REGISTER (Tdata_t) (rename.c_str());
    128       }
    129 
    130124#ifdef POSITION
    131125    _component->generate_file();
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_genMealy_read.cpp

    r71 r78  
    2929            else
    3030              address = 0;
    31             Tdata_t    data    = REGISTER_READ(reg_DATA[address]);
     31            Tdata_t    data    = reg_DATA[address];
    3232
    3333            log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
    3434
    35 #ifdef STATISTICS
    36             (*_stat_nb_read) ++;
    37 #endif   
    3835            // Write in registerFile
    3936            PORT_WRITE(out_READ_DATA[i],data);
     
    6158              address = 0;
    6259           
    63             data = REGISTER_READ(reg_DATA[address]);
     60            data = reg_DATA[address];
    6461
    6562            log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_statistics_declaration.cpp

    r75 r78  
    2323    _stat_nb_read           = _stat->create_variable("nb_read" );
    2424    _stat_nb_write          = _stat->create_variable("nb_write");
    25    
    26     _stat_average_read      = _stat->create_counter("average_read" , "", "Average read by cycle");
    27     _stat_average_write     = _stat->create_counter("average_write", "", "Average write by cycle");
    2825
    29     _stat_percent_use_read  = _stat->create_counter("percent_use_read" , "%", "Read port usage");
    30     _stat_percent_use_write = _stat->create_counter("percent_use_write", "%", "Write port usage");
     26    _stat->create_expr_average_by_cycle("average_read" , "nb_read" , "", "Average read by cycle" );
     27    _stat->create_expr_average_by_cycle("average_write", "nb_write", "", "Average write by cycle");
    3128
    32     _stat->create_expr("average_read" , "/ nb_read  cycle", false);
    33     _stat->create_expr("average_write", "/ nb_write cycle", false);
    34 
    35     _stat->create_expr("percent_use_read" , "/ * average_read  100 " + toString(_param->_nb_port_read +_param->_nb_port_read_write), false);
    36     _stat->create_expr("percent_use_write", "/ * average_write 100 " + toString(_param->_nb_port_write+_param->_nb_port_read_write), false);
     29    _stat->create_expr_percent         ("percent_use_read" , "average_read" , toString(_param->_nb_port_read +_param->_nb_port_read_write), "Percent read by cycle" );
     30    _stat->create_expr_percent         ("percent_use_write", "average_write", toString(_param->_nb_port_write+_param->_nb_port_read_write), "Percent write by cycle");
    3731
    3832  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_transition.cpp

    r75 r78  
    3838
    3939            // Write in registerFile
    40             REGISTER_WRITE(reg_DATA[address],data);
     40            reg_DATA[address] = data;
    4141          }
    4242      }
     
    6262               
    6363                // Write in registerFile
    64                 REGISTER_WRITE(reg_DATA[address],data);
     64                reg_DATA[address] = data;
    6565              }
    6666#ifdef STATISTICS
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/Parameters.h

    r75 r78  
    6464  public : ~Parameters () ;
    6565
    66   public :        std::string  msg_error  (void);
     66  public :        Parameters_test msg_error  (void);
    6767  public :        std::string   print      (uint32_t depth);
    6868  public : friend std::ostream& operator<< (std::ostream& output_stream,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h

    r75 r78  
    7373
    7474    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    75   private   : SC_REGISTER (Tdata_t)       *** reg_DATA         ;
     75  private   : Tdata_t ** reg_DATA;
    7676
    7777    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/Parameters_msg_error.cpp

    r75 r78  
    1515
    1616
    17   std::string Parameters::msg_error(void)
     17  Parameters_test Parameters::msg_error(void)
    1818  {
    1919    log_printf(FUNC,RegisterFile_Multi_Banked,"msg_error","Begin");
    2020
    21     std::string msg = "";
     21    Parameters_test test("RegisterFile_Multi_Banked");
    2222
    2323    if (_nb_port_read < _nb_port_read_by_bank)
    24       {
    25         msg += "  - Each bank read's port must be higher at number of read port\n";
    26         msg += "    * nb_port_read                    : " + toString(_nb_port_read        ) + "\n";
    27         msg += "    * nb_port_read_by_bank            : " + toString(_nb_port_read_by_bank) + "\n";
    28       }
     24      test.error("Each bank read's port must be higher at number of read port");
    2925
    3026    if (_nb_port_write < _nb_port_write_by_bank)
    31       {
    32         msg += "  - Each bank write's port must be higher at number of write port\n";
    33         msg += "    * nb_port_write                   : " + toString(_nb_port_write        ) + "\n";
    34         msg += "    * nb_port_write_by_bank           : " + toString(_nb_port_write_by_bank) + "\n";
    35       }
     27      test.error("Each bank write's port must be higher at number of write port");
    3628   
    3729    if (_nb_bank < 1)
    38       {
    39         msg += "  - nb_bank must be higher at 1\n";
    40         msg += "    * nb_bank                         : " + toString(_nb_bank             ) + "\n";
    41       }
    42 
    43     return msg;
     30      test.error("nb_bank must be higher at 1");
    4431
    4532    log_printf(FUNC,RegisterFile_Multi_Banked,"msg_error","End");
     33
     34    return test;
    4635  };
    4736
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_allocation.cpp

    r75 r78  
    9696    // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    9797
    98     reg_DATA = new SC_REGISTER (Tdata_t) ** [_param->_nb_bank];
     98    reg_DATA = new Tdata_t * [_param->_nb_bank];
    9999
    100100    for (uint32_t i=0; i<_param->_nb_bank; i++)
    101101      {
    102         reg_DATA [i] = new SC_REGISTER (Tdata_t) * [_param->_nb_word];
    103        
    104         for (uint32_t j=0; j<_param->_nb_word; j++)
    105           {
    106             std::string rename = "reg_DATA_"  + toString(i) + "_"  + toString(j);
    107             reg_DATA [i][j]  = new SC_REGISTER (Tdata_t) (rename.c_str());
    108           }
     102        reg_DATA [i] = new Tdata_t [_param->_nb_word];
    109103      }
    110104
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_full_crossbar_genMealy_read.cpp

    r62 r78  
    6262                    log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * bank_port : %d",j);
    6363
    64                     Tdata_t    data    = REGISTER_READ(reg_DATA[bank][num_reg]);
     64                    Tdata_t    data    = reg_DATA[bank][num_reg];
    6565                   
    6666                    log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * data      : %d",data);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_partial_crossbar_genMealy_read.cpp

    r62 r78  
    6464                    log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * bank_port : %d",j);
    6565
    66                     Tdata_t    data    = REGISTER_READ(reg_DATA[bank][num_reg]);
     66                    Tdata_t    data    = reg_DATA[bank][num_reg];
    6767                   
    6868                    log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * data      : %d",data);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_transition.cpp

    r75 r78  
    3131           
    3232            // Write in registerFile
    33             REGISTER_WRITE(reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]],data);
     33            reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]] = data;
    3434          }
    3535      }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/include/Parameters.h

    r75 r78  
    4343  public : ~Parameters () ;
    4444
    45   public :        std::string   msg_error  (void);
     45  public :        Parameters_test  msg_error  (void);
    4646  public :        std::string   print      (uint32_t depth);
    4747  public : friend std::ostream& operator<< (std::ostream& output_stream,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/include/RegisterFile.h

    r75 r78  
    55 * $Id$
    66 *
    7  * [ Description ]
     7 * [ Description ]
    88 *
    99 */
     
    4141#endif
    4242  {
    43     // -----[ fields ]----------------------------------------------------
     43    // -----[ fields ]----------------------------------------------------
    4444    // Parameters
    4545  protected : const std::string       _name;
     
    5454
    5555#ifdef SYSTEMC
    56     // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     56    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    5757    // Interface
    5858  public    : SC_CLOCK                      *  in_CLOCK        ;
     
    7373#endif
    7474
    75     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     75    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    7676  protected : morpheo::behavioural::generic::registerfile::registerfile_monolithic  ::RegisterFile_Monolithic  ::RegisterFile_Monolithic   * component_RegisterFile_Monolithic  ;
    7777  protected : morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked * component_RegisterFile_Multi_Banked;
    7878
    79     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     79    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    8080
    81     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     81    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    8282
    83     // -----[ methods ]---------------------------------------------------
     83    // -----[ methods ]---------------------------------------------------
    8484
    8585#ifdef SYSTEMC
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/src/Parameters_msg_error.cpp

    r75 r78  
    1616
    1717
    18   std::string Parameters::msg_error(void)
     18  Parameters_test Parameters::msg_error(void)
    1919  {
    20     log_printf(FUNC,RegisterFile,"msg_error","Begin");
    21 
    2220    if (_instance == instance_RegisterFile_Monolithic)
    2321      return _param_registerfile_monolithic  ->msg_error();
    2422    else
    2523      return _param_registerfile_multi_banked->msg_error();
    26    
    27     log_printf(FUNC,RegisterFile,"msg_error","End");
    2824  };
    2925
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Select/Select_Priority_Fixed/include/Parameters.h

    r75 r78  
    3434  public : ~Parameters () ;
    3535
    36   public :        std::string  msg_error  (void);
     36  public :        Parameters_test msg_error  (void);
    3737  public :        std::string   print      (uint32_t depth);
    3838  public : friend std::ostream& operator<< (std::ostream& output_stream,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Select/Select_Priority_Fixed/src/Parameters_msg_error.cpp

    r75 r78  
    1717
    1818
    19   std::string Parameters::msg_error(void)
     19  Parameters_test Parameters::msg_error(void)
    2020  {
    2121    log_printf(FUNC,Select_Priority_Fixed,"msg_error","Begin");
    2222
    23     std::string msg = "";
     23    Parameters_test test ("Select_Priority_Fixed");
    2424
    2525    if ((_encoding_one_hot or _encoding_compact) == false)
    26       {
    27         msg += "  - you must select a less one encoding\n";
    28         msg += "    * encoding_one_hot                : " + toString(_encoding_one_hot) + "\n";
    29         msg += "    * encoding_compact                : " + toString(_encoding_compact) + "\n";
    30       }
     26      test.error("you must select a less one encoding");
    3127
    3228    log_printf(FUNC,Select_Priority_Fixed,"msg_error","End");
    3329
    34     return msg;
     30    return test;
    3531  };
    3632
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/TODO

    r10 r78  
    11- Ajouter quelques algorithme de selection
     2  * Random
     3    -> LFSR (?) qui ne tourne pas à chaque cycle mais à chaque in_access_val = '1'
    24  * Round Robin
    35    -> simple compteur de log2(N) bits
     6  * Not Last Used
     7    -> idem random mais : sauvegarde le dernier élément accéder. Si rand = last_elt, alors on renvoye not rand
    48  * True LRU
    59    -> fifo matériel. Un élément accéder sera placer en fin de fifo.
    6   * Random
    7     -> LFSR (?) qui ne tourne pas à chaque cycle mais à chaque in_access_val = '1'
     10  * fifo
     11    idem true LRU mais aucun evenement lors de l'accès
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/configuration.cfg

    r42 r78  
    11Victim_Pseudo_LRU
    2 4       16      *2      # nb_entity
    3 1       4       *2      # nb_access
    4 1       4       *2      # nb_update
    5 1       16      *2      # size_table
     24       16      *4      # nb_entity
     31       4       *4      # nb_access             # 1     4       *4      # nb_update
     41       16      *4      # size_table
     50       1       +1      # table_global
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/src/main.cpp

    r15 r78  
    1414  cerr << "<Usage> " << exec << " name_instance list_params" << endl
    1515       << "list_params is :" << endl
    16        << " - nb_entity  (unsigned int)" << endl
    17        << " - nb_access  (unsigned int)" << endl
    18        << " - nb_update  (unsigned int)" << endl
    19        << " - size_table (unsigned int)" << endl;
     16       << " - nb_entity     (unsigned int)" << endl
     17       << " - nb_access     (unsigned int)" << endl
     18//        << " - nb_update     (unsigned int)" << endl
     19       << " - size_table    (unsigned int)" << endl
     20       << " - table_global  (bool        )" << endl;
    2021  exit (1);
    2122}
     
    3031    usage (argv[0]);
    3132
    32   const string   name       = argv[1];
    33   const uint32_t nb_entity  = atoi(argv[2]);
    34   const uint32_t nb_access  = atoi(argv[3]);
    35   const uint32_t nb_update  = atoi(argv[4]);
    36   const uint32_t size_table = atoi(argv[5]);
    37  
    38   morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param (nb_entity ,
    39                                                                        nb_access ,
    40                                                                        nb_update ,
    41                                                                        size_table);
     33  const string   name         = argv[1];
     34  const uint32_t nb_entity    = atoi(argv[2]);
     35  const uint32_t nb_access    = atoi(argv[3]);
     36//   const uint32_t nb_update    = atoi(argv[4]);
     37  const uint32_t size_table   = atoi(argv[4]);
     38  const bool     table_global = atoi(argv[5]); 
     39  morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param
     40    (nb_entity ,
     41     nb_access ,
     42//      nb_update ,
     43     size_table,
     44     table_global);
    4245
    4346  test (name,param);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/src/test.cpp

    r75 r78  
    1515  cout << "<" << name << "> : Simulation SystemC" << endl;
    1616
    17   if (param._nb_update < 1)
    18     {
    19       cerr << "<" << name << "> : To test, need a less one update's port" << endl;
    20       exit (EXIT_FAILURE);
    21     }
    22  
    2317  try
    2418    {
     
    4539                                                                  param_stat,
    4640#endif
    47                                                                   param);
     41                                                                  &param);
    4842 
    4943#ifdef SYSTEMC
     
    5751  sc_signal<Tcontrol_t>                    ACCESS_ACK     [param._nb_access];
    5852  sc_signal<Taddress_t>                    ACCESS_ADDRESS [param._nb_access];
     53  sc_signal<Tcontrol_t>                    ACCESS_HIT     [param._nb_access];
    5954  sc_signal<Tentity_t >                    ACCESS_ENTITY  [param._nb_access];
    60  
    61   sc_signal<Tcontrol_t>                    UPDATE_VAL     [param._nb_update];
    62   sc_signal<Tcontrol_t>                    UPDATE_ACK     [param._nb_update];
    63   sc_signal<Taddress_t>                    UPDATE_ADDRESS [param._nb_update];
    64   sc_signal<Tentity_t >                    UPDATE_ENTITY  [param._nb_update];
     55  sc_signal<Tentity_t >                    ACCESS_VICTIM  [param._nb_access];
    6556 
    6657  /********************************************************
     
    7768        (*(_Victim_Pseudo_LRU-> in_ACCESS_VAL     [i])) (ACCESS_VAL     [i]);
    7869        (*(_Victim_Pseudo_LRU->out_ACCESS_ACK     [i])) (ACCESS_ACK     [i]);
    79         if (param._size_table>1)
     70        if (param._size_address>1)
    8071        (*(_Victim_Pseudo_LRU-> in_ACCESS_ADDRESS [i])) (ACCESS_ADDRESS [i]);
    81         (*(_Victim_Pseudo_LRU->out_ACCESS_ENTITY  [i])) (ACCESS_ENTITY  [i]);
     72        (*(_Victim_Pseudo_LRU-> in_ACCESS_HIT     [i])) (ACCESS_HIT     [i]);
     73        (*(_Victim_Pseudo_LRU-> in_ACCESS_ENTITY  [i])) (ACCESS_ENTITY  [i]);
     74        (*(_Victim_Pseudo_LRU->out_ACCESS_VICTIM  [i])) (ACCESS_VICTIM  [i]);
    8275      }
    8376
    84     for (uint32_t i=0; i<param._nb_update; i++)
    85       {
    86         (*(_Victim_Pseudo_LRU-> in_UPDATE_VAL     [i])) (UPDATE_VAL     [i]);
    87         (*(_Victim_Pseudo_LRU->out_UPDATE_ACK     [i])) (UPDATE_ACK     [i]);
    88         if (param._size_table>1)
    89         (*(_Victim_Pseudo_LRU-> in_UPDATE_ADDRESS [i])) (UPDATE_ADDRESS [i]);
    90         (*(_Victim_Pseudo_LRU-> in_UPDATE_ENTITY  [i])) (UPDATE_ENTITY  [i]);
    91       }
    9277  /********************************************************
    9378   * Simulation - Begin
     
    10590      ACCESS_VAL[i].write(0);
    10691    }
    107   for (uint32_t i=0; i<param._nb_update; i++)
    108     {
    109       UPDATE_VAL[i].write(0);
    110     }
    11192
    11293  sc_start(5);
    11394  cout << "-----[ Test Update ]------------------------------" << endl;
    114   for (uint32_t i=0; i<param._nb_update; i++)
    115     {
    116       UPDATE_VAL[i].write(1);
    117     }
    118  
    119   for (uint32_t j=0; j<param._size_table; j+=param._nb_update)
     95  for (uint32_t i=0; i<param._nb_access; i++)
     96    {
     97      ACCESS_VAL[i].write(1);
     98      ACCESS_HIT[i].write(1);
     99    }
     100 
     101  for (uint32_t j=0; j<param._size_table; j+=param._nb_access)
    120102    for (uint32_t k=0; k<param._nb_entity; k++)
    121103      {
    122104        cout << "time : " << static_cast<uint32_t>(sc_simulation_time()) << endl;
    123         for (uint32_t i=0; i<param._nb_update; i++)
     105        for (uint32_t i=0; i<param._nb_access; i++)
    124106          {
    125107           
     
    131113              addr = 0;
    132114            Tentity_t  entity  = (k+1)%param._nb_entity;
    133             UPDATE_VAL     [i].write(val );
    134             if (param._size_table>1)
    135               UPDATE_ADDRESS [i].write(addr);
    136             UPDATE_ENTITY  [i].write(entity);
     115            ACCESS_VAL     [i].write(val );
     116            if (param._size_address>1)
     117              ACCESS_ADDRESS [i].write(addr);
     118            ACCESS_ENTITY  [i].write(entity);
    137119           
    138120            sc_start(0);
    139             cout << "\t[" << i << "] " << val << " - " << UPDATE_ACK[i].read() << " addr : " << addr << " -> " << entity << endl;
     121            cout << "\t[" << i << "] " << val << " - " << ACCESS_ACK[i].read() << " addr : " << addr << " -> " << entity << endl;
    140122          }
    141123        sc_start(1);
     
    143125                   
    144126
    145   for (uint32_t i=0; i<param._nb_update; i++)
    146     {
    147       UPDATE_VAL[i].write(0);
     127  for (uint32_t i=0; i<param._nb_access; i++)
     128    {
     129      ACCESS_VAL[i].write(0);
    148130    }
    149131
     
    151133
    152134  cout << "-----[ Test Access ]------------------------------" << endl;
     135
     136  for (uint32_t i=0; i<param._nb_access; i++)
     137    {
     138      ACCESS_HIT[i].write(0);
     139    }
    153140 
    154141 
     
    171158                addr = 0;
    172159              ACCESS_VAL     [i].write(val );
    173               if (param._size_table>1)
     160              if (param._size_address>1)
    174161                ACCESS_ADDRESS [i].write(addr);
    175162             
    176163              sc_start(0);
    177164             
    178               Tentity_t  entity  = ACCESS_ENTITY [i].read();
     165              Tentity_t  entity  = ACCESS_VICTIM [i].read();
    179166             
    180167              cout << "\t[" << i << "] " << val << " - " << ACCESS_ACK[i].read() << " addr : " << addr << " -> " << entity << endl;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Parameters.h

    r75 r78  
    2424  public : const uint32_t _nb_entity ; // number of entity
    2525  public : const uint32_t _nb_access ; // number of port to select an entity
    26   public : const uint32_t _nb_update ; // number of port to update the internal entity
     26//public : const uint32_t _nb_update ; // number of port to update the internal entity
    2727  public : const uint32_t _size_table; // Size of victim_pseudo_lru's table
     28  public : const bool     _table_global;
     29  public : const uint32_t _size_address;
    2830
    2931    //-----[ methods ]-----------------------------------------------------------
    3032  public : Parameters  (uint32_t nb_entity ,
    3133                        uint32_t nb_access ,
    32                         uint32_t nb_update ,
    33                         uint32_t size_table);
     34//                      uint32_t nb_update ,
     35                        uint32_t size_table,
     36                        bool     table_global);
    3437  public : Parameters  (Parameters & param) ;
    3538  public : ~Parameters () ;
    3639
    37   public :        std::string  msg_error  (void);
    38   public :        std::string   print      (uint32_t depth);
    39   public : friend std::ostream& operator<< (std::ostream& output_stream,
    40                                             morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters & x);
     40  public :        Parameters_test msg_error  (void);
     41  public :        std::string     print      (uint32_t depth);
     42  public : friend std::ostream&   operator<< (std::ostream& output_stream,
     43                                              morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters & x);
    4144  };
    4245
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Types.h

    r75 r78  
    99 */
    1010
    11 #include "Behavioural/include/Types.h"
     11#include "Behavioural/Generic/Victim/include/Types.h"
    1212
    1313namespace morpheo {
     
    1717namespace victim_pseudo_lru {
    1818
    19   typedef uint32_t Taddress_t;
    20   typedef uint32_t Tentity_t;
     19  class entry_t
     20  {
     21    // Numerotation of victim_pseudo_lru's tree
     22    // Tree of Pseudo-LRU
     23    //
     24    // | d2              [3]                 |
     25    // |          0_______|_______1          |
     26    // |          |               |          |
     27    // | d1      [1]             [5]         |
     28    // |      0___|___1       0___|___1      |
     29    // |      |       |       |       |      |
     30    // | d0  [0]     [2]     [4]     [6]     |
     31    // |    0_|_1   0_|_1   0_|_1   0_|_1    |
     32    // |    |   |   |   |   |   |   |   |    |
     33    // |   Way Way Way Way Way Way Way Way   |
     34    // |    0   1   2   3   4   5   6   7    |
     35    //
     36    // Access :  Way N with N=2*n   -> bit 2*n = 0
     37    //                 with N=2*n+1 -> bit 2*n = 1
     38    //
     39    // if bit = B, depth = D, next_B = B+D if B==1
     40    //                               = B-D if B==0
     41    //
     42    // Update :
     43
     44  private : bool    * _entry;
     45  private : uint32_t  _size;
     46   
     47  public  : entry_t ()
     48    {
     49    };
     50  public  : entry_t (uint32_t size) : _size (size)
     51    {
     52      _entry = new bool [size];
     53     
     54      // initialisation
     55      for (uint32_t i=0; i<size; i++)
     56        _entry [i] = false;
     57    }
     58   
     59  public : ~entry_t ()
     60    {
     61      delete _entry;
     62    }
     63   
     64  private : uint32_t one_access (uint32_t index, uint32_t offset)
     65    {
     66      bool val = _entry[index];
     67     
     68      // Compute next slot
     69      if (val == true)
     70        return index + offset;
     71      else
     72        return index - offset;
     73    }
     74
     75  public : uint32_t access ()
     76    {
     77      uint32_t index = (_size>>1)-1; // middle
     78
     79      for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>= 1; i--)
     80        {
     81          index = one_access (index,(1<<(i-1)));
     82        }
     83      index = one_access (index,0);
     84     
     85      // reverse by one_access make always a reverse
     86      uint32_t offset = (_entry[index]==true)?1:0;
     87
     88      return index+offset;
     89    }
     90
     91  private : uint32_t one_update (uint32_t index, uint32_t offset, uint32_t value)
     92    {
     93      uint32_t mask = (offset==0)?1:(offset<<1);
     94      bool     val  = ((value & mask) != 0);
     95
     96      // reverse
     97      _entry[index] = not val;
     98
     99      if (val == true)
     100      // Compute next slot
     101        return index + offset;
     102      else
     103        return index - offset;
     104    }
     105  public : void update (uint32_t value)
     106    {
     107      uint32_t index = (_size>>1)-1; // middle
     108
     109      for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>=1; i--)
     110        {
     111          index = one_update (index,1<<(i-1),value);
     112        }
     113      index = one_update (index,0,value);
     114    }
     115
     116  public : std::string print ()
     117    {
     118      std::string res = "";
     119
     120      for (int32_t i=static_cast<int32_t>(_size)-1; i>=0; i--)
     121        res += toString(_entry[i]) + " ";
     122
     123      return res;
     124    }
     125  };
    21126
    22127}; // end namespace victim_pseudo_lru
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h

    r75 r78  
    55 * $Id$
    66 *
    7  * [ Description ]
     7 * [ Description ]
    88 *
    99 */
     
    5353#endif
    5454  {
    55     // -----[ internal class ]--------------------------------------------
    56   protected : class entry_t
    57   {
    58     // Numerotation of victim_pseudo_lru's tree
    59     // Tree of Pseudo-LRU
    60     //
    61     // | d2              [3]                 |
    62     // |          0_______|_______1          |
    63     // |          |               |          |
    64     // | d1      [1]             [5]         |
    65     // |      0___|___1       0___|___1      |
    66     // |      |       |       |       |      |
    67     // | d0  [0]     [2]     [4]     [6]     |
    68     // |    0_|_1   0_|_1   0_|_1   0_|_1    |
    69     // |    |   |   |   |   |   |   |   |    |
    70     // |   Way Way Way Way Way Way Way Way   |
    71     // |    0   1   2   3   4   5   6   7    |
    72     //
    73     // Access :  Way N with N=2*n   -> bit 2*n = 0
    74     //                 with N=2*n+1 -> bit 2*n = 1
    75     //
    76     // if bit = B, depth = D, next_B = B+D if B==1
    77     //                               = B-D if B==0
    78     //
    79     // Update :
     55    // -----[ fields ]----------------------------------------------------
     56    // Parameters
     57  protected : const std::string   _name;
    8058
    81   private : bool    * _entry;
    82   private : uint32_t  _size;
    83 
    84   public  : entry_t ()
    85     {
    86     };
    87   public  : entry_t (uint32_t size) : _size (size)
    88     {
    89       _entry = new bool [size];
    90      
    91       // initialisation
    92       for (uint32_t i=0; i<size; i++)
    93         _entry [i] = false;
    94     }
    95    
    96   public : ~entry_t ()
    97     {
    98       delete _entry;
    99     }
    100    
    101   private : uint32_t one_access (uint32_t index, uint32_t offset)
    102     {
    103       bool val = _entry[index];
    104      
    105       // Compute next slot
    106       if (val == true)
    107         return index + offset;
    108       else
    109         return index - offset;
    110     }
    111 
    112   public : uint32_t access ()
    113     {
    114       uint32_t index = (_size>>1)-1; // medium
    115 
    116       for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>= 1; i--)
    117         {
    118           index = one_access (index,(1<<(i-1)));
    119         }
    120       index = one_access (index,0);
    121      
    122       // reverse by one_access make always a reverse
    123       uint32_t offset = (_entry[index]==true)?1:0;
    124 
    125       return index+offset;
    126     }
    127 
    128   private : uint32_t one_update (uint32_t index, uint32_t offset, uint32_t value)
    129     {
    130       uint32_t mask = (offset==0)?1:(offset<<1);
    131       bool     val  = ((value & mask) != 0);
    132 
    133       // reverse
    134       _entry[index] = not val;
    135 
    136       if (val == true)
    137       // Compute next slot
    138         return index + offset;
    139       else
    140         return index - offset;
    141     }
    142   public : void update (uint32_t value)
    143     {
    144       uint32_t index = (_size>>1)-1; // medium
    145 
    146       for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>=1; i--)
    147         {
    148           index = one_update (index,1<<(i-1),value);
    149         }
    150       index = one_update (index,0,value);
    151     }
    152 
    153   public : std::string print ()
    154     {
    155       std::string res = "";
    156 
    157       for (int32_t i=static_cast<int32_t>(_size)-1; i>=0; i--)
    158         res += toString(_entry[i]) + " ";
    159 
    160       return res;
    161     }
    162 
    163   };
    164     // -----[ fields ]----------------------------------------------------
    165     // Parameters
    166   protected : const std::string     _name;
    167 
    168   protected : const Parameters _param;
     59  protected : const Parameters  * _param;
    16960#ifdef STATISTICS
    17061  public    : Stat                           * _stat;
     
    17566
    17667#ifdef SYSTEMC
    177     // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     68    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    17869    // Interface
    17970  public    : SC_CLOCK                      *  in_CLOCK         ;
     
    18475  public    : SC_OUT(Tcontrol_t)           ** out_ACCESS_ACK    ;
    18576  public    : SC_IN (Taddress_t)           **  in_ACCESS_ADDRESS;
    186   public    : SC_OUT(Tentity_t )           ** out_ACCESS_ENTITY ;
    187     // Interface update
    188   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL    ;
    189   public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK    ;
    190   public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS;
    191   public    : SC_IN (Tentity_t )           **  in_UPDATE_ENTITY ;
     77  public    : SC_IN (Tcontrol_t)           **  in_ACCESS_HIT    ; // hit = 1 : update next_victim with in_entity else with out_victim
     78  public    : SC_IN (Tentity_t )           **  in_ACCESS_ENTITY ;
     79  public    : SC_OUT(Tentity_t )           ** out_ACCESS_VICTIM ;
    19280
    19381    // Interface update
    194     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     82    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    19583  private   : entry_t                      ** reg_TABLE;
    19684
    197     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    198   private   : Tentity_t                     * internal_ACCESS_ENTITY;
     85    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     86  private   : Tcontrol_t                    * internal_ACCESS_ACK   ;
     87  private   : Tentity_t                     * internal_ACCESS_VICTIM;
    19988#endif
    20089
    201     // -----[ methods ]---------------------------------------------------
     90    // -----[ methods ]---------------------------------------------------
    20291
    20392#ifdef SYSTEMC
     
    20594#endif
    20695
    207   public  :          Victim_Pseudo_LRU              (
     96  public  :          Victim_Pseudo_LRU             
     97  (
    20898#ifdef SYSTEMC
    209                                               sc_module_name                                name,
     99   sc_module_name                                name,
    210100#else                                         
    211                                               std::string                                   name,
     101   std::string                                   name,
    212102#endif                                         
    213103#ifdef STATISTICS
    214                                               morpheo::behavioural::Parameters_Statistics * param_statistics,
     104   morpheo::behavioural::Parameters_Statistics * param_statistics,
    215105#endif
    216                                               Parameters                                    param );
     106   Parameters                                  * param );
    217107                                               
    218108  public  :          Victim_Pseudo_LRU              (Parameters param );
     
    224114                                               
    225115  public  : void     transition                (void);
    226   public  : void     genMealy_access           (void);
     116  public  : void     genMoore                  (void);
    227117#endif
    228118                                               
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters.cpp

    r15 r78  
    1717  Parameters::Parameters (uint32_t nb_entity ,
    1818                          uint32_t nb_access ,
    19                           uint32_t nb_update ,
    20                           uint32_t size_table):
     19//                        uint32_t nb_update ,
     20                          uint32_t size_table,
     21                          bool     table_global):
    2122    _nb_entity  (nb_entity ),
    2223    _nb_access  (nb_access ),
    23     _nb_update  (nb_update ),
    24     _size_table (size_table)
     24//     _nb_update  (nb_update ),
     25    _size_table ((table_global == true)?1:size_table),
     26    _table_global (table_global),
     27    _size_address (size_table)
    2528  {
    2629    test();
     
    3033    _nb_entity  (param._nb_entity ),
    3134    _nb_access  (param._nb_access ),
    32     _nb_update  (param._nb_update ),
    33     _size_table (param._size_table)
     35//     _nb_update  (param._nb_update ),
     36    _size_table (param._size_table),
     37    _table_global(param._table_global),
     38    _size_address(param._size_address)
    3439  {
    3540    test();
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters_msg_error.cpp

    r75 r78  
    1616namespace victim_pseudo_lru {
    1717
    18   std::string Parameters::msg_error(void)
     18  Parameters_test Parameters::msg_error(void)
    1919  {
    20     std::string msg = "";
     20    Parameters_test test ("Victime_Pseudo_LRU");
    2121
    2222    if (_nb_entity < 2)
    23       {
    24         msg += "  - nb_entity must be >= 2\n";
    25         msg += "    * nb_entity                       : " + toString(_nb_entity) + "\n";
    26       }
    27 
     23      test.error("nb_entity must be >= 2");
     24   
    2825    if (is_positive(log2(_nb_entity)) == false)
    29       {
    30         msg += "  - nb_entity is not a power of 2\n";
    31         msg += "    * nb_entity                       : " + toString(_nb_entity) + "\n";
    32       }
     26      test.error("nb_entity is not a power of 2");
    3327
    3428    if (_nb_access <  1)
    35       {
    36         msg += "  - nb_access must be >= 1\n";
    37         msg += "    * nb_access                       : " + toString(_nb_access) + "\n";
    38       }
     29      test.error("nb_access must be >= 1");
    3930
    4031    if (_size_table < 1)
    41       {
    42         msg += "  - size_table must be >= 1\n";
    43         msg += "    * size_table                      : " + toString(_size_table) + "\n";
    44       }
     32      test.error("size_table must be >= 1");
    4533
    4634    if (is_between_inclusive (static_cast<uint32_t>(log2(_nb_entity)),0 ,(8*sizeof(Tentity_t))) == false)
    47       {
    48         msg += "  - type \"Tentity_t\" is too little to the size defined by nb_entity\n";
    49         msg += "    * nb_entity                       : " + toString(_nb_entity) + "\n";
    50         msg += "    * Tentity_t                (bits) : " + toString(8*(sizeof(Tentity_t))) + "\n";
    51       }
     35      test.error("type \"Tentity_t\" is too little to the size defined by nb_entity");
    5236
    5337    if (is_between_inclusive (static_cast<uint32_t>(log2(_size_table)),0 ,(8*sizeof(Taddress_t))) == false)
    54       {
    55         msg += "  - type \"Taddress_t\" is too little to the size defined by size_table\n";
    56         msg += "    * size_table                      : " + toString(_size_table)    + "\n";
    57         msg += "      > size                   (bits) : " + toString(log2(_size_table)) + "\n";
    58         msg += "    * Taddress_t               (bits) : " + toString(8*(sizeof(Taddress_t))) + "\n";
    59       }
     38      test.error("type \"Taddress_t\" is too little to the size defined by size_table");
    6039
    61 
    62 
    63     return msg;
     40    return test;
    6441  };
    6542
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters_print.cpp

    r75 r78  
    2121
    2222    xml.balise_open("victim_pseudo_lru");
    23     xml.singleton_begin("nb_entity "); xml.attribut("value",toString(_nb_entity )); xml.singleton_end();
    24     xml.singleton_begin("nb_access "); xml.attribut("value",toString(_nb_access )); xml.singleton_end();
    25     xml.singleton_begin("nb_update "); xml.attribut("value",toString(_nb_update )); xml.singleton_end();
    26     xml.singleton_begin("size_table"); xml.attribut("value",toString(_size_table)); xml.singleton_end();
     23    xml.singleton_begin("nb_entity   "); xml.attribut("value",toString(_nb_entity   )); xml.singleton_end();
     24    xml.singleton_begin("nb_access   "); xml.attribut("value",toString(_nb_access   )); xml.singleton_end();
     25//     xml.singleton_begin("nb_update   "); xml.attribut("value",toString(_nb_update   )); xml.singleton_end();
     26    xml.singleton_begin("size_table  "); xml.attribut("value",toString(_size_table  )); xml.singleton_end();
     27    xml.singleton_begin("table_global"); xml.attribut("value",toString(_table_global)); xml.singleton_end();
    2728    xml.balise_close();
    2829
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU.cpp

    r75 r78  
    2222                          morpheo::behavioural::Parameters_Statistics * param_statistics,
    2323#endif
    24                           morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param ):
     24                          morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters * param ):
    2525                          _name   (name)
    2626                          ,_param (param)
     
    5252    sensitive << (*(in_CLOCK)).pos();
    5353
    54     SC_METHOD (genMealy_access);
     54    SC_METHOD (genMoore);
    5555    dont_initialize ();
    5656    sensitive << (*(in_CLOCK)).neg();
    57     for (uint32_t i=0; i<_param._nb_access; i++)
    58       {
    59         sensitive << *(in_ACCESS_VAL     [i]);
    60         if (_param._size_table>1)
    61           sensitive << *(in_ACCESS_ADDRESS [i]);
    62       }
    6357
    6458#ifdef SYSTEMCASS_SPECIFIC
    65     log_printf(TRACE,Victim_Pseudo_LRU,"Victim_Pseudo_LRU","List dependency information");
    66     // List dependency information
    67     for (uint32_t i=0; i<_param._nb_access; i++)
    68       {
    69         (*(out_ACCESS_ENTITY [i])) (*( in_ACCESS_VAL     [i]));
    70         if (_param._size_table>1)
    71           (*(out_ACCESS_ENTITY [i])) (*( in_ACCESS_ADDRESS [i]));
    72       }
    7359#endif   
    7460
    7561    // Constant - ack is always at one
    76     for (uint32_t i=0; i<_param._nb_access; i++)
    77       PORT_WRITE (out_ACCESS_ACK [i], 1);
    78     for (uint32_t i=0; i<_param._nb_update; i++)
    79       PORT_WRITE (out_UPDATE_ACK [i], 1);
     62    for (uint32_t i=0; i<_param->_nb_access; i++)
     63      {
     64        internal_ACCESS_ACK [i] = 1;
     65        PORT_WRITE (out_ACCESS_ACK [i], internal_ACCESS_ACK [i]);
     66      }
    8067
    8168#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_allocation.cpp

    r75 r78  
    88
    99#include "Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h"
     10#include "Behavioural/include/Allocation.h"
    1011
    1112namespace morpheo {
     
    4243    // ~~~~~[ Interface : "access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4344    {
    44        in_ACCESS_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_access];
    45       out_ACCESS_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_access];
    46       if (_param._size_table>1)
    47        in_ACCESS_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_access];
    48       out_ACCESS_ENTITY  = new SC_OUT(Tentity_t ) * [_param._nb_access];
    49      
    50       for (uint32_t i=0; i<_param._nb_access; i++)
    51         {
    52           Interface_fifo * interface = _interfaces->set_interface("access_"+toString(i)
    53 #ifdef POSITION
    54                                                                   , IN  ,WEST, "Access"
    55 #endif
    56                                                                   );
     45      ALLOC1_INTERFACE("access",IN,WEST, "Access", _param->_nb_access);
    5746
    58            in_ACCESS_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
    59           out_ACCESS_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
    60          
    61           if (_param._size_table>1)
    62            in_ACCESS_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
    63           out_ACCESS_ENTITY  [i] = interface->set_signal_out <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
    64         }
     47      ALLOC1_VALACK_IN ( in_ACCESS_VAL    ,VAL);
     48      ALLOC1_VALACK_OUT(out_ACCESS_ACK    ,ACK);
     49      ALLOC1_SIGNAL_IN ( in_ACCESS_HIT    ,"hit"    ,Tcontrol_t,1);
     50      ALLOC1_SIGNAL_IN ( in_ACCESS_ADDRESS,"address",Taddress_t,log2(_param->_size_address));
     51      ALLOC1_SIGNAL_IN ( in_ACCESS_ENTITY ,"entity" ,Tentity_t ,log2(_param->_nb_entity   ));
     52      ALLOC1_SIGNAL_OUT(out_ACCESS_VICTIM ,"victim" ,Tentity_t ,log2(_param->_nb_entity   ));
    6553    }
    6654
    67     // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    68    
    69     {
    70        in_UPDATE_VAL     = new SC_IN (Tcontrol_t) *  [_param._nb_update];
    71       out_UPDATE_ACK     = new SC_OUT(Tcontrol_t) *  [_param._nb_update];
    72       if (_param._size_table>1)
    73        in_UPDATE_ADDRESS = new SC_IN (Taddress_t) *  [_param._nb_update];
    74        in_UPDATE_ENTITY  = new SC_IN (Tentity_t ) *  [_param._nb_update];
    75      
    76       for (uint32_t i=0; i<_param._nb_update; i++)
    77         {
    78           Interface_fifo * interface = _interfaces->set_interface("update_"+toString(i)
    79 #ifdef POSITION
    80                                                                   , IN  ,EAST, "Update"
    81 #endif
    82                                                                   );
     55    // -----[ Register ]---------------------------------------------------
     56    reg_TABLE = new entry_t *  [_param->_size_table];
    8357
    84           in_UPDATE_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
    85          out_UPDATE_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
    86          if (_param._size_table>1)
    87           in_UPDATE_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
    88           in_UPDATE_ENTITY  [i] = interface->set_signal_in  <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
    89         }
    90     }
    91     // -----[ Register ]---------------------------------------------------
    92     reg_TABLE = new entry_t *  [_param._size_table];
    93 
    94     for (uint32_t i=0; i<_param._size_table; i++)
    95       reg_TABLE [i] = new entry_t (_param._nb_entity);
     58    for (uint32_t i=0; i<_param->_size_table; i++)
     59      reg_TABLE [i] = new entry_t (_param->_nb_entity);
    9660   
    9761    // -----[ Internal ]---------------------------------------------------
    98     internal_ACCESS_ENTITY = new Tentity_t [_param._nb_entity];
     62    internal_ACCESS_ACK    = new Tcontrol_t [_param->_nb_access];
     63    internal_ACCESS_VICTIM = new Tentity_t  [_param->_nb_access];
    9964
    10065#ifdef POSITION
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_deallocation.cpp

    r42 r78  
    33 * $Id$
    44 *
    5  * [ Description ]
     5 * [ Description ]
    66 *
    77 */
     
    1919    delete     in_CLOCK;
    2020    delete     in_NRESET;
    21     // -----[ Interface access ]-------------------------------------------
     21    // -----[ Interface access ]-------------------------------------------
    2222    delete []  in_ACCESS_VAL    ;
    2323    delete [] out_ACCESS_ACK    ;
    24     if (_param._size_table>1)
     24    if (_param->_size_address>1)
    2525    delete []  in_ACCESS_ADDRESS;
    26     delete [] out_ACCESS_ENTITY ;
     26    delete []  in_ACCESS_HIT    ;
     27    delete []  in_ACCESS_ENTITY ;
     28    delete [] out_ACCESS_VICTIM ;
    2729   
    28     // -----[ Interface update ]-------------------------------------------
    29     delete []  in_UPDATE_VAL    ;
    30     delete [] out_UPDATE_ACK    ;
    31     if (_param._size_table>1)
    32     delete []  in_UPDATE_ADDRESS;
    33     delete []  in_UPDATE_ENTITY ;
    34 
    35     // -----[ Register ]---------------------------------------------------
     30    // -----[ Register ]---------------------------------------------------
    3631    delete [] reg_TABLE;
    3732
    38     // -----[ Internal ]---------------------------------------------------
    39     delete [] internal_ACCESS_ENTITY;
     33    // -----[ Internal ]---------------------------------------------------
     34    delete [] internal_ACCESS_ACK   ;
     35    delete [] internal_ACCESS_VICTIM;
    4036
    41 #ifdef POSITION
    4237    delete _component;
    43 #else
    44     delete _interfaces;
    45 #endif
    4638  };
    4739
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_genMoore.cpp

    r59 r78  
    1515namespace victim_pseudo_lru {
    1616
    17   void Victim_Pseudo_LRU::genMealy_access (void)
     17  void Victim_Pseudo_LRU::genMoore (void)
    1818  {
    19     for (uint32_t i=0; i<_param._nb_access; i++)
     19    for (uint32_t i=0; i<_param->_nb_access; i++)
    2020      {
    21         if (PORT_READ (in_ACCESS_VAL[i]) == 1)
    22           {
    23             Taddress_t address;
     21        Taddress_t address = (_param->_size_table>1)?PORT_READ(in_ACCESS_ADDRESS[i]):0;
    2422
    25             if (_param._size_table>1)
    26               address = PORT_READ     (in_ACCESS_ADDRESS[i]);
    27             else
    28               address = 0;
    29            
    30             internal_ACCESS_ENTITY[i] = reg_TABLE[address]->access();
    31           }
    32         else
    33           {
    34             internal_ACCESS_ENTITY[i] = 0;
    35           }
     23        internal_ACCESS_VICTIM[i] = reg_TABLE[address]->access();
    3624
    37         PORT_WRITE(out_ACCESS_ENTITY[i], internal_ACCESS_ENTITY[i]);
     25        PORT_WRITE(out_ACCESS_VICTIM[i], internal_ACCESS_VICTIM[i]);
    3826      }//end for i
    3927  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_transition.cpp

    r75 r78  
    1717  void Victim_Pseudo_LRU::transition (void)
    1818  {
    19 #ifdef STATISTICS
    20     uint32_t _stat_nb_access = 0;
    21     uint32_t _stat_nb_update = 0;
    22 #endif
     19    for (uint32_t i=0; i<_param->_nb_access; i++)
     20      {
     21        if (PORT_READ (in_ACCESS_VAL[i]) and internal_ACCESS_ACK)
     22          {
     23            Taddress_t address = (_param->_size_table>1)?PORT_READ(in_ACCESS_ADDRESS[i]):0;
     24            Tentity_t  entity;
    2325
    24     for (uint32_t i=0; i<_param._nb_access; i++)
    25       {
    26         // Access ... (ack is always at 1)
    27         if (PORT_READ (in_ACCESS_VAL[i]) == 1)
    28           {
    29 #ifdef STATISTICS
    30             _stat_nb_access ++;
    31 #endif
    32             Taddress_t address;
     26            if (PORT_READ(in_ACCESS_HIT [i]))
     27              {
     28                // Hit  : don't need a victim
     29// #ifdef STATISTICS
     30//              _stat_nb_update ++;
     31// #endif
     32                entity = PORT_READ(in_ACCESS_ENTITY[i]);
     33              }
     34            else
     35              {
     36                // Miss : need victim
     37// #ifdef STATISTICS
     38//              _stat_nb_access ++;
     39// #endif
     40                entity = internal_ACCESS_VICTIM[i];
     41              }
    3342
    34             if (_param._size_table>1)
    35               address = PORT_READ     (in_ACCESS_ADDRESS[i]);
    36             else
    37               address = 0;
    38            
    39             reg_TABLE[address]->update(internal_ACCESS_ENTITY[i]);
     43            reg_TABLE[address]->update(entity);
    4044          }
    4145      }//end for i
    4246   
    43     for (uint32_t i=0; i<_param._nb_update; i++)
    44       {
    45         // Update ... (ack is always at 1)
    46         if (PORT_READ (in_UPDATE_VAL[i]) == 1)
    47           {
    48 #ifdef STATISTICS
    49             _stat_nb_update ++;
    50 #endif
    51            
    52             Taddress_t address;
    53            
    54             if (_param._size_table>1)
    55               address = PORT_READ     (in_UPDATE_ADDRESS[i]);
    56             else
    57               address = 0;
    58            
    59             reg_TABLE[address]->update(PORT_READ(in_UPDATE_ENTITY[i]));
    60           }
    61       }//end for i
    62 
    6347#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    6448    end_cycle ();
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_vhdl_body.cpp

    r75 r78  
    3535    vhdl->set_body ("--    Way Way Way Way Way Way Way Way   ");
    3636    vhdl->set_body ("--     0   1   2   3   4   5   6   7    ");
    37     for (uint32_t i=0; i<_param._nb_access; i++)
     37    for (uint32_t i=0; i<_param->_nb_access; i++)
    3838      {
    3939        vhdl->set_body ("");
     
    4242        std::string access_address;
    4343
    44         if (_param._size_table>1)
     44        if (_param->_size_table>1)
    4545          access_address = "conv_integer(in_ACCESS_"+toString(i)+"_ADDRESS)";
    4646        else
     
    5050        vhdl->set_body ("");
    5151
    52         for (int32_t j=static_cast<uint32_t>(log2(_param._nb_entity)-1); j>=0; j--)
     52        for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--)
    5353          {
    5454            vhdl->set_body ("access_entity_"+toString(i)+"("+toString(j)+") <= ");
     
    5656            uint32_t cpt=0;
    5757
    58             for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param._nb_entity-1); k+=(1<<(j+1)))
     58            for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1)))
    5959              {
    6060                std::string cond = "";
    6161               
    6262                // Create the condition
    63                 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param._nb_entity));l++)
     63                for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++)
    6464                  {
    6565                    if (l==static_cast<uint32_t>(j+1))
     
    8585    vhdl->set_body ("");
    8686    vhdl->set_body ("-- port access");
    87     for (uint32_t i=0; i<_param._nb_access; i++)
    88       for (int32_t j=static_cast<uint32_t>(log2(_param._nb_entity)-1); j>=0; j--)
     87    for (uint32_t i=0; i<_param->_nb_access; i++)
     88      for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--)
    8989        {
    9090          uint32_t cpt=0;
    9191         
    92           for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param._nb_entity-1); k+=(1<<(j+1)))
     92          for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1)))
    9393            {
    9494              bool   have_cond = false;
     
    9696             
    9797              // condition to change the bit
    98               for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param._nb_entity));l++)
     98              for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++)
    9999                {
    100100                  have_cond = true;
     
    118118    vhdl->set_body ("");
    119119    vhdl->set_body ("-- port update");
    120     for (uint32_t i=0; i<_param._nb_update; i++)
    121       for (int32_t j=static_cast<uint32_t>(log2(_param._nb_entity)-1); j>=0; j--)
     120    for (uint32_t i=0; i<_param->_nb_update; i++)
     121      for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--)
    122122        {
    123123          uint32_t cpt=0;
    124124         
    125           for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param._nb_entity-1); k+=(1<<(j+1)))
     125          for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1)))
    126126            {
    127127              bool   have_cond = false;
     
    129129             
    130130              // condition to change the bit
    131               for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param._nb_entity));l++)
     131              for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++)
    132132                {
    133133                  have_cond = true;
     
    146146                  std::string update_address;
    147147
    148                   if (_param._size_table>1)
     148                  if (_param->_size_table>1)
    149149                    update_address = "conv_integer(in_UPDATE_"+toString(i)+"_ADDRESS)";
    150150                  else
     
    168168    vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
    169169    vhdl->set_body ("\t\t-- Access port");
    170     for (uint32_t i=0; i<_param._nb_access; i++)
     170    for (uint32_t i=0; i<_param->_nb_access; i++)
    171171      {
    172172        std::string access_address;
    173173
    174         if (_param._size_table>1)
     174        if (_param->_size_table>1)
    175175          access_address = "conv_integer(in_ACCESS_"+toString(i)+"_ADDRESS)";
    176176        else
     
    183183
    184184    vhdl->set_body ("\t\t-- Update port");
    185     for (uint32_t i=0; i<_param._nb_update; i++)
     185    for (uint32_t i=0; i<_param->_nb_update; i++)
    186186      {
    187187        std::string update_address;
    188188
    189         if (_param._size_table>1)
     189        if (_param->_size_table>1)
    190190          update_address = "conv_integer(in_UPDATE_"+toString(i)+"_ADDRESS)";
    191191        else
     
    207207    vhdl->set_body ("-- Ack is always ");
    208208    vhdl->set_body ("");
    209     for (uint32_t i=0; i<_param._nb_access; i++)
     209    for (uint32_t i=0; i<_param->_nb_access; i++)
    210210      {
    211211        vhdl->set_body ("out_ACCESS_"+toString(i)+"_ACK    <= '1';");
     
    213213      }
    214214    vhdl->set_body ("");
    215     for (uint32_t i=0; i<_param._nb_update; i++)
     215    for (uint32_t i=0; i<_param->_nb_update; i++)
    216216      {
    217217        vhdl->set_body ("out_UPDATE_"+toString(i)+"_ACK    <= '1';");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_vhdl_declaration.cpp

    r42 r78  
    1818  void Victim_Pseudo_LRU::vhdl_declaration (Vhdl * & vhdl)
    1919  {
    20     vhdl->set_type ("Ttable", "array (" + toString(_param._size_table-1) + " downto 0) of "+std_logic(_param._nb_entity-1));
     20    vhdl->set_type ("Ttable", "array (" + toString(_param->_size_table-1) + " downto 0) of "+std_logic(_param->_nb_entity-1));
    2121
    2222
    2323    vhdl->set_signal ("reg_TABLE", "Ttable");
    24     for (uint32_t i=0; i<_param._nb_access; i++)
     24    for (uint32_t i=0; i<_param->_nb_access; i++)
    2525      {
    26         vhdl->set_signal ("access_entry_"+toString(i)+"     ",std_logic(_param._nb_entity-1));
    27         vhdl->set_signal ("access_next_entry_"+toString(i)+"",std_logic(_param._nb_entity-1));
    28         vhdl->set_signal ("access_entity_"+toString(i)+"    ",std_logic(static_cast<uint32_t>(log2(_param._nb_entity))));
     26        vhdl->set_signal ("access_entry_"+toString(i)+"     ",std_logic(_param->_nb_entity-1));
     27        vhdl->set_signal ("access_next_entry_"+toString(i)+"",std_logic(_param->_nb_entity-1));
     28        vhdl->set_signal ("access_entity_"+toString(i)+"    ",std_logic(static_cast<uint32_t>(log2(_param->_nb_entity))));
    2929      }
    3030
    31     for (uint32_t i=0; i<_param._nb_update; i++)
     31    for (uint32_t i=0; i<_param->_nb_update; i++)
    3232      {
    33         vhdl->set_signal ("update_next_entry_"+toString(i)+"",std_logic(_param._nb_entity-1));
     33        vhdl->set_signal ("update_next_entry_"+toString(i)+"",std_logic(_param->_nb_entity-1));
    3434      }
    3535  };
Note: See TracChangeset for help on using the changeset viewer.