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
RevLine 
[2]1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
[15]8#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
[2]9
10namespace morpheo                    {
11namespace behavioural                {
12namespace generic                    {
13namespace registerfile               {
[15]14namespace registerfile_monolithic    {
[2]15
[15]16  void RegisterFile_Monolithic::allocation (void)
[2]17  {
[57]18    _component   = new Component (_usage);
[42]19
20    Entity * entity = _component->set_entity (_name                   
21                                             ,"RegisterFile_Monolithic"
[41]22#ifdef POSITION
[42]23                                             ,REGISTER                 
24#endif
25                                              );
[41]26   
27    _interfaces = entity->set_interfaces();
28
29    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[42]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    }
[41]42    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
[55]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];
[62]46    if (_param->_have_port_address)
[55]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];
[2]49
[55]50    for (uint32_t i=0; i<_param->_nb_port_read; i++)
[41]51      { 
[42]52        Interface_fifo * interface = _interfaces->set_interface("read_"+toString(i)
53#ifdef POSITION
54                                                                , IN 
55                                                                ,WEST
56                                                                , "Interface Read"
57#endif
58                                                                );
[2]59
[42]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]62        if (_param->_have_port_address)
[55]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);
[41]65      }
[2]66
[41]67    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[6]68
[55]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];
[62]71    if (_param->_have_port_address)
[55]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];
[2]74   
[55]75    for (uint32_t i=0; i<_param->_nb_port_write; i++)
[2]76      {
[42]77        Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i)
78#ifdef POSITION
79                                                                , IN 
80                                                                ,EAST
81                                                                , "Interface Write"
82#endif
83                                                                );
[2]84
[42]85         in_WRITE_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
86        out_WRITE_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
[62]87        if (_param->_have_port_address)
[55]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);
[2]90      }
91
[55]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];
[62]97    if (_param->_have_port_address)
[55]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);
[62]115        if (_param->_have_port_address)
[55]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
[2]121    // ----- Register
[55]122    reg_DATA = new SC_REGISTER (Tdata_t) * [_param->_nb_word];
[2]123   
[55]124    for (uint32_t i=0; i<_param->_nb_word; i++)
[2]125      {
126        string rename = "reg_DATA["  + toString(i) + "]";
127        reg_DATA [i]  = new SC_REGISTER (Tdata_t) (rename.c_str());
[41]128      }
129
130#ifdef POSITION
[42]131    _component->generate_file();
[41]132#endif
[2]133  };
134
[15]135}; // end namespace registerfile_monolithic
[2]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.