[10] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[15] | 9 | #include "Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h" |
---|
[10] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace victim { |
---|
[15] | 15 | namespace victim_pseudo_lru { |
---|
[10] | 16 | |
---|
[15] | 17 | void Victim_Pseudo_LRU::allocation (void) |
---|
[10] | 18 | { |
---|
[42] | 19 | #ifdef POSITION |
---|
| 20 | _component = new Component (); |
---|
[10] | 21 | |
---|
[42] | 22 | Entity * entity = _component->set_entity (_name , |
---|
| 23 | "Select_Priority_Fixed", |
---|
| 24 | COMBINATORY ); |
---|
[10] | 25 | |
---|
[42] | 26 | _interfaces = entity->set_interfaces(); |
---|
| 27 | #else |
---|
| 28 | _interfaces = new Interfaces(); |
---|
| 29 | #endif |
---|
[10] | 30 | |
---|
[42] | 31 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 32 | { |
---|
| 33 | Interface_fifo * interface = _interfaces->set_interface("", IN ,WEST, "Generalist interface"); |
---|
| 34 | |
---|
| 35 | in_CLOCK = interface->set_signal_clk ("clock" ,1); |
---|
| 36 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1); |
---|
| 37 | } |
---|
[10] | 38 | |
---|
[42] | 39 | // ~~~~~[ Interface : "access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 40 | { |
---|
| 41 | in_ACCESS_VAL = new SC_IN (Tcontrol_t) * [_param._nb_access]; |
---|
| 42 | out_ACCESS_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_access]; |
---|
| 43 | if (_param._size_table>1) |
---|
| 44 | in_ACCESS_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_access]; |
---|
| 45 | out_ACCESS_ENTITY = new SC_OUT(Tentity_t ) * [_param._nb_access]; |
---|
| 46 | |
---|
| 47 | for (uint32_t i=0; i<_param._nb_access; i++) |
---|
| 48 | { |
---|
| 49 | Interface_fifo * interface = _interfaces->set_interface("access_"+toString(i), IN ,WEST, "Access"); |
---|
[10] | 50 | |
---|
[42] | 51 | in_ACCESS_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 52 | out_ACCESS_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 53 | |
---|
| 54 | if (_param._size_table>1) |
---|
| 55 | in_ACCESS_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table))); |
---|
| 56 | out_ACCESS_ENTITY [i] = interface->set_signal_out <Tentity_t> ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity ))); |
---|
| 57 | } |
---|
| 58 | } |
---|
[10] | 59 | |
---|
[42] | 60 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 61 | |
---|
| 62 | { |
---|
| 63 | in_UPDATE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_update]; |
---|
| 64 | out_UPDATE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_update]; |
---|
| 65 | if (_param._size_table>1) |
---|
| 66 | in_UPDATE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_update]; |
---|
| 67 | in_UPDATE_ENTITY = new SC_IN (Tentity_t ) * [_param._nb_update]; |
---|
| 68 | |
---|
| 69 | for (uint32_t i=0; i<_param._nb_update; i++) |
---|
| 70 | { |
---|
| 71 | Interface_fifo * interface = _interfaces->set_interface("update_"+toString(i), IN ,EAST, "Update"); |
---|
[10] | 72 | |
---|
[42] | 73 | in_UPDATE_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 74 | out_UPDATE_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 75 | if (_param._size_table>1) |
---|
| 76 | in_UPDATE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table))); |
---|
| 77 | in_UPDATE_ENTITY [i] = interface->set_signal_in <Tentity_t> ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity ))); |
---|
| 78 | } |
---|
| 79 | } |
---|
[10] | 80 | // -----[ Register ]--------------------------------------------------- |
---|
| 81 | reg_TABLE = new entry_t * [_param._size_table]; |
---|
| 82 | |
---|
| 83 | for (uint32_t i=0; i<_param._size_table; i++) |
---|
| 84 | reg_TABLE [i] = new entry_t (_param._nb_entity); |
---|
| 85 | |
---|
| 86 | // -----[ Internal ]--------------------------------------------------- |
---|
| 87 | internal_ACCESS_ENTITY = new Tentity_t [_param._nb_entity]; |
---|
[42] | 88 | |
---|
| 89 | #ifdef POSITION |
---|
| 90 | _component->generate_file(); |
---|
| 91 | #endif |
---|
[10] | 92 | }; |
---|
| 93 | |
---|
[15] | 94 | }; // end namespace victim_pseudo_lru |
---|
[10] | 95 | }; // end namespace victim |
---|
| 96 | }; // end namespace generic |
---|
| 97 | |
---|
| 98 | }; // end namespace behavioural |
---|
| 99 | }; // end namespace morpheo |
---|
| 100 | #endif |
---|