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

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Dcache_Access_genMealy_req.cpp 88 2008-12-10 18:31:39Z 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    Tcontrol_t dcache_req_val [_param->_nb_dcache_port];
24    for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
25      {
26        dcache_req_val [i] = 0;
27       
28#ifdef STATISTICS
29        _internal_DCACHE_REQ_NB_ACCESS         [i] = 0;
30        _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [i] = 0;
31#endif
32      }
33   
34    Tcontrol_t lsq_req_ack [_param->_nb_execute_loop][_param->_max_nb_load_store_unit][_param->_max_nb_cache_access];
35    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
36      for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
37        for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
38          lsq_req_ack [i][j][k] = 0;
39   
40    std::list<generic::priority::select_t> * select = _priority ->select();
41    for (std::list<generic::priority::select_t>::iterator it=select ->begin();
42         it!=select->end();
43         ++it)
44      {
45        uint32_t num_execute_loop    = it->grp;
46        uint32_t num_load_store_unit = it->elt;
47       
48        for (uint32_t num_cache_access = 0; num_cache_access<_param->_nb_cache_access [num_execute_loop][num_load_store_unit]; ++num_cache_access)
49          {
50            if (PORT_READ(in_LSQ_REQ_VAL [num_execute_loop][num_load_store_unit][num_cache_access]))
51              {
52                uint32_t   num_port       = _param->_table_routing[num_execute_loop][num_load_store_unit][num_cache_access];
53                Tcontrol_t dcache_req_ack = PORT_READ(in_DCACHE_REQ_ACK [num_port]);
54               
55#ifdef STATISTICS
56                if (dcache_req_ack)
57                  {
58                    _internal_DCACHE_REQ_NB_ACCESS [num_port] ++;
59                    if (dcache_req_val [num_port])
60                    _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [num_port] ++;
61                  }
62#endif
63                if (not dcache_req_val [num_port])
64                  {
65                    dcache_req_val  [num_port] = 1;
66                    lsq_req_ack [num_execute_loop][num_load_store_unit][num_cache_access] = dcache_req_ack;
67                   
68                    if (_param->_have_port_dcache_thread_id)
69                      {
70                    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;
71                    PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], _param->_translate_load_store_unit_to_thread[num_execute_loop][num_load_store_unit][num_context]);
72                      }
73//                  PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], ((num_execute_loop    << _param->_shift_num_execute_loop   )+
74//                                                                   (num_load_store_unit << _param->_shift_num_load_store_unit)+
75//                                                                   (num_cache_access    << _param->_shift_num_cache_access   )+
76//                                                                    num_context));
77                    if (_param->_have_port_dcache_packet_id)
78                      {
79                    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;
80                    PORT_WRITE(out_DCACHE_REQ_PACKET_ID [num_port], ((num_cache_access    << _param->_shift_num_cache_access   )+
81                                                                     packet_id));
82                      }
83                    PORT_WRITE(out_DCACHE_REQ_ADDRESS   [num_port], PORT_READ(in_LSQ_REQ_ADDRESS   [num_execute_loop][num_load_store_unit][num_cache_access]));
84                    PORT_WRITE(out_DCACHE_REQ_WDATA     [num_port], PORT_READ(in_LSQ_REQ_WDATA     [num_execute_loop][num_load_store_unit][num_cache_access]));
85                    PORT_WRITE(out_DCACHE_REQ_TYPE      [num_port], PORT_READ(in_LSQ_REQ_TYPE      [num_execute_loop][num_load_store_unit][num_cache_access]));
86                  }
87              }
88          }
89      }
90   
91    for (uint32_t i=0; i<_param->_nb_dcache_port; ++i)
92      PORT_WRITE(out_DCACHE_REQ_VAL [i], dcache_req_val [i]);
93   
94    for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
95      for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j)
96        for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k)
97          PORT_WRITE(out_LSQ_REQ_ACK [i][j][k], lsq_req_ack [i][j][k]);
98
99    log_end(Dcache_Access,FUNCTION);
100  };
101
102}; // end namespace dcache_access
103}; // end namespace core
104
105}; // end namespace behavioural
106}; // end namespace morpheo             
107#endif
Note: See TracBrowser for help on using the repository browser.