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 @ 111

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

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Decod_queue_function_multi_fifo_genMealy_decod_out.cpp 111 2009-02-27 18:37:40Z 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    Tcontrol_t val [_param->_nb_inst_decod];
28    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
29      {
30        val                    [i] = 0;
31        internal_DECOD_OUT_VAL [i] = 0;
32        internal_DECOD_OUT_ACK [i] = 0;
33      }
34   
35    uint32_t num_bank = reg_NUM_BANK_HEAD%_param->_nb_bank;
36   
37    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
38      {
39        log_printf(TRACE,Decod_queue,FUNCTION,_("  * num_bank : %d"),num_bank);
40
41        if (not reg_QUEUE[num_bank].empty())
42          {
43            log_printf(TRACE,Decod_queue,FUNCTION,_("  * Queue is not empty, slot [%d] is valid."),i);
44           
45            Tcontext_t context         = reg_QUEUE[num_bank].front()->_context_id    [0];
46            Tdepth_t   depth           = reg_QUEUE[num_bank].front()->_depth         [0];
47            Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
48            Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
49            Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
50
51            // is a valid instruction ?
52            // If DEPTH_CURRENT :
53            // equal at     DEPTH_MIN            -> not speculative
54            // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
55            //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
56           
57            // All case
58            // ....... min ...X... max ....... OK
59            // ....... min ....... max ...X... KO
60            // ...X... min ....... max ....... KO
61            // ....... max ....... min ...X... OK
62            // ...X... max ....... min ....... OK
63            // ....... max ...X... min ....... KO
64           
65            Tcontrol_t   is_valid      = ((depth == depth_min) or
66                                          depth_full or
67                                          ((depth_min <= depth_max)?
68                                           ((depth >= depth_min) and (depth <=depth_max)):
69                                           ((depth >= depth_min) or  (depth <=depth_max))));
70            //Tcontrol_t is_valid        = ((depth == depth_min) or
71            //                              ((depth_min < depth_max)?
72            //                               (depth<=depth_max):
73            //                               ((depth > depth_min) or (depth <= depth_max))));
74            //Tcontrol_t is_valid        = depth <= depth_max;
75           
76            log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
77            log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
78            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
79            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
80            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
81            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
82#ifdef DEBUG
83            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);
84#endif
85            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);
86
87            internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
88            if (is_valid)
89              {
90                val                    [i] = 1;
91                internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]);
92              }
93            else
94              {
95                // Consume the instruction (to erase)
96                internal_DECOD_OUT_ACK [i] = 1;
97              }
98          }
99        num_bank = (num_bank+1)%_param->_nb_bank;
100      }
101   
102    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
103      {
104        log_printf(TRACE,Decod_queue,FUNCTION,"  * DECOD_OUT_VAL : %d",val [i]);
105       
106        PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]);
107      }
108
109    log_end(Decod_queue,FUNCTION);
110  };
111
112}; // end namespace decod_queue
113}; // end namespace decod_unit
114}; // end namespace front_end
115}; // end namespace multi_front_end
116}; // end namespace core
117
118}; // end namespace behavioural
119}; // end namespace morpheo             
120#endif
Note: See TracBrowser for help on using the repository browser.