1 | /* |
---|
2 | * $Id: Victim_allocation.cpp 112 2009-03-18 22:36:26Z 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 | __ALLOC0_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK ); |
---|
34 | __ALLOC0_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t)); |
---|
35 | } |
---|
36 | |
---|
37 | // ~~~~~[ Interface : "Access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
38 | { |
---|
39 | __ALLOC1_INTERFACE_BEGIN("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 | __ALLOC1_INTERFACE_END(_param->_nb_access); |
---|
50 | } |
---|
51 | |
---|
52 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
53 | std::string name; |
---|
54 | |
---|
55 | switch (_param->_victim_scheme) |
---|
56 | { |
---|
57 | // case VICTIM_RANDOM : |
---|
58 | // case VICTIM_ROUND_ROBIN : |
---|
59 | // case VICTIM_NLU : |
---|
60 | case VICTIM_PSEUDO_LRU : |
---|
61 | { |
---|
62 | std::cout << "Create : " << _name << std::endl; |
---|
63 | |
---|
64 | _component_victim_pseudo_lru = new morpheo::behavioural::generic::victim::victim_pseudo_lru::Victim_Pseudo_LRU |
---|
65 | (_name.c_str() |
---|
66 | #ifdef STATISTICS |
---|
67 | ,param_statistics |
---|
68 | #endif |
---|
69 | ,_param->_param_victim_pseudo_lru |
---|
70 | ,_usage); |
---|
71 | break; |
---|
72 | } |
---|
73 | // case VICTIM_LRU : |
---|
74 | // case VICTIM_FIFO : |
---|
75 | default : break; |
---|
76 | } |
---|
77 | |
---|
78 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
79 | |
---|
80 | std::cout << "Instance : " << _name << std::endl; |
---|
81 | |
---|
82 | switch (_param->_victim_scheme) |
---|
83 | { |
---|
84 | |
---|
85 | // case VICTIM_RANDOM : |
---|
86 | // case VICTIM_ROUND_ROBIN : |
---|
87 | // case VICTIM_NLU : |
---|
88 | case VICTIM_PSEUDO_LRU : |
---|
89 | { |
---|
90 | { |
---|
91 | (*(_component_victim_pseudo_lru-> in_CLOCK )) (*( in_CLOCK)); |
---|
92 | (*(_component_victim_pseudo_lru-> in_NRESET)) (*( in_NRESET)); |
---|
93 | } |
---|
94 | |
---|
95 | for (uint32_t i=0; i<_param->_nb_access; i++) |
---|
96 | { |
---|
97 | (*(_component_victim_pseudo_lru-> in_ACCESS_VAL [i])) (*( in_ACCESS_VAL [i])); |
---|
98 | (*(_component_victim_pseudo_lru->out_ACCESS_ACK [i])) (*(out_ACCESS_ACK [i])); |
---|
99 | if (_param->_have_port_address) |
---|
100 | (*(_component_victim_pseudo_lru-> in_ACCESS_ADDRESS [i])) (*( in_ACCESS_ADDRESS [i])); |
---|
101 | (*(_component_victim_pseudo_lru-> in_ACCESS_HIT [i])) (*( in_ACCESS_HIT [i])); |
---|
102 | (*(_component_victim_pseudo_lru-> in_ACCESS_ENTITY [i])) (*( in_ACCESS_ENTITY [i])); |
---|
103 | (*(_component_victim_pseudo_lru->out_ACCESS_VICTIM [i])) (*(out_ACCESS_VICTIM [i])); |
---|
104 | } |
---|
105 | |
---|
106 | break; |
---|
107 | } |
---|
108 | // case VICTIM_LRU : |
---|
109 | // case VICTIM_FIFO : |
---|
110 | default : break; |
---|
111 | } |
---|
112 | |
---|
113 | |
---|
114 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
115 | switch (_param->_victim_scheme) |
---|
116 | { |
---|
117 | // case VICTIM_RANDOM : _component = _component_victim_random ->_component; break; |
---|
118 | // case VICTIM_ROUND_ROBIN : _component = _component_victim_round_robin->_component; break; |
---|
119 | // case VICTIM_NLU : _component = _component_victim_nlu ->_component; break; |
---|
120 | case VICTIM_PSEUDO_LRU : _component = _component_victim_pseudo_lru ->_component; break; |
---|
121 | // case VICTIM_LRU : _component = _component_victim_lru ->_component; break; |
---|
122 | // case VICTIM_FIFO : _component = _component_victim_fifo ->_component; break; |
---|
123 | default : break; |
---|
124 | } |
---|
125 | |
---|
126 | log_printf(FUNC,Victim,FUNCTION,"End"); |
---|
127 | }; |
---|
128 | |
---|
129 | }; // end namespace victim |
---|
130 | }; // end namespace generic |
---|
131 | |
---|
132 | }; // end namespace behavioural |
---|
133 | }; // end namespace morpheo |
---|