| 1 | #include "../include/Environment.h"
|
|---|
| 2 |
|
|---|
| 3 | using namespace morpheo;
|
|---|
| 4 |
|
|---|
| 5 | namespace 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 | _cout(ENVIRONMENT, "buffer_irsp [%d] : nb_slot_use %d\n",i,component_buffer_irsp [i]->nb_slot_use());
|
|---|
| 37 | for (uint32_t j = 0; j+1 <= component_buffer_irsp [i]->nb_slot_use(); j ++)
|
|---|
| 38 | {
|
|---|
| 39 | // Test the number of element in the respons's buffer
|
|---|
| 40 |
|
|---|
| 41 | queue::slot_t<irsp_t*> slot = component_buffer_irsp [i]->read(j);
|
|---|
| 42 |
|
|---|
| 43 | uint32_t port = slot._data->port;
|
|---|
| 44 |
|
|---|
| 45 | bool val = ((slot._delay == 0) and (icache_rsp_val [i][port] == 0));
|
|---|
| 46 |
|
|---|
| 47 | _cout(ENVIRONMENT, "buffer_irsp [%d][%d] - delay %d - port %d\n",i,j,slot._delay,port);
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | if (val)
|
|---|
| 51 | {
|
|---|
| 52 | _cout(ENVIRONMENT, "ICACHE_RSP [%d][%d] - respons valid\n",i,port);
|
|---|
| 53 |
|
|---|
| 54 | icache_rsp_val [i][port] = 1;
|
|---|
| 55 |
|
|---|
| 56 | ICACHE_RSP_CONTEXT_ID [i][port]->write(slot._data->trdid); // TODO : test if exist
|
|---|
| 57 | ICACHE_RSP_PACKET_ID [i][port]->write(slot._data->pktid); // TODO : test if exist
|
|---|
| 58 | ICACHE_RSP_ERROR [i][port]->write(slot._data->error);
|
|---|
| 59 |
|
|---|
| 60 | for (uint32_t k = 0; k < param->iaccess_nb_instruction[i]; k ++)
|
|---|
| 61 | {
|
|---|
| 62 | Ticache_instruction_t data = 0;
|
|---|
| 63 |
|
|---|
| 64 | atoi (slot._data->data[k], data, param->iaccess_size_instruction[i]/8);
|
|---|
| 65 |
|
|---|
| 66 | ICACHE_RSP_INSTRUCTION [i][port][k]->write(data);
|
|---|
| 67 | }
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | for (uint32_t j = 0; j < param->icache_dedicated_nb_port [i]; j ++)
|
|---|
| 72 | ICACHE_RSP_VAL [i][j]->write (icache_rsp_val [i][j]);
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | //=============================================================================
|
|---|
| 76 | //===== [ DCACHE ]=============================================================
|
|---|
| 77 | //=============================================================================
|
|---|
| 78 |
|
|---|
| 79 | //-----------------------------------------------------------------------------
|
|---|
| 80 | //----- [ Request ]------------------------------------------------------------
|
|---|
| 81 | //-----------------------------------------------------------------------------
|
|---|
| 82 | {
|
|---|
| 83 | uint32_t nb_slot_free = component_buffer_drsp [i]->nb_slot_free ();
|
|---|
| 84 | for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
|
|---|
| 85 | {
|
|---|
| 86 | dcache_req_ack [i][j] = (j < nb_slot_free);
|
|---|
| 87 | DCACHE_REQ_ACK [i][j]->write (dcache_req_ack [i][j]);
|
|---|
| 88 | }
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | //-----------------------------------------------------------------------------
|
|---|
| 92 | //----- [ Respons ]------------------------------------------------------------
|
|---|
| 93 | //-----------------------------------------------------------------------------
|
|---|
| 94 | {
|
|---|
| 95 | for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
|
|---|
| 96 | {
|
|---|
| 97 | // Test the number of element in the respons's buffer
|
|---|
| 98 | if (j >= component_buffer_drsp [i]->nb_slot_use())
|
|---|
| 99 | {
|
|---|
| 100 | dcache_rsp_val [i][j] = 0; // No respons
|
|---|
| 101 | }
|
|---|
| 102 | else
|
|---|
| 103 | {
|
|---|
| 104 | queue::slot_t<drsp_t*> slot = component_buffer_drsp [i]->read(j);
|
|---|
| 105 |
|
|---|
| 106 | bool val = (slot._delay == 0); // respons if have a result
|
|---|
| 107 |
|
|---|
| 108 | dcache_rsp_val [i][j] = (val); // respons if have a result
|
|---|
| 109 |
|
|---|
| 110 | if (val)
|
|---|
| 111 | {
|
|---|
| 112 | _cout(ENVIRONMENT, "DCACHE_RSP [%d][%d] - respons valid\n",i,j);
|
|---|
| 113 |
|
|---|
| 114 | DCACHE_RSP_CONTEXT_ID [i][j]->write(slot._data->trdid); // TODO : test if exist
|
|---|
| 115 | DCACHE_RSP_PACKET_ID [i][j]->write(slot._data->pktid); // TODO : test if exist
|
|---|
| 116 | DCACHE_RSP_ERROR [i][j]->write(slot._data->error);
|
|---|
| 117 |
|
|---|
| 118 | Tdcache_data_t data = 0;
|
|---|
| 119 | atoi (slot._data->data[0], data, param->daccess_size_data[i]/8);
|
|---|
| 120 |
|
|---|
| 121 | DCACHE_RSP_RDATA [i][j]->write(data);
|
|---|
| 122 | }
|
|---|
| 123 | }
|
|---|
| 124 | DCACHE_RSP_VAL [i][j]->write (dcache_rsp_val [i][j]);
|
|---|
| 125 | }
|
|---|
| 126 | }
|
|---|
| 127 | }
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | };
|
|---|