source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Dcache_Access/src/Dcache_Access_genMealy_req.cpp @ 123

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

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Dcache_Access_genMealy_req.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Dcache_Access/include/Dcache_Access.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace dcache_access {
15
16
17#undef  FUNCTION
18#define FUNCTION "Dcache_Access::genMealy_req"
19  void Dcache_Access::genMealy_req (void)
20  {
21    log_begin(Dcache_Access,FUNCTION);
22
23    if (PORT_READ(in_NRESET))
24      {
25    Tcontrol_t dcache_req_val [_param->_nb_dcache_port];
26    for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
27      {
28        dcache_req_val [i] = 0;
29       
30#ifdef STATISTICS
31        _internal_DCACHE_REQ_NB_ACCESS         [i] = 0;
32        _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [i] = 0;
33#endif
34      }
35   
36    Tcontrol_t lsq_req_ack [_param->_nb_execute_loop][_param->_max_nb_load_store_unit][_param->_max_nb_cache_access];
37    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
38      for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
39        for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
40          lsq_req_ack [i][j][k] = 0;
41   
42    std::list<generic::priority::select_t> * select = _priority ->select();
43    for (std::list<generic::priority::select_t>::iterator it=select ->begin();
44         it!=select->end();
45         ++it)
46      {
47        uint32_t num_execute_loop    = it->grp;
48        uint32_t num_load_store_unit = it->elt;
49       
50        for (uint32_t num_cache_access = 0; num_cache_access<_param->_nb_cache_access [num_execute_loop][num_load_store_unit]; ++num_cache_access)
51          {
52            if (PORT_READ(in_LSQ_REQ_VAL [num_execute_loop][num_load_store_unit][num_cache_access]))
53              {
54                uint32_t   num_port       = _param->_table_routing[num_execute_loop][num_load_store_unit][num_cache_access];
55                Tcontrol_t dcache_req_ack = PORT_READ(in_DCACHE_REQ_ACK [num_port]);
56
57                log_printf(TRACE,Dcache_Access,FUNCTION,"  * num_port      : %d",num_port);
58               
59#ifdef STATISTICS
60                if (dcache_req_ack)
61                  {
62                    _internal_DCACHE_REQ_NB_ACCESS [num_port] ++;
63                    if (dcache_req_val [num_port])
64                    _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [num_port] ++;
65                  }
66#endif
67                if (not dcache_req_val [num_port])
68                  {
69                    dcache_req_val  [num_port] = 1;
70                    lsq_req_ack [num_execute_loop][num_load_store_unit][num_cache_access] = dcache_req_ack;
71                   
72                    log_printf(TRACE,Dcache_Access,FUNCTION,"    * kane - dcache");
73
74                    if (_param->_have_port_dcache_thread_id)
75                      {
76                    Tcontext_t num_context = (_param->_have_port_lsq_thread_id [num_execute_loop][num_load_store_unit])?PORT_READ(in_LSQ_REQ_THREAD_ID [num_execute_loop][num_load_store_unit][num_cache_access]):0;
77                    Tcontext_t num_thread  = _param->_translate_load_store_unit_to_thread[num_execute_loop][num_load_store_unit][num_context];
78                    log_printf(TRACE,Dcache_Access,FUNCTION,"    * num_context : %d",num_context);
79                    log_printf(TRACE,Dcache_Access,FUNCTION,"    * num_thread  : %d",num_thread );
80
81
82                    PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], num_thread);
83                      }
84//                  PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], ((num_execute_loop    << _param->_shift_num_execute_loop   )+
85//                                                                   (num_load_store_unit << _param->_shift_num_load_store_unit)+
86//                                                                   (num_cache_access    << _param->_shift_num_cache_access   )+
87//                                                                    num_context));
88                    if (_param->_have_port_dcache_packet_id)
89                      {
90                    Tpacket_t packet_id = (_param->_have_port_lsq_packet_id [num_execute_loop][num_load_store_unit])?PORT_READ(in_LSQ_REQ_PACKET_ID [num_execute_loop][num_load_store_unit][num_cache_access]):0;
91                    PORT_WRITE(out_DCACHE_REQ_PACKET_ID [num_port], ((num_cache_access    << _param->_shift_num_cache_access   )+
92                                                                     packet_id));
93                      }
94                    PORT_WRITE(out_DCACHE_REQ_ADDRESS   [num_port], PORT_READ(in_LSQ_REQ_ADDRESS   [num_execute_loop][num_load_store_unit][num_cache_access]));
95                    PORT_WRITE(out_DCACHE_REQ_WDATA     [num_port], PORT_READ(in_LSQ_REQ_WDATA     [num_execute_loop][num_load_store_unit][num_cache_access]));
96                    PORT_WRITE(out_DCACHE_REQ_TYPE      [num_port], PORT_READ(in_LSQ_REQ_TYPE      [num_execute_loop][num_load_store_unit][num_cache_access]));
97                  }
98              }
99          }
100      }
101   
102    for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
103      PORT_WRITE(out_DCACHE_REQ_VAL [i], dcache_req_val [i]);
104   
105    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
106      for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
107        for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
108          PORT_WRITE(out_LSQ_REQ_ACK [i][j][k], lsq_req_ack [i][j][k]);
109      }
110
111    else
112      {
113        for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
114          PORT_WRITE(out_DCACHE_REQ_VAL [i], 0);
115       
116        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
117          for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
118            for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
119              PORT_WRITE(out_LSQ_REQ_ACK [i][j][k], 0);
120      }
121
122    log_end(Dcache_Access,FUNCTION);
123  };
124
125}; // end namespace dcache_access
126}; // end namespace core
127
128}; // end namespace behavioural
129}; // end namespace morpheo             
130#endif
Note: See TracBrowser for help on using the repository browser.