Ignore:
Timestamp:
Sep 28, 2007, 2:58:08 PM (17 years ago)
Author:
rosiere
Message:
  • VHDL - RegisterFile_Multi_Banked (only partial_crossbar)
  • SystemC - modif Component, interface and co -> ajout du type Tusage_T pour instancier un coposant mais ne demander que le VHDL ou le systemC.
  • Séminaire interne
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_vhdl.cpp

    r53 r57  
    88
    99#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h"
     10#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
     11#include "Behavioural/Generic/Select/Select_Priority_Fixed/include/Select_Priority_Fixed.h"
    1012#include "Behavioural/include/Vhdl.h"
    1113
     
    1618namespace registerfile_multi_banked {
    1719
    18 
    1920  void RegisterFile_Multi_Banked::vhdl (void)
    2021  {
    2122    log_printf(FUNC,RegisterFile_Multi_Banked,"vhdl","Begin");
    22 
     23   
     24    //===================================
     25    //===== Component               =====
     26    //===================================
     27
     28    //----- RegisterFile_Monolithic -----
     29
     30    morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param_bank;
     31    morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic * bank;
     32   
     33    // Create all bank. All bank is identical
     34    param_bank = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters
     35      (_param->_nb_port_read_by_bank
     36       ,_param->_nb_port_write_by_bank
     37       ,0 // mixte port
     38       ,_param->_nb_word/_param->_nb_bank
     39       ,_param->_size_word);
     40   
     41    string bank_name = _name + "_bank";
     42    bank = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic
     43      (bank_name.c_str()
     44#ifdef STATISTICS
     45       ,NULL
     46#endif
     47       ,param_bank
     48       ,USE_VHDL);
     49   
     50    _component->set_component(bank->_component
     51#ifdef POSITION
     52                              , 0, 0, 0, 0
     53#endif
     54                              , INSTANCE_LIBRARY
     55                              );
     56   
     57
     58    //----- Select_Priority_Fixed -----
     59
     60    // Create all select_unit :
     61    //  * 4 units : to the read port, "quotient" ports and "rest" ports. Idem to the write port.
     62    //  * for a FULL_CROSSBAR, there are no "rest" ports
     63    uint32_t nb_select_port_1 ;
     64    uint32_t nb_select_port_2 ;
     65    uint32_t nb_select_port_3 ;
     66    uint32_t nb_select_port_4 ;
     67     
     68    if (_param->_crossbar == FULL_CROSSBAR)
     69      {
     70        nb_select_port_1 = _param->_nb_port_read ;
     71        nb_select_port_3 = _param->_nb_port_write;
     72        nb_select_port_2 = nb_select_port_4 = 0;
     73      }
     74    else
     75      {
     76        nb_select_port_2=(_param->_nb_port_read                  )/_param->_nb_port_read_by_bank;
     77        nb_select_port_1=((_param->_nb_port_read%_param->_nb_port_read_by_bank)==0)?0:(nb_select_port_2+1);
     78        nb_select_port_4=(_param->_nb_port_write                 )/_param->_nb_port_write_by_bank;
     79        nb_select_port_3=((_param->_nb_port_write%_param->_nb_port_write_by_bank)==0)?0:(nb_select_port_4+1);
     80      }
     81     
     82//     cout << "nb_select_port_1 : " << nb_select_port_1 << endl;
     83//     cout << "nb_select_port_2 : " << nb_select_port_2 << endl;
     84//     cout << "nb_select_port_3 : " << nb_select_port_3 << endl;
     85//     cout << "nb_select_port_4 : " << nb_select_port_4 << endl;
     86   
     87    morpheo::behavioural::generic::select::select_priority_fixed::Parameters *param_select1 = NULL;
     88    morpheo::behavioural::generic::select::select_priority_fixed::Parameters *param_select2 = NULL;
     89    morpheo::behavioural::generic::select::select_priority_fixed::Parameters *param_select3 = NULL;
     90    morpheo::behavioural::generic::select::select_priority_fixed::Parameters *param_select4 = NULL;
     91
     92    morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed *select1 = NULL;
     93    morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed *select2 = NULL;
     94    morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed *select3 = NULL;
     95    morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed *select4 = NULL;
     96
     97    bool have_select1 = ((nb_select_port_1 != 0               ));
     98    bool have_select2 = ((nb_select_port_2 != 0               ) and
     99                         (nb_select_port_2 != nb_select_port_1));
     100    bool have_select3 = ((nb_select_port_3 != 0               ) and
     101                         (nb_select_port_3 != nb_select_port_2) and
     102                         (nb_select_port_3 != nb_select_port_1));
     103    bool have_select4 = ((nb_select_port_4 != 0               ) and
     104                         (nb_select_port_4 != nb_select_port_3) and
     105                         (nb_select_port_4 != nb_select_port_2) and
     106                         (nb_select_port_4 != nb_select_port_1) );
     107
     108    string select_name1;
     109    string select_name2;
     110    string select_name3;
     111    string select_name4;
     112   
     113    if (have_select1)
     114      {
     115        select_name1  = _name+"_select_"+toString(nb_select_port_1)+"_ports";
     116        param_select1 = new morpheo::behavioural::generic::select::select_priority_fixed::Parameters (nb_select_port_1,true, false);
     117        select1       = new morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed
     118          (select_name1.c_str()
     119#ifdef STATISTICS
     120           ,NULL
     121#endif
     122           ,param_select1
     123           ,USE_VHDL);
     124
     125        _component->set_component(select1->_component
     126#ifdef POSITION
     127                                  , 0, 0, 0, 0
     128#endif
     129                                  , INSTANCE_LIBRARY
     130                                  );
     131      }
     132
     133    if (have_select2)
     134      {
     135        select_name2  = _name+"_select_"+toString(nb_select_port_2)+"_ports";
     136       
     137        param_select2 = new morpheo::behavioural::generic::select::select_priority_fixed::Parameters (nb_select_port_2,true, false);
     138        select2       = new morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed
     139          (select_name2.c_str()
     140#ifdef STATISTICS
     141           ,NULL
     142#endif
     143           ,param_select2
     144           ,USE_VHDL);
     145     
     146        _component->set_component(select2->_component
     147#ifdef POSITION
     148                                  , 0, 0, 0, 0
     149#endif
     150                                  , INSTANCE_LIBRARY
     151                                  );
     152      }
     153
     154    if (have_select3)
     155      {
     156        select_name3  = _name+"_select_"+toString(nb_select_port_3)+"_ports";
     157       
     158        param_select3 = new morpheo::behavioural::generic::select::select_priority_fixed::Parameters (nb_select_port_3,true, false);
     159        select3       = new morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed
     160          (select_name3.c_str()
     161#ifdef STATISTICS
     162           ,NULL
     163#endif
     164           ,param_select3
     165           ,USE_VHDL);
     166
     167        _component->set_component(select3->_component
     168#ifdef POSITION
     169                                  , 0, 0, 0, 0
     170#endif
     171                                  , INSTANCE_LIBRARY
     172                                  );
     173      }
     174   
     175    if (have_select4)
     176      {
     177        select_name4  = _name+"_select_"+toString(nb_select_port_4)+"_ports";
     178       
     179        param_select4 = new morpheo::behavioural::generic::select::select_priority_fixed::Parameters (nb_select_port_4,true, false);
     180        select4       = new morpheo::behavioural::generic::select::select_priority_fixed::Select_Priority_Fixed
     181          (select_name4.c_str()
     182#ifdef STATISTICS
     183           ,NULL
     184#endif
     185           ,param_select4
     186           ,USE_VHDL);
     187     
     188        _component->set_component(select4->_component
     189#ifdef POSITION
     190                                  , 0, 0, 0, 0
     191#endif
     192                                  , INSTANCE_LIBRARY
     193                                  );
     194      }
     195   
    23196    Vhdl * vhdl = new Vhdl (_name);
    24197
     
    32205
    33206    delete vhdl;
     207    delete bank;
     208    delete param_bank;
     209    if (have_select1)
     210      {
     211        delete select1;
     212        delete param_select1;
     213      }
     214    if (have_select2)
     215      {
     216        delete select2;
     217        delete param_select2;
     218      }
     219    if (have_select3)
     220      {
     221        delete select3;
     222        delete param_select3;
     223      }
     224    if (have_select4)
     225      {
     226        delete select4;
     227        delete param_select4;
     228      }
    34229
    35230    log_printf(FUNC,RegisterFile_Multi_Banked,"vhdl","End");
Note: See TracChangeset for help on using the changeset viewer.