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