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

Last change on this file since 62 was 62, checked in by rosiere, 17 years ago

Modification en profondeur de Component-port_map.
Compilation ok pour Register_unit ... a tester (systemC et vhdl)

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