source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_commit.cpp @ 129

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

1) Debug_Signal

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMealy_commit.cpp 129 2009-06-29 16:38:40Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace commit_unit {
17
18
19#undef  FUNCTION
20#define FUNCTION "Commit_unit::genMealy_commit"
21  void Commit_unit::genMealy_commit (void)
22  {
23    log_begin(Commit_unit,FUNCTION);
24    log_function(Commit_unit,FUNCTION,_name.c_str());
25
26    if (PORT_READ(in_NRESET))
27      {
28
29#ifdef STATISTICS
30    internal_BANK_COMMIT_CONFLIT_ACCESS = 0;
31#endif
32
33    uint32_t           bank_nb_access    [_param->_nb_bank];
34    uint32_t           commit_ack        [_param->_nb_inst_commit];
35
36    // Initialisation
37    for (uint32_t i=0; i<_param->_nb_bank; i++)
38      {
39        bank_nb_access            [i] = 0;
40        for (uint32_t j=0; j<_param->_nb_bank_access_commit; j++)
41          internal_BANK_COMMIT_VAL  [i][j] = false;
42      }
43
44    // commit interface -> scan all entry (Out of Order)
45    for (uint32_t i=0; i<_param->_nb_inst_commit; i++)
46      {
47        commit_ack [i] = false;
48
49        // Test if have valid instruction
50        if (PORT_READ(in_COMMIT_VAL [i]))
51          {
52            // packet_id number can
53            Tpacket_t packet_id       = (_param->_have_port_rob_ptr)?PORT_READ(in_COMMIT_PACKET_ID [i]):0;
54            uint32_t  num_bank        = packet_id & _param->_mask_num_bank;
55            uint32_t  num_bank_access = bank_nb_access [num_bank];
56           
57            // test if bank is not busy (previous access)
58            if (num_bank_access < _param->_nb_bank_access_commit)
59              {
60                // find
61                bank_nb_access  [num_bank] ++;
62                commit_ack      [i] = true;
63
64                internal_BANK_COMMIT_VAL      [num_bank][num_bank_access] = true;
65                internal_BANK_COMMIT_NUM_INST [num_bank][num_bank_access] = i;
66               
67                Tpacket_t num_packet = packet_id >> _param->_shift_num_slot;
68               
69                // find the good entry !!!
70                entry_t* entry = NULL;
71                for (std::list<entry_t*>::iterator it=_rob[num_bank].begin();
72                     it!=_rob[num_bank].end();
73                     it++)
74                  if ((*it)->ptr == num_packet)
75                    {
76                      entry = (*it);
77                      break;
78                    }
79
80#ifdef DEBUG_TEST
81                if (entry == NULL)
82                  throw ERRORMORPHEO(FUNCTION,_("Commit : Packet_id miss match in the Re Order Buffer.\n"));
83#endif
84
85                internal_BANK_COMMIT_ENTRY    [num_bank][num_bank_access] = entry;
86
87//              PORT_WRITE(out_COMMIT_NUM_REG_RD [i],(entry->rename_unit_id << _param->_size_general_register)+entry->num_reg_rd_phy_new);
88                PORT_WRITE(out_COMMIT_NUM_REG_RD [i],entry->num_reg_rd_phy_new);
89              }
90#ifdef STATISTICS
91            else
92              {
93                internal_BANK_COMMIT_CONFLIT_ACCESS ++;
94              }
95#endif
96          }
97      }
98   
99    for (uint32_t i=0; i<_param->_nb_inst_commit; i++)
100      PORT_WRITE(out_COMMIT_ACK [i],commit_ack [i]);
101      }
102    else
103      {
104        for (uint32_t i=0; i<_param->_nb_inst_commit; i++)
105          PORT_WRITE(out_COMMIT_ACK [i],0);
106      }
107   
108    log_end(Commit_unit,FUNCTION);
109  };
110
111}; // end namespace commit_unit
112}; // end namespace ooo_engine
113}; // end namespace multi_ooo_engine
114}; // end namespace core
115}; // end namespace behavioural
116}; // end namespace morpheo             
117#endif
Note: See TracBrowser for help on using the repository browser.