source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Icache_Access/src/Icache_Access_genMealy_rsp.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: 3.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Icache_Access_genMealy_rsp.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Icache_Access/include/Icache_Access.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace icache_access {
15
16
17#undef  FUNCTION
18#define FUNCTION "Icache_Access::genMealy_rsp"
19  void Icache_Access::genMealy_rsp (void)
20  {
21    log_begin(Icache_Access,FUNCTION);
22
23    Tcontrol_t context_rsp_val [_param->_nb_front_end][_param->_max_nb_context];
24    for (uint32_t i=0; i<_param->_nb_front_end; ++i)
25      for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
26        context_rsp_val [i][j] = 0;
27
28    if (PORT_READ(in_NRESET))
29      {
30    for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
31      {
32        Tcontrol_t val = PORT_READ(in_ICACHE_RSP_VAL [i]);
33        Tcontrol_t ack;
34       
35        Tcontext_t thread_id = (_param->_have_port_icache_thread_id)?PORT_READ(in_ICACHE_RSP_THREAD_ID [i]):0;
36
37#ifdef DEBUG_TEST
38        if (thread_id > _param->_nb_thread)
39          throw ERRORMORPHEO(FUNCTION,_("invalid thread_id.\n"));
40#endif
41
42        if (val)
43          {
44            Tcontext_t front_end_id = _param->_translate_thread_to_context  [thread_id];
45            Tcontext_t context_id   = _param->_translate_thread_to_front_end[thread_id];
46           
47//          log_printf(TRACE,Icache_Access,FUNCTION,"thread_id     : %d",thread_id);
48//          log_printf(TRACE,Icache_Access,FUNCTION,"front_end_id  : %d",front_end_id);
49//          log_printf(TRACE,Icache_Access,FUNCTION,"context_id    : %d",context_id);
50           
51#ifdef DEBUG_TEST
52            if (front_end_id > _param->_nb_front_end)
53              throw ERRORMORPHEO(FUNCTION,_("invalid front_end_id.\n"));
54
55            if (context_id > _param->_nb_context[front_end_id])
56              throw ERRORMORPHEO(FUNCTION,_("invalid context_id.\n"));
57
58            if (_param->_table_routing [front_end_id][context_id] != i)
59              throw ERRORMORPHEO(FUNCTION,_("invalid route.\n"));
60#endif
61
62            ack = PORT_READ(in_CONTEXT_RSP_ACK [front_end_id][context_id]);
63           
64            context_rsp_val [front_end_id][context_id] = 1;
65//          if (_param->_have_port_icache_packet_id)
66            if (_param->_have_port_packet_id [front_end_id][context_id])
67            PORT_WRITE(out_CONTEXT_RSP_PACKET_ID   [front_end_id][context_id], PORT_READ(in_ICACHE_RSP_PACKET_ID   [i]));
68            PORT_WRITE(out_CONTEXT_RSP_ERROR       [front_end_id][context_id], PORT_READ(in_ICACHE_RSP_ERROR       [i]));
69           
70            for (uint32_t j=0; j<_param->_nb_instruction [front_end_id][context_id]; ++j)
71              PORT_WRITE(out_CONTEXT_RSP_INSTRUCTION [front_end_id][context_id][j], PORT_READ(in_ICACHE_RSP_INSTRUCTION [i][j]));
72          }
73        else
74          ack = 0;
75               
76        PORT_WRITE(out_ICACHE_RSP_ACK [i],ack);
77      }
78
79      }
80    else
81      for (uint32_t i=0; i<_param->_nb_icache_port; ++i)
82        PORT_WRITE(out_ICACHE_RSP_ACK [i],0);
83
84    for (uint32_t i=0; i<_param->_nb_front_end; ++i)
85      for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
86        PORT_WRITE(out_CONTEXT_RSP_VAL [i][j], context_rsp_val [i][j]);
87
88    log_end(Icache_Access,FUNCTION);
89  };
90
91}; // end namespace icache_access
92}; // end namespace core
93
94}; // end namespace behavioural
95}; // end namespace morpheo             
96#endif
Note: See TracBrowser for help on using the repository browser.