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
RevLine 
[2]1#ifdef SYSTEMC
2/*
3 * $Id: RegisterFile_Monolithic_transition.cpp 106 2009-02-09 22:55:26Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
[15]9#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
[2]10
11namespace morpheo                    {
12namespace behavioural                {
13namespace generic                    {
14namespace registerfile               {
[15]15namespace registerfile_monolithic    {
[106]16
17#undef  FUNCTION
18#define FUNCTION "RegisterFile_Monolithic::transition"
[15]19  void RegisterFile_Monolithic::transition (void)
[2]20  {
[106]21    log_begin(RegisterFile_Monolithic,FUNCTION);
22    log_function(RegisterFile_Monolithic,FUNCTION,_name.c_str());
[2]23
[101]24    if (_param->_have_init_value and (PORT_READ(in_NRESET) == 0))
[2]25      {
[101]26        for (uint32_t i=0; i<_param->_nb_word; ++i)
27          reg_DATA[i] = fromString<Tdata_t>(_param->_init_value);
[2]28      }
[101]29    else
[55]30      {
[101]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              {
[55]36#ifdef STATISTICS
[101]37                if (usage_is_set(_usage,USE_STATISTICS))
[88]38                  (*_stat_nb_write) ++;
[55]39#endif   
[101]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               
[106]44                log_printf(TRACE,RegisterFile,FUNCTION,"  * [%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
[101]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                  {
[71]57#ifdef STATISTICS
[101]58                    if (usage_is_set(_usage,USE_STATISTICS))
59                      (*_stat_nb_write) ++;
[71]60#endif   
[101]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                   
[106]65                    log_printf(TRACE,RegisterFile,FUNCTION,"  * [%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
[101]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          }
[55]79      }
80
[2]81#ifdef STATISTICS
[88]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) ++;
[2]86#endif   
87
[106]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
[75]112#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
[71]113    end_cycle();
[75]114#endif
[106]115
116    log_end(RegisterFile_Monolithic,FUNCTION);
[2]117  };
118
[15]119}; // end namespace registerfile_monolithic
[2]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.