source: trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp @ 124

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

1) Add test and configuration
2) Fix Bug
3) Add log file in load store unit
4) Fix Bug in environment

  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1#include "../include/Environment.h"
2
3using namespace morpheo;
4
5namespace environment {
6
7  void Environment::genMoore (void)
8  {
9    //Scan all entity and for each entity scan all port
10    for (uint32_t i = 0; i < param->nb_entity; i++)
11      {
12        //=============================================================================
13        //===== [ ICACHE ]=============================================================
14        //=============================================================================
15       
16        //-----------------------------------------------------------------------------
17        //----- [ Request ]------------------------------------------------------------
18        //-----------------------------------------------------------------------------
19        {
20          uint32_t nb_slot_free = component_buffer_irsp [i]->nb_slot_free ();
21          for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j ++)
22            {
23              icache_req_ack [i][j] = (j < nb_slot_free);
24              ICACHE_REQ_ACK [i][j]->write (icache_req_ack [i][j]);
25            }
26        }
27
28        //-----------------------------------------------------------------------------
29        //----- [ Respons ]------------------------------------------------------------
30        //-----------------------------------------------------------------------------
31        {
32          // init
33          for (uint32_t j = 0; j < param->icache_dedicated_nb_port [i]; j ++)
34            icache_rsp_val [i][j] = 0;
35
36          for (uint32_t j = 0; j+1 < component_buffer_irsp [i]->nb_slot_use(); j ++)
37            {
38              // Test the number of element in the respons's buffer
39             
40              queue::slot_t<irsp_t*> slot = component_buffer_irsp [i]->read(j);
41             
42              uint32_t port = slot._data->port;
43             
44              bool val = ((slot._delay == 0) and (icache_rsp_val [i][port] == 0));
45
46              _cout(ENVIRONMENT, "buffer_irsp [%d][%d] - delay %d - port %d\n",i,j,slot._delay,port);
47
48             
49              if (val)
50                {
51                  _cout(ENVIRONMENT, "ICACHE_RSP [%d][%d] - respons valid\n",i,port);
52                 
53                  icache_rsp_val        [i][port] = 1;
54                               
55                  ICACHE_RSP_CONTEXT_ID [i][port]->write(slot._data->trdid); // TODO : test if exist
56                  ICACHE_RSP_PACKET_ID  [i][port]->write(slot._data->pktid); // TODO : test if exist
57                  ICACHE_RSP_ERROR      [i][port]->write(slot._data->error);
58                 
59                  for (uint32_t k = 0; k < param->iaccess_nb_instruction[i]; k ++)
60                    {
61                      Ticache_instruction_t data = 0;
62                     
63                      atoi (slot._data->data[k], data, param->iaccess_size_instruction[i]/8);
64                     
65                      ICACHE_RSP_INSTRUCTION [i][port][k]->write(data);
66                    }
67                }
68            }
69         
70          for (uint32_t j = 0; j < param->icache_dedicated_nb_port [i]; j ++)
71            ICACHE_RSP_VAL [i][j]->write (icache_rsp_val [i][j]);
72        }
73       
74        //=============================================================================
75        //===== [ DCACHE ]=============================================================
76        //=============================================================================
77       
78        //-----------------------------------------------------------------------------
79        //----- [ Request ]------------------------------------------------------------
80        //-----------------------------------------------------------------------------
81        {
82          uint32_t nb_slot_free = component_buffer_drsp [i]->nb_slot_free ();
83          for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
84            {
85              dcache_req_ack [i][j] = (j < nb_slot_free);
86              DCACHE_REQ_ACK [i][j]->write (dcache_req_ack [i][j]);
87            }
88        }
89       
90        //-----------------------------------------------------------------------------
91        //----- [ Respons ]------------------------------------------------------------
92        //-----------------------------------------------------------------------------
93        {
94          for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
95            {
96              // Test the number of element in the respons's buffer
97              if (j >= component_buffer_drsp [i]->nb_slot_use())
98                {
99                  dcache_rsp_val [i][j] = 0; // No respons
100                }
101              else
102                {
103                  queue::slot_t<drsp_t*> slot = component_buffer_drsp [i]->read(j);
104
105                  bool val = (slot._delay == 0); // respons if have a result
106                 
107                  dcache_rsp_val [i][j] = (val); // respons if have a result
108
109                  if (val)
110                    {
111                      _cout(ENVIRONMENT, "DCACHE_RSP [%d][%d] - respons valid\n",i,j);
112
113                      DCACHE_RSP_CONTEXT_ID [i][j]->write(slot._data->trdid); // TODO : test if exist
114                      DCACHE_RSP_PACKET_ID  [i][j]->write(slot._data->pktid); // TODO : test if exist
115                      DCACHE_RSP_ERROR      [i][j]->write(slot._data->error);
116                     
117                      Tdcache_data_t data = 0;
118                      atoi (slot._data->data[0], data, param->daccess_size_data[i]/8);
119                     
120                      DCACHE_RSP_RDATA       [i][j]->write(data);
121                    }
122                }
123              DCACHE_RSP_VAL [i][j]->write (dcache_rsp_val [i][j]);
124            }
125        }
126      }
127  }
128
129};
Note: See TracBrowser for help on using the repository browser.