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

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

1) Bug fix (Operation, Instruction)
2) Modif Return Address Stack
3) Add Soft Test
4) Add Soc Test

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMoore.cpp 100 2009-01-08 13:06:27Z 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::genMoore"
21  void Commit_unit::genMoore (void)
22  {
23    log_begin(Commit_unit,FUNCTION);
24    log_function(Commit_unit,FUNCTION,_name.c_str());
25
26    // ===================================================================
27    // =====[ REEXECUTE ]=================================================
28    // ===================================================================
29    {
30      // Store instruction comming Out Of Order in Load Store Unit.
31      // Must be executed in no speculative mode. Also, send a signal when an Store is in head of ROB
32
33      Tcontrol_t val = false;
34
35      if (not _rob[reg_NUM_BANK_HEAD].empty())
36        {
37          entry_t    * entry = _rob [reg_NUM_BANK_HEAD].front();
38          rob_state_t  state = entry->state;
39
40          // Test state
41          val   = ((state == ROB_STORE_HEAD_OK) or
42                   (state == ROB_STORE_HEAD_KO));
43         
44          if (val)
45            {
46              // Reexecute store
47              if (_param->_have_port_context_id)
48              PORT_WRITE(out_REEXECUTE_CONTEXT_ID            [0], entry->context_id           );
49              if (_param->_have_port_front_end_id)
50              PORT_WRITE(out_REEXECUTE_FRONT_END_ID          [0], entry->front_end_id         );
51              if (_param->_have_port_rob_ptr  )
52              PORT_WRITE(out_REEXECUTE_PACKET_ID             [0], entry->ptr                  );
53              PORT_WRITE(out_REEXECUTE_TYPE                  [0], entry->type                 );
54              PORT_WRITE(out_REEXECUTE_STORE_QUEUE_PTR_WRITE [0], entry->store_queue_ptr_write);
55              PORT_WRITE(out_REEXECUTE_OPERATION             [0], (state == ROB_STORE_HEAD_OK)?OPERATION_MEMORY_STORE_HEAD_OK:OPERATION_MEMORY_STORE_HEAD_KO);
56            }
57        }
58 
59      internal_REEXECUTE_VAL      [0] = val;
60      internal_REEXECUTE_NUM_BANK [0] = reg_NUM_BANK_HEAD;
61     
62      PORT_WRITE(out_REEXECUTE_VAL[0], internal_REEXECUTE_VAL [0]);
63    }
64
65    // ===================================================================
66    // =====[ BRANCH_COMPLETE ]===========================================
67    // ===================================================================
68    {
69      // Branchement must be send at the prediction unit
70      uint32_t nb_scan_bank = 0;
71
72      // for each port, find a valid branchement.
73      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
74        {
75          Tcontrol_t  val  = false;
76         
77          for (uint32_t j=nb_scan_bank; j<_param->_nb_bank; j++)
78            {
79              nb_scan_bank ++;
80
81              // translate bank number
82              uint32_t num_bank = (reg_NUM_BANK_HEAD+j)%_param->_nb_bank;
83             
84              if (not _rob [num_bank].empty())
85                {
86                  entry_t    * entry    = _rob [num_bank].front();
87                  rob_state_t  state    = entry->state;
88                 
89                  if (state == ROB_BRANCH_COMPLETE)
90                    {
91                      val = true;
92                     
93                      internal_BRANCH_COMPLETE_NUM_BANK           [i] = num_bank;
94                     
95                      if (_param->_have_port_context_id)
96                      PORT_WRITE(out_BRANCH_COMPLETE_CONTEXT_ID   [i], entry->context_id      );
97                      if (_param->_have_port_front_end_id)
98                      PORT_WRITE(out_BRANCH_COMPLETE_FRONT_END_ID [i], entry->front_end_id    );
99                      if (_param->_have_port_depth)
100                      PORT_WRITE(out_BRANCH_COMPLETE_DEPTH        [i], entry->depth           );
101                      PORT_WRITE(out_BRANCH_COMPLETE_ADDRESS      [i], entry->data_commit     );
102//                    PORT_WRITE(out_BRANCH_COMPLETE_FLAG         [i],(entry->flags&FLAG_F)!=0);
103                      PORT_WRITE(out_BRANCH_COMPLETE_NO_SEQUENCE  [i], entry->no_sequence     );
104                     
105                      break;
106                    }
107                }
108            }
109
110          internal_BRANCH_COMPLETE_VAL [i] = val;
111          PORT_WRITE(out_BRANCH_COMPLETE_VAL [i], internal_BRANCH_COMPLETE_VAL [i]);
112        }
113    }
114
115    // ===================================================================
116    // =====[ UPDATE ]====================================================
117    // ===================================================================
118    {
119      Tcontrol_t val = false;
120
121      if (not _rob[reg_NUM_BANK_HEAD].empty())
122        {
123          entry_t    * entry = _rob [reg_NUM_BANK_HEAD].front();
124          rob_state_t  state = entry->state;
125
126          val   = (state == ROB_END_EXCEPTION);
127         
128          if (val)
129            {
130              throw ERRORMORPHEO(FUNCTION,_("Moore : exception is not yet supported (Coming Soon).\n"));
131            }
132        }
133    }
134 
135    // ===================================================================
136    // =====[ NB_INST ]===================================================
137    // ===================================================================
138    for (uint32_t i=0; i<_param->_nb_front_end; i++)
139      for (uint32_t j=0; j<_param->_nb_context [i]; j++)
140        {
141          PORT_WRITE(out_NB_INST_COMMIT_ALL [i][j], reg_NB_INST_COMMIT_ALL [i][j]);
142          PORT_WRITE(out_NB_INST_COMMIT_MEM [i][j], reg_NB_INST_COMMIT_MEM [i][j]);
143        }
144
145
146    log_end(Commit_unit,FUNCTION);
147  };
148
149}; // end namespace commit_unit
150}; // end namespace ooo_engine
151}; // end namespace multi_ooo_engine
152}; // end namespace core
153}; // end namespace behavioural
154}; // end namespace morpheo             
155#endif
Note: See TracBrowser for help on using the repository browser.