source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_allocation.cpp @ 75

Last change on this file since 75 was 75, checked in by rosiere, 16 years ago

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 4.4 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace generic {
14namespace registerfile {
15namespace registerfile_multi_banked {
16
17
18  void RegisterFile_Multi_Banked::allocation (void)
19  {
20    log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","Begin");
21
22    _component   = new Component ();
23
24    Entity * entity = _component->set_entity (_name       
25                                              ,"RegisterFile_Multi_Banked"
26#ifdef POSITION
27                                              ,REGISTER
28#endif
29                                              );
30
31    _interfaces = entity->set_interfaces();
32
33    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
35      Interface * interface = _interfaces->set_interface(""
36#ifdef POSITION
37                                                         ,IN
38                                                         ,SOUTH,
39                                                         "Generalist interface"
40#endif
41                                                         );
42
43     in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
44     in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
45
46    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
48     in_READ_VAL         = new SC_IN (Tcontrol_t) * [_param->_nb_port_read];
49    out_READ_ACK         = new SC_OUT(Tcontrol_t) * [_param->_nb_port_read];
50    if (_param->_have_port_address == true)
51     in_READ_ADDRESS     = new SC_IN (Taddress_t) * [_param->_nb_port_read];
52    out_READ_DATA        = new SC_OUT(Tdata_t   ) * [_param->_nb_port_read];
53
54    for (uint32_t i=0; i<_param->_nb_port_read; i++)
55      { 
56        Interface_fifo * interface = _interfaces->set_interface("read_"+toString(i)
57#ifdef POSITION
58                                                                , IN 
59                                                                ,WEST
60                                                                , "Interface Read"
61#endif
62                                                                );
63
64         in_READ_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
65        out_READ_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
66        if (_param->_have_port_address == true)
67         in_READ_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", static_cast<uint32_t>(log2(_param->_nb_word)));
68        out_READ_DATA    [i]  = interface->set_signal_out <Tdata_t   > ("data"   , _param->_size_word);
69      }
70
71    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
73     in_WRITE_VAL        = new SC_IN (Tcontrol_t) * [_param->_nb_port_write];
74    out_WRITE_ACK        = new SC_OUT(Tcontrol_t) * [_param->_nb_port_write];
75    if (_param->_have_port_address == true)
76     in_WRITE_ADDRESS    = new SC_IN (Taddress_t) * [_param->_nb_port_write];
77     in_WRITE_DATA       = new SC_IN (Tdata_t   ) * [_param->_nb_port_write];
78   
79    for (uint32_t i=0; i<_param->_nb_port_write; i++)
80      {
81        Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i)
82#ifdef POSITION
83                                                                , IN 
84                                                                ,EAST
85                                                                , "Interface Write"
86#endif
87                                                                );
88
89         in_WRITE_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
90        out_WRITE_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
91        if (_param->_have_port_address == true)
92         in_WRITE_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", static_cast<uint32_t>(log2(_param->_nb_word)));
93         in_WRITE_DATA    [i]  = interface->set_signal_in  <Tdata_t   > ("data"   , _param->_size_word);
94      }
95
96    // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97
98    reg_DATA = new SC_REGISTER (Tdata_t) ** [_param->_nb_bank];
99
100    for (uint32_t i=0; i<_param->_nb_bank; i++)
101      {
102        reg_DATA [i] = new SC_REGISTER (Tdata_t) * [_param->_nb_word];
103       
104        for (uint32_t j=0; j<_param->_nb_word; j++)
105          {
106            std::string rename = "reg_DATA_"  + toString(i) + "_"  + toString(j);
107            reg_DATA [i][j]  = new SC_REGISTER (Tdata_t) (rename.c_str());
108          }
109      }
110
111    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112    internal_WRITE_VAL     = new bool       [_param->_nb_port_write];
113    internal_WRITE_BANK    = new Taddress_t [_param->_nb_port_write];
114    internal_WRITE_NUM_REG = new Taddress_t [_param->_nb_port_write];
115
116    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
117
118#ifdef POSITION
119    _component->generate_file();
120#endif
121
122    log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","End");
123  };
124
125}; // end namespace registerfile_multi_banked
126}; // end namespace registerfile
127}; // end namespace generic
128
129}; // end namespace behavioural
130}; // end namespace morpheo             
131#endif
Note: See TracBrowser for help on using the repository browser.