[59] | 1 | /* |
---|
| 2 | * $Id: Load_store_unit.cpp 132 2009-07-11 16:39:35Z 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 | { |
---|
| 79 | case SPECULATIVE_LOAD_COMMIT : |
---|
| 80 | { |
---|
| 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; |
---|
| 86 | break; |
---|
| 87 | } |
---|
| 88 | case NO_SPECULATIVE_LOAD : |
---|
| 89 | case SPECULATIVE_LOAD_ACCESS : |
---|
[78] | 90 | //case SPECULATIVE_LOAD_BYPASS : |
---|
[59] | 91 | default : |
---|
| 92 | { |
---|
| 93 | break; |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
[131] | 97 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 98 | constant(); |
---|
| 99 | #else |
---|
| 100 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - constant"); |
---|
[71] | 101 | |
---|
[131] | 102 | SC_METHOD (constant); |
---|
| 103 | // dont_initialize (); |
---|
[71] | 104 | |
---|
[131] | 105 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 106 | // List dependency information |
---|
| 107 | #endif |
---|
| 108 | #endif |
---|
[88] | 109 | |
---|
[59] | 110 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - transition"); |
---|
| 111 | |
---|
| 112 | SC_METHOD (transition); |
---|
| 113 | dont_initialize (); |
---|
[131] | 114 | sensitive << (*(in_CLOCK)).pos(); |
---|
[59] | 115 | |
---|
| 116 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 117 | // List dependency information |
---|
| 118 | #endif |
---|
| 119 | |
---|
| 120 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMoore"); |
---|
| 121 | |
---|
| 122 | SC_METHOD (genMoore); |
---|
| 123 | dont_initialize (); |
---|
[131] | 124 | sensitive << (*(in_CLOCK)).neg(); |
---|
[59] | 125 | |
---|
| 126 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 127 | // List dependency information |
---|
| 128 | #endif |
---|
| 129 | |
---|
| 130 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_insert"); |
---|
| 131 | |
---|
| 132 | SC_METHOD (genMealy_insert); |
---|
| 133 | dont_initialize (); |
---|
[132] | 134 | sensitive << (*(in_CLOCK)).neg() |
---|
| 135 | << (*(in_NRESET)); |
---|
[88] | 136 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
| 137 | sensitive << (*(in_MEMORY_IN_VAL [i])) |
---|
| 138 | << (*(in_MEMORY_IN_OPERATION [i])); |
---|
[59] | 139 | |
---|
| 140 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 141 | // List dependency information |
---|
[88] | 142 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
| 143 | // for (uint32_t x=0; x<_param->_nb_inst_memory; x++) |
---|
| 144 | { |
---|
| 145 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_VAL [i])); |
---|
| 146 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_OPERATION [i])); |
---|
| 147 | } |
---|
[59] | 148 | #endif |
---|
| 149 | |
---|
| 150 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_retire"); |
---|
| 151 | |
---|
| 152 | SC_METHOD (genMealy_retire); |
---|
| 153 | dont_initialize (); |
---|
[132] | 154 | sensitive << (*(in_CLOCK)).neg() |
---|
| 155 | << (*(in_NRESET)); |
---|
[59] | 156 | |
---|
| 157 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 158 | // List dependency information |
---|
| 159 | #endif |
---|
| 160 | |
---|
| 161 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_dcache"); |
---|
| 162 | |
---|
| 163 | SC_METHOD (genMealy_dcache); |
---|
| 164 | dont_initialize (); |
---|
[132] | 165 | sensitive << (*(in_CLOCK)).neg() |
---|
| 166 | << (*(in_NRESET)); |
---|
[59] | 167 | |
---|
| 168 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 169 | // List dependency information |
---|
| 170 | #endif |
---|
[88] | 171 | } |
---|
[59] | 172 | #endif |
---|
| 173 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
| 174 | }; |
---|
| 175 | |
---|
| 176 | #undef FUNCTION |
---|
| 177 | #define FUNCTION "Load_store_unit::~Load_store_unit" |
---|
| 178 | Load_store_unit::~Load_store_unit (void) |
---|
| 179 | { |
---|
| 180 | log_printf(FUNC,Load_store_unit,FUNCTION,"Begin"); |
---|
| 181 | |
---|
| 182 | #ifdef STATISTICS |
---|
[88] | 183 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[110] | 184 | statistics_deallocation (); |
---|
[59] | 185 | #endif |
---|
| 186 | |
---|
| 187 | #ifdef SYSTEMC |
---|
| 188 | log_printf(INFO,Load_store_unit,FUNCTION,"Deallocation"); |
---|
| 189 | |
---|
| 190 | deallocation (); |
---|
| 191 | #endif |
---|
| 192 | |
---|
| 193 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | }; // end namespace load_store_unit |
---|
| 197 | }; // end namespace execute_unit |
---|
| 198 | }; // end namespace multi_execute_unit |
---|
| 199 | }; // end namespace execute_loop |
---|
| 200 | }; // end namespace multi_execute_loop |
---|
| 201 | }; // end namespace core |
---|
| 202 | |
---|
| 203 | }; // end namespace behavioural |
---|
| 204 | }; // end namespace morpheo |
---|