source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_select/src/Rename_select_genMealy.cpp

Last change on this file was 139, checked in by rosiere, 14 years ago
  • Add test for all configuration
  • RAT : add rat scheme (depth_save)
  • Property svn:keywords set to Id
File size: 7.9 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Rename_select_genMealy.cpp 139 2010-07-30 14:47:27Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_select/include/Rename_select.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace rename_unit {
17namespace rename_select {
18
19#undef  FUNCTION
20#define FUNCTION "Rename_select::genMealy"
21  void Rename_select::genMealy (void)
22  {
23    log_begin(Rename_select,FUNCTION);
24    log_function(Rename_select,FUNCTION,_name.c_str());
25
26    Tcontrol_t val                  [_param->_nb_inst_rename];
27    Tcontrol_t ack                  [_param->_nb_front_end][_param->_max_nb_inst_decod];
28
29    for (uint32_t i=0; i<_param->_nb_inst_rename; ++i)
30      val [i] = false;
31    for (uint32_t i=0; i<_param->_nb_front_end; i++)
32      for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
33        ack [i][j] = false;
34   
35    if (PORT_READ(in_NRESET))
36      {
37        Tcontrol_t previous_transaction [_param->_nb_front_end];
38        for (uint32_t i=0; i<_param->_nb_front_end; i++)
39          previous_transaction [i] = true;
40
41    std::list<generic::priority::select_t> * select = _priority->select();
42    std::list<generic::priority::select_t>::iterator it=select->begin();
43
44    for (uint32_t i=0; i<_param->_nb_inst_rename; i++)
45      {
46        log_printf(TRACE,Rename_select,FUNCTION,"  * RENAME_OUT [%d]",i);
47
48        // Scan all instruction until find
49        while ((it != select->end()) and (val [i] == false))
50          {
51            Tcontext_t x = it->grp;
52            uint32_t   y = it->elt;
53
54            log_printf(TRACE,Rename_select,FUNCTION,"    * front_end[%d].inst_decod[%d]",x,y);
55            log_printf(TRACE,Rename_select,FUNCTION,"      * in_RENAME_OUT_VAL    : %d",PORT_READ(in_RENAME_IN_VAL[x][y]));
56            log_printf(TRACE,Rename_select,FUNCTION,"      * previous_transaction : %d",previous_transaction[x]);
57
58            // Test if this instruction is valid and if all previous instruction of this front end is an valid transaction
59            if (previous_transaction [x] and
60                PORT_READ(in_RENAME_IN_VAL[x][y]))
61              {
62
63                log_printf(TRACE,Rename_select,FUNCTION,"      * in_RENAME_OUT_ACK    : %d",PORT_READ(in_RENAME_OUT_ACK[i]));
64                Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [x][y]):0;
65                Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_RENAME_IN_CONTEXT_ID   [x][y]):0;
66                Tcontrol_t stop         = PORT_READ(in_RETIRE_EVENT_STOP  [x][context_id]);
67
68                log_printf(TRACE,Rename_select,FUNCTION,"      * front_end_id         : %d",front_end_id);
69                log_printf(TRACE,Rename_select,FUNCTION,"      * context_id           : %d",context_id);
70                log_printf(TRACE,Rename_select,FUNCTION,"      * stop                 : %d",stop);
71               
72                // Test if ROB is Flushed
73                if (not stop)
74                  {
75                    // Find !!!
76                    val [i]    = true;
77                    ack [x][y] = PORT_READ(in_RENAME_OUT_ACK [i]);
78                   
79//                  Tcontrol_t     have_event          = (PORT_READ(in_RETIRE_EVENT_FLUSH [x][context_id]) // or
80//                                                           );
81//                  log_printf(TRACE,Rename_select,FUNCTION,"      * have_event           : %d",have_event);
82
83//                  Tcontrol_t     can_register_access = not have_event;
84//                  Tcontrol_t     no_execute          = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]) or have_event);
85//                  Tcontrol_t     read_ra             = (PORT_READ(in_RENAME_IN_READ_RA    [x][y]) and can_register_access);
86//                  Tcontrol_t     read_rb             = (PORT_READ(in_RENAME_IN_READ_RB    [x][y]) and can_register_access);
87//                  Tcontrol_t     read_rc             = (PORT_READ(in_RENAME_IN_READ_RC    [x][y]) and can_register_access);
88//                  Tcontrol_t     write_rd            = (PORT_READ(in_RENAME_IN_WRITE_RD   [x][y]) and can_register_access);
89//                  Tcontrol_t     write_re            = (PORT_READ(in_RENAME_IN_WRITE_RE   [x][y]) and can_register_access);
90                    Tcontrol_t     no_execute          = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]));
91                    Tcontrol_t     read_ra             = (PORT_READ(in_RENAME_IN_READ_RA    [x][y]));
92                    Tcontrol_t     read_rb             = (PORT_READ(in_RENAME_IN_READ_RB    [x][y]));
93                    Tcontrol_t     read_rc             = (PORT_READ(in_RENAME_IN_READ_RC    [x][y]));
94                    Tcontrol_t     write_rd            = (PORT_READ(in_RENAME_IN_WRITE_RD   [x][y]));
95                    Tcontrol_t     write_re            = (PORT_READ(in_RENAME_IN_WRITE_RE   [x][y]));
96                   
97                    log_printf(TRACE,Rename_select,FUNCTION,"      * no_execute           : %d",no_execute);
98                   
99                    if (_param->_have_port_front_end_id)
100                    PORT_WRITE(out_RENAME_OUT_FRONT_END_ID [i],front_end_id);
101                    if (_param->_have_port_context_id)
102                    PORT_WRITE(out_RENAME_OUT_CONTEXT_ID   [i],context_id);
103                    if (_param->_have_port_depth)
104                    PORT_WRITE(out_RENAME_OUT_DEPTH        [i],PORT_READ(in_RENAME_IN_DEPTH         [x][y]));
105#ifdef STATISTICS
106                    PORT_WRITE(out_RENAME_OUT_INSTRUCTION  [i],PORT_READ(in_RENAME_IN_INSTRUCTION   [x][y]));
107#endif
108                    PORT_WRITE(out_RENAME_OUT_TYPE         [i],PORT_READ(in_RENAME_IN_TYPE          [x][y]));
109                    PORT_WRITE(out_RENAME_OUT_OPERATION    [i],PORT_READ(in_RENAME_IN_OPERATION     [x][y]));
110                    PORT_WRITE(out_RENAME_OUT_NO_EXECUTE   [i],no_execute);
111                    PORT_WRITE(out_RENAME_OUT_LAST_EVENT   [i],PORT_READ(in_RENAME_IN_LAST_EVENT    [x][y]));
112                    PORT_WRITE(out_RENAME_OUT_IS_DELAY_SLOT[i],PORT_READ(in_RENAME_IN_IS_DELAY_SLOT [x][y]));
113                    PORT_WRITE(out_RENAME_OUT_SAVE_RAT     [i],PORT_READ(in_RENAME_IN_SAVE_RAT      [x][y]));
114#ifdef DEBUG       
115                    PORT_WRITE(out_RENAME_OUT_ADDRESS      [i],PORT_READ(in_RENAME_IN_ADDRESS       [x][y]));
116#endif             
117                    PORT_WRITE(out_RENAME_OUT_ADDRESS_NEXT [i],PORT_READ(in_RENAME_IN_ADDRESS_NEXT  [x][y]));
118                    PORT_WRITE(out_RENAME_OUT_HAS_IMMEDIAT [i],PORT_READ(in_RENAME_IN_HAS_IMMEDIAT  [x][y]));
119                    PORT_WRITE(out_RENAME_OUT_IMMEDIAT     [i],PORT_READ(in_RENAME_IN_IMMEDIAT      [x][y]));
120                    PORT_WRITE(out_RENAME_OUT_READ_RA      [i],read_ra);
121                    PORT_WRITE(out_RENAME_OUT_NUM_REG_RA   [i],PORT_READ(in_RENAME_IN_NUM_REG_RA    [x][y]));
122                    PORT_WRITE(out_RENAME_OUT_READ_RB      [i],read_rb);
123                    PORT_WRITE(out_RENAME_OUT_NUM_REG_RB   [i],PORT_READ(in_RENAME_IN_NUM_REG_RB    [x][y]));
124                    PORT_WRITE(out_RENAME_OUT_READ_RC      [i],read_rc);
125                    PORT_WRITE(out_RENAME_OUT_NUM_REG_RC   [i],PORT_READ(in_RENAME_IN_NUM_REG_RC    [x][y]));
126                    PORT_WRITE(out_RENAME_OUT_WRITE_RD     [i],write_rd);
127                    PORT_WRITE(out_RENAME_OUT_NUM_REG_RD   [i],PORT_READ(in_RENAME_IN_NUM_REG_RD    [x][y]));
128                    PORT_WRITE(out_RENAME_OUT_WRITE_RE     [i],write_re);
129                    PORT_WRITE(out_RENAME_OUT_NUM_REG_RE   [i],PORT_READ(in_RENAME_IN_NUM_REG_RE    [x][y]));
130                    PORT_WRITE(out_RENAME_OUT_EXCEPTION_USE[i],PORT_READ(in_RENAME_IN_EXCEPTION_USE [x][y]));
131                    PORT_WRITE(out_RENAME_OUT_EXCEPTION    [i],PORT_READ(in_RENAME_IN_EXCEPTION     [x][y]));
132                  }
133              }
134
135            // ack = 1 if previous_transaction == true and rename_in_val == true and rename_out == true
136            previous_transaction [x] = ack [x][y];
137
138            it ++;
139          }
140
141      }
142
143      }
144//     else
145//       {
146//       }
147
148    for (uint32_t i=0; i<_param->_nb_inst_rename; ++i)
149      PORT_WRITE(out_RENAME_OUT_VAL [i], val [i]);
150
151    for (uint32_t i=0; i<_param->_nb_front_end; i++)
152      for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
153        PORT_WRITE(out_RENAME_IN_ACK [i][j], ack [i][j]);
154
155
156    log_end(Rename_select,FUNCTION);
157  };
158
159}; // end namespace rename_select
160}; // end namespace rename_unit
161}; // end namespace ooo_engine
162}; // end namespace multi_ooo_engine
163}; // end namespace core
164
165}; // end namespace behavioural
166}; // end namespace morpheo             
167#endif
Note: See TracBrowser for help on using the repository browser.