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

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

Almost complete design
with Test and test platform

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