[78] | 1 | /* |
---|
| 2 | * $Id: Victim_allocation.cpp 82 2008-05-01 16:48:45Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Victim/include/Victim.h" |
---|
| 9 | #include "Behavioural/include/Allocation.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace victim { |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | #undef FUNCTION |
---|
| 19 | #define FUNCTION "Victim::allocation" |
---|
| 20 | void Victim::allocation ( |
---|
| 21 | #ifdef STATISTICS |
---|
| 22 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
| 23 | #else |
---|
| 24 | void |
---|
| 25 | #endif |
---|
| 26 | ) |
---|
| 27 | { |
---|
| 28 | log_printf(FUNC,Victim,FUNCTION,"Begin"); |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 32 | { |
---|
| 33 | __ALLOC_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK ); |
---|
| 34 | __ALLOC_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t)); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | // ~~~~~[ Interface : "Access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 38 | { |
---|
| 39 | __ALLOC1_INTERFACE("ACCESS",_param->_nb_access); |
---|
| 40 | |
---|
| 41 | __ALLOC1_SIGNAL_IN ( in_ACCESS_VAL ,"VAL" ,Tcontrol_t); |
---|
| 42 | __ALLOC1_SIGNAL_OUT(out_ACCESS_ACK ,"ACK" ,Tcontrol_t); |
---|
| 43 | if (_param->_have_port_address) |
---|
| 44 | __ALLOC1_SIGNAL_IN ( in_ACCESS_ADDRESS,"ADDRESS",Taddress_t); |
---|
| 45 | __ALLOC1_SIGNAL_IN ( in_ACCESS_HIT ,"HIT" ,Tcontrol_t); |
---|
| 46 | __ALLOC1_SIGNAL_IN ( in_ACCESS_ENTITY ,"ENTITY" ,Tentity_t ); |
---|
| 47 | __ALLOC1_SIGNAL_OUT(out_ACCESS_VICTIM ,"VICTIM" ,Tentity_t ); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 51 | std::string name; |
---|
| 52 | |
---|
| 53 | switch (_param->_victim_scheme) |
---|
| 54 | { |
---|
| 55 | // case VICTIM_RANDOM : |
---|
| 56 | // case VICTIM_ROUND_ROBIN : |
---|
| 57 | // case VICTIM_NLU : |
---|
| 58 | case VICTIM_PSEUDO_LRU : |
---|
| 59 | { |
---|
| 60 | std::cout << "Create : " << _name << std::endl; |
---|
| 61 | |
---|
| 62 | _component_victim_pseudo_lru = new morpheo::behavioural::generic::victim::victim_pseudo_lru::Victim_Pseudo_LRU |
---|
| 63 | (_name.c_str() |
---|
| 64 | #ifdef STATISTICS |
---|
| 65 | ,param_statistics |
---|
| 66 | #endif |
---|
[82] | 67 | ,_param->_param_victim_pseudo_lru |
---|
| 68 | ,_usage); |
---|
[78] | 69 | break; |
---|
| 70 | } |
---|
| 71 | // case VICTIM_LRU : |
---|
| 72 | // case VICTIM_FIFO : |
---|
| 73 | default : break; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 77 | |
---|
| 78 | std::cout << "Instance : " << _name << std::endl; |
---|
| 79 | |
---|
| 80 | switch (_param->_victim_scheme) |
---|
| 81 | { |
---|
| 82 | |
---|
| 83 | // case VICTIM_RANDOM : |
---|
| 84 | // case VICTIM_ROUND_ROBIN : |
---|
| 85 | // case VICTIM_NLU : |
---|
| 86 | case VICTIM_PSEUDO_LRU : |
---|
| 87 | { |
---|
| 88 | { |
---|
| 89 | (*(_component_victim_pseudo_lru-> in_CLOCK )) (*( in_CLOCK)); |
---|
| 90 | (*(_component_victim_pseudo_lru-> in_NRESET)) (*( in_NRESET)); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | for (uint32_t i=0; i<_param->_nb_access; i++) |
---|
| 94 | { |
---|
| 95 | (*(_component_victim_pseudo_lru-> in_ACCESS_VAL [i])) (*( in_ACCESS_VAL [i])); |
---|
| 96 | (*(_component_victim_pseudo_lru->out_ACCESS_ACK [i])) (*(out_ACCESS_ACK [i])); |
---|
| 97 | if (_param->_have_port_address) |
---|
| 98 | (*(_component_victim_pseudo_lru-> in_ACCESS_ADDRESS [i])) (*( in_ACCESS_ADDRESS [i])); |
---|
| 99 | (*(_component_victim_pseudo_lru-> in_ACCESS_HIT [i])) (*( in_ACCESS_HIT [i])); |
---|
| 100 | (*(_component_victim_pseudo_lru-> in_ACCESS_ENTITY [i])) (*( in_ACCESS_ENTITY [i])); |
---|
| 101 | (*(_component_victim_pseudo_lru->out_ACCESS_VICTIM [i])) (*(out_ACCESS_VICTIM [i])); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | break; |
---|
| 105 | } |
---|
| 106 | // case VICTIM_LRU : |
---|
| 107 | // case VICTIM_FIFO : |
---|
| 108 | default : break; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 113 | switch (_param->_victim_scheme) |
---|
| 114 | { |
---|
| 115 | // case VICTIM_RANDOM : _component = _component_victim_random ->_component; break; |
---|
| 116 | // case VICTIM_ROUND_ROBIN : _component = _component_victim_round_robin->_component; break; |
---|
| 117 | // case VICTIM_NLU : _component = _component_victim_nlu ->_component; break; |
---|
| 118 | case VICTIM_PSEUDO_LRU : _component = _component_victim_pseudo_lru ->_component; break; |
---|
| 119 | // case VICTIM_LRU : _component = _component_victim_lru ->_component; break; |
---|
| 120 | // case VICTIM_FIFO : _component = _component_victim_fifo ->_component; break; |
---|
| 121 | default : break; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | log_printf(FUNC,Victim,FUNCTION,"End"); |
---|
| 125 | }; |
---|
| 126 | |
---|
| 127 | }; // end namespace victim |
---|
| 128 | }; // end namespace generic |
---|
| 129 | |
---|
| 130 | }; // end namespace behavioural |
---|
| 131 | }; // end namespace morpheo |
---|