source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/src/RegisterFile_allocation.cpp @ 145

Last change on this file since 145 was 131, checked in by rosiere, 15 years ago

1) add constant method
2) test with systemc 2.2.0

  • Property svn:keywords set to Id
File size: 7.5 KB
RevLine 
[53]1#ifdef SYSTEMC
2/*
3 * $Id: RegisterFile_allocation.cpp 131 2009-07-08 18:40:08Z rosiere $
4 *
[131]5 * [ Description ]
[53]6 *
7 */
8
9#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
[131]10#include "Behavioural/include/Allocation.h"
[53]11
12namespace morpheo                    {
13namespace behavioural {
14namespace generic {
15namespace registerfile {
16
[75]17  void RegisterFile::allocation (
18#ifdef STATISTICS
19                                 morpheo::behavioural::Parameters_Statistics * param_statistics
20#else
21                                 void
22#endif
23                                 )
[53]24  {
[75]25    std::string rename;
[53]26
27    log_printf(FUNC,RegisterFile,"allocation","Begin");
28
[131]29#ifdef SYSTEMCASS_SPECIFIC
30    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[53]31    {
[131]32      __ALLOC0_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK          );
33      __ALLOC0_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t));
[53]34    }
[131]35    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36    {
37      __ALLOC1_INTERFACE_BEGIN("READ",_param->_nb_port_read);
[53]38
[131]39      __ALLOC1_SIGNAL_IN ( in_READ_VAL    ,"VAL"    ,Tcontrol_t);
40      __ALLOC1_SIGNAL_OUT(out_READ_ACK    ,"ACK"    ,Tcontrol_t);
41      if (_param->_have_port_address)
42      __ALLOC1_SIGNAL_IN ( in_READ_ADDRESS,"ADDRESS",Taddress_t);
43      __ALLOC1_SIGNAL_OUT(out_READ_DATA   ,"DATA"   ,Tdata_t   );
[53]44
[131]45      __ALLOC1_INTERFACE_END(_param->_nb_port_read);
46    }
[53]47
[131]48    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49    {
50      __ALLOC1_INTERFACE_BEGIN("WRITE",_param->_nb_port_write);
[53]51
[131]52      __ALLOC1_SIGNAL_IN ( in_WRITE_VAL    ,"VAL"    ,Tcontrol_t);
53      __ALLOC1_SIGNAL_OUT(out_WRITE_ACK    ,"ACK"    ,Tcontrol_t);
54      if (_param->_have_port_address)
55      __ALLOC1_SIGNAL_IN ( in_WRITE_ADDRESS,"ADDRESS",Taddress_t);
56      __ALLOC1_SIGNAL_IN ( in_WRITE_DATA   ,"DATA"   ,Tdata_t   );
[53]57
[131]58      __ALLOC1_INTERFACE_END(_param->_nb_port_write);
59    }
60#endif
61
62     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                               
[62]63    if (_param->_instance == instance_RegisterFile_Monolithic)
[53]64    // =====[ component_RegisterFile_Monolithic ]=========================
65      {
66        component_RegisterFile_Monolithic  = new morpheo::behavioural::generic::registerfile::registerfile_monolithic  ::RegisterFile_Monolithic  ::RegisterFile_Monolithic   (_name.c_str()
67#ifdef STATISTICS
[75]68                                                                                                                                                                               ,param_statistics
[53]69#endif
[62]70                                                                                                                                                                               ,_param->_param_registerfile_monolithic
[82]71                                                                                                                                                                               ,_usage);
[53]72       
73      }
74    else
75    // =====[ component_RegisterFile_Multi_Banked ]=======================
76      {
77        component_RegisterFile_Multi_Banked = new morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked (_name.c_str()
78#ifdef STATISTICS
[75]79                                                                                                                                                                                ,param_statistics
[53]80#endif
[62]81                                                                                                                                                                                ,_param->_param_registerfile_multi_banked
[82]82                                                                                                                                                                                ,_usage);
[53]83       
84      }
85    // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86
[62]87    if (_param->_instance == instance_RegisterFile_Monolithic)
[53]88    // =====[ Component_RegisterFile_Monolithic - Instanciation ]=========
89      {
[131]90#ifdef SYSTEMCASS_SPECIFIC
91        (*(component_RegisterFile_Monolithic  ->in_CLOCK )) (*(in_CLOCK ));
[53]92        (*(component_RegisterFile_Monolithic  ->in_NRESET)) (*(in_NRESET));
93       
[62]94        for (uint32_t i=0; i<_param->_nb_port_read; i++)
[53]95          { 
96            (*(component_RegisterFile_Monolithic  -> in_READ_VAL     [i])) (*( in_READ_VAL     [i]));   
97            (*(component_RegisterFile_Monolithic  ->out_READ_ACK     [i])) (*(out_READ_ACK     [i]));
[62]98            if (_param->_have_port_address == true)
[53]99            (*(component_RegisterFile_Monolithic  -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i]));
100            (*(component_RegisterFile_Monolithic  ->out_READ_DATA    [i])) (*(out_READ_DATA    [i]));
101          }
102       
[62]103        for (uint32_t i=0; i<_param->_nb_port_write; i++)
[53]104          {
105            (*(component_RegisterFile_Monolithic  -> in_WRITE_VAL     [i])) (*( in_WRITE_VAL     [i]));
106            (*(component_RegisterFile_Monolithic  ->out_WRITE_ACK     [i])) (*(out_WRITE_ACK     [i]));
[62]107            if (_param->_have_port_address == true)
[53]108            (*(component_RegisterFile_Monolithic  -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i]));
109            (*(component_RegisterFile_Monolithic  -> in_WRITE_DATA    [i])) (*( in_WRITE_DATA    [i]));
110          }
[131]111#else
112         in_CLOCK         = component_RegisterFile_Monolithic-> in_CLOCK        ;
113         in_NRESET        = component_RegisterFile_Monolithic-> in_NRESET       ;
114
115         in_READ_VAL      = component_RegisterFile_Monolithic-> in_READ_VAL     ;   
116        out_READ_ACK      = component_RegisterFile_Monolithic->out_READ_ACK     ;
117         in_READ_ADDRESS  = component_RegisterFile_Monolithic-> in_READ_ADDRESS ;
118        out_READ_DATA     = component_RegisterFile_Monolithic->out_READ_DATA    ;
119
120         in_WRITE_VAL     = component_RegisterFile_Monolithic-> in_WRITE_VAL    ;
121        out_WRITE_ACK     = component_RegisterFile_Monolithic->out_WRITE_ACK    ;
122         in_WRITE_ADDRESS = component_RegisterFile_Monolithic-> in_WRITE_ADDRESS;
123         in_WRITE_DATA    = component_RegisterFile_Monolithic-> in_WRITE_DATA   ;
124#endif
[53]125      }
126    else
127    // =====[ Component_RegisterFile_Multi_Banked - Instanciation ]=======
128      {
[131]129#ifdef SYSTEMCASS_SPECIFIC
[53]130        (*(component_RegisterFile_Multi_Banked->in_CLOCK )) (*(in_CLOCK ));
131        (*(component_RegisterFile_Multi_Banked->in_NRESET)) (*(in_NRESET));
132       
[62]133        for (uint32_t i=0; i<_param->_nb_port_read; i++)
[53]134          { 
135            (*(component_RegisterFile_Multi_Banked-> in_READ_VAL     [i])) (*( in_READ_VAL     [i]));   
136            (*(component_RegisterFile_Multi_Banked->out_READ_ACK     [i])) (*(out_READ_ACK     [i]));
[62]137            if (_param->_have_port_address == true)
[53]138            (*(component_RegisterFile_Multi_Banked-> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i]));
139            (*(component_RegisterFile_Multi_Banked->out_READ_DATA    [i])) (*(out_READ_DATA    [i]));
140          }
141       
[62]142        for (uint32_t i=0; i<_param->_nb_port_write; i++)
[53]143          {
144            (*(component_RegisterFile_Multi_Banked-> in_WRITE_VAL     [i])) (*( in_WRITE_VAL     [i]));
145            (*(component_RegisterFile_Multi_Banked->out_WRITE_ACK     [i])) (*(out_WRITE_ACK     [i]));
[62]146            if (_param->_have_port_address == true)
[53]147            (*(component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i]));
148            (*(component_RegisterFile_Multi_Banked-> in_WRITE_DATA    [i])) (*( in_WRITE_DATA    [i]));
149          }
[131]150#else
151         in_CLOCK         = component_RegisterFile_Multi_Banked-> in_CLOCK        ;
152         in_NRESET        = component_RegisterFile_Multi_Banked-> in_NRESET       ;
153       
154         in_READ_VAL      = component_RegisterFile_Multi_Banked-> in_READ_VAL     ;   
155        out_READ_ACK      = component_RegisterFile_Multi_Banked->out_READ_ACK     ;
156         in_READ_ADDRESS  = component_RegisterFile_Multi_Banked-> in_READ_ADDRESS ;
157        out_READ_DATA     = component_RegisterFile_Multi_Banked->out_READ_DATA    ;
158       
159         in_WRITE_VAL     = component_RegisterFile_Multi_Banked-> in_WRITE_VAL    ;
160        out_WRITE_ACK     = component_RegisterFile_Multi_Banked->out_WRITE_ACK    ;
161         in_WRITE_ADDRESS = component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS;
162         in_WRITE_DATA    = component_RegisterFile_Multi_Banked-> in_WRITE_DATA   ;
163#endif
164
[53]165      }
166
[62]167    if (_param->_instance == instance_RegisterFile_Monolithic)
[53]168      _component = component_RegisterFile_Monolithic  ->_component;
169    else
170      _component = component_RegisterFile_Multi_Banked->_component;
171
172    log_printf(FUNC,RegisterFile,"allocation","End");
173  };
174
175}; // end namespace registerfile
176}; // end namespace generic
177
178}; // end namespace behavioural
179}; // end namespace morpheo             
180#endif
Note: See TracBrowser for help on using the repository browser.