[88] | 1 | /* |
---|
| 2 | * $Id: Icache_Access.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Icache_Access/include/Icache_Access.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | namespace icache_access { |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #undef FUNCTION |
---|
| 17 | #define FUNCTION "Icache_Access::Icache_Access" |
---|
| 18 | Icache_Access::Icache_Access |
---|
| 19 | ( |
---|
| 20 | #ifdef SYSTEMC |
---|
| 21 | sc_module_name name, |
---|
| 22 | #else |
---|
| 23 | string name, |
---|
| 24 | #endif |
---|
| 25 | #ifdef STATISTICS |
---|
| 26 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 27 | #endif |
---|
| 28 | morpheo::behavioural::core::icache_access::Parameters * param, |
---|
| 29 | morpheo::behavioural::Tusage_t usage |
---|
| 30 | ): |
---|
| 31 | _name (name) |
---|
| 32 | ,_param (param) |
---|
| 33 | ,_usage (usage) |
---|
| 34 | { |
---|
| 35 | log_begin(Icache_Access,FUNCTION); |
---|
| 36 | |
---|
| 37 | usage_environment(_usage); |
---|
| 38 | |
---|
[123] | 39 | // #if DEBUG_Core == true |
---|
| 40 | // log_printf(INFO,Core,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 41 | |
---|
[123] | 42 | // std::cout << *param << std::endl; |
---|
| 43 | // #endif |
---|
[88] | 44 | |
---|
| 45 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Allocation"),_name.c_str()); |
---|
| 46 | |
---|
| 47 | allocation ( |
---|
| 48 | #ifdef STATISTICS |
---|
| 49 | param_statistics |
---|
| 50 | #endif |
---|
| 51 | ); |
---|
| 52 | |
---|
| 53 | #ifdef STATISTICS |
---|
| 54 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 55 | { |
---|
| 56 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str()); |
---|
| 57 | |
---|
| 58 | statistics_allocation(param_statistics); |
---|
| 59 | } |
---|
| 60 | #endif |
---|
| 61 | |
---|
| 62 | #ifdef VHDL |
---|
| 63 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 64 | { |
---|
| 65 | // generate the vhdl |
---|
| 66 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str()); |
---|
| 67 | |
---|
| 68 | vhdl(); |
---|
| 69 | } |
---|
| 70 | #endif |
---|
| 71 | |
---|
| 72 | #ifdef SYSTEMC |
---|
| 73 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 74 | { |
---|
| 75 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - transition"),_name.c_str()); |
---|
| 76 | |
---|
| 77 | SC_METHOD (transition); |
---|
| 78 | dont_initialize (); |
---|
| 79 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 80 | |
---|
| 81 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 82 | // List dependency information |
---|
| 83 | # endif |
---|
| 84 | |
---|
| 85 | // log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str()); |
---|
| 86 | |
---|
| 87 | // SC_METHOD (genMoore); |
---|
| 88 | // dont_initialize (); |
---|
| 89 | // sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
| 90 | |
---|
| 91 | // # ifdef SYSTEMCASS_SPECIFIC |
---|
| 92 | // // List dependency information |
---|
| 93 | // # endif |
---|
| 94 | |
---|
| 95 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMealy_req"),_name.c_str()); |
---|
| 96 | |
---|
| 97 | SC_METHOD (genMealy_req); |
---|
| 98 | dont_initialize (); |
---|
[132] | 99 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 100 | << (*(in_NRESET)); |
---|
[88] | 101 | |
---|
| 102 | for (uint32_t i=0; i<_param->_nb_icache_port; ++i) |
---|
| 103 | sensitive << (*(in_ICACHE_REQ_ACK [i])); |
---|
| 104 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 105 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 106 | { |
---|
| 107 | sensitive << (*(in_CONTEXT_REQ_VAL [i][j])) |
---|
| 108 | << (*(in_CONTEXT_REQ_ADDRESS [i][j])) |
---|
| 109 | << (*(in_CONTEXT_REQ_TYPE [i][j])); |
---|
| 110 | if (_param->_have_port_packet_id [i][j]) |
---|
| 111 | sensitive << (*(in_CONTEXT_REQ_PACKET_ID [i][j])); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 115 | // List dependency information |
---|
| 116 | |
---|
| 117 | for (uint32_t i=0; i<_param->_nb_icache_port; ++i) |
---|
| 118 | { |
---|
| 119 | for (uint32_t x=0; x<_param->_nb_icache_port; ++x) |
---|
| 120 | { |
---|
| 121 | (*(out_ICACHE_REQ_VAL [i])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 122 | if (_param->_have_port_icache_thread_id) |
---|
| 123 | (*(out_ICACHE_REQ_THREAD_ID [i])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 124 | if (_param->_have_port_icache_packet_id) |
---|
| 125 | (*(out_ICACHE_REQ_PACKET_ID [i])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 126 | (*(out_ICACHE_REQ_ADDRESS [i])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 127 | (*(out_ICACHE_REQ_TYPE [i])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 128 | } |
---|
| 129 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
| 130 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
| 131 | { |
---|
| 132 | (*(out_ICACHE_REQ_VAL [i])) (*(in_CONTEXT_REQ_VAL [x][y])); |
---|
| 133 | if (_param->_have_port_packet_id [x][y]) |
---|
| 134 | (*(out_ICACHE_REQ_PACKET_ID [i])) (*(in_CONTEXT_REQ_PACKET_ID [x][y])); |
---|
| 135 | (*(out_ICACHE_REQ_ADDRESS [i])) (*(in_CONTEXT_REQ_ADDRESS [x][y])); |
---|
| 136 | (*(out_ICACHE_REQ_TYPE [i])) (*(in_CONTEXT_REQ_TYPE [x][y])); |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 141 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 142 | { |
---|
| 143 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
| 144 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
| 145 | (*(out_CONTEXT_REQ_ACK [i][j])) (*(in_CONTEXT_REQ_VAL [x][y])); |
---|
| 146 | |
---|
| 147 | for (uint32_t x=0; x<_param->_nb_icache_port; ++x) |
---|
| 148 | (*(out_CONTEXT_REQ_ACK [i][j])) (*(in_ICACHE_REQ_ACK [x])); |
---|
| 149 | } |
---|
| 150 | # endif |
---|
| 151 | |
---|
| 152 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Method - genMealy_rsp"),_name.c_str()); |
---|
| 153 | |
---|
| 154 | SC_METHOD (genMealy_rsp); |
---|
| 155 | dont_initialize (); |
---|
[132] | 156 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 157 | << (*(in_NRESET)); |
---|
| 158 | |
---|
[88] | 159 | for (uint32_t i=0; i<_param->_nb_icache_port; ++i) |
---|
| 160 | { |
---|
| 161 | sensitive << (*(in_ICACHE_RSP_VAL [i])) |
---|
| 162 | << (*(in_ICACHE_RSP_ERROR [i])); |
---|
| 163 | if (_param->_have_port_icache_thread_id) |
---|
| 164 | sensitive << (*(in_ICACHE_RSP_THREAD_ID [i])); |
---|
| 165 | if (_param->_have_port_icache_packet_id) |
---|
| 166 | sensitive << (*(in_ICACHE_RSP_PACKET_ID [i])); |
---|
| 167 | |
---|
| 168 | for (uint32_t j=0; j<_param->_icache_nb_instruction[i]; ++j) |
---|
| 169 | sensitive << (*(in_ICACHE_RSP_INSTRUCTION [i][j])); |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 173 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 174 | sensitive << (*(in_CONTEXT_RSP_ACK [i][j])); |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | |
---|
| 178 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 179 | // List dependency information |
---|
| 180 | |
---|
| 181 | for (uint32_t i=0; i<_param->_nb_icache_port; ++i) |
---|
| 182 | { |
---|
| 183 | if (_param->_have_port_icache_thread_id) |
---|
| 184 | (*(out_ICACHE_RSP_ACK [i])) (*(in_ICACHE_RSP_THREAD_ID [i])); |
---|
| 185 | |
---|
| 186 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
| 187 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
| 188 | (*(out_ICACHE_RSP_ACK [i])) (*(in_CONTEXT_RSP_ACK [x][y])); |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 192 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 193 | for (uint32_t x=0; x<_param->_nb_icache_port; ++x) |
---|
| 194 | { |
---|
| 195 | if (_param->_have_port_icache_thread_id) |
---|
| 196 | { |
---|
| 197 | (*(out_CONTEXT_RSP_VAL [i][j])) (*(in_ICACHE_RSP_THREAD_ID [x])); |
---|
| 198 | if (_param->_have_port_packet_id [i][j]) |
---|
| 199 | (*(out_CONTEXT_RSP_PACKET_ID [i][j])) (*(in_ICACHE_RSP_THREAD_ID [x])); |
---|
| 200 | (*(out_CONTEXT_RSP_ERROR [i][j])) (*(in_ICACHE_RSP_THREAD_ID [x])); |
---|
| 201 | for (uint32_t k=0; k<_param->_nb_instruction [i][j]; ++k) |
---|
| 202 | (*(out_CONTEXT_RSP_INSTRUCTION [i][j][k])) (*(in_ICACHE_RSP_THREAD_ID [x])); |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | (*(out_CONTEXT_RSP_VAL [i][j])) (*(in_ICACHE_RSP_VAL [x])); |
---|
| 206 | if (_param->_have_port_packet_id [i][j]) |
---|
| 207 | (*(out_CONTEXT_RSP_PACKET_ID [i][j])) (*(in_ICACHE_RSP_PACKET_ID [x])); |
---|
| 208 | (*(out_CONTEXT_RSP_ERROR [i][j])) (*(in_ICACHE_RSP_ERROR [x])); |
---|
| 209 | for (uint32_t k=0; k<_param->_nb_instruction [i][j]; ++k) |
---|
| 210 | for (uint32_t y=0; y<_param->_icache_nb_instruction[x]; ++y) |
---|
| 211 | (*(out_CONTEXT_RSP_INSTRUCTION [i][j][k])) (*(in_ICACHE_RSP_INSTRUCTION [x][y])); |
---|
| 212 | } |
---|
| 213 | # endif |
---|
| 214 | |
---|
| 215 | #endif |
---|
| 216 | } |
---|
| 217 | log_end(Icache_Access,FUNCTION); |
---|
| 218 | }; |
---|
| 219 | |
---|
| 220 | #undef FUNCTION |
---|
| 221 | #define FUNCTION "Icache_Access::~Icache_Access" |
---|
| 222 | Icache_Access::~Icache_Access (void) |
---|
| 223 | { |
---|
| 224 | log_begin(Icache_Access,FUNCTION); |
---|
| 225 | |
---|
| 226 | #ifdef STATISTICS |
---|
| 227 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 228 | { |
---|
| 229 | statistics_deallocation(); |
---|
| 230 | } |
---|
| 231 | #endif |
---|
| 232 | |
---|
| 233 | log_printf(INFO,Icache_Access,FUNCTION,_("<%s> : Deallocation"),_name.c_str()); |
---|
| 234 | deallocation (); |
---|
| 235 | |
---|
| 236 | log_end(Icache_Access,FUNCTION); |
---|
| 237 | }; |
---|
| 238 | |
---|
| 239 | }; // end namespace icache_access |
---|
| 240 | }; // end namespace core |
---|
| 241 | |
---|
| 242 | }; // end namespace behavioural |
---|
| 243 | }; // end namespace morpheo |
---|