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

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

1) Bug fix (Operation, Instruction)
2) Modif Return Address Stack
3) Add Soft Test
4) Add Soc Test

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