source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Execution_unit_to_Write_unit/src/Execution_unit_to_Write_unit_genMealy.cpp

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

1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Execution_unit_to_Write_unit_genMealy.cpp 136 2009-10-20 18:52:15Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Execution_unit_to_Write_unit/include/Execution_unit_to_Write_unit.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_execute_loop {
15namespace execute_loop {
16namespace network {
17namespace execution_unit_to_write_unit {
18
19
20#undef  FUNCTION
21#define FUNCTION "Execution_unit_to_Write_unit::genMealy"
22  void Execution_unit_to_Write_unit::genMealy (void)
23  {
24    log_printf(FUNC,Execution_unit_to_Write_unit,FUNCTION,"Begin");
25
26    if (PORT_READ(in_NRESET))
27      {
28    bool write_unit_use [_param->_nb_write_unit];
29
30    for (uint32_t i=0; i<_param->_nb_write_unit; i++)
31      write_unit_use[i] = (PORT_READ(in_WRITE_UNIT_IN_ACK [i]) == 0);
32
33    for (uint32_t i=0; i<_param->_nb_execute_unit; i++)
34      for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++)
35        {
36          bool       ack = false;
37         
38          log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"Test execute_unit[%d][%d]",i,j);
39         
40          if (PORT_READ(in_EXECUTE_UNIT_OUT_VAL [i][j]) == true)
41            {
42              log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION," * have a valid entry.");
43             
44              Tcontext_t context_id    = (_param->_have_port_context_id   )?PORT_READ(in_EXECUTE_UNIT_OUT_CONTEXT_ID    [i][j]):0;
45              Tcontext_t front_end_id  = (_param->_have_port_front_end_id )?PORT_READ(in_EXECUTE_UNIT_OUT_FRONT_END_ID  [i][j]):0;
46              Tcontext_t ooo_engine_id = (_param->_have_port_ooo_engine_id)?PORT_READ(in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID [i][j]):0;
47              Tcontext_t num_thread    = get_num_thread(context_id   , _param->_size_context_id   ,
48                                                        front_end_id , _param->_size_front_end_id ,
49                                                        ooo_engine_id, _param->_size_ooo_engine_id);
50#ifdef DEBUG_TEST
51              if (_destination[i][j][num_thread].empty())
52                throw ERRORMORPHEO(FUNCTION,"Invalid Operation : They have no write_unit to receive a operation from the execute_unit ["+toString(i)+"]["+toString(j)+"], thread ["+toString(num_thread)+"].");
53#endif
54             
55              // find a free write_unit
56              for (std::list<uint32_t>::iterator it=_destination[i][j][num_thread].begin();
57                   (it != _destination[i][j][num_thread].end()) and (ack == false);
58                   it++)
59                {
60                  uint32_t dest = *it;
61                 
62                  log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"   * Test destination [%d].",dest);
63                 
64                  if (write_unit_use [dest] == false)
65                    {
66                      log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"     * Is ok! Link.");
67                      // have find !!!
68                      ack                   = true;
69                      write_unit_use [dest] = true;
70                     
71                      if (_param->_have_port_context_id)
72                      PORT_WRITE(out_WRITE_UNIT_IN_CONTEXT_ID            [dest], context_id);
73                      if (_param->_have_port_front_end_id)
74                      PORT_WRITE(out_WRITE_UNIT_IN_FRONT_END_ID          [dest], front_end_id);
75                      if (_param->_have_port_ooo_engine_id)
76                      PORT_WRITE(out_WRITE_UNIT_IN_OOO_ENGINE_ID         [dest], ooo_engine_id);
77                      if (_param->_have_port_rob_ptr  )
78                      PORT_WRITE(out_WRITE_UNIT_IN_PACKET_ID             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_PACKET_ID             [i][j]));
79//                    PORT_WRITE(out_WRITE_UNIT_IN_OPERATION             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_OPERATION             [i][j]));
80//                    PORT_WRITE(out_WRITE_UNIT_IN_TYPE                  [dest], PORT_READ(in_EXECUTE_UNIT_OUT_TYPE                  [i][j]));
81                      PORT_WRITE(out_WRITE_UNIT_IN_CANCEL                [dest], PORT_READ(in_EXECUTE_UNIT_OUT_CANCEL                [i][j]));
82                      PORT_WRITE(out_WRITE_UNIT_IN_WRITE_RD              [dest], PORT_READ(in_EXECUTE_UNIT_OUT_WRITE_RD              [i][j]));
83                      PORT_WRITE(out_WRITE_UNIT_IN_NUM_REG_RD            [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NUM_REG_RD            [i][j]));
84                      PORT_WRITE(out_WRITE_UNIT_IN_DATA_RD               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_DATA_RD               [i][j]));
85                      PORT_WRITE(out_WRITE_UNIT_IN_WRITE_RE              [dest], PORT_READ(in_EXECUTE_UNIT_OUT_WRITE_RE              [i][j]));
86                      PORT_WRITE(out_WRITE_UNIT_IN_NUM_REG_RE            [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NUM_REG_RE            [i][j]));
87                      PORT_WRITE(out_WRITE_UNIT_IN_DATA_RE               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_DATA_RE               [i][j]));
88                      PORT_WRITE(out_WRITE_UNIT_IN_EXCEPTION             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_EXCEPTION             [i][j]));
89                      PORT_WRITE(out_WRITE_UNIT_IN_NO_SEQUENCE           [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NO_SEQUENCE           [i][j]));
90                      PORT_WRITE(out_WRITE_UNIT_IN_ADDRESS               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_ADDRESS               [i][j]));
91                    }
92                }
93            }
94          PORT_WRITE(out_EXECUTE_UNIT_OUT_ACK [i][j], ack);
95      }
96
97    for (uint32_t i=0; i<_param->_nb_write_unit; i++)
98      {
99        PORT_WRITE(out_WRITE_UNIT_IN_VAL[i], write_unit_use[i]); 
100      }
101      }
102    else
103      {
104        for (uint32_t i=0; i<_param->_nb_execute_unit; i++)
105          for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++)
106            PORT_WRITE(out_EXECUTE_UNIT_OUT_ACK [i][j], 0);
107       
108        for (uint32_t i=0; i<_param->_nb_write_unit; i++)
109          PORT_WRITE(out_WRITE_UNIT_IN_VAL[i], 0); 
110      }
111
112    log_printf(FUNC,Execution_unit_to_Write_unit,FUNCTION,"End");
113  };
114
115}; // end namespace execution_unit_to_write_unit
116}; // end namespace network
117}; // end namespace execute_loop
118}; // end namespace multi_execute_loop
119}; // end namespace core
120
121}; // end namespace behavioural
122}; // end namespace morpheo             
123#endif
Note: See TracBrowser for help on using the repository browser.