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

Last change on this file since 146 was 146, checked in by rosiere, 13 years ago

1) Integration of RegisterFile_Internal_Banked in RegisterFile?
2) Erase "read_write" interface in RegisterFile_Monolithic component
3) Add smith predictor parameters in Load_store_pointer_unit.
4) Fix not statistics flags

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