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 @ 88

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Execution_unit_to_Write_unit_genMealy.cpp 88 2008-12-10 18:31:39Z 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    bool write_unit_use [_param->_nb_write_unit];
27
28    for (uint32_t i=0; i<_param->_nb_write_unit; i++)
29      write_unit_use[i] = (PORT_READ(in_WRITE_UNIT_IN_ACK [i]) == 0);
30
31    for (uint32_t i=0; i<_param->_nb_execute_unit; i++)
32      for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++)
33        {
34          bool       ack = false;
35         
36          log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"Test execute_unit[%d][%d]",i,j);
37         
38          if (PORT_READ(in_EXECUTE_UNIT_OUT_VAL [i][j]) == true)
39            {
40              log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION," * have a valid entry.");
41             
42              Tcontext_t context_id    = (_param->_have_port_context_id   )?PORT_READ(in_EXECUTE_UNIT_OUT_CONTEXT_ID    [i][j]):0;
43              Tcontext_t front_end_id  = (_param->_have_port_front_end_id )?PORT_READ(in_EXECUTE_UNIT_OUT_FRONT_END_ID  [i][j]):0;
44              Tcontext_t ooo_engine_id = (_param->_have_port_ooo_engine_id)?PORT_READ(in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID [i][j]):0;
45              Tcontext_t num_thread    = get_num_thread(context_id   , _param->_size_context_id   ,
46                                                        front_end_id , _param->_size_front_end_id ,
47                                                        ooo_engine_id, _param->_size_ooo_engine_id);
48#ifdef DEBUG_TEST
49              if (_destination[i][j][num_thread].empty())
50                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)+"].");
51#endif
52             
53              // find a free write_unit
54              for (std::list<uint32_t>::iterator it=_destination[i][j][num_thread].begin();
55                   (it != _destination[i][j][num_thread].end()) and (ack == false);
56                   it++)
57                {
58                  uint32_t dest = *it;
59                 
60                  log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"   * Test destination [%d].",dest);
61                 
62                  if (write_unit_use [dest] == false)
63                    {
64                      log_printf(TRACE,Execution_unit_to_Write_unit,FUNCTION,"     * Is ok! Link.");
65                      // have find !!!
66                      ack                   = true;
67                      write_unit_use [dest] = true;
68                     
69                      if (_param->_have_port_context_id)
70                      PORT_WRITE(out_WRITE_UNIT_IN_CONTEXT_ID            [dest], context_id);
71                      if (_param->_have_port_front_end_id)
72                      PORT_WRITE(out_WRITE_UNIT_IN_FRONT_END_ID          [dest], front_end_id);
73                      if (_param->_have_port_ooo_engine_id)
74                      PORT_WRITE(out_WRITE_UNIT_IN_OOO_ENGINE_ID         [dest], ooo_engine_id);
75                      if (_param->_have_port_rob_ptr  )
76                      PORT_WRITE(out_WRITE_UNIT_IN_PACKET_ID             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_PACKET_ID             [i][j]));
77                  //  PORT_WRITE(out_WRITE_UNIT_IN_OPERATION             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_OPERATION             [i][j]));
78                      PORT_WRITE(out_WRITE_UNIT_IN_TYPE                  [dest], PORT_READ(in_EXECUTE_UNIT_OUT_TYPE                  [i][j]));
79                      PORT_WRITE(out_WRITE_UNIT_IN_WRITE_RD              [dest], PORT_READ(in_EXECUTE_UNIT_OUT_WRITE_RD              [i][j]));
80                      PORT_WRITE(out_WRITE_UNIT_IN_NUM_REG_RD            [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NUM_REG_RD            [i][j]));
81                      PORT_WRITE(out_WRITE_UNIT_IN_DATA_RD               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_DATA_RD               [i][j]));
82                      PORT_WRITE(out_WRITE_UNIT_IN_WRITE_RE              [dest], PORT_READ(in_EXECUTE_UNIT_OUT_WRITE_RE              [i][j]));
83                      PORT_WRITE(out_WRITE_UNIT_IN_NUM_REG_RE            [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NUM_REG_RE            [i][j]));
84                      PORT_WRITE(out_WRITE_UNIT_IN_DATA_RE               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_DATA_RE               [i][j]));
85                      PORT_WRITE(out_WRITE_UNIT_IN_EXCEPTION             [dest], PORT_READ(in_EXECUTE_UNIT_OUT_EXCEPTION             [i][j]));
86                      PORT_WRITE(out_WRITE_UNIT_IN_NO_SEQUENCE           [dest], PORT_READ(in_EXECUTE_UNIT_OUT_NO_SEQUENCE           [i][j]));
87                      PORT_WRITE(out_WRITE_UNIT_IN_ADDRESS               [dest], PORT_READ(in_EXECUTE_UNIT_OUT_ADDRESS               [i][j]));
88                    }
89                }
90            }
91          PORT_WRITE(out_EXECUTE_UNIT_OUT_ACK [i][j], ack);
92      }
93
94    for (uint32_t i=0; i<_param->_nb_write_unit; i++)
95      {
96        PORT_WRITE(out_WRITE_UNIT_IN_VAL[i], write_unit_use[i]); 
97      }
98
99    log_printf(FUNC,Execution_unit_to_Write_unit,FUNCTION,"End");
100  };
101
102}; // end namespace execution_unit_to_write_unit
103}; // end namespace network
104}; // end namespace execute_loop
105}; // end namespace multi_execute_loop
106}; // end namespace core
107
108}; // end namespace behavioural
109}; // end namespace morpheo             
110#endif
Note: See TracBrowser for help on using the repository browser.