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

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

1) RAT : Fix bug when update and event in same cycle
2) Context State : Compute depth
3) Load Store Unit : In check logic, translate all access in little endian. More easy to check
4) UFPT : End Event

  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: RegisterFile_Monolithic_transition.cpp 106 2009-02-09 22:55:26Z rosiere $
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#undef  FUNCTION
18#define FUNCTION "RegisterFile_Monolithic::transition"
19  void RegisterFile_Monolithic::transition (void)
20  {
21    log_begin(RegisterFile_Monolithic,FUNCTION);
22    log_function(RegisterFile_Monolithic,FUNCTION,_name.c_str());
23
24    if (_param->_have_init_value and (PORT_READ(in_NRESET) == 0))
25      {
26        for (uint32_t i=0; i<_param->_nb_word; ++i)
27          reg_DATA[i] = fromString<Tdata_t>(_param->_init_value);
28      }
29    else
30      {
31        for (uint32_t i=0; i<_param->_nb_port_write; i++)
32          {
33            // Have a write?
34            if ( PORT_READ(in_WRITE_VAL[i]) == true)
35              {
36#ifdef STATISTICS
37                if (usage_is_set(_usage,USE_STATISTICS))
38                  (*_stat_nb_write) ++;
39#endif   
40               
41                Taddress_t address = (_param->_have_port_address)?PORT_READ(in_WRITE_ADDRESS[i]):0;
42                Tdata_t    data    = PORT_READ(in_WRITE_DATA   [i]);
43               
44                log_printf(TRACE,RegisterFile,FUNCTION,"  * [%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
45               
46                // Write in registerFile
47                reg_DATA[address] = data;
48              }
49          }
50        for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
51          {
52            // Have a read_write?
53            if (PORT_READ(in_READ_WRITE_VAL[i]) == true)
54              {
55                if (PORT_READ(in_READ_WRITE_RW [i]) == RW_WRITE)
56                  {
57#ifdef STATISTICS
58                    if (usage_is_set(_usage,USE_STATISTICS))
59                      (*_stat_nb_write) ++;
60#endif   
61                   
62                    Taddress_t address = (_param->_have_port_address)?PORT_READ(in_READ_WRITE_ADDRESS[i]):0;
63                    Tdata_t    data    = PORT_READ(in_READ_WRITE_WDATA  [i]);
64                   
65                    log_printf(TRACE,RegisterFile,FUNCTION,"  * [%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
66                   
67                    // Write in registerFile
68                    reg_DATA[address] = data;
69                  }
70#ifdef STATISTICS
71                else
72                  {
73                    if (usage_is_set(_usage,USE_STATISTICS))
74                      (*_stat_nb_read) ++;
75                  }
76#endif   
77              }
78          }
79      }
80
81#ifdef STATISTICS
82    if (usage_is_set(_usage,USE_STATISTICS))
83      for (uint32_t i=0; i<_param->_nb_port_read; i++)
84        if ( PORT_READ(in_READ_VAL [i]) == 1)
85          (*_stat_nb_read) ++;
86#endif   
87
88#if defined(DEBUG_RegisterFile_Monolithic) and DEBUG_RegisterFile_Monolithic and (DEBUG >= DEBUG_TRACE)
89    {
90      log_printf(TRACE,RegisterFile,FUNCTION,"  * Dump RegisterFile");
91
92      uint32_t limit = 4;
93     
94      for (uint32_t i=0; i<_param->_nb_word; i+=limit)
95        {
96          std::string str = "";
97         
98          for (uint32_t j=0; j<limit; j++)
99            {
100              uint32_t index = i+j;
101              if (index >= _param->_nb_word)
102                break;
103              else
104                str+=toString("[%.4d] %.8x ",index,reg_DATA[index]);
105            }
106
107          log_printf(TRACE,RegisterFile,FUNCTION,"  %s",str.c_str());
108        }
109    }
110#endif
111
112#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
113    end_cycle();
114#endif
115
116    log_end(RegisterFile_Monolithic,FUNCTION);
117  };
118
119}; // end namespace registerfile_monolithic
120}; // end namespace registerfile
121}; // end namespace generic
122}; // end namespace behavioural         
123}; // end namespace morpheo             
124#endif
Note: See TracBrowser for help on using the repository browser.