source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_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: 5.1 KB
Line 
1/*
2 * $Id: RegisterFile_Monolithic_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $
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    if (usage_is_set(_usage,USE_SYSTEMC))
123      reg_DATA = new Tdata_t [_param->_nb_word];
124   
125#ifdef POSITION
126    if (usage_is_set(_usage,USE_POSITION))
127      _component->generate_file();
128#endif
129  };
130
131}; // end namespace registerfile_monolithic
132}; // end namespace registerfile
133}; // end namespace generic
134}; // end namespace behavioural         
135}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.