[73] | 1 | /* |
---|
| 2 | * $Id: Write_queue.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_Write_unit/Write_unit/Write_queue/include/Write_queue.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | namespace multi_execute_loop { |
---|
| 14 | namespace execute_loop { |
---|
| 15 | namespace multi_write_unit { |
---|
| 16 | namespace write_unit { |
---|
| 17 | namespace write_queue { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Write_queue::Write_queue" |
---|
| 22 | Write_queue::Write_queue |
---|
| 23 | ( |
---|
| 24 | #ifdef SYSTEMC |
---|
| 25 | sc_module_name name, |
---|
| 26 | #else |
---|
| 27 | string name, |
---|
| 28 | #endif |
---|
| 29 | #ifdef STATISTICS |
---|
| 30 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 31 | #endif |
---|
| 32 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_write_unit::write_unit::write_queue::Parameters * param, |
---|
| 33 | morpheo::behavioural::Tusage_t usage |
---|
| 34 | ): |
---|
| 35 | _name (name) |
---|
| 36 | ,_param (param) |
---|
| 37 | ,_usage (usage) |
---|
| 38 | { |
---|
[113] | 39 | log_begin(Write_queue,FUNCTION); |
---|
[73] | 40 | |
---|
[113] | 41 | // #if DEBUG_Write_queue == true |
---|
| 42 | // log_printf(INFO,Write_queue,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 43 | |
---|
[113] | 44 | // std::cout << *param << std::endl; |
---|
| 45 | // #endif |
---|
[88] | 46 | |
---|
[113] | 47 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Allocation"),_name.c_str()); |
---|
[73] | 48 | allocation (); |
---|
| 49 | |
---|
| 50 | #ifdef STATISTICS |
---|
[88] | 51 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[73] | 52 | { |
---|
[113] | 53 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str()); |
---|
[73] | 54 | |
---|
| 55 | statistics_declaration(param_statistics); |
---|
| 56 | } |
---|
| 57 | #endif |
---|
| 58 | |
---|
| 59 | #ifdef VHDL |
---|
[88] | 60 | if (usage_is_set(_usage,USE_VHDL)) |
---|
[73] | 61 | { |
---|
| 62 | // generate the vhdl |
---|
[113] | 63 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str()); |
---|
[73] | 64 | |
---|
| 65 | vhdl(); |
---|
| 66 | } |
---|
| 67 | #endif |
---|
| 68 | |
---|
| 69 | #ifdef SYSTEMC |
---|
[88] | 70 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
[73] | 71 | { |
---|
[113] | 72 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Method - transition"),_name.c_str()); |
---|
[73] | 73 | |
---|
| 74 | SC_METHOD (transition); |
---|
| 75 | dont_initialize (); |
---|
| 76 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 77 | |
---|
| 78 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 79 | // List dependency information |
---|
| 80 | # endif |
---|
| 81 | |
---|
[113] | 82 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Method - genMoore"),_name.c_str()); |
---|
[73] | 83 | |
---|
| 84 | SC_METHOD (genMoore); |
---|
| 85 | dont_initialize (); |
---|
[115] | 86 | sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
[73] | 87 | |
---|
| 88 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 89 | // List dependency information |
---|
| 90 | # endif |
---|
[115] | 91 | |
---|
| 92 | if (_param->_queue_scheme == WRITE_QUEUE_SCHEME_MEALY) |
---|
| 93 | { |
---|
[118] | 94 | log_printf(INFO,Write_queue,FUNCTION,"Method - genMealy_write"); |
---|
[115] | 95 | |
---|
[118] | 96 | SC_METHOD (genMealy_write); |
---|
[115] | 97 | dont_initialize (); |
---|
[132] | 98 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 99 | << (*(in_NRESET)); |
---|
[115] | 100 | for (uint32_t i=0; i<_param->_nb_gpr_write; ++i) |
---|
| 101 | sensitive << (*(in_GPR_WRITE_ACK [i])); |
---|
| 102 | for (uint32_t i=0; i<_param->_nb_spr_write; ++i) |
---|
| 103 | sensitive << (*(in_SPR_WRITE_ACK [i])); |
---|
| 104 | |
---|
| 105 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 106 | // List dependency information |
---|
| 107 | # endif |
---|
| 108 | } |
---|
| 109 | |
---|
[118] | 110 | if ((_param->_bypass_write_scheme == BYPASS_WRITE_FROM_ALU) and |
---|
| 111 | (_param->_nb_bypass_write > 0)) |
---|
| 112 | { |
---|
| 113 | log_printf(INFO,Write_queue,FUNCTION,"Method - genMealy_bypass"); |
---|
| 114 | |
---|
| 115 | SC_METHOD (genMealy_bypass); |
---|
| 116 | dont_initialize (); |
---|
| 117 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
[132] | 118 | sensitive << (*(in_NRESET)) |
---|
| 119 | << (*(in_WRITE_QUEUE_IN_VAL )) |
---|
[118] | 120 | << (*(in_WRITE_QUEUE_IN_WRITE_RD )) |
---|
| 121 | << (*(in_WRITE_QUEUE_IN_NUM_REG_RD )) |
---|
| 122 | << (*(in_WRITE_QUEUE_IN_DATA_RD )) |
---|
| 123 | << (*(in_WRITE_QUEUE_IN_WRITE_RE )) |
---|
| 124 | << (*(in_WRITE_QUEUE_IN_NUM_REG_RE )) |
---|
| 125 | << (*(in_WRITE_QUEUE_IN_DATA_RE )); |
---|
| 126 | if (_param->_have_port_ooo_engine_id) |
---|
| 127 | sensitive << (*(in_WRITE_QUEUE_IN_OOO_ENGINE_ID)); |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 131 | // List dependency information |
---|
| 132 | # endif |
---|
| 133 | } |
---|
| 134 | |
---|
[73] | 135 | #endif |
---|
| 136 | } |
---|
[113] | 137 | log_end(Write_queue,FUNCTION); |
---|
[73] | 138 | }; |
---|
| 139 | |
---|
| 140 | #undef FUNCTION |
---|
| 141 | #define FUNCTION "Write_queue::~Write_queue" |
---|
| 142 | Write_queue::~Write_queue (void) |
---|
| 143 | { |
---|
[113] | 144 | log_begin(Write_queue,FUNCTION); |
---|
[73] | 145 | |
---|
| 146 | #ifdef STATISTICS |
---|
[88] | 147 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[73] | 148 | { |
---|
[113] | 149 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Generate Statistics file"),_name.c_str()); |
---|
[73] | 150 | |
---|
| 151 | delete _stat; |
---|
| 152 | } |
---|
| 153 | #endif |
---|
| 154 | |
---|
[113] | 155 | log_printf(INFO,Write_queue,FUNCTION,_("<%s> Deallocation"),_name.c_str()); |
---|
[73] | 156 | deallocation (); |
---|
| 157 | |
---|
[113] | 158 | log_end(Write_queue,FUNCTION); |
---|
[73] | 159 | }; |
---|
| 160 | |
---|
| 161 | }; // end namespace write_queue |
---|
| 162 | }; // end namespace write_unit |
---|
| 163 | }; // end namespace multi_write_unit |
---|
| 164 | }; // end namespace execute_loop |
---|
| 165 | }; // end namespace multi_execute_loop |
---|
| 166 | }; // end namespace core |
---|
| 167 | |
---|
| 168 | }; // end namespace behavioural |
---|
| 169 | }; // end namespace morpheo |
---|