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