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