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

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

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: RegisterFile_Monolithic_transition.cpp 101 2009-01-15 17:19:08Z 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  void RegisterFile_Monolithic::transition (void)
17  {
18    log_printf(FUNC,RegisterFile,"transition","Begin");
19
20    if (_param->_have_init_value and (PORT_READ(in_NRESET) == 0))
21      {
22        for (uint32_t i=0; i<_param->_nb_word; ++i)
23          reg_DATA[i] = fromString<Tdata_t>(_param->_init_value);
24      }
25    else
26      {
27        for (uint32_t i=0; i<_param->_nb_port_write; i++)
28          {
29            // Have a write?
30            if ( PORT_READ(in_WRITE_VAL[i]) == true)
31              {
32#ifdef STATISTICS
33                if (usage_is_set(_usage,USE_STATISTICS))
34                  (*_stat_nb_write) ++;
35#endif   
36               
37                Taddress_t address = (_param->_have_port_address)?PORT_READ(in_WRITE_ADDRESS[i]):0;
38                Tdata_t    data    = PORT_READ(in_WRITE_DATA   [i]);
39               
40                log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
41               
42                // Write in registerFile
43                reg_DATA[address] = data;
44              }
45          }
46        for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
47          {
48            // Have a read_write?
49            if (PORT_READ(in_READ_WRITE_VAL[i]) == true)
50              {
51                if (PORT_READ(in_READ_WRITE_RW [i]) == RW_WRITE)
52                  {
53#ifdef STATISTICS
54                    if (usage_is_set(_usage,USE_STATISTICS))
55                      (*_stat_nb_write) ++;
56#endif   
57                   
58                    Taddress_t address = (_param->_have_port_address)?PORT_READ(in_READ_WRITE_ADDRESS[i]):0;
59                    Tdata_t    data    = PORT_READ(in_READ_WRITE_WDATA  [i]);
60                   
61                    log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
62                   
63                    // Write in registerFile
64                    reg_DATA[address] = data;
65                  }
66#ifdef STATISTICS
67                else
68                  {
69                    if (usage_is_set(_usage,USE_STATISTICS))
70                      (*_stat_nb_read) ++;
71                  }
72#endif   
73              }
74          }
75      }
76
77#ifdef STATISTICS
78    if (usage_is_set(_usage,USE_STATISTICS))
79      for (uint32_t i=0; i<_param->_nb_port_read; i++)
80        if ( PORT_READ(in_READ_VAL [i]) == 1)
81          (*_stat_nb_read) ++;
82#endif   
83
84#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
85    end_cycle();
86#endif
87    log_printf(FUNC,RegisterFile,"transition","End");
88  };
89
90}; // end namespace registerfile_monolithic
91}; // end namespace registerfile
92}; // end namespace generic
93}; // end namespace behavioural         
94}; // end namespace morpheo             
95#endif
Note: See TracBrowser for help on using the repository browser.