[53] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace registerfile { |
---|
| 15 | namespace registerfile_multi_banked { |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | void RegisterFile_Multi_Banked::allocation (void) |
---|
| 19 | { |
---|
| 20 | string rename; |
---|
| 21 | |
---|
| 22 | log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","Begin"); |
---|
| 23 | |
---|
| 24 | _component = new Component (); |
---|
| 25 | |
---|
| 26 | Entity * entity = _component->set_entity (_name |
---|
| 27 | ,"RegisterFile_Multi_Banked" |
---|
| 28 | #ifdef POSITION |
---|
| 29 | ,Register |
---|
| 30 | #endif |
---|
| 31 | ); |
---|
| 32 | |
---|
| 33 | _interfaces = entity->set_interfaces(); |
---|
| 34 | |
---|
| 35 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 36 | |
---|
| 37 | Interface * interface = _interfaces->set_interface("" |
---|
| 38 | #ifdef POSITION |
---|
| 39 | ,IN |
---|
| 40 | ,SOUTH, |
---|
| 41 | "Generalist interface" |
---|
| 42 | #endif |
---|
| 43 | ); |
---|
| 44 | |
---|
| 45 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
| 46 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
| 47 | |
---|
| 48 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 49 | |
---|
| 50 | in_READ_VAL = new SC_IN (Tcontrol_t) * [_param._nb_port_read]; |
---|
| 51 | out_READ_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_port_read]; |
---|
| 52 | in_READ_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_port_read]; |
---|
| 53 | out_READ_DATA = new SC_OUT(Tdata_t ) * [_param._nb_port_read]; |
---|
| 54 | |
---|
| 55 | for (uint32_t i=0; i<_param._nb_port_read; i++) |
---|
| 56 | { |
---|
| 57 | Interface_fifo * interface = _interfaces->set_interface("read_"+toString(i) |
---|
| 58 | #ifdef POSITION |
---|
| 59 | , IN |
---|
| 60 | ,WEST |
---|
| 61 | , "Interface Read" |
---|
| 62 | #endif |
---|
| 63 | ); |
---|
| 64 | |
---|
| 65 | in_READ_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 66 | out_READ_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 67 | in_READ_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word))); |
---|
| 68 | out_READ_DATA [i] = interface->set_signal_out <Tdata_t > ("data" , _param._size_word); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 72 | |
---|
| 73 | in_WRITE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_port_write]; |
---|
| 74 | out_WRITE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_port_write]; |
---|
| 75 | in_WRITE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_port_write]; |
---|
| 76 | in_WRITE_DATA = new SC_IN (Tdata_t ) * [_param._nb_port_write]; |
---|
| 77 | |
---|
| 78 | for (uint32_t i=0; i<_param._nb_port_write; i++) |
---|
| 79 | { |
---|
| 80 | Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i) |
---|
| 81 | #ifdef POSITION |
---|
| 82 | , IN |
---|
| 83 | ,EAST |
---|
| 84 | , "Interface Write" |
---|
| 85 | #endif |
---|
| 86 | ); |
---|
| 87 | |
---|
| 88 | in_WRITE_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 89 | out_WRITE_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 90 | in_WRITE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word))); |
---|
| 91 | in_WRITE_DATA [i] = interface->set_signal_in <Tdata_t > ("data" , _param._size_word); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 95 | |
---|
| 96 | reg_DATA = new SC_REGISTER (Tdata_t) ** [_param._nb_bank]; |
---|
| 97 | |
---|
| 98 | for (uint32_t i=0; i<_param._nb_bank; i++) |
---|
| 99 | { |
---|
| 100 | reg_DATA [i] = new SC_REGISTER (Tdata_t) * [_param._nb_word]; |
---|
| 101 | |
---|
| 102 | for (uint32_t j=0; j<_param._nb_word; j++) |
---|
| 103 | { |
---|
| 104 | string rename = "reg_DATA_" + toString(i) + "_" + toString(j); |
---|
| 105 | reg_DATA [i][j] = new SC_REGISTER (Tdata_t) (rename.c_str()); |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 110 | internal_WRITE_VAL = new bool [_param._nb_port_write]; |
---|
| 111 | internal_WRITE_BANK = new Taddress_t [_param._nb_port_write]; |
---|
| 112 | internal_WRITE_NUM_REG = new Taddress_t [_param._nb_port_write]; |
---|
| 113 | |
---|
| 114 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 115 | |
---|
| 116 | #ifdef POSITION |
---|
| 117 | _component->generate_file(); |
---|
| 118 | #endif |
---|
| 119 | |
---|
| 120 | log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","End"); |
---|
| 121 | }; |
---|
| 122 | |
---|
| 123 | }; // end namespace registerfile_multi_banked |
---|
| 124 | }; // end namespace registerfile |
---|
| 125 | }; // end namespace generic |
---|
| 126 | |
---|
| 127 | }; // end namespace behavioural |
---|
| 128 | }; // end namespace morpheo |
---|
| 129 | #endif |
---|