source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_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: 5.2 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
9
10namespace morpheo                    {
11namespace behavioural                {
12namespace generic                    {
13namespace registerfile               {
14namespace registerfile_monolithic    {
15
16  void RegisterFile_Monolithic::allocation (void)
17  {
18    _component   = new Component (_usage);
19
20    Entity * entity = _component->set_entity (_name                   
21                                             ,"RegisterFile_Monolithic"
22#ifdef POSITION
23                                             ,REGISTER                 
24#endif
25                                              );
26   
27    _interfaces = entity->set_interfaces();
28
29    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30    {
31      Interface * interface = _interfaces->set_interface(""
32#ifdef POSITION
33                                                         , IN
34                                                         ,SOUTH
35                                                         , "Generalist interface"
36#endif
37                                                         );
38     
39      in_CLOCK              = interface->set_signal_clk              ("clock" ,1);
40      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
41    }
42    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
44     in_READ_VAL         = new SC_IN (Tcontrol_t) * [_param->_nb_port_read];
45    out_READ_ACK         = new SC_OUT(Tcontrol_t) * [_param->_nb_port_read];
46    if (_param->_have_port_address)
47     in_READ_ADDRESS     = new SC_IN (Taddress_t) * [_param->_nb_port_read];
48    out_READ_DATA        = new SC_OUT(Tdata_t   ) * [_param->_nb_port_read];
49
50    for (uint32_t i=0; i<_param->_nb_port_read; i++)
51      { 
52        Interface_fifo * interface = _interfaces->set_interface("read_"+toString(i)
53#ifdef POSITION
54                                                                , IN 
55                                                                ,WEST
56                                                                , "Interface Read"
57#endif
58                                                                );
59
60         in_READ_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
61        out_READ_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
62        if (_param->_have_port_address)
63         in_READ_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", _param->_size_address);
64        out_READ_DATA    [i]  = interface->set_signal_out <Tdata_t   > ("data"   , _param->_size_word);
65      }
66
67    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68
69     in_WRITE_VAL        = new SC_IN (Tcontrol_t) * [_param->_nb_port_write];
70    out_WRITE_ACK        = new SC_OUT(Tcontrol_t) * [_param->_nb_port_write];
71    if (_param->_have_port_address)
72     in_WRITE_ADDRESS    = new SC_IN (Taddress_t) * [_param->_nb_port_write];
73     in_WRITE_DATA       = new SC_IN (Tdata_t   ) * [_param->_nb_port_write];
74   
75    for (uint32_t i=0; i<_param->_nb_port_write; i++)
76      {
77        Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i)
78#ifdef POSITION
79                                                                , IN 
80                                                                ,EAST
81                                                                , "Interface Write"
82#endif
83                                                                );
84
85         in_WRITE_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
86        out_WRITE_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
87        if (_param->_have_port_address)
88         in_WRITE_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", _param->_size_address);
89         in_WRITE_DATA    [i]  = interface->set_signal_in  <Tdata_t   > ("data"   , _param->_size_word);
90      }
91
92    // ~~~~~[ Interface : "read_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93
94     in_READ_WRITE_VAL         = new SC_IN (Tcontrol_t) * [_param->_nb_port_read_write];
95    out_READ_WRITE_ACK         = new SC_OUT(Tcontrol_t) * [_param->_nb_port_read_write];
96     in_READ_WRITE_RW          = new SC_IN (Tcontrol_t) * [_param->_nb_port_read_write];
97    if (_param->_have_port_address)
98     in_READ_WRITE_ADDRESS     = new SC_IN (Taddress_t) * [_param->_nb_port_read_write];
99     in_READ_WRITE_WDATA       = new SC_IN (Tdata_t   ) * [_param->_nb_port_read_write];
100    out_READ_WRITE_RDATA       = new SC_OUT(Tdata_t   ) * [_param->_nb_port_read_write];
101
102    for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
103      { 
104        Interface_fifo * interface = _interfaces->set_interface("read_write_"+toString(i)
105#ifdef POSITION
106                                                                , IN 
107                                                                ,WEST
108                                                                , "Interface Read_Write"
109#endif
110                                                                );
111
112         in_READ_WRITE_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
113        out_READ_WRITE_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
114         in_READ_WRITE_RW      [i]  = interface->set_signal_valack_in        ("rw"     , VAL);
115        if (_param->_have_port_address)
116         in_READ_WRITE_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", _param->_size_address);
117         in_READ_WRITE_WDATA   [i]  = interface->set_signal_in  <Tdata_t   > ("wdata"  , _param->_size_word);
118        out_READ_WRITE_RDATA   [i]  = interface->set_signal_out <Tdata_t   > ("rdata"  , _param->_size_word);
119      }
120
121    // ----- Register
122    reg_DATA = new SC_REGISTER (Tdata_t) * [_param->_nb_word];
123   
124    for (uint32_t i=0; i<_param->_nb_word; i++)
125      {
126        string rename = "reg_DATA["  + toString(i) + "]";
127        reg_DATA [i]  = new SC_REGISTER (Tdata_t) (rename.c_str());
128      }
129
130#ifdef POSITION
131    _component->generate_file();
132#endif
133  };
134
135}; // end namespace registerfile_monolithic
136}; // end namespace registerfile
137}; // end namespace generic
138}; // end namespace behavioural         
139}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.