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, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 4.2 KB
RevLine 
[53]1/*
2 * $Id: RegisterFile_Multi_Banked_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
[88]4 * [ Description ]
[53]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
[82]21    _component   = new Component (_usage);
[53]22
23    Entity * entity = _component->set_entity (_name       
24                                              ,"RegisterFile_Multi_Banked"
25#ifdef POSITION
[75]26                                              ,REGISTER
[53]27#endif
28                                              );
29
30    _interfaces = entity->set_interfaces();
31
[88]32    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[53]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
[88]45    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[53]46
[57]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];
[62]49    if (_param->_have_port_address == true)
[57]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];
[53]52
[57]53    for (uint32_t i=0; i<_param->_nb_port_read; i++)
[53]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);
[62]65        if (_param->_have_port_address == true)
[57]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);
[53]68      }
69
[88]70    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[53]71
[57]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];
[62]74    if (_param->_have_port_address == true)
[57]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];
[53]77   
[57]78    for (uint32_t i=0; i<_param->_nb_port_write; i++)
[53]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);
[62]90        if (_param->_have_port_address == true)
[57]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);
[53]93      }
94
[88]95    if (usage_is_set(_usage,USE_SYSTEMC))
96      {
97    // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[53]98
[78]99    reg_DATA = new Tdata_t * [_param->_nb_bank];
[53]100
[57]101    for (uint32_t i=0; i<_param->_nb_bank; i++)
[53]102      {
[78]103        reg_DATA [i] = new Tdata_t [_param->_nb_word];
[53]104      }
105
[88]106    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[57]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];
[88]110      }
[53]111
[88]112    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
[53]113
114#ifdef POSITION
[88]115    if (usage_is_set(_usage,USE_POSITION))
116      _component->generate_file();
[53]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.