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

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

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

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