source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMealy_decod_out.cpp @ 123

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

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 6.1 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Decod_queue_function_one_fifo_genMealy_decod_out.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace decod_unit {
17namespace decod_queue {
18
19
20#undef  FUNCTION
21#define FUNCTION "Decod_queue::function_one_fifo_genMealy_decod_out"
22  void Decod_queue::function_one_fifo_genMealy_decod_out (void)
23  {
24    log_begin(Decod_queue,FUNCTION);
25    log_function(Decod_queue,FUNCTION,_name.c_str());
26
27    if (PORT_READ(in_NRESET))
28      {
29    bool       context_val   [_param->_nb_context];
30    uint32_t   nb_inst_event [_param->_nb_context];
31    for (uint32_t i=0; i<_param->_nb_context; i++)
32      {
33        context_val   [i] = true;
34        nb_inst_event [i] = reg_NB_INST_EVENT [i];
35      }
36
37    Tcontrol_t val [_param->_nb_inst_decod];
38    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
39      {
40        val                    [i] = 0;
41        internal_DECOD_OUT_VAL [i] = 0;
42        internal_DECOD_OUT_ACK [i] = 0;
43      }
44
45    if (not reg_QUEUE->empty())
46      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
47        {
48          uint32_t index = reg_LAST_SLOT + i;
49
50          // Stop
51          if (index >= _param->_nb_inst_decod)
52            break;
53
54          if (reg_QUEUE->front()->_val [index])
55            {
56              log_printf(TRACE,Decod_queue,FUNCTION,_("  * Queue is not empty, slot [%d] is valid."),i);
57             
58              Tcontext_t context         = reg_QUEUE->front()->_context_id    [index];
59
60              log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
61
62              if (context_val [context])
63                {
64
65//               Tdepth_t   depth           = reg_QUEUE->front()->_depth         [index];
66//               Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
67//               Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
68//               Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
69
70                  // is a valid instruction ?
71                  // If DEPTH_CURRENT :
72                  // equal at     DEPTH_MIN            -> not speculative
73                  // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
74                  //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
75                 
76                  // All case
77                  // ....... min ...X... max ....... OK
78                  // ....... min ....... max ...X... KO
79                  // ...X... min ....... max ....... KO
80                  // ....... max ....... min ...X... OK
81                  // ...X... max ....... min ....... OK
82                  // ....... max ...X... min ....... KO
83                 
84                  Tcontrol_t is_valid = (nb_inst_event [context] == 0);
85
86//                   Tcontrol_t   is_valid      = ((depth == depth_min) or
87//                                                 depth_full or
88//                                                 ((depth_min <= depth_max)?
89//                                                  ((depth >= depth_min) and (depth <=depth_max)):
90//                                                  ((depth >= depth_min) or  (depth <=depth_max))));
91                 
92                  log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
93                  log_printf(TRACE,Decod_queue,FUNCTION,"      * context_val  : %d",context_val   [context]);
94                  log_printf(TRACE,Decod_queue,FUNCTION,"      * nb_inst_event: %d",nb_inst_event [context]);
95//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
96//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
97//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
98//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
99#ifdef DEBUG     
100                  log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE->front()->_address     [index],reg_QUEUE->front()->_address     [index]<<2);
101#endif           
102                  log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE->front()->_address_next[index],reg_QUEUE->front()->_address_next[index]<<2);
103                  internal_DECOD_OUT_VAL [index] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
104                 
105                  if (is_valid)
106                    {
107                      val                    [i]     = 1;
108                      internal_DECOD_OUT_ACK [index] = PORT_READ(in_DECOD_OUT_ACK [i]);
109                    }
110                  else
111                    {
112                      // Consume the instruction (to erase)
113                      internal_DECOD_OUT_ACK [index] = 1;
114
115                      // Have event ?
116                      if (nb_inst_event [context] > 0)
117                        {
118                          nb_inst_event [context] --;
119                         
120                          // Last event ?
121                          if (nb_inst_event [context] == 0)
122                            {
123                              context_val [context] = false;
124                            }
125                        }
126                    }
127                }
128            }
129      }
130
131    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
132      {
133        log_printf(TRACE,Decod_queue,FUNCTION,"  * DECOD_OUT_VAL : %d",val [i]);
134       
135        PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]);
136      }
137      }
138    else
139      {
140        // Reset
141        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
142          {
143            internal_DECOD_OUT_VAL [i] = 0;
144            internal_DECOD_OUT_ACK [i] = 0;
145            PORT_WRITE(out_DECOD_OUT_VAL [i],0);
146          }
147      }
148
149    log_end(Decod_queue,FUNCTION);
150  };
151
152}; // end namespace decod_queue
153}; // end namespace decod_unit
154}; // end namespace front_end
155}; // end namespace multi_front_end
156}; // end namespace core
157
158}; // end namespace behavioural
159}; // end namespace morpheo             
160#endif
Note: See TracBrowser for help on using the repository browser.