source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/src/Decod_transition.cpp @ 141

Last change on this file since 141 was 141, checked in by rosiere, 14 years ago

Add statistics in stage IFETCH, DECODE and COMMIT (insert, retire and commit)

  • Property svn:keywords set to Id
File size: 2.0 KB
RevLine 
[78]1#ifdef SYSTEMC
2/*
3 * $Id: Decod_transition.cpp 141 2010-08-02 18:56:05Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/include/Decod.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace decod_unit {
17namespace decod {
18
19
20#undef  FUNCTION
21#define FUNCTION "Decod::transition"
22  void Decod::transition (void)
23  {
[88]24    log_begin(Decod,FUNCTION);
[78]25
26    if (PORT_READ(in_NRESET) == 0)
27      {
[88]28        _priority->reset();
[78]29
30        for (uint32_t i=0; i<_param->_nb_context; i++)
[87]31          {
32            reg_CONTEXT_ADDRESS_PREVIOUS [i] = 0xfc; // 0x100-4. (0x100 : reset address)
33            reg_CONTEXT_IS_DELAY_SLOT    [i] = 0;
[139]34            // reg_CONTEXT_SAVE_RAT         [i] = 0;
[87]35          }
[78]36      }
37    else
38      {
[88]39        _priority->transition();
[78]40
41        // Compute "next previous" address
42        for (uint32_t i=0; i<_param->_nb_context; i++)
43          if (internal_CONTEXT_HAVE_TRANSACTION[i])
44            {
45              reg_CONTEXT_ADDRESS_PREVIOUS [i] = internal_CONTEXT_ADDRESS_PREVIOUS [i];
46              reg_CONTEXT_IS_DELAY_SLOT    [i] = internal_CONTEXT_IS_DELAY_SLOT    [i];
[139]47              // reg_CONTEXT_SAVE_RAT         [i] = internal_CONTEXT_SAVE_RAT         [i];
[78]48            }
49
50//      for (uint32_t i=0; i<_param->_nb_context; i++)
51//        log_printf(TRACE,Decod,FUNCTION,"[%d] %.8x %d",i,reg_CONTEXT_ADDRESS_PREVIOUS [i], reg_CONTEXT_IS_DELAY_SLOT [i]);
[88]52
53#ifdef STATISTICS
54        if (usage_is_set(_usage,USE_STATISTICS))
[141]55          {
56            uint32_t stat_nb_inst_decod = 0;
57            for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
58              if (internal_DECOD_VAL [i] and PORT_READ(in_DECOD_ACK[i]))
59                stat_nb_inst_decod ++;
60            (*_stat_nb_inst_decod) += stat_nb_inst_decod;
61          }
[88]62#endif
[78]63      }
64
65#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
66    end_cycle ();
67#endif
68
[88]69    log_end(Decod,FUNCTION);
[78]70  };
71
72}; // end namespace decod
73}; // end namespace decod_unit
74}; // end namespace front_end
75}; // end namespace multi_front_end
76}; // end namespace core
77
78}; // end namespace behavioural
79}; // end namespace morpheo             
80#endif
Note: See TracBrowser for help on using the repository browser.