source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_allocation.cpp @ 42

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

File size: 3.6 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
10
11namespace morpheo                    {
12namespace behavioural                {
13namespace generic                    {
14namespace registerfile               {
15namespace registerfile_monolithic    {
16
17  void RegisterFile_Monolithic::allocation (void)
18  {
19    _component   = new Component ();
20
21    Entity * entity = _component->set_entity (_name                   
22                                             ,"RegisterFile_Monolithic"
23#ifdef POSITION
24                                             ,REGISTER                 
25#endif
26                                              );
27   
28    _interfaces = entity->set_interfaces();
29
30    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31    {
32      Interface * interface = _interfaces->set_interface(""
33#ifdef POSITION
34                                                         , IN
35                                                         ,SOUTH
36                                                         , "Generalist interface"
37#endif
38                                                         );
39     
40      in_CLOCK              = interface->set_signal_clk              ("clock" ,1);
41      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
42    }
43    // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
45     in_READ_VAL         = new SC_IN (Tcontrol_t) * [_param._nb_port_read];
46    out_READ_ACK         = new SC_OUT(Tcontrol_t) * [_param._nb_port_read];
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         in_READ_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word)));
63        out_READ_DATA    [i]  = interface->set_signal_out <Tdata_t   > ("data"   , _param._size_word);
64      }
65
66    // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
68     in_WRITE_VAL        = new SC_IN (Tcontrol_t) * [_param._nb_port_write];
69    out_WRITE_ACK        = new SC_OUT(Tcontrol_t) * [_param._nb_port_write];
70     in_WRITE_ADDRESS    = new SC_IN (Taddress_t) * [_param._nb_port_write];
71     in_WRITE_DATA       = new SC_IN (Tdata_t   ) * [_param._nb_port_write];
72   
73    for (uint32_t i=0; i<_param._nb_port_write; i++)
74      {
75        Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i)
76#ifdef POSITION
77                                                                , IN 
78                                                                ,EAST
79                                                                , "Interface Write"
80#endif
81                                                                );
82
83         in_WRITE_VAL     [i]  = interface->set_signal_valack_in        ("val"    , VAL);
84        out_WRITE_ACK     [i]  = interface->set_signal_valack_out       ("ack"    , ACK);
85         in_WRITE_ADDRESS [i]  = interface->set_signal_in  <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word)));
86         in_WRITE_DATA    [i]  = interface->set_signal_in  <Tdata_t   > ("data"   , _param._size_word);
87      }
88
89    // ----- Register
90    reg_DATA = new SC_REGISTER (Tdata_t) * [_param._nb_word];
91   
92    for (uint32_t i=0; i<_param._nb_word; i++)
93      {
94        string rename = "reg_DATA["  + toString(i) + "]";
95        reg_DATA [i]  = new SC_REGISTER (Tdata_t) (rename.c_str());
96      }
97
98#ifdef POSITION
99    _component->generate_file();
100#endif
101  };
102
103}; // end namespace registerfile_monolithic
104}; // end namespace registerfile
105}; // end namespace generic
106}; // end namespace behavioural         
107}; // end namespace morpheo             
108#endif
Note: See TracBrowser for help on using the repository browser.