source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic.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: 3.3 KB
Line 
1/*
2 * $Id: RegisterFile_Monolithic.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  RegisterFile_Monolithic::RegisterFile_Monolithic
17  (
18#ifdef SYSTEMC
19   sc_module_name name,
20#else
21   std::string name        ,
22#endif
23#ifdef STATISTICS
24   morpheo::behavioural::Parameters_Statistics            * param_statistics,
25#endif
26   morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param,
27   morpheo::behavioural::Tusage_t usage
28   ):
29    _name  (name),
30    _param (param),
31    _usage (usage)
32  {
33    log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","Begin");
34
35#if DEBUG_RegisterFile_Monolithic == true
36    log_printf(INFO,RegisterFile_Monolithic,FUNCTION,_("<%s> Parameters"),_name.c_str());
37
38    std::cout << *param << std::endl;
39#endif   
40
41    log_printf(INFO,RegisterFile_Monolithic,"RegisterFile_Monolithic","Allocation");
42    allocation ();
43
44#ifdef STATISTICS
45    if (usage_is_set(_usage,USE_STATISTICS))
46      statistics_declaration(param_statistics);
47#endif
48
49#ifdef VHDL
50    // generate the vhdl
51    vhdl();
52#endif
53
54#ifdef SYSTEMC
55    if (usage_is_set(_usage,USE_SYSTEMC))
56      {
57        SC_METHOD (transition);
58        dont_initialize ();
59        sensitive << (*(in_CLOCK)).pos();
60       
61        SC_METHOD (genMealy_read);
62        dont_initialize ();
63        sensitive << (*(in_CLOCK)).neg();
64        for (uint32_t i=0; i<_param->_nb_port_read; i++)
65          {
66            sensitive << *(in_READ_VAL     [i]);
67            if (_param->_have_port_address)
68              sensitive << *(in_READ_ADDRESS [i]);
69          }
70        for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
71          {
72            sensitive << *(in_READ_WRITE_VAL     [i])
73                      << *(in_READ_WRITE_RW      [i]);
74            if (_param->_have_port_address)
75              sensitive << *(in_READ_WRITE_ADDRESS [i]);
76          }
77       
78# ifdef SYSTEMCASS_SPECIFIC
79        // List dependency information
80        for (uint32_t i=0; i<_param->_nb_port_read; i++)
81          {
82            (*(out_READ_DATA  [i])) (*( in_READ_VAL     [i]));
83            if (_param->_have_port_address)
84              (*(out_READ_DATA  [i])) (*( in_READ_ADDRESS [i]));
85          }
86        for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
87          { 
88            (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_VAL     [i]));
89            (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_RW      [i]));
90            if (_param->_have_port_address)
91              (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_ADDRESS [i]));
92          }
93# endif   
94       
95        for (uint32_t i=0; i<_param->_nb_port_read       ; i++)
96          PORT_WRITE(out_READ_ACK        [i], 1);
97        for (uint32_t i=0; i<_param->_nb_port_write      ; i++)
98          PORT_WRITE(out_WRITE_ACK       [i], 1);
99        for (uint32_t i=0; i<_param->_nb_port_read_write ; i++)
100          PORT_WRITE(out_READ_WRITE_ACK  [i], 1);
101      }
102#endif
103   
104    log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","End");
105  };
106 
107  RegisterFile_Monolithic::~RegisterFile_Monolithic (void)
108  {
109#ifdef STATISTICS
110    if (usage_is_set(_usage,USE_STATISTICS))
111      delete _stat;
112#endif
113
114    deallocation ();
115  };
116
117}; // end namespace registerfile_monolithic
118}; // end namespace registerfile
119}; // end namespace generic
120}; // end namespace behavioural         
121}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.