[59] | 1 | /* |
---|
| 2 | * $Id: Load_store_unit.cpp 145 2010-10-13 18:15:51Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Load_store_unit.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | namespace multi_execute_loop { |
---|
| 14 | namespace execute_loop { |
---|
| 15 | namespace multi_execute_unit { |
---|
| 16 | namespace execute_unit { |
---|
| 17 | namespace load_store_unit { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Load_store_unit::Load_store_unit" |
---|
[82] | 22 | Load_store_unit::Load_store_unit |
---|
| 23 | ( |
---|
[59] | 24 | #ifdef SYSTEMC |
---|
[82] | 25 | sc_module_name name, |
---|
[59] | 26 | #else |
---|
[82] | 27 | std::string name, |
---|
[59] | 28 | #endif |
---|
| 29 | #ifdef STATISTICS |
---|
[82] | 30 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
[59] | 31 | #endif |
---|
[82] | 32 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters * param , |
---|
| 33 | morpheo::behavioural::Tusage_t usage |
---|
| 34 | ): |
---|
| 35 | _name (name) |
---|
| 36 | ,_param (param) |
---|
| 37 | ,_usage (usage) |
---|
[59] | 38 | { |
---|
| 39 | log_printf(FUNC,Load_store_unit,FUNCTION,"Begin"); |
---|
| 40 | |
---|
[123] | 41 | // #if DEBUG_Load_store_unit == true |
---|
| 42 | // log_printf(INFO,Load_store_unit,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 43 | |
---|
[123] | 44 | // std::cout << *param << std::endl; |
---|
| 45 | // #endif |
---|
[88] | 46 | |
---|
[59] | 47 | #ifdef SYSTEMC |
---|
| 48 | log_printf(INFO,Load_store_unit,FUNCTION,"Allocation"); |
---|
| 49 | |
---|
| 50 | allocation (); |
---|
| 51 | #endif |
---|
| 52 | |
---|
| 53 | #ifdef STATISTICS |
---|
[88] | 54 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 55 | { |
---|
| 56 | log_printf(INFO,Load_store_unit,FUNCTION,"Allocation of statistics"); |
---|
| 57 | |
---|
[110] | 58 | statistics_allocation(param_statistics); |
---|
[88] | 59 | } |
---|
[59] | 60 | #endif |
---|
| 61 | |
---|
| 62 | #ifdef VHDL |
---|
[88] | 63 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 64 | { |
---|
| 65 | // generate the vhdl |
---|
| 66 | log_printf(INFO,Load_store_unit,FUNCTION,"Generate the vhdl"); |
---|
| 67 | |
---|
| 68 | vhdl(); |
---|
| 69 | } |
---|
[59] | 70 | #endif |
---|
| 71 | |
---|
| 72 | #ifdef SYSTEMC |
---|
[88] | 73 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 74 | { |
---|
[111] | 75 | |
---|
[59] | 76 | // Function pointer |
---|
| 77 | switch (_param->_speculative_load) |
---|
| 78 | { |
---|
[145] | 79 | case SPECULATIVE_LOAD_COMMIT : |
---|
[59] | 80 | { |
---|
[145] | 81 | function_transition = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_transition ; |
---|
| 82 | function_genMoore = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMoore ; |
---|
| 83 | function_genMealy_dcache = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_dcache; |
---|
| 84 | function_genMealy_insert = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_insert; |
---|
| 85 | function_genMealy_retire = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_retire; |
---|
[59] | 86 | break; |
---|
| 87 | } |
---|
| 88 | case NO_SPECULATIVE_LOAD : |
---|
[145] | 89 | // case SPECULATIVE_LOAD_ACCESS : |
---|
[59] | 90 | default : |
---|
| 91 | { |
---|
| 92 | break; |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | |
---|
[131] | 96 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 97 | constant(); |
---|
| 98 | #else |
---|
| 99 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - constant"); |
---|
[71] | 100 | |
---|
[131] | 101 | SC_METHOD (constant); |
---|
| 102 | // dont_initialize (); |
---|
[71] | 103 | |
---|
[131] | 104 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 105 | // List dependency information |
---|
| 106 | #endif |
---|
| 107 | #endif |
---|
[88] | 108 | |
---|
[59] | 109 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - transition"); |
---|
| 110 | |
---|
| 111 | SC_METHOD (transition); |
---|
| 112 | dont_initialize (); |
---|
[131] | 113 | sensitive << (*(in_CLOCK)).pos(); |
---|
[59] | 114 | |
---|
| 115 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 116 | // List dependency information |
---|
| 117 | #endif |
---|
| 118 | |
---|
| 119 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMoore"); |
---|
| 120 | |
---|
| 121 | SC_METHOD (genMoore); |
---|
| 122 | dont_initialize (); |
---|
[131] | 123 | sensitive << (*(in_CLOCK)).neg(); |
---|
[59] | 124 | |
---|
| 125 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 126 | // List dependency information |
---|
| 127 | #endif |
---|
| 128 | |
---|
| 129 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_insert"); |
---|
| 130 | |
---|
| 131 | SC_METHOD (genMealy_insert); |
---|
| 132 | dont_initialize (); |
---|
[132] | 133 | sensitive << (*(in_CLOCK)).neg() |
---|
| 134 | << (*(in_NRESET)); |
---|
[88] | 135 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
| 136 | sensitive << (*(in_MEMORY_IN_VAL [i])) |
---|
| 137 | << (*(in_MEMORY_IN_OPERATION [i])); |
---|
[59] | 138 | |
---|
| 139 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 140 | // List dependency information |
---|
[88] | 141 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
| 142 | // for (uint32_t x=0; x<_param->_nb_inst_memory; x++) |
---|
| 143 | { |
---|
| 144 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_VAL [i])); |
---|
| 145 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_OPERATION [i])); |
---|
| 146 | } |
---|
[59] | 147 | #endif |
---|
| 148 | |
---|
| 149 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_retire"); |
---|
| 150 | |
---|
| 151 | SC_METHOD (genMealy_retire); |
---|
| 152 | dont_initialize (); |
---|
[132] | 153 | sensitive << (*(in_CLOCK)).neg() |
---|
| 154 | << (*(in_NRESET)); |
---|
[59] | 155 | |
---|
| 156 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 157 | // List dependency information |
---|
| 158 | #endif |
---|
| 159 | |
---|
| 160 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_dcache"); |
---|
| 161 | |
---|
| 162 | SC_METHOD (genMealy_dcache); |
---|
| 163 | dont_initialize (); |
---|
[132] | 164 | sensitive << (*(in_CLOCK)).neg() |
---|
| 165 | << (*(in_NRESET)); |
---|
[59] | 166 | |
---|
| 167 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 168 | // List dependency information |
---|
| 169 | #endif |
---|
[88] | 170 | } |
---|
[59] | 171 | #endif |
---|
| 172 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
| 173 | }; |
---|
| 174 | |
---|
| 175 | #undef FUNCTION |
---|
| 176 | #define FUNCTION "Load_store_unit::~Load_store_unit" |
---|
| 177 | Load_store_unit::~Load_store_unit (void) |
---|
| 178 | { |
---|
| 179 | log_printf(FUNC,Load_store_unit,FUNCTION,"Begin"); |
---|
| 180 | |
---|
| 181 | #ifdef STATISTICS |
---|
[88] | 182 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[110] | 183 | statistics_deallocation (); |
---|
[59] | 184 | #endif |
---|
| 185 | |
---|
| 186 | #ifdef SYSTEMC |
---|
| 187 | log_printf(INFO,Load_store_unit,FUNCTION,"Deallocation"); |
---|
| 188 | |
---|
| 189 | deallocation (); |
---|
| 190 | #endif |
---|
| 191 | |
---|
| 192 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
| 193 | }; |
---|
| 194 | |
---|
| 195 | }; // end namespace load_store_unit |
---|
| 196 | }; // end namespace execute_unit |
---|
| 197 | }; // end namespace multi_execute_unit |
---|
| 198 | }; // end namespace execute_loop |
---|
| 199 | }; // end namespace multi_execute_loop |
---|
| 200 | }; // end namespace core |
---|
| 201 | |
---|
| 202 | }; // end namespace behavioural |
---|
| 203 | }; // end namespace morpheo |
---|