[53] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace registerfile { |
---|
| 15 | |
---|
| 16 | |
---|
[75] | 17 | void RegisterFile::allocation ( |
---|
| 18 | #ifdef STATISTICS |
---|
| 19 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
| 20 | #else |
---|
| 21 | void |
---|
| 22 | #endif |
---|
| 23 | ) |
---|
[53] | 24 | { |
---|
[75] | 25 | std::string rename; |
---|
[53] | 26 | |
---|
| 27 | log_printf(FUNC,RegisterFile,"allocation","Begin"); |
---|
| 28 | |
---|
| 29 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 30 | { |
---|
| 31 | in_CLOCK = new SC_CLOCK ("in_CLOCK" ); |
---|
| 32 | in_NRESET = new SC_IN (Tcontrol_t) ("in_NRESET"); |
---|
| 33 | } |
---|
| 34 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 35 | |
---|
[62] | 36 | in_READ_VAL = new SC_IN (Tcontrol_t) * [_param->_nb_port_read]; |
---|
| 37 | out_READ_ACK = new SC_OUT(Tcontrol_t) * [_param->_nb_port_read]; |
---|
| 38 | if (_param->_have_port_address == true) |
---|
| 39 | in_READ_ADDRESS = new SC_IN (Taddress_t) * [_param->_nb_port_read]; |
---|
| 40 | out_READ_DATA = new SC_OUT(Tdata_t ) * [_param->_nb_port_read]; |
---|
[53] | 41 | |
---|
[62] | 42 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[53] | 43 | { |
---|
| 44 | rename = "in_READ_"+toString(i)+"_VAL" ; |
---|
| 45 | in_READ_VAL [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 46 | rename = "out_READ_"+toString(i)+"_ACK" ; |
---|
| 47 | out_READ_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
[62] | 48 | if (_param->_have_port_address == true) |
---|
| 49 | { |
---|
[53] | 50 | rename = "in_READ_"+toString(i)+"_ADDRESS"; |
---|
| 51 | in_READ_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str()); |
---|
[62] | 52 | } |
---|
[53] | 53 | rename = "out_READ_"+toString(i)+"_DATA" ; |
---|
| 54 | out_READ_DATA [i] = new SC_OUT(Tdata_t ) (rename.c_str()); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 58 | |
---|
[62] | 59 | in_WRITE_VAL = new SC_IN (Tcontrol_t) * [_param->_nb_port_write]; |
---|
| 60 | out_WRITE_ACK = new SC_OUT(Tcontrol_t) * [_param->_nb_port_write]; |
---|
| 61 | if (_param->_have_port_address == true) |
---|
| 62 | in_WRITE_ADDRESS = new SC_IN (Taddress_t) * [_param->_nb_port_write]; |
---|
| 63 | in_WRITE_DATA = new SC_IN (Tdata_t ) * [_param->_nb_port_write]; |
---|
[53] | 64 | |
---|
[62] | 65 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
[53] | 66 | { |
---|
| 67 | rename = "in_WRITE_"+toString(i)+"_VAL" ; |
---|
| 68 | in_WRITE_VAL [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 69 | rename = "out_WRITE_"+toString(i)+"_ACK" ; |
---|
| 70 | out_WRITE_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
[62] | 71 | if (_param->_have_port_address == true) |
---|
| 72 | { |
---|
[53] | 73 | rename = "in_WRITE_"+toString(i)+"_ADDRESS"; |
---|
| 74 | in_WRITE_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str()); |
---|
[62] | 75 | } |
---|
[53] | 76 | rename = "in_WRITE_"+toString(i)+"_DATA" ; |
---|
| 77 | in_WRITE_DATA [i] = new SC_IN (Tdata_t ) (rename.c_str()); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[62] | 81 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[53] | 82 | // =====[ component_RegisterFile_Monolithic ]========================= |
---|
| 83 | { |
---|
| 84 | component_RegisterFile_Monolithic = new morpheo::behavioural::generic::registerfile::registerfile_monolithic ::RegisterFile_Monolithic ::RegisterFile_Monolithic (_name.c_str() |
---|
| 85 | #ifdef STATISTICS |
---|
[75] | 86 | ,param_statistics |
---|
[53] | 87 | #endif |
---|
[62] | 88 | ,_param->_param_registerfile_monolithic |
---|
[53] | 89 | ); |
---|
| 90 | |
---|
| 91 | } |
---|
| 92 | else |
---|
| 93 | // =====[ component_RegisterFile_Multi_Banked ]======================= |
---|
| 94 | { |
---|
| 95 | component_RegisterFile_Multi_Banked = new morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked (_name.c_str() |
---|
| 96 | #ifdef STATISTICS |
---|
[75] | 97 | ,param_statistics |
---|
[53] | 98 | #endif |
---|
[62] | 99 | ,_param->_param_registerfile_multi_banked |
---|
[53] | 100 | ); |
---|
| 101 | |
---|
| 102 | } |
---|
| 103 | // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 104 | |
---|
[62] | 105 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[53] | 106 | // =====[ Component_RegisterFile_Monolithic - Instanciation ]========= |
---|
| 107 | { |
---|
| 108 | (*(component_RegisterFile_Monolithic ->in_CLOCK )) (*(in_CLOCK )); |
---|
| 109 | (*(component_RegisterFile_Monolithic ->in_NRESET)) (*(in_NRESET)); |
---|
| 110 | |
---|
[62] | 111 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[53] | 112 | { |
---|
| 113 | (*(component_RegisterFile_Monolithic -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
| 114 | (*(component_RegisterFile_Monolithic ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
[62] | 115 | if (_param->_have_port_address == true) |
---|
[53] | 116 | (*(component_RegisterFile_Monolithic -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
| 117 | (*(component_RegisterFile_Monolithic ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
| 118 | } |
---|
| 119 | |
---|
[62] | 120 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
[53] | 121 | { |
---|
| 122 | (*(component_RegisterFile_Monolithic -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
| 123 | (*(component_RegisterFile_Monolithic ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
[62] | 124 | if (_param->_have_port_address == true) |
---|
[53] | 125 | (*(component_RegisterFile_Monolithic -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
| 126 | (*(component_RegisterFile_Monolithic -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | else |
---|
| 130 | // =====[ Component_RegisterFile_Multi_Banked - Instanciation ]======= |
---|
| 131 | { |
---|
| 132 | (*(component_RegisterFile_Multi_Banked->in_CLOCK )) (*(in_CLOCK )); |
---|
| 133 | (*(component_RegisterFile_Multi_Banked->in_NRESET)) (*(in_NRESET)); |
---|
| 134 | |
---|
[62] | 135 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[53] | 136 | { |
---|
| 137 | (*(component_RegisterFile_Multi_Banked-> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
| 138 | (*(component_RegisterFile_Multi_Banked->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
[62] | 139 | if (_param->_have_port_address == true) |
---|
[53] | 140 | (*(component_RegisterFile_Multi_Banked-> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
| 141 | (*(component_RegisterFile_Multi_Banked->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
| 142 | } |
---|
| 143 | |
---|
[62] | 144 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
[53] | 145 | { |
---|
| 146 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
| 147 | (*(component_RegisterFile_Multi_Banked->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
[62] | 148 | if (_param->_have_port_address == true) |
---|
[53] | 149 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
| 150 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
| 151 | } |
---|
| 152 | } |
---|
| 153 | |
---|
[62] | 154 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
[53] | 155 | _component = component_RegisterFile_Monolithic ->_component; |
---|
| 156 | else |
---|
| 157 | _component = component_RegisterFile_Multi_Banked->_component; |
---|
| 158 | |
---|
| 159 | log_printf(FUNC,RegisterFile,"allocation","End"); |
---|
| 160 | }; |
---|
| 161 | |
---|
| 162 | }; // end namespace registerfile |
---|
| 163 | }; // end namespace generic |
---|
| 164 | |
---|
| 165 | }; // end namespace behavioural |
---|
| 166 | }; // end namespace morpheo |
---|
| 167 | #endif |
---|