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

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

Almost complete design
with Test and test platform

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