PandA-2024.02
create_address_translation.cpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2015-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
41 
42 #include "Parameter.hpp"
43 #include "aadl_information.hpp"
44 #include "application_manager.hpp"
45 #include "asn_type.hpp"
46 #include "dbgPrintHelper.hpp"
47 #include "design_flow_manager.hpp"
48 #include "hls_manager.hpp"
50 #include "string_manipulation.hpp"
51 #include "taste_constants.hpp"
52 #include "tree_helper.hpp"
53 #include "tree_manager.hpp"
54 #include "tree_node.hpp"
55 #include "tree_reindex.hpp"
56 #include "utility.hpp"
57 
59  const DesignFlowManagerConstRef _design_flow_manager,
60  const ParameterConstRef _parameters)
61  : ApplicationFrontendFlowStep(_AppM, FrontendFlowStepType::CREATE_ADDRESS_TRANSLATION, _design_flow_manager,
62  _parameters),
63  aadl_information(GetPointer<const HLS_manager>(_AppM)->aadl_information)
64 {
65  debug_level = parameters->get_class_debug_level(GET_CLASS(*this));
66 }
67 
69 
72 {
74  switch(relationship_type)
75  {
77  {
78  relationships.insert(std::make_pair(CREATE_TREE_MANAGER, WHOLE_APPLICATION));
79  break;
80  }
82  {
83  break;
84  }
86  {
88  {
89  relationships.insert(std::make_pair(CREATE_TREE_MANAGER, WHOLE_APPLICATION));
90  }
91  break;
92  }
93  default:
95  }
96  return relationships;
97 }
98 
99 void CreateAddressTranslation::ComputeAddress(const AsnTypeRef asn_type, const unsigned int tree_parameter_type,
100  unsigned long long int& bambu_address,
101  unsigned long long int& taste_address, unsigned int& registers,
102  const bool first_level, const bool little_endianess)
103 {
104  switch(asn_type->GetKind())
105  {
107  {
108  if(first_level)
109  {
111  memory_enabling->Append(",0");
112  data_size->Append(",0");
113  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
114  taste_address = taste_address + 4;
115  registers++;
116  break;
117  }
118  else
119  {
120  address_translation->Append("," + STR(bambu_address));
121  memory_enabling->Append(",1");
122  data_size->Append(",1");
123  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
124  bambu_address = bambu_address + 1;
125  taste_address = taste_address + 4;
126  break;
127  }
128  break;
129  }
131  {
132  THROW_ERROR("Choice ASN type not supported");
133  break;
134  }
136  {
137  if(first_level)
138  {
140  memory_enabling->Append(",0");
141  data_size->Append(",0");
142  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
143  taste_address = taste_address + 4;
144  registers++;
145  break;
146  }
147  else
148  {
149  address_translation->Append("," + STR(bambu_address));
150  memory_enabling->Append(",1");
151  data_size->Append(",4");
152  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
153  bambu_address = bambu_address + 4;
154  taste_address = taste_address + 4;
155  break;
156  }
157  }
159  {
160  if(first_level)
161  {
162  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->INTEGER (first level)");
163  address_translation->Append(",0,0");
164  memory_enabling->Append(",0,0");
165  data_size->Append(",0,0");
166  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
167  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
168  taste_address = taste_address + 8;
169  const auto byte_size = tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
170  if(byte_size == 8)
171  {
172  registers += 2;
173  }
174  else
175  {
176  registers++;
177  }
179  break;
180  }
181  else
182  {
183  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->INTEGER (not first level)");
184  const auto byte_size = tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
185  if(byte_size <= 4)
186  {
187  little_endianess ? address_translation->Append(",0," + STR(bambu_address)) :
188  address_translation->Append("," + STR(bambu_address) + ",0");
189  little_endianess ? memory_enabling->Append(",0,1") : memory_enabling->Append(",1,0");
190  little_endianess ? data_size->Append(",0," + STR(byte_size)) :
191  data_size->Append("," + STR(byte_size) + ",0");
192  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
193  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
194  bambu_address = bambu_address + byte_size;
195  taste_address = taste_address + 8;
196  }
197  else if(byte_size == 8)
198  {
199  address_translation->Append("," + STR(bambu_address) + "," + STR(bambu_address + 4));
200  memory_enabling->Append(",1,1");
201  data_size->Append("," + STR(byte_size) + "," + STR(byte_size));
202  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
203  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
204  bambu_address = bambu_address + byte_size;
205  taste_address = taste_address + 8;
206  }
207  else
208  {
209  THROW_ERROR("Integer larger than 128 bits not supported");
210  }
212  }
213  break;
214  }
216  {
217  const auto octet_string = GetPointer<const OctetStringAsnType>(asn_type);
218  const auto byte_size = octet_string->size;
219  const auto word_size = (byte_size % 4) ? ((byte_size / 4) + 1) * 4 : byte_size / 4;
220  for(unsigned int word = 0; word < word_size; word++)
221  {
222  address_translation->Append("," + STR(bambu_address));
223  memory_enabling->Append(",1");
224  data_size->Append("," + STR(byte_size));
225  endianess_check->Append(",0");
226  bambu_address = bambu_address + 1;
227  taste_address = taste_address + 1;
228  }
229  break;
230  }
231  case AsnType_Kind::REAL:
232  {
233  if(first_level)
234  {
235  const auto byte_size = tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
236  if(byte_size == 8)
237  {
238  address_translation->Append(",0,0,");
239  memory_enabling->Append(",0,0");
240  data_size->Append(",0,0,");
241  endianess_check->Append("," + std::string(little_endianess ? "0,0" : "1,1"));
242  taste_address = taste_address + 8;
243  registers += 2;
244  }
245  else
246  {
248  memory_enabling->Append(",0");
249  data_size->Append(",0");
250  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
251  taste_address = taste_address + 4;
252  registers++;
253  }
254  break;
255  }
256  else
257  {
258  const auto byte_size = tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
259  if(byte_size == 4)
260  {
261  little_endianess ? address_translation->Append(",0," + STR(bambu_address)) :
262  address_translation->Append("," + STR(bambu_address) + ",0");
263  little_endianess ? memory_enabling->Append(",0,1") : memory_enabling->Append(",1,0");
264  little_endianess ? data_size->Append(",0," + STR(byte_size)) :
265  data_size->Append("," + STR(byte_size) + ",0");
266  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
267  bambu_address = bambu_address + byte_size;
268  taste_address = taste_address + 4;
269  }
270  else if(byte_size == 8)
271  {
272  address_translation->Append("," + STR(bambu_address) + "," + STR(bambu_address + 4));
273  memory_enabling->Append(",1,1");
274  data_size->Append("," + STR(byte_size) + "," + STR(byte_size));
275  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
276  endianess_check->Append("," + std::string(little_endianess ? "0" : "1"));
277  bambu_address = bambu_address + byte_size;
278  taste_address = taste_address + 8;
279  }
280  else
281  {
282  THROW_ERROR("Unsupported real type size " + STR(byte_size));
283  }
284  break;
285  }
286  }
288  {
289  const auto redefine = GetPointer<const RedefineAsnType>(asn_type);
290  const auto redefine_asn_type = aadl_information->CGetAsnType(redefine->name);
291  ComputeAddress(redefine_asn_type, tree_parameter_type, bambu_address, taste_address, registers, first_level,
292  little_endianess);
293  break;
294  }
296  {
297  const auto sequence = GetPointer<const SequenceAsnType>(asn_type);
298  const auto tree_record_type = GetPointer<const record_type>(TreeM->get_tree_node_const(tree_parameter_type));
299  const auto tree_fields = tree_record_type->list_of_flds;
300  size_t tree_field_index = 0;
301  for(const auto& field : sequence->fields)
302  {
303  ComputeAddress(field.second, tree_helper::CGetType(tree_fields[tree_field_index])->index, bambu_address,
304  taste_address, registers, false, little_endianess);
306  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos) >= 0,
307  "");
308  const auto field_bpos = static_cast<unsigned long long>(tree_helper::GetConstValue(
309  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos));
310  THROW_ASSERT(field_bpos % 8 == 0, "Bitfield not supported");
311  const auto current_field_beginning = field_bpos / 8;
312  const auto next_field_beginning = [&]() -> unsigned long long int {
313  if(tree_field_index + 1 > tree_fields.size())
314  {
315  return tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
316  }
317  else
318  {
320  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos) >=
321  0,
322  "");
323  return static_cast<unsigned long long>(
325  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos) /
326  8);
327  }
328  }();
329  const auto field_size = tree_helper::Size(tree_fields[tree_field_index]) / 8;
330  bambu_address = bambu_address + (field_size - (next_field_beginning - current_field_beginning));
331  tree_field_index++;
332  }
333  break;
334  }
336  {
338  const auto sequenceof = GetPointer<const SequenceOfAsnType>(asn_type);
339  const auto element_type = aadl_information->CGetAsnType(sequenceof->element);
340  for(size_t counter = 0; counter < sequenceof->size; counter++)
341  {
342  ComputeAddress(element_type,
344  bambu_address, taste_address, registers, false, little_endianess);
345  }
347  break;
348  }
349  case AsnType_Kind::SET:
350  {
351  const auto set = GetPointer<const SetAsnType>(asn_type);
352  const auto tree_record_type = GetPointer<const record_type>(TreeM->CGetTreeNode(tree_parameter_type));
353  const auto tree_fields = tree_record_type->list_of_flds;
354  size_t tree_field_index = 0;
355  for(const auto& field : set->fields)
356  {
357  ComputeAddress(field.second, tree_helper::CGetType(tree_fields[tree_field_index])->index, bambu_address,
358  taste_address, registers, false, little_endianess);
360  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos) >= 0,
361  "");
362  const auto field_bpos = static_cast<unsigned long long>(tree_helper::GetConstValue(
363  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos));
364  THROW_ASSERT(field_bpos % 8 == 0, "Bitfield not supported");
365  const auto current_field_beginning = field_bpos / 8;
366  const auto next_field_beginning = [&]() -> unsigned long long {
367  if(tree_field_index + 1 > tree_fields.size())
368  {
369  return tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
370  }
371  else
372  {
374  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos) >=
375  0,
376  "");
377  return static_cast<unsigned long long>(
379  GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos) /
380  8);
381  }
382  }();
383  const auto field_size = tree_helper::Size(tree_fields[tree_field_index]) / 8;
384  bambu_address = bambu_address + (field_size - (next_field_beginning - current_field_beginning));
385  tree_field_index++;
386  }
387  break;
388  }
389  case AsnType_Kind::SETOF:
390  {
391  const auto setof = GetPointer<const SetOfAsnType>(asn_type);
392  const auto element_type = aadl_information->CGetAsnType(setof->element);
393  for(size_t counter = 0; counter < setof->size; counter++)
394  {
395  ComputeAddress(element_type,
397  bambu_address, taste_address, registers, false, little_endianess);
398  }
399  break;
400  }
401  default:
402  THROW_UNREACHABLE("");
403  }
404 }
405 
407 {
408  already_executed = true;
409  bool changed = false;
410  const auto tmp_directory = parameters->getOption<std::string>(OPT_output_temporary_directory);
411  const auto top_functions = parameters->getOption<std::string>(OPT_top_functions_names);
412  auto new_top_functions = top_functions;
413  THROW_ASSERT(aadl_information->top_functions_names.size(), "");
414  for(const auto& top_function_name : aadl_information->top_functions_names)
415  {
416  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Analyzing function " + top_function_name);
418  unsigned long long int taste_return_address = 0;
419 
420  THROW_ASSERT(aadl_information->function_parameters.find("PI_" + top_function_name) !=
421  aadl_information->function_parameters.end(),
422  top_function_name);
423  auto& function_parameters = aadl_information->function_parameters.find("PI_" + top_function_name)->second;
424  const auto function_node = TreeM->GetFunction(top_function_name);
426  address_translation->Append("unsigned int " STR_CST_taste_address_translation + top_function_name +
427  "(unsigned int arg)\n");
428  address_translation->Append("{\n");
429  address_translation->Append("const unsigned int address[] = {0");
431  memory_enabling->Append("unsigned int " STR_CST_taste_memory_enabling + top_function_name +
432  "(unsigned int arg)\n");
433  memory_enabling->Append("{\n");
434  memory_enabling->Append("const unsigned int memory_enabling[] = {0");
436  data_size->Append("unsigned int " STR_CST_taste_data_size + top_function_name + "(unsigned int arg)\n");
437  data_size->Append("{\n");
438  data_size->Append("const unsigned int data_size[] = {0");
440  endianess_check->Append("unsigned int " STR_CST_taste_endianess_check + top_function_name +
441  "(unsigned int arg)\n");
442  endianess_check->Append("{\n");
443  endianess_check->Append("const unsigned int endianess_check[] = {0");
444  unsigned long long int bambu_address = 0;
446  unsigned long long int taste_address = 4;
448  CustomMap<std::string, unsigned int> parameter_to_type;
449  THROW_ASSERT(function_node, "Function " + top_function_name + " not found in tree");
450  const auto fd = GetPointer<const function_decl>(GET_CONST_NODE(function_node));
451  for(const auto& arg : fd->list_of_args)
452  {
453  const auto pd = GetPointer<const parm_decl>(GET_NODE(arg));
454  const auto id = GetPointer<const identifier_node>(GET_NODE(pd->name));
455  const auto param_name = id->strg;
456  parameter_to_type[param_name] = tree_helper::CGetType(arg)->index;
457  }
458  const auto ft = GetPointer<const function_type>(GET_NODE(fd->type));
459  if(ft->retn)
460  {
461  parameter_to_type["return"] = ft->retn->index;
462  }
463  bool used_return = false;
464  for(auto& parameter : function_parameters)
465  {
466  const auto parameter_name = parameter.name;
467  bambu_address = (bambu_address % 8) ? ((bambu_address / 8) + 1) * 8 : bambu_address;
468  taste_address = (taste_address % 8) ? ((taste_address / 8) + 1) * 8 : taste_address;
469 
470  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Analyzing parameter " + parameter_name);
471  const auto tree_parameter_index = [&]() -> unsigned int {
472  if(parameter_to_type.find(parameter_name) != parameter_to_type.end())
473  {
474  return parameter_to_type.find(parameter_name)->second;
475  }
476  else
477  {
478  THROW_ASSERT(not used_return, "Parameter " + parameter_name + " not found in C function");
479  THROW_ASSERT(parameter_to_type.find("return") != parameter_to_type.end(),
480  "Parameter " + parameter_name + " not found in C function");
481  used_return = true;
482  taste_return_address = taste_address;
483  return parameter_to_type.find("return")->second;
484  }
485  }();
486  const auto asn_type = aadl_information->CGetAsnType(parameter.asn_type);
488  parameter.bambu_address = bambu_address;
489  parameter.pointer = tree_helper::is_a_pointer(TreeM, tree_parameter_index);
490  ComputeAddress(asn_type, tree_parameter_index, bambu_address, taste_address, parameter.num_registers, true,
491  parameter.endianess);
492  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Analyzed parameter " + parameter_name);
493  }
494  address_translation->Append("};\n");
495  address_translation->Append("return address[arg];\n");
496  address_translation->Append("}\n");
497  memory_enabling->Append("};\n");
498  memory_enabling->Append("return memory_enabling[arg];\n");
499  memory_enabling->Append("}\n");
500  data_size->Append("};\n");
501  data_size->Append("return data_size[arg];\n");
502  data_size->Append("}\n");
503  endianess_check->Append("};\n");
504  endianess_check->Append("return endianess_check[arg];\n");
505  endianess_check->Append("}\n");
506 
507  const auto endianess_check_file = tmp_directory + "/" + STR_CST_taste_endianess_check + top_function_name + ".c";
508  endianess_check->WriteFile(endianess_check_file);
509  AppM->input_files.push_back(endianess_check_file);
510  new_top_functions += STR_CST_string_separator + STR_CST_taste_endianess_check + top_function_name;
511 
512  if(bambu_address != 0)
513  {
514  aadl_information->internal_memory_sizes[top_function_name] = bambu_address;
515  aadl_information->exposed_memory_sizes[top_function_name] = taste_address;
516  changed = true;
517  const auto address_translation_file =
518  tmp_directory + "/" + STR_CST_taste_address_translation + top_function_name + ".c";
519  const auto memory_enabling_file =
520  tmp_directory + "/" + STR_CST_taste_memory_enabling + top_function_name + ".c";
521  const auto data_size_file = tmp_directory + "/" + STR_CST_taste_data_size + top_function_name + ".c";
522  address_translation->WriteFile(address_translation_file);
523  memory_enabling->WriteFile(memory_enabling_file);
524  data_size->WriteFile(data_size_file);
525  AppM->input_files.push_back(address_translation_file);
526  AppM->input_files.push_back(memory_enabling_file);
527  AppM->input_files.push_back(data_size_file);
528  new_top_functions += STR_CST_string_separator + STR_CST_taste_address_translation + top_function_name +
531  }
533  output_multiplexer->Append("unsigned int " STR_CST_taste_output_multiplexer + top_function_name +
534  "(unsigned int address, unsigned int reg_status" +
535  (used_return ? ", unsigned int function_return_port" : "") +
536  (bambu_address != 0 ? ", unsigned int from_memory" : "") + ")\n");
537  output_multiplexer->Append("{\n");
538  output_multiplexer->Append("unsigned int ret = 0;\n");
539  if(used_return)
540  {
541  output_multiplexer->Append("if(address == " + STR(taste_return_address) + ")\n");
542  output_multiplexer->Append("{\n");
543  output_multiplexer->Append("return function_return_port;\n");
544  output_multiplexer->Append("}\n");
545  }
546  if(bambu_address != 0)
547  {
548  output_multiplexer->Append("if(address == 0)\n");
549  output_multiplexer->Append("{\n");
550  output_multiplexer->Append("return reg_status;\n");
551  output_multiplexer->Append("}\n");
552  output_multiplexer->Append("else\n");
553  output_multiplexer->Append("{\n");
554  output_multiplexer->Append("return from_memory;\n");
555  output_multiplexer->Append("}\n");
556  }
557  else
558  {
559  output_multiplexer->Append("return reg_status;\n");
560  }
561  output_multiplexer->Append("}\n");
562  const auto output_multiplexer_file =
563  tmp_directory + "/" + STR_CST_taste_output_multiplexer + top_function_name + ".c";
564  output_multiplexer->WriteFile(output_multiplexer_file);
565  AppM->input_files.push_back(output_multiplexer_file);
566  new_top_functions += STR_CST_string_separator + STR_CST_taste_output_multiplexer + top_function_name;
567 
568  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Analyzed function " + top_function_name);
569  }
571  reg_status->Append("unsigned int " STR_CST_taste_reg_status
572  "(unsigned int current_value, unsigned int from_outside, unsigned int from_done)\n");
573  reg_status->Append("{\n");
574  reg_status->Append("unsigned int ret = 0;\n");
576  reg_status->Append("unsigned int bit0 = from_outside & 1;\n");
577  reg_status->Append("ret = ret | bit0 ;\n");
579  reg_status->Append("unsigned int bit1 = (((bit0 != 0) && ((current_value & 2) == 0)) || (((current_value & 2) != 0) "
580  "&& (from_done == 0))) ? 2 : 0;\n");
581  reg_status->Append("ret = ret | bit1;\n");
583  reg_status->Append(
584  "unsigned int bit2 = (((current_value & 4) || (from_done)) && !((bit0) && !(current_value & 2))) ? 4 : 0;\n");
585  reg_status->Append("ret = ret | bit2;\n");
587  reg_status->Append("unsigned int bit3 = ((bit0) && (current_value & 2)) ? 8 : 0;\n");
588  reg_status->Append("ret = ret | bit3;\n");
589  reg_status->Append("return ret;\n");
590  reg_status->Append("}\n");
591  const auto reg_status_file = tmp_directory + "/" + STR_CST_taste_reg_status + ".c";
592  reg_status->WriteFile(reg_status_file);
593  AppM->input_files.push_back(reg_status_file);
594  new_top_functions += STR_CST_string_separator + STR_CST_taste_reg_status;
595 
596 #if 0
597  IndentedOutputStreamRef endianess_inversion(new IndentedOutputStream());
598  endianess_inversion->Append("unsigned int " STR_CST_taste_endianess_inversion " (unsigned int input, unsigned int endianess)\n");
599  endianess_inversion->Append("{\n");
600  endianess_inversion->Append("const int inverted = bswap32(input);\n");
601  endianess_inversion->Append("return endianess == 1 ? inverted : input;\n");
602  endianess_inversion->Append("}\n");
603  const auto endianess_inversion_file = tmp_directory + "/" + STR_CST_taste_endianess_inversion + ".c";
604  endianess_inversion->WriteFile(endianess_inversion_file);
605  AppM->input_files.push_back(endianess_inversion_file);
606 #endif
608 
609  const_cast<Parameter*>(parameters.get())->setOption(OPT_top_functions_names, new_top_functions);
611 }
612 
614 {
616  TreeM = AppM->get_tree_manager();
617 }
618 
620 {
621  return not already_executed;
622 }
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
The information collected from aadl file.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
virtual void Initialize()
Initialize the step (i.e., like a constructor, but executed just before exec.
File containing functions and utilities to support the printing of debug messagges.
void WriteFile(const std::string &file_name)
Write the indented output on a file.
#define STR_CST_string_separator
The character used to separate concatenated string.
Definition: utility.hpp:61
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Step successfully executed.
const tree_nodeRef CGetTreeReindex(const unsigned int i) const
Return a tree_reindex wrapping the i-th tree_node.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
#define STR_CST_taste_memory_enabling
The suffix of the memory enabling function.
void ComputeAddress(const AsnTypeRef asn_type, const unsigned int tree_parameter_type, unsigned long long &bambu_address, unsigned long long int &taste_address, unsigned int &registers, const bool first_level, const bool little_endianess)
Compute the addresses and add them to the writers.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
Source must be executed to satisfy target.
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
#define STR_CST_taste_output_multiplexer
The suffix of the output multiplexer function.
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
IndentedOutputStreamRef memory_enabling
The memory enabling stream.
Class to print indented code.
Writes source code of hdl module to translate addresses from pci address space to bambu address space...
bool already_executed
True if it was already executed.
const tree_nodeConstRef CGetTreeNode(const unsigned int i) const
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Definition: exceptions.hpp:292
~CreateAddressTranslation() override
Destructor.
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
refcount< IndentedOutputStream > IndentedOutputStreamRef
void Append(const std::string &str)
Append a string to the output.
const unsigned int index
Represent the index read from the raw file and the index-1 of the vector of tree_node associated to t...
Definition: tree_node.hpp:146
#define index(x, y)
Definition: Keccak.c:74
#define STR_CST_taste_reg_status
The suffix of the reg_status value computation function.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
#define GET_CONST_NODE(t)
Definition: tree_node.hpp:347
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
#define STR_CST_taste_endianess_check
The suffix of the endianess check function.
tree_managerConstRef TreeM
The tree manager.
static bool is_a_pointer(const tree_managerConstRef &TM, const unsigned int index)
Return if treenode index is a pointer.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
Wrapper of design_flow.
#define STR_CST_taste_data_size
The suffix of the data size function.
#define STR_CST_taste_endianess_inversion
The suffix of the endianess inversion function.
This file collects some utility functions.
enum FrontendFlowStepType { CREATE_TREE_MANAGER, FIND_MAX_TRANSFORMATIONS, FUNCTION_ANALYSIS, SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP, ADD_BB_ECFG_EDGES, ADD_ARTIFICIAL_CALL_FLOW_EDGES, ADD_OP_EXIT_FLOW_EDGES, ADD_OP_LOOP_FLOW_EDGES, ADD_OP_PHI_FLOW_EDGES, BAMBU_FRONTEND_FLOW, BASIC_BLOCKS_CFG_COMPUTATION, BB_CONTROL_DEPENDENCE_COMPUTATION, BB_FEEDBACK_EDGES_IDENTIFICATION, BB_ORDER_COMPUTATION, BB_REACHABILITY_COMPUTATION, BIT_VALUE, BIT_VALUE_OPT, BITVALUE_RANGE, BIT_VALUE_IPA, BLOCK_FIX, BUILD_VIRTUAL_PHI, CALL_EXPR_FIX, CALL_GRAPH_BUILTIN_CALL, CHECK_SYSTEM_TYPE, COMPLETE_BB_GRAPH, COMPLETE_CALL_GRAPH, COMPUTE_IMPLICIT_CALLS, COMMUTATIVE_EXPR_RESTRUCTURING, COND_EXPR_RESTRUCTURING, CSE_STEP, DATAFLOW_CG_EXT, DEAD_CODE_ELIMINATION, DEAD_CODE_ELIMINATION_IPA, DETERMINE_MEMORY_ACCESSES, DOM_POST_DOM_COMPUTATION, EXTRACT_GIMPLE_COND_OP, EXTRACT_PATTERNS, FIX_STRUCTS_PASSED_BY_VALUE, FUNCTION_CALL_TYPE_CLEANUP, FUNCTION_CALL_OPT, FANOUT_OPT, FIX_VDEF, HDL_FUNCTION_DECL_FIX, HDL_VAR_DECL_FIX, HLS_DIV_CG_EXT, HWCALL_INJECTION, INTERFACE_INFER, IR_LOWERING, LOOP_COMPUTATION, LOOPS_ANALYSIS_BAMBU, LOOPS_COMPUTATION, LUT_TRANSFORMATION, MULTI_WAY_IF, MULTIPLE_ENTRY_IF_REDUCTION, NI_SSA_LIVENESS, OP_CONTROL_DEPENDENCE_COMPUTATION, OP_FEEDBACK_EDGES_IDENTIFICATION, OP_ORDER_COMPUTATION, OP_REACHABILITY_COMPUTATION, OPERATIONS_CFG_COMPUTATION, PARM2SSA, PARM_DECL_TAKEN_ADDRESS, PHI_OPT, PREDICATE_STATEMENTS, ESSA, RANGE_ANALYSIS, REBUILD_INITIALIZATION, REBUILD_INITIALIZATION2, REMOVE_CLOBBER_GA, REMOVE_ENDING_IF, SCALAR_SSA_DATA_FLOW_ANALYSIS, SERIALIZE_MUTUAL_EXCLUSIONS, SPLIT_RETURN, SHORT_CIRCUIT_TAF, SIMPLE_CODE_MOTION, SOFT_FLOAT_CG_EXT, STRING_CST_FIX, SWITCH_FIX, UN_COMPARISON_LOWERING, UNROLLING_DEGREE, USE_COUNTING, VAR_ANALYSIS, VAR_DECL_FIX, VECTORIZE, VERIFICATION_OPERATION, VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, VIRTUAL_PHI_NODES_SPLIT } FrontendFlowStepType
IndentedOutputStreamRef data_size
The data size stream.
std::string GetSignature() const override
Return the signature of this step.
IndentedOutputStreamRef address_translation
The address translation stream.
constants used in taste
const AadlInformationRef aadl_information
The asn information.
refcount< T > lock() const
Definition: refcount.hpp:212
#define STR_CST_taste_address_translation
The suffix of the address translation function.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
AsnType_Kind GetKind()
Return the type.
Definition: asn_type.cpp:55
T * GetPointer(const refcount< U > &t)
Template function used to hide dynamic_cast The template parameter T represents a type of an object h...
Definition: refcount.hpp:237
short word
Definition: private.h:30
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
T * get() const
Definition: refcount.hpp:169
static tree_nodeConstRef CGetPointedType(const tree_nodeConstRef &pointer)
Return the pointed type of a pointer object.
this class is used to manage the command-line or XML options.
unsigned counter[N_THREADS]
Definition: data.c:3
Class to print indented code.
static integer_cst_t GetConstValue(const tree_nodeConstRef &tn, bool is_signed=true)
Get value from integer constant.
int debug_level
The debug level.
Data classes storing information for asn types.
DesignFlowStep_Status Exec() override
Execute this step.
tree_nodeRef GetFunction(const std::string &function_name) const
Return the index of a function given its name.
IndentedOutputStreamRef endianess_check
The endianess check stream.
CreateAddressTranslation(const application_managerRef AppM, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
Class specification of the manager of the tree structures extracted from the raw file.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

Generated on Mon Feb 12 2024 13:02:53 for PandA-2024.02 by doxygen 1.8.13