source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_insert.cpp @ 112

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

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Commit_unit_genMealy_insert.cpp 112 2009-03-18 22:36:26Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_ooo_engine {
15namespace ooo_engine {
16namespace commit_unit {
17
18
19#undef  FUNCTION
20#define FUNCTION "Commit_unit::genMealy_insert"
21  void Commit_unit::genMealy_insert (void)
22  {
23    log_begin(Commit_unit,FUNCTION);
24    log_function(Commit_unit,FUNCTION,_name.c_str());
25
26    Tcontrol_t bank_full         [_param->_nb_bank];
27    Tcontrol_t insert_ack        [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
28#ifdef SYSTEMC_VHDL_COMPATIBILITY
29    Tpacket_t  insert_packet_id  [_param->_nb_rename_unit][_param->_max_nb_inst_insert];
30#endif
31    bool       can_rename_select [_param->_nb_rename_unit];
32    bool       event_stop;
33   
34//     Initialisation
35    event_stop = false; // one signal for all context.
36    for (uint32_t i=0; i<_param->_nb_front_end; ++i)
37      for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
38        event_stop |= reg_EVENT_STOP [i][j];
39    for (uint32_t i=0; i<_param->_nb_bank; i++)
40      {
41        internal_BANK_INSERT_VAL  [i] = false;
42        bank_full [i] = not (_rob[i].size() < _param->_size_bank); 
43      }
44    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
45      {
46        can_rename_select [i] = true;
47        for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
48          {
49            insert_ack       [i][j] = false;
50#ifdef SYSTEMC_VHDL_COMPATIBILITY
51            insert_packet_id [i][j] = false;
52#endif
53          }
54      }
55
56    // insert interface
57//     log_printf(TRACE,Commit_unit,FUNCTION,"  * reg_NUM_BANK_TAIL : %d",reg_NUM_BANK_TAIL);
58
59    if (not event_stop)
60      {
61        std::list<generic::priority::select_t> * select_insert = _priority_insert ->select(); // same select for all insert
62        std::list<generic::priority::select_t>::iterator it=select_insert ->begin();
63       
64        // Scan all bank ...
65        for (uint32_t i=0; i<_param->_nb_bank; i++)
66          {
67            // compute the bank number (num_bank_tail is the older write slot)
68            uint32_t num_bank = (reg_NUM_BANK_TAIL+i)%_param->_nb_bank;
69     
70//          log_printf(TRACE,Commit_unit,FUNCTION,"  * BANK : %d", num_bank);
71//          log_printf(TRACE,Commit_unit,FUNCTION,"    * val  : %d", internal_BANK_INSERT_VAL [num_bank]);
72//          log_printf(TRACE,Commit_unit,FUNCTION,"    * full : %d", bank_full [num_bank]);
73     
74            // Scan all insert interface to find a valid transaction
75            while (it!=select_insert ->end())
76              {
77                uint32_t num_rename_unit = it->grp;
78                uint32_t num_inst_insert = it->elt;
79     
80                it++;
81     
82                log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d]", num_rename_unit,num_inst_insert);
83//                  log_printf(TRACE,Commit_unit,FUNCTION,"    * INSERT_VAL        : %d", PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert]));
84                log_printf(TRACE,Commit_unit,FUNCTION,"    * can_rename_select : %d", can_rename_select [num_rename_unit]);
85     
86                // Test if have instruction
87                //   -> rename_unit_glue test the in-order insert !!!!!
88                if (can_rename_select [num_rename_unit] // and
89//              PORT_READ(in_INSERT_VAL [num_rename_unit][num_inst_insert])
90                    )
91                  {
92                    log_printf(TRACE,Commit_unit,FUNCTION,"      * have instruction");
93                    log_printf(TRACE,Commit_unit,FUNCTION,"      * bank_full : %d",bank_full [num_bank]);
94                   
95                    // test if bank is not busy (full or previous access)
96                    if (not bank_full [num_bank])
97                      {
98                        // find !!!
99                        insert_ack       [num_rename_unit][num_inst_insert] = true;
100                       
101                        Tpacket_t packet_id = ((num_bank << _param->_shift_num_bank) | reg_BANK_PTR [num_bank]);
102                       
103#ifdef SYSTEMC_VHDL_COMPATIBILITY
104                        insert_packet_id [num_rename_unit][num_inst_insert] = packet_id;
105#else
106                        if (_param->_have_port_rob_ptr  )
107                        PORT_WRITE(out_INSERT_PACKET_ID [num_rename_unit][num_inst_insert],packet_id);
108#endif
109                        internal_BANK_INSERT_VAL             [num_bank] = true;
110                        internal_BANK_INSERT_NUM_RENAME_UNIT [num_bank] = num_rename_unit;
111                        internal_BANK_INSERT_NUM_INST        [num_bank] = num_inst_insert;
112                       
113                        break;
114                      }
115                  }
116               
117                // is a valid instruction, but it's not send at a bank
118                //  ... invalid this rename_unit (because, insert in_order)
119                can_rename_select [num_rename_unit] = false;
120              }
121          }
122      }
123   
124    // Write output
125    for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
126      for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
127        {
128          PORT_WRITE(out_INSERT_ACK       [i][j],insert_ack       [i][j]);
129          log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT [%d][%d] -> ack %d",i,j,insert_ack[i][j]);
130
131#ifdef SYSTEMC_VHDL_COMPATIBILITY
132          if (_param->_have_port_rob_ptr  )
133          PORT_WRITE(out_INSERT_PACKET_ID [i][j],insert_packet_id [i][j]);
134#endif
135        }
136   
137    log_end(Commit_unit,FUNCTION);
138  };
139
140}; // end namespace commit_unit
141}; // end namespace ooo_engine
142}; // end namespace multi_ooo_engine
143}; // end namespace core
144}; // end namespace behavioural
145}; // end namespace morpheo             
146#endif
Note: See TracBrowser for help on using the repository browser.