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

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

1) Write queue with mealy
2) Network : fix bug
3) leak memory

  • Property svn:keywords set to Id
File size: 7.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Rename_select_genMealy.cpp 115 2009-04-20 21:29:17Z 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,"      * in_RENAME_OUT_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,"      * in_RENAME_OUT_ACK    : %d",PORT_READ(in_RENAME_OUT_ACK[i]));
66                Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [x][y]):0;
67                Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_RENAME_IN_CONTEXT_ID   [x][y]):0;
68
69                log_printf(TRACE,Rename_select,FUNCTION,"      * front_end_id         : %d",front_end_id);
70                log_printf(TRACE,Rename_select,FUNCTION,"      * context_id           : %d",context_id);
71               
72                // Test if ROB is Flushed
73                Tevent_state_t event_state         = PORT_READ(in_RETIRE_EVENT_STATE [x][context_id]);
74                Tcontrol_t     have_event          = (event_state != EVENT_STATE_NO_EVENT);
75                Tcontrol_t     can_register_access = not have_event;
76                Tcontrol_t     no_execute          = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]) or have_event);
77                Tcontrol_t     read_ra             = (PORT_READ(in_RENAME_IN_READ_RA    [x][y]) and can_register_access);
78                Tcontrol_t     read_rb             = (PORT_READ(in_RENAME_IN_READ_RB    [x][y]) and can_register_access);
79                Tcontrol_t     read_rc             = (PORT_READ(in_RENAME_IN_READ_RC    [x][y]) and can_register_access);
80                Tcontrol_t     write_rd            = (PORT_READ(in_RENAME_IN_WRITE_RD   [x][y]) and can_register_access);
81                Tcontrol_t     write_re            = (PORT_READ(in_RENAME_IN_WRITE_RE   [x][y]) and can_register_access);
82//              Tcontrol_t     read_ra             = (PORT_READ(in_RENAME_IN_READ_RA    [x][y]));
83//              Tcontrol_t     read_rb             = (PORT_READ(in_RENAME_IN_READ_RB    [x][y]));
84//              Tcontrol_t     read_rc             = (PORT_READ(in_RENAME_IN_READ_RC    [x][y]));
85//              Tcontrol_t     write_rd            = (PORT_READ(in_RENAME_IN_WRITE_RD   [x][y]));
86//              Tcontrol_t     write_re            = (PORT_READ(in_RENAME_IN_WRITE_RE   [x][y]));
87
88                log_printf(TRACE,Rename_select,FUNCTION,"      * event_state          : %d",event_state);
89                log_printf(TRACE,Rename_select,FUNCTION,"      * no_execute (before)  : %d",PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]));
90                log_printf(TRACE,Rename_select,FUNCTION,"      * no_execute (after)   : %d",no_execute);
91
92                if (_param->_have_port_front_end_id)
93                PORT_WRITE(out_RENAME_OUT_FRONT_END_ID [i],front_end_id);
94                if (_param->_have_port_context_id)
95                PORT_WRITE(out_RENAME_OUT_CONTEXT_ID   [i],context_id);
96                if (_param->_have_port_depth)
97                PORT_WRITE(out_RENAME_OUT_DEPTH        [i],PORT_READ(in_RENAME_IN_DEPTH         [x][y]));
98                PORT_WRITE(out_RENAME_OUT_TYPE         [i],PORT_READ(in_RENAME_IN_TYPE          [x][y]));
99                PORT_WRITE(out_RENAME_OUT_OPERATION    [i],PORT_READ(in_RENAME_IN_OPERATION     [x][y]));
100                PORT_WRITE(out_RENAME_OUT_NO_EXECUTE   [i],no_execute);
101                PORT_WRITE(out_RENAME_OUT_IS_DELAY_SLOT[i],PORT_READ(in_RENAME_IN_IS_DELAY_SLOT [x][y]));
102#ifdef DEBUG
103                PORT_WRITE(out_RENAME_OUT_ADDRESS      [i],PORT_READ(in_RENAME_IN_ADDRESS       [x][y]));
104#endif
105                PORT_WRITE(out_RENAME_OUT_ADDRESS_NEXT [i],PORT_READ(in_RENAME_IN_ADDRESS_NEXT  [x][y]));
106                PORT_WRITE(out_RENAME_OUT_HAS_IMMEDIAT [i],PORT_READ(in_RENAME_IN_HAS_IMMEDIAT  [x][y]));
107                PORT_WRITE(out_RENAME_OUT_IMMEDIAT     [i],PORT_READ(in_RENAME_IN_IMMEDIAT      [x][y]));
108                PORT_WRITE(out_RENAME_OUT_READ_RA      [i],read_ra);
109                PORT_WRITE(out_RENAME_OUT_NUM_REG_RA   [i],PORT_READ(in_RENAME_IN_NUM_REG_RA    [x][y]));
110                PORT_WRITE(out_RENAME_OUT_READ_RB      [i],read_rb);
111                PORT_WRITE(out_RENAME_OUT_NUM_REG_RB   [i],PORT_READ(in_RENAME_IN_NUM_REG_RB    [x][y]));
112                PORT_WRITE(out_RENAME_OUT_READ_RC      [i],read_rc);
113                PORT_WRITE(out_RENAME_OUT_NUM_REG_RC   [i],PORT_READ(in_RENAME_IN_NUM_REG_RC    [x][y]));
114                PORT_WRITE(out_RENAME_OUT_WRITE_RD     [i],write_rd);
115                PORT_WRITE(out_RENAME_OUT_NUM_REG_RD   [i],PORT_READ(in_RENAME_IN_NUM_REG_RD    [x][y]));
116                PORT_WRITE(out_RENAME_OUT_WRITE_RE     [i],write_re);
117                PORT_WRITE(out_RENAME_OUT_NUM_REG_RE   [i],PORT_READ(in_RENAME_IN_NUM_REG_RE    [x][y]));
118                PORT_WRITE(out_RENAME_OUT_EXCEPTION_USE[i],PORT_READ(in_RENAME_IN_EXCEPTION_USE [x][y]));
119                PORT_WRITE(out_RENAME_OUT_EXCEPTION    [i],PORT_READ(in_RENAME_IN_EXCEPTION     [x][y]));
120              }
121
122            // ack = 1 if previous_transaction == true and rename_in_val == true and rename_out == true
123            previous_transaction [x] = ack [x][y];
124
125            it ++;
126          }
127
128      }
129
130    for (uint32_t i=0; i<_param->_nb_inst_rename; ++i)
131      PORT_WRITE(out_RENAME_OUT_VAL [i], val [i]);
132
133    for (uint32_t i=0; i<_param->_nb_front_end; i++)
134      for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
135        PORT_WRITE(out_RENAME_IN_ACK [i][j], ack [i][j]);
136
137    log_end(Rename_select,FUNCTION);
138  };
139
140}; // end namespace rename_select
141}; // end namespace rename_unit
142}; // end namespace ooo_engine
143}; // end namespace multi_ooo_engine
144}; // end namespace core
145
146}; // end namespace behavioural
147}; // end namespace morpheo             
148#endif
Note: See TracBrowser for help on using the repository browser.