source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_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_multi_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_multi_fifo_genMealy_decod_out"
22  void Decod_queue::function_multi_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    uint32_t num_bank = reg_NUM_BANK_HEAD%_param->_nb_bank;
46   
47    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
48      {
49        log_printf(TRACE,Decod_queue,FUNCTION,_("  * num_bank : %d"),num_bank);
50
51        if (not reg_QUEUE[num_bank].empty())
52          {
53            log_printf(TRACE,Decod_queue,FUNCTION,_("  * Queue is not empty, slot [%d] is valid."),i);
54           
55            Tcontext_t context         = reg_QUEUE[num_bank].front()->_context_id    [0];
56
57            log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
58
59            if (context_val [context])
60              {
61
62//                 Tdepth_t   depth           = reg_QUEUE[num_bank].front()->_depth         [0];
63//                 Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
64//                 Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
65//                 Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
66               
67                    // is a valid instruction ?
68                // If DEPTH_CURRENT :
69                // equal at     DEPTH_MIN            -> not speculative
70                // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
71                //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
72               
73                // All case
74                // ....... min ...X... max ....... OK
75                // ....... min ....... max ...X... KO
76                // ...X... min ....... max ....... KO
77                // ....... max ....... min ...X... OK
78                // ...X... max ....... min ....... OK
79                // ....... max ...X... min ....... KO
80               
81                Tcontrol_t is_valid = (nb_inst_event [context] == 0);
82               
83//                 Tcontrol_t   is_valid      = ((depth == depth_min) or
84//                                               depth_full or
85//                                               ((depth_min <= depth_max)?
86//                                                ((depth >= depth_min) and (depth <=depth_max)):
87//                                                ((depth >= depth_min) or  (depth <=depth_max))));
88               
89                log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
90                log_printf(TRACE,Decod_queue,FUNCTION,"      * context_val  : %d",context_val   [context]);
91                log_printf(TRACE,Decod_queue,FUNCTION,"      * nb_inst_event: %d",nb_inst_event [context]);
92//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
93//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
94//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
95//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
96#ifdef DEBUG   
97                log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address     [0],reg_QUEUE[num_bank].front()->_address     [0]<<2);
98#endif         
99                log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address_next[0],reg_QUEUE[num_bank].front()->_address_next[0]<<2);
100               
101                internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
102               
103                if (is_valid)
104                  {
105                    val                    [i] = 1;
106                    internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]);
107               
108                  }
109                else
110                  {
111                    // Consume the instruction (to erase)
112                    internal_DECOD_OUT_ACK [i] = 1;
113
114                    // Have event ?
115                    if (nb_inst_event [context] > 0)
116                      {
117                        nb_inst_event [context] --;
118                       
119                        // Last event ?
120                        if (nb_inst_event [context] == 0)
121                          {
122                            context_val [context] = false;
123                          }
124                      }
125                  }
126              }
127          }
128        num_bank = (num_bank+1)%_param->_nb_bank;
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.