source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_select/src/Rename_select_genMealy.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: 6.3 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Rename_select_genMealy.cpp 111 2009-02-27 18:37:40Z 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
20#undef  FUNCTION
21#define FUNCTION "Rename_select::genMealy"
22  void Rename_select::genMealy (void)
23  {
24    log_begin(Rename_select,FUNCTION);
25    log_function(Rename_select,FUNCTION,_name.c_str());
26
27    Tcontrol_t val                  [_param->_nb_inst_rename];
28    Tcontrol_t ack                  [_param->_nb_front_end][_param->_max_nb_inst_decod];
29    Tcontrol_t previous_transaction [_param->_nb_front_end];
30
31    for (uint32_t i=0; i<_param->_nb_inst_rename; ++i)
32      val [i] = false;
33    for (uint32_t i=0; i<_param->_nb_front_end; i++)
34      {
35        previous_transaction [i] = true;
36        for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
37          ack [i][j] = false;
38      }
39
40    std::list<generic::priority::select_t> * select = _priority->select();
41    std::list<generic::priority::select_t>::iterator it=select->begin();
42
43    for (uint32_t i=0; i<_param->_nb_inst_rename; i++)
44      {
45        log_printf(TRACE,Rename_select,FUNCTION,"  * RENAME_OUT [%d]",i);
46
47        // Scan all instruction until find
48        while ((it != select->end()) and (val [i] == false))
49          {
50            Tcontext_t x = it->grp;
51            uint32_t   y = it->elt;
52
53            log_printf(TRACE,Rename_select,FUNCTION,"    * front_end[%d].inst_decod[%d]",x,y);
54            log_printf(TRACE,Rename_select,FUNCTION,"      * rename_in_val        : %d",PORT_READ(in_RENAME_IN_VAL[x][y]));
55            log_printf(TRACE,Rename_select,FUNCTION,"      * previous_transaction : %d",previous_transaction[x]);
56
57            // Test if this instruction is valid and if all previous instruction of this front end is an valid transaction
58            if (previous_transaction [x] and
59                PORT_READ(in_RENAME_IN_VAL[x][y]))
60              {
61                // Find !!!
62                val [i]    = true;
63                ack [x][y] = PORT_READ(in_RENAME_OUT_ACK [i]);
64
65                log_printf(TRACE,Rename_select,FUNCTION,"      * rename_out_ack       : %d",PORT_READ(in_RENAME_OUT_ACK[i]));
66
67                Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [x][y]):0;
68                Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_RENAME_IN_CONTEXT_ID   [x][y]):0;
69               
70                Tcontrol_t no_execute   = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]));
71//              Tcontrol_t read_ra      = (PORT_READ(in_RENAME_IN_READ_RA    [x][y]));
72//              Tcontrol_t read_rb      = (PORT_READ(in_RENAME_IN_READ_RB    [x][y]));
73//              Tcontrol_t read_rc      = (PORT_READ(in_RENAME_IN_READ_RC    [x][y]));
74//              Tcontrol_t write_rd     = (PORT_READ(in_RENAME_IN_WRITE_RD   [x][y]));
75//              Tcontrol_t write_re     = (PORT_READ(in_RENAME_IN_WRITE_RE   [x][y]));
76
77                // Test if ROB is Flushed
78                Tevent_state_t event_state         = PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]);
79                Tcontrol_t     can_register_access = (event_state == EVENT_STATE_NO_EVENT);
80
81                Tcontrol_t read_ra  = (PORT_READ(in_RENAME_IN_READ_RA  [x][y]) and can_register_access);
82                Tcontrol_t read_rb  = (PORT_READ(in_RENAME_IN_READ_RB  [x][y]) and can_register_access);
83                Tcontrol_t read_rc  = (PORT_READ(in_RENAME_IN_READ_RC  [x][y]) and can_register_access);
84                Tcontrol_t write_rd = (PORT_READ(in_RENAME_IN_WRITE_RD [x][y]) and can_register_access);
85                Tcontrol_t write_re = (PORT_READ(in_RENAME_IN_WRITE_RE [x][y]) and can_register_access);
86               
87                if (_param->_have_port_front_end_id)
88                PORT_WRITE(out_RENAME_OUT_FRONT_END_ID [i],front_end_id);
89                if (_param->_have_port_context_id)
90                PORT_WRITE(out_RENAME_OUT_CONTEXT_ID   [i],context_id);
91                if (_param->_have_port_depth)
92                PORT_WRITE(out_RENAME_OUT_DEPTH        [i],PORT_READ(in_RENAME_IN_DEPTH         [x][y]));
93                PORT_WRITE(out_RENAME_OUT_TYPE         [i],PORT_READ(in_RENAME_IN_TYPE          [x][y]));
94                PORT_WRITE(out_RENAME_OUT_OPERATION    [i],PORT_READ(in_RENAME_IN_OPERATION     [x][y]));
95                PORT_WRITE(out_RENAME_OUT_NO_EXECUTE   [i],no_execute);
96                PORT_WRITE(out_RENAME_OUT_IS_DELAY_SLOT[i],PORT_READ(in_RENAME_IN_IS_DELAY_SLOT [x][y]));
97#ifdef DEBUG
98                PORT_WRITE(out_RENAME_OUT_ADDRESS      [i],PORT_READ(in_RENAME_IN_ADDRESS       [x][y]));
99#endif
100                PORT_WRITE(out_RENAME_OUT_ADDRESS_NEXT [i],PORT_READ(in_RENAME_IN_ADDRESS_NEXT  [x][y]));
101                PORT_WRITE(out_RENAME_OUT_HAS_IMMEDIAT [i],PORT_READ(in_RENAME_IN_HAS_IMMEDIAT  [x][y]));
102                PORT_WRITE(out_RENAME_OUT_IMMEDIAT     [i],PORT_READ(in_RENAME_IN_IMMEDIAT      [x][y]));
103                PORT_WRITE(out_RENAME_OUT_READ_RA      [i],read_ra);
104                PORT_WRITE(out_RENAME_OUT_NUM_REG_RA   [i],PORT_READ(in_RENAME_IN_NUM_REG_RA    [x][y]));
105                PORT_WRITE(out_RENAME_OUT_READ_RB      [i],read_rb);
106                PORT_WRITE(out_RENAME_OUT_NUM_REG_RB   [i],PORT_READ(in_RENAME_IN_NUM_REG_RB    [x][y]));
107                PORT_WRITE(out_RENAME_OUT_READ_RC      [i],read_rc);
108                PORT_WRITE(out_RENAME_OUT_NUM_REG_RC   [i],PORT_READ(in_RENAME_IN_NUM_REG_RC    [x][y]));
109                PORT_WRITE(out_RENAME_OUT_WRITE_RD     [i],write_rd);
110                PORT_WRITE(out_RENAME_OUT_NUM_REG_RD   [i],PORT_READ(in_RENAME_IN_NUM_REG_RD    [x][y]));
111                PORT_WRITE(out_RENAME_OUT_WRITE_RE     [i],write_re);
112                PORT_WRITE(out_RENAME_OUT_NUM_REG_RE   [i],PORT_READ(in_RENAME_IN_NUM_REG_RE    [x][y]));
113                PORT_WRITE(out_RENAME_OUT_EXCEPTION_USE[i],PORT_READ(in_RENAME_IN_EXCEPTION_USE [x][y]));
114                PORT_WRITE(out_RENAME_OUT_EXCEPTION    [i],PORT_READ(in_RENAME_IN_EXCEPTION     [x][y]));
115              }
116
117            // ack = 1 if previous_transaction == true and rename_in_val == true and rename_out == true
118            previous_transaction [x] = ack [x][y];
119
120            it ++;
121          }
122
123      }
124
125    for (uint32_t i=0; i<_param->_nb_inst_rename; ++i)
126      PORT_WRITE(out_RENAME_OUT_VAL [i], val [i]);
127
128    for (uint32_t i=0; i<_param->_nb_front_end; i++)
129      for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
130        PORT_WRITE(out_RENAME_IN_ACK [i][j], ack [i][j]);
131
132    log_end(Rename_select,FUNCTION);
133  };
134
135}; // end namespace rename_select
136}; // end namespace rename_unit
137}; // end namespace ooo_engine
138}; // end namespace multi_ooo_engine
139}; // end namespace core
140
141}; // end namespace behavioural
142}; // end namespace morpheo             
143#endif
Note: See TracBrowser for help on using the repository browser.