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

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

1) Correct bug in link two signal
2) Fix error detected with valgrind
3) modif distexe script

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id: RegisterFile_Multi_Banked_transition.cpp 128 2009-06-26 08:43:23Z rosiere $
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace generic {
15namespace registerfile {
16namespace registerfile_multi_banked {
17
18#undef  FUNCTION
19#define FUNCTION "RegisterFile_Multi_Banked::transition"
20  void RegisterFile_Multi_Banked::transition (void)
21  {
22    log_begin(RegisterFile_Multi_Banked,FUNCTION);
23    log_function(RegisterFile_Multi_Banked,FUNCTION,_name.c_str());
24   
25    // call function pointer
26//     (this->*function_transition) ();
27    if (PORT_READ(in_NRESET) == 0)
28      {
29        if (_param->_have_init_value)
30          {
31            for (uint32_t i=0; i<_param->_nb_bank; ++i)
32              for (uint32_t j=0; j<_param->_nb_word; ++j)
33                reg_DATA[i][j] = fromString<Tdata_t>(_param->_init_value);
34          }
35        else
36          {
37            for (uint32_t i=0; i<_param->_nb_bank; ++i)
38              for (uint32_t j=0; j<_param->_nb_word; ++j)
39                reg_DATA[i][j] = 0;
40          }
41      }
42    else
43      {
44        for (uint32_t i=0; i<_param->_nb_port_write; i++)
45          {
46            if (internal_WRITE_VAL [i] == 1)
47              {
48                Tdata_t data = PORT_READ(in_WRITE_DATA   [i]);
49               
50                // Write in registerFile
51                reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]] = data;
52              }
53          }
54      }
55
56#if defined(DEBUG_RegisterFile_Multi_Banked) and DEBUG_RegisterFile_Multi_Banked and (DEBUG >= DEBUG_TRACE)
57    if (0)
58    {
59      log_printf(TRACE,RegisterFile,FUNCTION,"  * Dump RegisterFile");
60
61      uint32_t limit = 4;
62     
63      for (uint32_t i=0; i<_param->_nb_bank; i++)
64        {
65         
66          log_printf(TRACE,RegisterFile,FUNCTION,"  Bank %d",i);
67
68          for (uint32_t j=0; j<_param->_nb_word_by_bank; j+=limit)
69            {
70              std::string str = "";
71             
72              for (uint32_t k=0; k<limit; k++)
73                {
74                  uint32_t index = j+k;
75                  if (index >= _param->_nb_word)
76                    break;
77                  else
78                    str+=toString("[%.4d] %.8x ",index,reg_DATA[i][index]);
79                }
80             
81              log_printf(TRACE,RegisterFile,FUNCTION,"  %s",str.c_str());
82            }
83        }
84    }
85#endif
86
87#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
88    end_cycle();
89#endif
90
91    log_end(RegisterFile_Multi_Banked,FUNCTION);
92  };
93
94}; // end namespace registerfile_multi_banked
95}; // end namespace registerfile
96}; // end namespace generic
97
98}; // end namespace behavioural
99}; // end namespace morpheo             
100#endif
101//#endif
Note: See TracBrowser for help on using the repository browser.