1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/include/Direction.h" |
---|
9 | #include "Behavioural/include/Allocation.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_front_end { |
---|
15 | namespace front_end { |
---|
16 | namespace prediction_unit { |
---|
17 | namespace direction { |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | #undef FUNCTION |
---|
22 | #define FUNCTION "Direction::allocation" |
---|
23 | void Direction::allocation ( |
---|
24 | #ifdef STATISTICS |
---|
25 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
26 | #else |
---|
27 | void |
---|
28 | #endif |
---|
29 | ) |
---|
30 | { |
---|
31 | log_printf(FUNC,Direction,FUNCTION,"Begin"); |
---|
32 | |
---|
33 | _component = new Component (_usage); |
---|
34 | |
---|
35 | Entity * entity = _component->set_entity (_name |
---|
36 | ,"Direction" |
---|
37 | #ifdef POSITION |
---|
38 | ,COMBINATORY |
---|
39 | #endif |
---|
40 | ); |
---|
41 | |
---|
42 | _interfaces = entity->set_interfaces(); |
---|
43 | |
---|
44 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
45 | { |
---|
46 | Interface * interface = _interfaces->set_interface("" |
---|
47 | #ifdef POSITION |
---|
48 | ,IN |
---|
49 | ,SOUTH, |
---|
50 | "Generalist interface" |
---|
51 | #endif |
---|
52 | ); |
---|
53 | |
---|
54 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
55 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
56 | } |
---|
57 | |
---|
58 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
59 | { |
---|
60 | ALLOC1_INTERFACE("predict", IN, SOUTH, "Interface predict",_param->_nb_inst_predict); |
---|
61 | |
---|
62 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
63 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
64 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS_SRC,"address_src",Taddress_t,_param->_size_address); |
---|
65 | ALLOC1_SIGNAL_IN ( in_PREDICT_STATIC ,"static" ,Tcontrol_t,1); |
---|
66 | ALLOC1_SIGNAL_IN ( in_PREDICT_LAST_TAKE ,"last_take" ,Tcontrol_t,1); |
---|
67 | ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY ,"history" ,Thistory_t,_param->_size_history); |
---|
68 | ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION ,"direction" ,Tcontrol_t,1); |
---|
69 | } |
---|
70 | |
---|
71 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
72 | { |
---|
73 | ALLOC1_INTERFACE("update", IN, SOUTH, "Interface update",_param->_nb_inst_update); |
---|
74 | |
---|
75 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
76 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
77 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"address" ,Taddress_t,_param->_size_address); |
---|
78 | ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY ,"history" ,Thistory_t,_param->_size_history); |
---|
79 | ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION,"direction",Tcontrol_t,1); |
---|
80 | } |
---|
81 | |
---|
82 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
83 | std::string name; |
---|
84 | |
---|
85 | { |
---|
86 | name = _name+"_glue"; |
---|
87 | std::cout << "Create : " << name << std::endl; |
---|
88 | |
---|
89 | _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Direction_Glue |
---|
90 | (name.c_str() |
---|
91 | #ifdef STATISTICS |
---|
92 | ,param_statistics |
---|
93 | #endif |
---|
94 | ,_param->_param_glue); |
---|
95 | |
---|
96 | _component->set_component (_component_glue->_component |
---|
97 | #ifdef POSITION |
---|
98 | , 50, 50, 10, 10 |
---|
99 | #endif |
---|
100 | ); |
---|
101 | } |
---|
102 | |
---|
103 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
104 | std::string src,dest; |
---|
105 | |
---|
106 | { |
---|
107 | src = _name+"_glue"; |
---|
108 | std::cout << "Instance : " << src << std::endl; |
---|
109 | |
---|
110 | { |
---|
111 | dest = _name; |
---|
112 | #ifdef POSITION |
---|
113 | _component->interface_map (src ,"", |
---|
114 | dest,""); |
---|
115 | #endif |
---|
116 | |
---|
117 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
118 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
119 | } |
---|
120 | |
---|
121 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
122 | { |
---|
123 | dest = _name; |
---|
124 | #ifdef POSITION |
---|
125 | _component->interface_map (src ,"predict_"+toString(i), |
---|
126 | dest,"predict_"+toString(i)); |
---|
127 | #endif |
---|
128 | |
---|
129 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL" , |
---|
130 | dest, "in_PREDICT_"+toString(i)+"_VAL" ); |
---|
131 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK" , |
---|
132 | dest,"out_PREDICT_"+toString(i)+"_ACK" ); |
---|
133 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS_SRC", |
---|
134 | dest, "in_PREDICT_"+toString(i)+"_ADDRESS_SRC"); |
---|
135 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_STATIC" , |
---|
136 | dest, "in_PREDICT_"+toString(i)+"_STATIC" ); |
---|
137 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_LAST_TAKE" , |
---|
138 | dest, "in_PREDICT_"+toString(i)+"_LAST_TAKE" ); |
---|
139 | if (_param->_have_port_history) |
---|
140 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY" , |
---|
141 | dest,"out_PREDICT_"+toString(i)+"_HISTORY" ); |
---|
142 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION" , |
---|
143 | dest,"out_PREDICT_"+toString(i)+"_DIRECTION" ); |
---|
144 | |
---|
145 | // PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL" ,dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL" ); |
---|
146 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK" ); |
---|
147 | // PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC",dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC"); |
---|
148 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY" ); |
---|
149 | // PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION" ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION" ); |
---|
150 | } |
---|
151 | |
---|
152 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
153 | { |
---|
154 | dest = _name; |
---|
155 | #ifdef POSITION |
---|
156 | _component->interface_map (src ,"update_"+toString(i), |
---|
157 | dest,"update_"+toString(i)); |
---|
158 | #endif |
---|
159 | |
---|
160 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL" , |
---|
161 | dest, "in_UPDATE_"+toString(i)+"_VAL" ); |
---|
162 | PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK" , |
---|
163 | dest,"out_UPDATE_"+toString(i)+"_ACK" ); |
---|
164 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS" , |
---|
165 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS" ); |
---|
166 | if (_param->_have_port_history) |
---|
167 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY" , |
---|
168 | dest, "in_UPDATE_"+toString(i)+"_HISTORY" ); |
---|
169 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION", |
---|
170 | dest, "in_UPDATE_"+toString(i)+"_DIRECTION"); |
---|
171 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL" ); |
---|
172 | // PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK" ,dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK" ); |
---|
173 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS" ); |
---|
174 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY" ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY" ); |
---|
175 | // PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION",dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"); |
---|
176 | } |
---|
177 | } |
---|
178 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
179 | _component->test_map(); |
---|
180 | |
---|
181 | #ifdef POSITION |
---|
182 | _component->generate_file(); |
---|
183 | #endif |
---|
184 | |
---|
185 | log_printf(FUNC,Direction,FUNCTION,"End"); |
---|
186 | }; |
---|
187 | |
---|
188 | }; // end namespace direction |
---|
189 | }; // end namespace prediction_unit |
---|
190 | }; // end namespace front_end |
---|
191 | }; // end namespace multi_front_end |
---|
192 | }; // end namespace core |
---|
193 | |
---|
194 | }; // end namespace behavioural |
---|
195 | }; // end namespace morpheo |
---|