PandA-2024.02
minimal_interface.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) 2004-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  */
44 #include "minimal_interface.hpp"
45 
46 #include "Parameter.hpp"
47 #include "behavioral_helper.hpp"
48 #include "call_graph_manager.hpp"
49 #include "copyrights_strings.hpp"
50 #include "custom_map.hpp"
51 #include "custom_set.hpp"
52 #include "fileIO.hpp"
53 #include "hls.hpp"
54 #include "hls_device.hpp"
55 #include "hls_manager.hpp"
56 #include "memory.hpp"
57 #include "memory_allocation.hpp"
58 #include "memory_symbol.hpp"
59 #include "string_manipulation.hpp"
60 #include "structural_manager.hpp"
61 #include "structural_objects.hpp"
62 #include "technology_manager.hpp"
63 #include "technology_node.hpp"
64 #include "testbench_generation.hpp"
65 #include "tree_helper.hpp"
66 #include "tree_manager.hpp"
67 #include "tree_node.hpp"
68 #include "tree_reindex.hpp"
69 
70 #include <list>
71 #include <string>
72 #include <utility>
73 #include <vector>
74 
75 minimal_interface::minimal_interface(const ParameterConstRef _Param, const HLS_managerRef _HLSMgr, unsigned int _funId,
76  const DesignFlowManagerConstRef _design_flow_manager,
77  const HLSFlowStep_Type _hls_flow_step_type)
78  : module_interface(_Param, _HLSMgr, _funId, _design_flow_manager, _hls_flow_step_type)
79 {
80  THROW_ASSERT(funId, "Function not set in minimal interface");
81 }
82 
84 
86 {
87  const auto& SM = HLS->top;
88  if(!SM)
89  {
90  THROW_ERROR("Top component has not been created yet!");
91  }
92 
93  const auto FB = HLSMgr->CGetFunctionBehavior(funId);
94  const auto BH = FB->CGetBehavioralHelper();
95  const auto top_functions = HLSMgr->CGetCallGraphManager()->GetRootFunctions();
96  const auto is_top = top_functions.find(BH->get_function_index()) != top_functions.end();
97  const auto wrappedObj = SM->get_circ();
98  const auto module_name = is_top ? BH->get_function_name() : wrappedObj->get_id() + "_minimal_interface";
99 
100  const structural_managerRef SM_minimal_interface(new structural_manager(parameters));
101  const structural_type_descriptorRef module_type(new structural_type_descriptor(module_name));
102  SM_minimal_interface->set_top_info(module_name, module_type);
103  const auto interfaceObj = SM_minimal_interface->get_circ();
104 
105  // add the core to the wrapper
106  wrappedObj->set_owner(interfaceObj);
107  wrappedObj->set_id(wrappedObj->get_id() + "_i0");
108  GetPointerS<module>(interfaceObj)->add_internal_object(wrappedObj);
110  GetPointerS<module>(interfaceObj)
111  ->set_description("Minimal interface for function: " +
112  (is_top ? BH->get_function_name() : wrappedObj->get_typeRef()->id_type));
113  GetPointerS<module>(interfaceObj)->set_copyright(GENERATED_COPYRIGHT);
114  GetPointerS<module>(interfaceObj)->set_authors("Component automatically generated by bambu");
115  GetPointerS<module>(interfaceObj)->set_license(GENERATED_LICENSE);
116 
117  build_wrapper(wrappedObj, interfaceObj, SM_minimal_interface);
118 
119  if(!is_top || (parameters->isOption(OPT_expose_globals) && parameters->getOption<bool>(OPT_expose_globals)))
120  {
121  memory::propagate_memory_parameters(HLS->top->get_circ(), SM_minimal_interface);
122  }
123  // Generation completed, the new created module substitutes the current top-level one
124  HLS->top = SM_minimal_interface;
126 }
127 
128 static bool compareMemVarsPair(std::pair<unsigned int, memory_symbolRef>& first,
129  std::pair<unsigned int, memory_symbolRef>& second)
130 {
131  bool result = false;
132  if(first.second->get_address() < second.second->get_address())
133  {
134  result = true;
135  }
136 
137  return result;
138 }
139 
141  structural_managerRef SM_minimal_interface)
142 {
143  std::map<unsigned long long, structural_objectRef> null_values;
144 
145  const auto& base_address = HLSMgr->base_address;
146  const auto has_extern_mem = HLSMgr->Rmem->get_memory_address() - base_address > 0;
147  const auto has_unknown_addresses = HLSMgr->Rmem->has_unknown_addresses();
148  const auto FB = HLSMgr->CGetFunctionBehavior(funId);
149  const auto channels_number = FB->GetChannelsNumber();
150  const auto channels_type = FB->GetChannelsType();
151  const auto memory_allocation_policy = FB->GetMemoryAllocationPolicy();
152  const auto top_function_ids = HLSMgr->CGetCallGraphManager()->GetRootFunctions();
153  const auto Has_intern_shared_data =
154  HLSMgr->Rmem->has_intern_shared_data() ||
155  (memory_allocation_policy == MemoryAllocation_Policy::EXT_PIPELINED_BRAM) ||
156  (memory_allocation_policy == MemoryAllocation_Policy::NO_BRAM) ||
157  (top_function_ids.count(funId) ? parameters->getOption<bool>(OPT_memory_mapped_top) :
158  HLSMgr->hasToBeInterfaced(funId));
159  bool with_master = false;
160  bool with_slave = false;
161  for(auto i = 0U; i < GetPointerS<module>(wrappedObj)->get_in_port_size(); ++i)
162  {
163  const auto port_obj = GetPointerS<module>(wrappedObj)->get_in_port(i);
164  if(GetPointerS<port_o>(port_obj)->get_is_memory())
165  {
166  if(GetPointerS<port_o>(port_obj)->get_is_master())
167  {
168  with_master = true;
169  }
170  else if(GetPointerS<port_o>(port_obj)->get_is_slave())
171  {
172  with_slave = true;
173  }
174  }
175  }
176 
180 
181  if(with_slave)
182  {
183  portsToConstant.insert(wrappedObj->find_member("Sin_DataRdy", port_o_K, wrappedObj));
184  portsToConstant.insert(wrappedObj->find_member("Sin_Rdata_ram", port_o_K, wrappedObj));
185  }
186  if(with_master)
187  {
188  portsToConstant.insert(wrappedObj->find_member("Min_oe_ram", port_o_K, wrappedObj));
189  portsToConstant.insert(wrappedObj->find_member("Min_we_ram", port_o_K, wrappedObj));
190  portsToConstant.insert(wrappedObj->find_member("Min_addr_ram", port_o_K, wrappedObj));
191  portsToConstant.insert(wrappedObj->find_member("Min_Wdata_ram", port_o_K, wrappedObj));
192  portsToConstant.insert(wrappedObj->find_member("Min_data_ram_size", port_o_K, wrappedObj));
193  }
194 
195  std::map<structural_objectRef, structural_objectRef> portsToConnect;
196  std::map<structural_objectRef, structural_objectRef> portsToSigConnect;
197 
198  CustomOrderedSet<std::string> param_renamed;
200  {
201  const auto fname = FB->CGetBehavioralHelper()->GetMangledFunctionName();
202  const auto func_arch = HLSMgr->module_arch->GetArchitecture(fname);
203  THROW_ASSERT(func_arch, "Expected interface architecture for function " + fname);
204  for(const auto& [parm_name, attrs] : func_arch->parms)
205  {
206  const auto& bundle_name = attrs.at(FunctionArchitecture::parm_bundle);
207  THROW_ASSERT(func_arch->ifaces.find(bundle_name) != func_arch->ifaces.end(),
208  "Expected bundle " + bundle_name + " in function " + fname);
209  const auto& iface_attrs = func_arch->ifaces.at(bundle_name);
210  const auto& iface_mode = iface_attrs.at(FunctionArchitecture::iface_mode);
211  if(iface_mode != "default")
212  {
213  const auto parm_port = wrappedObj->find_member(parm_name, port_o_K, wrappedObj);
214  THROW_ASSERT(parm_port, "Expected parameter port " + parm_name + " in function " + fname);
215  const auto forward_port = iface_mode == "m_axi" && attrs.at(FunctionArchitecture::parm_offset) == "direct";
216  if(!forward_port)
217  {
218  portsToConstant.insert(parm_port);
219  }
220  param_renamed.insert(parm_name);
221  }
222  }
223  }
224 
225  auto do_not_expose_globals_case = [&] {
226  auto manage_feedback1 = [&](const std::string& portS, const std::string& portM) {
229  const auto port1 = wrappedObj->find_member(portS, port_o_K, wrappedObj);
230  const auto port2 = wrappedObj->find_member(portM, port_o_K, wrappedObj);
231  if(port1->get_kind() == port_vector_o_K)
232  {
233  sign = SM_minimal_interface->add_sign_vector(port2->get_id() + "_INT",
234  GetPointerS<port_o>(port2)->get_ports_size(), interfaceObj,
235  port2->get_typeRef());
236  }
237  else
238  {
239  sign = SM_minimal_interface->add_sign(port2->get_id() + "_INT", interfaceObj, port2->get_typeRef());
240  }
241  SM_minimal_interface->add_connection(port1, sign);
242  SM_minimal_interface->add_connection(sign, port2);
243  portsToSigConnect[port2] = sign;
244  portsToSkip.insert(wrappedObj->find_member(portS, port_o_K, wrappedObj));
245  };
246  auto manage_feedback2 = [&](const std::string& portSin, const std::string& portSout, const std::string& portM) {
249  const auto port2 = wrappedObj->find_member(portM, port_o_K, wrappedObj);
250  if(port2->get_kind() == port_vector_o_K)
251  {
252  sign = SM_minimal_interface->add_sign_vector(port2->get_id() + "_INT",
253  GetPointerS<port_o>(port2)->get_ports_size(), interfaceObj,
254  port2->get_typeRef());
255  }
256  else
257  {
258  sign = SM_minimal_interface->add_sign(port2->get_id() + "_INT", interfaceObj, port2->get_typeRef());
259  }
260  const auto port1In = wrappedObj->find_member(portSin, port_o_K, wrappedObj);
261  SM_minimal_interface->add_connection(port1In, sign);
262  portsToSigConnect[port2] = sign;
263 
264  const auto port1Out = wrappedObj->find_member(portSout, port_o_K, wrappedObj);
265  if(port1Out->get_kind() == port_vector_o_K)
266  {
267  sign = SM_minimal_interface->add_sign_vector(port1Out->get_id() + "_INT",
268  GetPointerS<port_o>(port1Out)->get_ports_size(), interfaceObj,
269  port1Out->get_typeRef());
270  }
271  else
272  {
273  sign = SM_minimal_interface->add_sign(port1Out->get_id() + "_INT", interfaceObj, port1Out->get_typeRef());
274  }
275  SM_minimal_interface->add_connection(port1Out, sign);
276  SM_minimal_interface->add_connection(sign, port2);
277 
278  portsToSkip.insert(wrappedObj->find_member(portSin, port_o_K, wrappedObj));
279  portsToSkip.insert(wrappedObj->find_member(portSout, port_o_K, wrappedObj));
280  };
281  manage_feedback1("S_oe_ram", "Mout_oe_ram");
282  manage_feedback1("S_we_ram", "Mout_we_ram");
283  manage_feedback1("S_addr_ram", "Mout_addr_ram");
284  manage_feedback1("S_Wdata_ram", "Mout_Wdata_ram");
285  manage_feedback1("S_data_ram_size", "Mout_data_ram_size");
286  manage_feedback2("Sin_DataRdy", "Sout_DataRdy", "M_DataRdy");
287  manage_feedback2("Sin_Rdata_ram", "Sout_Rdata_ram", "M_Rdata_ram");
288  portsToConstant.erase(portsToConstant.find(wrappedObj->find_member("Sin_DataRdy", port_o_K, wrappedObj)));
289  portsToConstant.erase(portsToConstant.find(wrappedObj->find_member("Sin_Rdata_ram", port_o_K, wrappedObj)));
290  };
291  if(!Has_intern_shared_data)
292  {
293  if(!has_extern_mem)
294  {
295  if(!with_master && with_slave)
296  {
298  portsToConstant.insert(wrappedObj->find_member("S_oe_ram", port_o_K, wrappedObj));
299  portsToConstant.insert(wrappedObj->find_member("S_we_ram", port_o_K, wrappedObj));
300  portsToConstant.insert(wrappedObj->find_member("S_addr_ram", port_o_K, wrappedObj));
301  portsToConstant.insert(wrappedObj->find_member("S_Wdata_ram", port_o_K, wrappedObj));
302  portsToConstant.insert(wrappedObj->find_member("S_data_ram_size", port_o_K, wrappedObj));
304  portsToSkip.insert(wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj));
305  portsToSkip.insert(wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj));
306  }
307  else if(with_master && !with_slave)
308  {
311  }
312  else if(with_master && with_slave && has_unknown_addresses &&
313  HLSMgr->Rmem->get_allocated_internal_memory() == 0)
314  {
317  portsToConstant.insert(wrappedObj->find_member("S_oe_ram", port_o_K, wrappedObj));
318  portsToConstant.insert(wrappedObj->find_member("S_we_ram", port_o_K, wrappedObj));
319  portsToConstant.insert(wrappedObj->find_member("S_addr_ram", port_o_K, wrappedObj));
320  portsToConstant.insert(wrappedObj->find_member("S_Wdata_ram", port_o_K, wrappedObj));
321  portsToConstant.insert(wrappedObj->find_member("S_data_ram_size", port_o_K, wrappedObj));
323  portsToSkip.insert(wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj));
324  portsToSkip.insert(wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj));
325  }
326  else if(with_master && with_slave && !has_unknown_addresses)
327  {
329  portsToConnect[wrappedObj->find_member("S_oe_ram", port_o_K, wrappedObj)] =
330  wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj);
331  portsToConnect[wrappedObj->find_member("S_we_ram", port_o_K, wrappedObj)] =
332  wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj);
333  portsToConnect[wrappedObj->find_member("S_addr_ram", port_o_K, wrappedObj)] =
334  wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj);
335  portsToConnect[wrappedObj->find_member("S_Wdata_ram", port_o_K, wrappedObj)] =
336  wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj);
337  portsToConnect[wrappedObj->find_member("S_data_ram_size", port_o_K, wrappedObj)] =
338  wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj);
340  portsToConnect[wrappedObj->find_member("M_Rdata_ram", port_o_K, wrappedObj)] =
341  wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj);
342  portsToConnect[wrappedObj->find_member("M_DataRdy", port_o_K, wrappedObj)] =
343  wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj);
345  portsToSkip.insert(wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj));
346  portsToSkip.insert(wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj));
348  portsToSkip.insert(wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj));
349  portsToSkip.insert(wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj));
350  portsToSkip.insert(wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj));
351  portsToSkip.insert(wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj));
352  portsToSkip.insert(wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj));
353  }
354  else if(with_slave &&
355  (!parameters->isOption(OPT_expose_globals) || !parameters->getOption<bool>(OPT_expose_globals)))
356  {
357  do_not_expose_globals_case();
358  }
359  else
360  {
362  }
363  }
364  else
365  {
366  if(with_master && !has_unknown_addresses && HLSMgr->Rmem->get_ext_memory_variables().empty())
367  {
368  THROW_ASSERT(channels_type != (MemoryAllocation_ChannelsType::MEM_ACC_P1N), "unexpected condition");
370  structural_objectRef shared_memory;
371  bool is_memory_splitted;
372  std::string latency_postfix = "";
373  if(parameters->getOption<std::string>(OPT_bram_high_latency) != "")
374  {
375  latency_postfix = parameters->getOption<std::string>(OPT_bram_high_latency);
376  }
377  if(channels_type == MemoryAllocation_ChannelsType::MEM_ACC_11 or
379  {
380  is_memory_splitted = false;
381  shared_memory = SM_minimal_interface->add_module_from_technology_library(
382  "shared_memory", STD_BRAM + latency_postfix, LIBRARY_STD, interfaceObj,
383  HLSMgr->get_HLS_device()->get_technology_manager());
384  }
385  else
386  {
387  is_memory_splitted = true;
388  shared_memory = SM_minimal_interface->add_module_from_technology_library(
389  "shared_memory", STD_BRAMN + latency_postfix, LIBRARY_STD, interfaceObj,
390  HLSMgr->get_HLS_device()->get_technology_manager());
391  }
392  auto bus_data_bitsize = HLSMgr->Rmem->get_bus_data_bitsize();
393  auto bus_addr_bitsize = HLSMgr->get_address_bitsize();
394  auto bus_size_bitsize = HLSMgr->Rmem->get_bus_size_bitsize();
395  auto bram_bitsize = HLSMgr->Rmem->get_bram_bitsize();
396  unsigned long long int n_bytes = HLSMgr->Rmem->get_memory_address() - base_address;
397  unsigned long long int vec_size = n_bytes / (bus_data_bitsize / 8);
398  std::string init_filename = "shared_memory.mem";
399  std::ofstream init_file_a(GetPath(init_filename));
400  std::ofstream init_file_b(GetPath("0_" + init_filename));
401 
402  auto* shared_memory_module = GetPointer<module>(shared_memory);
403  shared_memory_module->SetParameter("address_space_begin", STR(base_address));
404  shared_memory_module->SetParameter("address_space_rangesize", STR(n_bytes));
405  if(parameters->isOption(OPT_sparse_memory) && parameters->getOption<bool>(OPT_sparse_memory))
406  {
407  shared_memory_module->SetParameter("USE_SPARSE_MEMORY", "1");
408  }
409  else
410  {
411  shared_memory_module->SetParameter("USE_SPARSE_MEMORY", "0");
412  }
413  if(is_memory_splitted)
414  {
415  shared_memory_module->SetParameter("MEMORY_INIT_file_a", "\"\"" + GetPath(init_filename) + "\"\"");
416  shared_memory_module->SetParameter("MEMORY_INIT_file_b",
417  "\"\"" + GetPath("0_" + init_filename) + "\"\"");
418  }
419  else
420  {
421  shared_memory_module->SetParameter("MEMORY_INIT_file", "\"\"" + GetPath(init_filename) + "\"\"");
422  }
423  shared_memory_module->SetParameter("n_elements", STR(vec_size));
424  shared_memory_module->SetParameter("data_size", STR(bus_data_bitsize));
425  shared_memory_module->SetParameter("BRAM_BITSIZE", STR(bram_bitsize));
426  if(has_extern_mem || has_unknown_addresses)
427  {
428  shared_memory_module->SetParameter("BUS_PIPELINED", "0");
429  }
430  else
431  {
432  shared_memory_module->SetParameter("BUS_PIPELINED", "1");
433  }
434  for(unsigned int i = 0; i < shared_memory_module->get_in_port_size(); i++)
435  {
436  structural_objectRef port = shared_memory_module->get_in_port(i);
437  if(GetPointer<port_o>(port)->get_kind() == port_vector_o_K &&
438  GetPointer<port_o>(port)->get_ports_size() == 0)
439  {
440  GetPointer<port_o>(port)->add_n_ports(channels_number, port);
441  }
442  if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_data_bus())
443  {
444  port->type_resize(bus_data_bitsize);
445  }
446  else if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_addr_bus())
447  {
448  port->type_resize(bus_addr_bitsize);
449  }
450  else if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_size_bus())
451  {
452  port->type_resize(bus_size_bitsize);
453  }
454  }
455  for(unsigned int i = 0; i < shared_memory_module->get_out_port_size(); i++)
456  {
457  structural_objectRef port = shared_memory_module->get_out_port(i);
458  if(GetPointer<port_o>(port)->get_kind() == port_vector_o_K &&
459  GetPointer<port_o>(port)->get_ports_size() == 0)
460  {
461  GetPointer<port_o>(port)->add_n_ports(channels_number, port);
462  }
463  if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_data_bus())
464  {
465  port->type_resize(bus_data_bitsize);
466  }
467  else if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_addr_bus())
468  {
469  port->type_resize(bus_addr_bitsize);
470  }
471  else if(GetPointer<port_o>(port) && GetPointer<port_o>(port)->get_is_size_bus())
472  {
473  port->type_resize(bus_size_bitsize);
474  }
475  }
476  const auto& mem_vars = HLSMgr->Rmem->get_ext_memory_variables();
477  auto nbyte_on_memory = (bram_bitsize / 8);
478 
479  std::string init_v;
480  std::string current_bits;
481  unsigned int counter = 0;
482  bool is_even = true;
483  std::list<std::pair<unsigned int, memory_symbolRef>> mem_variables;
484  for(const auto& mem_var : mem_vars)
485  {
486  mem_variables.push_back(std::make_pair(mem_var.first, mem_var.second));
487  }
488  mem_variables.sort(compareMemVarsPair);
489 
490  std::list<std::pair<unsigned int, memory_symbolRef>>::const_iterator m_next;
491  for(auto m = mem_variables.begin(); m != mem_variables.end(); ++m)
492  {
493  const auto splitted =
494  TestbenchGeneration::print_var_init(HLSMgr->get_tree_manager(), m->first, HLSMgr->Rmem);
495  unsigned int byte_allocated = 0;
496  unsigned long long int actual_byte =
497  tree_helper::Size(HLSMgr->get_tree_manager()->CGetTreeReindex(m->first)) / 8;
498  std::vector<std::string> eightbit_string;
499  for(const auto& i : splitted)
500  {
501  current_bits = i;
502  for(unsigned int base_index = 0; base_index < current_bits.size();
503  base_index = base_index + 8, ++byte_allocated)
504  {
505  eightbit_string.push_back(current_bits.substr(current_bits.size() - 8 - base_index, 8));
506  }
507  }
508  std::string str_bit;
509  str_bit = "";
510  for(unsigned int l = 0; l < eightbit_string.size();)
511  {
512  do
513  {
514  str_bit = eightbit_string[l] + str_bit;
515  ++counter;
516  ++l;
517  if(counter % nbyte_on_memory == 0)
518  {
519  if(is_even || !is_memory_splitted)
520  {
521  init_file_a << str_bit << std::endl;
522  }
523  else
524  {
525  init_file_b << str_bit << std::endl;
526  }
527  str_bit = "";
528  is_even = !is_even;
529  }
530  } while(l < eightbit_string.size());
531  }
533  if(actual_byte > byte_allocated)
534  {
535  for(unsigned int base_index = 0; base_index < actual_byte - byte_allocated; ++base_index)
536  {
537  str_bit = "00000000" + str_bit;
538  counter++;
539  if(counter % nbyte_on_memory == 0)
540  {
541  if(is_even || !is_memory_splitted)
542  {
543  init_file_a << str_bit << std::endl;
544  }
545  else
546  {
547  init_file_b << str_bit << std::endl;
548  }
549  str_bit = "";
550  is_even = !is_even;
551  }
552  }
553  }
555  m_next = m;
556  ++m_next;
557  unsigned long long int object_offset;
558  if(m_next != mem_variables.end())
559  {
560  object_offset = HLSMgr->Rmem->get_base_address(m_next->first, HLS->functionId) -
561  HLSMgr->Rmem->get_base_address(m->first, HLS->functionId);
562  }
563  else
564  {
565  object_offset =
566  HLSMgr->Rmem->get_memory_address() - HLSMgr->Rmem->get_base_address(m->first, HLS->functionId);
567  }
568  THROW_ASSERT(object_offset >= actual_byte, "more allocated memory than expected");
569  if(object_offset > actual_byte)
570  {
571  for(unsigned long long int base_index = 0; base_index < object_offset - actual_byte; ++base_index)
572  {
573  str_bit = "00000000" + str_bit;
574  counter++;
575  if(counter % nbyte_on_memory == 0)
576  {
577  if(is_even || !is_memory_splitted)
578  {
579  init_file_a << str_bit << std::endl;
580  }
581  else
582  {
583  init_file_b << str_bit << std::endl;
584  }
585  str_bit = "";
586  is_even = !is_even;
587  }
588  }
589  }
590  }
591 
592  structural_objectRef clock_port, reset_port;
593  structural_objectRef port_ck = shared_memory->find_member(CLOCK_PORT_NAME, port_o_K, shared_memory);
594  if(parameters->isOption(OPT_clock_name))
595  {
596  clock_port = SM_minimal_interface->add_port(parameters->getOption<std::string>(OPT_clock_name),
597  port_o::IN, interfaceObj, port_ck->get_typeRef());
598  }
599  else
600  {
601  clock_port = SM_minimal_interface->add_port(GetPointer<port_o>(port_ck)->get_id(), port_o::IN,
602  interfaceObj, port_ck->get_typeRef());
603  }
604  SM_minimal_interface->add_connection(clock_port, port_ck);
605 
606  structural_objectRef port_rst = shared_memory->find_member(RESET_PORT_NAME, port_o_K, shared_memory);
607  if(parameters->isOption(OPT_reset_name))
608  {
609  reset_port = SM_minimal_interface->add_port(parameters->getOption<std::string>(OPT_reset_name),
610  port_o::IN, interfaceObj, port_rst->get_typeRef());
611  }
612  else
613  {
614  reset_port = SM_minimal_interface->add_port(GetPointer<port_o>(port_rst)->get_id(), port_o::IN,
615  interfaceObj, port_rst->get_typeRef());
616  }
617  SM_minimal_interface->add_connection(reset_port, port_rst);
618 
619  if(!with_slave)
620  {
621  structural_objectRef port1, port2;
624  port1 = shared_memory->find_member("S_oe_ram", port_o_K, shared_memory);
625  port2 = wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj);
626  if(port1->get_kind() == port_vector_o_K)
627  {
628  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
629  GetPointer<port_o>(port1)->get_ports_size(),
630  interfaceObj, port1->get_typeRef());
631  }
632  else
633  {
634  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
635  }
636  SM_minimal_interface->add_connection(port1, sign);
637  SM_minimal_interface->add_connection(sign, port2);
638  port1 = shared_memory->find_member("S_we_ram", port_o_K, shared_memory);
639  port2 = wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj);
640  if(port1->get_kind() == port_vector_o_K)
641  {
642  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
643  GetPointer<port_o>(port1)->get_ports_size(),
644  interfaceObj, port1->get_typeRef());
645  }
646  else
647  {
648  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
649  }
650  SM_minimal_interface->add_connection(port1, sign);
651  SM_minimal_interface->add_connection(sign, port2);
652  port1 = shared_memory->find_member("S_addr_ram", port_o_K, shared_memory);
653  port2 = wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj);
654  if(port1->get_kind() == port_vector_o_K)
655  {
656  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
657  GetPointer<port_o>(port1)->get_ports_size(),
658  interfaceObj, port1->get_typeRef());
659  }
660  else
661  {
662  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
663  }
664  SM_minimal_interface->add_connection(port1, sign);
665  SM_minimal_interface->add_connection(sign, port2);
666  port1 = shared_memory->find_member("S_Wdata_ram", port_o_K, shared_memory);
667  port2 = wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj);
668  if(port1->get_kind() == port_vector_o_K)
669  {
670  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
671  GetPointer<port_o>(port1)->get_ports_size(),
672  interfaceObj, port1->get_typeRef());
673  }
674  else
675  {
676  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
677  }
678  SM_minimal_interface->add_connection(port1, sign);
679  SM_minimal_interface->add_connection(sign, port2);
680  port1 = shared_memory->find_member("S_data_ram_size", port_o_K, shared_memory);
681  port2 = wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj);
682  if(port1->get_kind() == port_vector_o_K)
683  {
684  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
685  GetPointer<port_o>(port1)->get_ports_size(),
686  interfaceObj, port1->get_typeRef());
687  }
688  else
689  {
690  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
691  }
692  SM_minimal_interface->add_connection(port1, sign);
693  SM_minimal_interface->add_connection(sign, port2);
694 
695  port1 = shared_memory->find_member("Sin_DataRdy", port_o_K, shared_memory);
696  if(null_values.find(GET_TYPE_SIZE(port1)) == null_values.end())
697  {
698  structural_objectRef const_obj = SM_minimal_interface->add_constant(
699  "null_value_" + STR(GET_TYPE_SIZE(port1)), interfaceObj, port1->get_typeRef(), STR(0));
700  null_values[GET_TYPE_SIZE(port1)] = const_obj;
701  }
702  if(port1->get_kind() == port_vector_o_K)
703  {
704  for(unsigned int p = 0; p < GetPointer<port_o>(port1)->get_ports_size(); ++p)
705  {
706  structural_objectRef port_d = GetPointer<port_o>(port1)->get_port(p);
707  SM_minimal_interface->add_connection(port_d, null_values[GET_TYPE_SIZE(port_d)]);
708  }
709  }
710  else
711  {
712  SM_minimal_interface->add_connection(port1, null_values[GET_TYPE_SIZE(port1)]);
713  }
714 
715  port1 = shared_memory->find_member("Sin_Rdata_ram", port_o_K, shared_memory);
716  if(null_values.find(GET_TYPE_SIZE(port1)) == null_values.end())
717  {
718  structural_objectRef const_obj = SM_minimal_interface->add_constant(
719  "null_value_" + STR(GET_TYPE_SIZE(port1)), interfaceObj, port1->get_typeRef(), STR(0));
720  null_values[GET_TYPE_SIZE(port1)] = const_obj;
721  }
722  if(port1->get_kind() == port_vector_o_K)
723  {
724  for(unsigned int p = 0; p < GetPointer<port_o>(port1)->get_ports_size(); ++p)
725  {
726  structural_objectRef port_d = GetPointer<port_o>(port1)->get_port(p);
727  SM_minimal_interface->add_connection(port_d, null_values[GET_TYPE_SIZE(port_d)]);
728  }
729  }
730  else
731  {
732  SM_minimal_interface->add_connection(port1, null_values[GET_TYPE_SIZE(port1)]);
733  }
734 
736  portsToConnect[wrappedObj->find_member("M_Rdata_ram", port_o_K, wrappedObj)] =
737  shared_memory->find_member("Sout_Rdata_ram", port_o_K, shared_memory);
738  portsToConnect[wrappedObj->find_member("M_DataRdy", port_o_K, wrappedObj)] =
739  shared_memory->find_member("Sout_DataRdy", port_o_K, shared_memory);
740 
742  portsToSkip.insert(wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj));
743  portsToSkip.insert(wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj));
744  portsToSkip.insert(wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj));
745  portsToSkip.insert(wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj));
746  portsToSkip.insert(wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj));
747  }
748  else
749  {
750  structural_objectRef port1, port2;
753  port1 = shared_memory->find_member("S_oe_ram", port_o_K, shared_memory);
754  port2 = wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj);
755  if(port1->get_kind() == port_vector_o_K)
756  {
757  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
758  GetPointer<port_o>(port1)->get_ports_size(),
759  interfaceObj, port1->get_typeRef());
760  }
761  else
762  {
763  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
764  }
765  SM_minimal_interface->add_connection(port1, sign);
766  SM_minimal_interface->add_connection(sign, port2);
767  port1 = wrappedObj->find_member("S_oe_ram", port_o_K, wrappedObj);
768  portsToSkip.insert(port1);
769  SM_minimal_interface->add_connection(port1, sign);
770 
771  port1 = shared_memory->find_member("S_we_ram", port_o_K, shared_memory);
772  port2 = wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj);
773  if(port1->get_kind() == port_vector_o_K)
774  {
775  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
776  GetPointer<port_o>(port1)->get_ports_size(),
777  interfaceObj, port1->get_typeRef());
778  }
779  else
780  {
781  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
782  }
783  SM_minimal_interface->add_connection(port1, sign);
784  SM_minimal_interface->add_connection(sign, port2);
785  port1 = wrappedObj->find_member("S_we_ram", port_o_K, wrappedObj);
786  portsToSkip.insert(port1);
787  SM_minimal_interface->add_connection(port1, sign);
788 
789  port1 = shared_memory->find_member("S_addr_ram", port_o_K, shared_memory);
790  port2 = wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj);
791  if(port1->get_kind() == port_vector_o_K)
792  {
793  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
794  GetPointer<port_o>(port1)->get_ports_size(),
795  interfaceObj, port1->get_typeRef());
796  }
797  else
798  {
799  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
800  }
801  SM_minimal_interface->add_connection(port1, sign);
802  SM_minimal_interface->add_connection(sign, port2);
803  port1 = wrappedObj->find_member("S_addr_ram", port_o_K, wrappedObj);
804  portsToSkip.insert(port1);
805  SM_minimal_interface->add_connection(port1, sign);
806 
807  port1 = shared_memory->find_member("S_Wdata_ram", port_o_K, shared_memory);
808  port2 = wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj);
809  if(port1->get_kind() == port_vector_o_K)
810  {
811  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
812  GetPointer<port_o>(port1)->get_ports_size(),
813  interfaceObj, port1->get_typeRef());
814  }
815  else
816  {
817  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
818  }
819  SM_minimal_interface->add_connection(port1, sign);
820  SM_minimal_interface->add_connection(sign, port2);
821  port1 = wrappedObj->find_member("S_Wdata_ram", port_o_K, wrappedObj);
822  portsToSkip.insert(port1);
823  SM_minimal_interface->add_connection(port1, sign);
824 
825  port1 = shared_memory->find_member("S_data_ram_size", port_o_K, shared_memory);
826  port2 = wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj);
827  if(port1->get_kind() == port_vector_o_K)
828  {
829  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
830  GetPointer<port_o>(port1)->get_ports_size(),
831  interfaceObj, port1->get_typeRef());
832  }
833  else
834  {
835  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
836  }
837  SM_minimal_interface->add_connection(port1, sign);
838  SM_minimal_interface->add_connection(sign, port2);
839  port1 = wrappedObj->find_member("S_data_ram_size", port_o_K, wrappedObj);
840  portsToSkip.insert(port1);
841  SM_minimal_interface->add_connection(port1, sign);
842 
843  port1 = wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj);
844  port2 = shared_memory->find_member("Sin_DataRdy", port_o_K, shared_memory);
845  if(port1->get_kind() == port_vector_o_K)
846  {
847  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
848  GetPointer<port_o>(port1)->get_ports_size(),
849  interfaceObj, port1->get_typeRef());
850  }
851  else
852  {
853  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
854  }
855  SM_minimal_interface->add_connection(port1, sign);
856  SM_minimal_interface->add_connection(sign, port2);
857 
858  port1 = wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj);
859  port2 = shared_memory->find_member("Sin_Rdata_ram", port_o_K, shared_memory);
860  if(port1->get_kind() == port_vector_o_K)
861  {
862  sign = SM_minimal_interface->add_sign_vector(port1->get_id() + "_INT",
863  GetPointer<port_o>(port1)->get_ports_size(),
864  interfaceObj, port1->get_typeRef());
865  }
866  else
867  {
868  sign = SM_minimal_interface->add_sign(port1->get_id() + "_INT", interfaceObj, port1->get_typeRef());
869  }
870  SM_minimal_interface->add_connection(port1, sign);
871  SM_minimal_interface->add_connection(sign, port2);
872 
874  portsToConnect[wrappedObj->find_member("M_Rdata_ram", port_o_K, wrappedObj)] =
875  shared_memory->find_member("Sout_Rdata_ram", port_o_K, shared_memory);
876  portsToConnect[wrappedObj->find_member("M_DataRdy", port_o_K, wrappedObj)] =
877  shared_memory->find_member("Sout_DataRdy", port_o_K, shared_memory);
878 
880  portsToSkip.insert(wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj));
881  portsToSkip.insert(wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj));
883  portsToSkip.insert(wrappedObj->find_member("Mout_oe_ram", port_o_K, wrappedObj));
884  portsToSkip.insert(wrappedObj->find_member("Mout_we_ram", port_o_K, wrappedObj));
885  portsToSkip.insert(wrappedObj->find_member("Mout_addr_ram", port_o_K, wrappedObj));
886  portsToSkip.insert(wrappedObj->find_member("Mout_Wdata_ram", port_o_K, wrappedObj));
887  portsToSkip.insert(wrappedObj->find_member("Mout_data_ram_size", port_o_K, wrappedObj));
888  }
889  }
890  else if(with_slave &&
891  (!parameters->isOption(OPT_expose_globals) || !parameters->getOption<bool>(OPT_expose_globals)))
892  {
893  do_not_expose_globals_case();
894  }
895  else if(with_slave && (HLSMgr->Rmem->get_allocated_internal_memory() == 0))
896  {
898  portsToConstant.insert(wrappedObj->find_member("S_oe_ram", port_o_K, wrappedObj));
899  portsToConstant.insert(wrappedObj->find_member("S_we_ram", port_o_K, wrappedObj));
900  portsToConstant.insert(wrappedObj->find_member("S_addr_ram", port_o_K, wrappedObj));
901  portsToConstant.insert(wrappedObj->find_member("S_Wdata_ram", port_o_K, wrappedObj));
902  portsToConstant.insert(wrappedObj->find_member("S_data_ram_size", port_o_K, wrappedObj));
904  portsToSkip.insert(wrappedObj->find_member("Sout_Rdata_ram", port_o_K, wrappedObj));
905  portsToSkip.insert(wrappedObj->find_member("Sout_DataRdy", port_o_K, wrappedObj));
906  }
907  }
908  }
909 
910  // in ports
911  for(unsigned int i = 0; i < GetPointer<module>(wrappedObj)->get_in_port_size(); ++i)
912  {
913  structural_objectRef port_in = GetPointer<module>(wrappedObj)->get_in_port(i);
914  auto port_name = GetPointer<port_o>(port_in)->get_id();
915  if(param_renamed.find(port_name) != param_renamed.end())
916  {
917  structural_objectRef ext_port = interfaceObj->find_member(port_name, port_o_K, interfaceObj);
918  structural_objectRef int_port = wrappedObj->find_member("_" + port_name, port_o_K, wrappedObj);
919  if(int_port)
920  {
921  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_RNONE)
922  {
923  portsToSkip.insert(int_port);
924  if(!ext_port)
925  {
926  if(port_in->get_kind() == port_vector_o_K)
927  {
928  ext_port = SM_minimal_interface->add_port_vector(port_name, port_o::IN,
929  GetPointer<port_o>(int_port)->get_ports_size(),
930  interfaceObj, int_port->get_typeRef());
931  }
932  else
933  {
934  ext_port =
935  SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, int_port->get_typeRef());
936  }
937  }
938  port_o::fix_port_properties(int_port, ext_port);
939  SM_minimal_interface->add_connection(int_port, ext_port);
940  }
941  else if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_WNONE)
942  {
943  THROW_ASSERT(GetPointer<port_o>(int_port)->get_port_direction() == port_o::port_direction::OUT,
944  "unexpected condition");
945  }
946  else if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_M_AXI_OFF)
947  {
948  portsToConstant.insert(int_port);
949  }
950  else if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_M_AXI_DIRECT)
951  {
952  portsToConstant.insert(int_port);
953  }
954  else if(GetPointer<port_o>(int_port)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
955  {
956  THROW_ERROR("not yet supported port interface");
957  }
958  }
959  else
960  {
962  int_port = wrappedObj->find_member("_" + port_name + "_i", port_o_K, wrappedObj);
963  if(int_port)
964  {
965  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_RNONE)
966  {
967  portsToSkip.insert(int_port);
968  if(port_in->get_kind() == port_vector_o_K)
969  {
970  ext_port = SM_minimal_interface->add_port_vector(port_name + "_i", port_o::IN,
971  GetPointer<port_o>(int_port)->get_ports_size(),
972  interfaceObj, int_port->get_typeRef());
973  }
974  else
975  {
976  ext_port = SM_minimal_interface->add_port(port_name + "_i", port_o::IN, interfaceObj,
977  int_port->get_typeRef());
978  }
979  port_o::fix_port_properties(int_port, ext_port);
980  SM_minimal_interface->add_connection(int_port, ext_port);
981  }
982  else if(GetPointer<port_o>(int_port)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
983  {
984  THROW_ERROR("not yet supported port interface");
985  }
986  }
987  else
988  {
990  int_port = wrappedObj->find_member("_" + port_name + "_dout", port_o_K, wrappedObj);
991  if(int_port)
992  {
993  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_RNONE ||
994  GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_FDOUT ||
995  GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_S_AXIS_TDATA)
996  {
997  portsToSkip.insert(int_port);
998  if(port_in->get_kind() == port_vector_o_K)
999  {
1000  ext_port = SM_minimal_interface->add_port_vector(port_name + "_dout", port_o::IN,
1001  GetPointer<port_o>(int_port)->get_ports_size(),
1002  interfaceObj, int_port->get_typeRef());
1003  }
1004  else
1005  {
1006  ext_port = SM_minimal_interface->add_port(port_name + "_dout", port_o::IN, interfaceObj,
1007  int_port->get_typeRef());
1008  }
1009  port_o::fix_port_properties(int_port, ext_port);
1010  SM_minimal_interface->add_connection(int_port, ext_port);
1011  }
1012  else if(GetPointer<port_o>(int_port)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
1013  {
1014  THROW_ERROR("not yet supported port interface");
1015  }
1016  }
1017  else
1018  {
1020  int_port = wrappedObj->find_member("_" + port_name + "_din", port_o_K, wrappedObj);
1021  if(int_port)
1022  {
1023  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_WNONE ||
1024  GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_FDIN ||
1025  GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_M_AXIS_TDATA)
1026  {
1027  int_port = wrappedObj->find_member(port_name, port_o_K, wrappedObj);
1028  THROW_ASSERT(int_port, "unexpected condition");
1029  portsToSkip.insert(int_port);
1030  }
1031  }
1032  else
1033  {
1035  int_port = wrappedObj->find_member("_" + port_name + "_q0", port_o_K, wrappedObj);
1036  if(int_port)
1037  {
1038  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_DIN)
1039  {
1040  int_port = wrappedObj->find_member(port_name, port_o_K, wrappedObj);
1041  THROW_ASSERT(int_port, "unexpected condition");
1042  portsToSkip.insert(int_port);
1043  }
1044  }
1045  else
1046  {
1048  int_port = wrappedObj->find_member("_" + port_name + "_d0", port_o_K, wrappedObj);
1049  if(int_port)
1050  {
1051  if(GetPointer<port_o>(int_port)->get_port_interface() == port_o::port_interface::PI_DOUT)
1052  {
1053  int_port = wrappedObj->find_member(port_name, port_o_K, wrappedObj);
1054  THROW_ASSERT(int_port, "unexpected condition");
1055  portsToSkip.insert(int_port);
1056  }
1057  }
1058  else
1059  {
1061  int_port = wrappedObj->find_member("_m_axis_" + port_name + "_TDATA", port_o_K, wrappedObj);
1062  if(int_port)
1063  {
1064  if(GetPointer<port_o>(int_port)->get_port_interface() ==
1065  port_o::port_interface::PI_FDIN ||
1066  GetPointer<port_o>(int_port)->get_port_interface() ==
1067  port_o::port_interface::PI_M_AXIS_TDATA)
1068  {
1069  int_port = wrappedObj->find_member(port_name, port_o_K, wrappedObj);
1070  THROW_ASSERT(int_port, "unexpected condition");
1071  portsToSkip.insert(int_port);
1072  }
1073  }
1074  else
1075  {
1077  int_port =
1078  wrappedObj->find_member("_s_axis_" + port_name + "_TDATA", port_o_K, wrappedObj);
1079  if(int_port)
1080  {
1081  if(GetPointer<port_o>(int_port)->get_port_interface() ==
1082  port_o::port_interface::PI_FDOUT ||
1083  GetPointer<port_o>(int_port)->get_port_interface() ==
1084  port_o::port_interface::PI_S_AXIS_TDATA)
1085  {
1086  portsToSkip.insert(int_port);
1087  if(port_in->get_kind() == port_vector_o_K)
1088  {
1089  ext_port = SM_minimal_interface->add_port_vector(
1090  "s_axis_" + port_name + "_TDATA", port_o::IN,
1091  GetPointer<port_o>(int_port)->get_ports_size(), interfaceObj,
1092  int_port->get_typeRef());
1093  }
1094  else
1095  {
1096  ext_port =
1097  SM_minimal_interface->add_port("s_axis_" + port_name + "_TDATA", port_o::IN,
1098  interfaceObj, int_port->get_typeRef());
1099  }
1100  port_o::fix_port_properties(int_port, ext_port);
1101  SM_minimal_interface->add_connection(int_port, ext_port);
1102  }
1103  else if(GetPointer<port_o>(int_port)->get_port_interface() !=
1104  port_o::port_interface::PI_DEFAULT)
1105  {
1106  THROW_ERROR("not yet supported port interface");
1107  }
1108  }
1109  }
1110  }
1111  }
1112  }
1113  }
1114  }
1115  if(!int_port)
1116  {
1117  int_port = wrappedObj->find_member(port_name, port_o_K, wrappedObj);
1118  THROW_ASSERT(int_port, "unexpected condition");
1119  const auto tnIndex = int_port->get_typeRef()->treenode;
1120  if(tnIndex > 0)
1121  {
1122  const auto tn = HLSMgr->get_tree_manager()->CGetTreeReindex(tnIndex);
1124  {
1125  const auto pt_type = tree_helper::CGetPointedType(tree_helper::CGetType(tn));
1126  const structural_type_descriptorRef Intype(
1127  new structural_type_descriptor("bool", tree_helper::Size(pt_type)));
1128  ext_port = SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, Intype);
1129  GetPointerS<port_o>(ext_port)->set_port_interface(port_o::port_interface::PI_RNONE);
1130  }
1131  }
1132  }
1133  }
1134  }
1135 
1136  if(parameters->isOption(OPT_clock_name) && port_name == CLOCK_PORT_NAME)
1137  {
1138  port_name = parameters->getOption<std::string>(OPT_clock_name);
1139  }
1140  else if(parameters->isOption(OPT_reset_name) && port_name == RESET_PORT_NAME)
1141  {
1142  port_name = parameters->getOption<std::string>(OPT_reset_name);
1143  }
1144  else if(parameters->isOption(OPT_start_name) && port_name == START_PORT_NAME)
1145  {
1146  port_name = parameters->getOption<std::string>(OPT_start_name);
1147  }
1148 
1149  if(portsToSkip.find(port_in) == portsToSkip.end() && portsToConnect.find(port_in) == portsToConnect.end() &&
1150  portsToConstant.find(port_in) == portsToConstant.end() &&
1151  portsToSigConnect.find(port_in) == portsToSigConnect.end())
1152  {
1153  if(GetPointer<port_o>(port_in)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
1154  {
1155  std::string ext_name = port_name[0] == '_' ? port_name.substr(1) : port_name;
1156  structural_objectRef ext_port = interfaceObj->find_member(ext_name, port_o_K, interfaceObj);
1157  if(!ext_port)
1158  {
1159  if(port_in->get_kind() == port_vector_o_K)
1160  {
1161  ext_port = SM_minimal_interface->add_port_vector(ext_name, port_o::IN,
1162  GetPointer<port_o>(port_in)->get_ports_size(),
1163  interfaceObj, port_in->get_typeRef());
1164  }
1165  else
1166  {
1167  ext_port = SM_minimal_interface->add_port(ext_name, port_o::IN, interfaceObj, port_in->get_typeRef());
1168  }
1169  }
1170  port_o::fix_port_properties(port_in, ext_port);
1171  SM_minimal_interface->add_connection(port_in, ext_port);
1172  }
1173  else
1174  {
1175  structural_objectRef ext_port = interfaceObj->find_member(port_name, port_o_K, interfaceObj);
1176 
1177  if(!ext_port)
1178  {
1179  if(port_in->get_kind() == port_vector_o_K)
1180  {
1181  ext_port = SM_minimal_interface->add_port_vector(port_name, port_o::IN,
1182  GetPointer<port_o>(port_in)->get_ports_size(),
1183  interfaceObj, port_in->get_typeRef());
1184  }
1185  else
1186  {
1189  {
1191  new structural_type_descriptor("bool", port_in->get_typeRef()->size));
1192  ext_port = SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, vecbool);
1193  }
1194  else
1195  {
1196  ext_port =
1197  SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, port_in->get_typeRef());
1198  }
1199  }
1200  }
1201  port_o::fix_port_properties(port_in, ext_port);
1202  SM_minimal_interface->add_connection(port_in, ext_port);
1203  }
1204  }
1205  else if(portsToConnect.find(port_in) != portsToConnect.end())
1206  {
1208  if(port_in->get_kind() == port_vector_o_K)
1209  {
1210  sign = SM_minimal_interface->add_sign_vector(port_in->get_id() + "_INT",
1211  GetPointer<port_o>(port_in)->get_ports_size(), interfaceObj,
1212  port_in->get_typeRef());
1213  }
1214  else
1215  {
1216  sign = SM_minimal_interface->add_sign(port_in->get_id() + "_INT", interfaceObj, port_in->get_typeRef());
1217  }
1218  SM_minimal_interface->add_connection(port_in, sign);
1219  SM_minimal_interface->add_connection(sign, portsToConnect[port_in]);
1220  }
1221  else if(portsToConstant.find(port_in) != portsToConstant.end())
1222  {
1223  if(null_values.find(GET_TYPE_SIZE(port_in)) == null_values.end())
1224  {
1225  structural_objectRef const_obj = SM_minimal_interface->add_constant(
1226  "null_value_" + STR(GET_TYPE_SIZE(port_in)), interfaceObj, port_in->get_typeRef(), STR(0));
1227  null_values[GET_TYPE_SIZE(port_in)] = const_obj;
1228  }
1229  if(port_in->get_kind() == port_vector_o_K)
1230  {
1231  for(unsigned int p = 0; p < GetPointer<port_o>(port_in)->get_ports_size(); ++p)
1232  {
1233  structural_objectRef port_d = GetPointer<port_o>(port_in)->get_port(p);
1234  SM_minimal_interface->add_connection(port_d, null_values[GET_TYPE_SIZE(port_d)]);
1235  }
1236  }
1237  else
1238  {
1239  SM_minimal_interface->add_connection(port_in, null_values[GET_TYPE_SIZE(port_in)]);
1240  }
1241  }
1242  else if(portsToSigConnect.find(port_in) != portsToSigConnect.end())
1243  {
1244  structural_objectRef ext_port = interfaceObj->find_member(port_name, port_o_K, interfaceObj);
1245  if(!ext_port)
1246  {
1247  if(port_in->get_kind() == port_vector_o_K)
1248  {
1249  ext_port = SM_minimal_interface->add_port_vector(port_name, port_o::IN,
1250  GetPointer<port_o>(port_in)->get_ports_size(),
1251  interfaceObj, port_in->get_typeRef());
1252  }
1253  else
1254  {
1257  {
1259  new structural_type_descriptor("bool", port_in->get_typeRef()->size));
1260  ext_port = SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, vecbool);
1261  }
1262  else
1263  {
1264  ext_port =
1265  SM_minimal_interface->add_port(port_name, port_o::IN, interfaceObj, port_in->get_typeRef());
1266  }
1267  }
1268  }
1269  port_o::fix_port_properties(port_in, ext_port);
1270  SM_minimal_interface->add_connection(portsToSigConnect[port_in], ext_port);
1271  }
1272  }
1273 
1274  // out ports
1275  for(unsigned int i = 0; i < GetPointer<module>(wrappedObj)->get_out_port_size(); ++i)
1276  {
1277  structural_objectRef port_out = GetPointer<module>(wrappedObj)->get_out_port(i);
1278  auto port_name = GetPointer<port_o>(port_out)->get_id();
1279  if(GetPointer<port_o>(port_out)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
1280  {
1281  auto check_interfaces = [&](std::set<port_o::port_interface> interfList) -> bool {
1282  return interfList.find(GetPointer<port_o>(port_out)->get_port_interface()) != interfList.end();
1283  };
1284  if(check_interfaces({port_o::port_interface::PI_WNONE, port_o::port_interface::PI_WVALID,
1285  port_o::port_interface::PI_RACK, port_o::port_interface::PI_READ,
1286  port_o::port_interface::PI_FDOUT, port_o::port_interface::PI_WRITE,
1287  port_o::port_interface::PI_FDIN, port_o::port_interface::PI_ADDRESS,
1288  port_o::port_interface::PI_CHIPENABLE, port_o::port_interface::PI_WRITEENABLE,
1289  port_o::port_interface::PI_DOUT, port_o::port_interface::M_AXI_AWVALID,
1290  port_o::port_interface::M_AXI_AWADDR, port_o::port_interface::M_AXI_AWID,
1291  port_o::port_interface::M_AXI_AWLEN, port_o::port_interface::M_AXI_AWSIZE,
1292  port_o::port_interface::M_AXI_AWBURST, port_o::port_interface::M_AXI_AWLOCK,
1293  port_o::port_interface::M_AXI_AWCACHE, port_o::port_interface::M_AXI_AWPROT,
1294  port_o::port_interface::M_AXI_AWQOS, port_o::port_interface::M_AXI_AWREGION,
1295  port_o::port_interface::M_AXI_AWUSER, port_o::port_interface::M_AXI_WVALID,
1296  port_o::port_interface::M_AXI_WDATA, port_o::port_interface::M_AXI_WSTRB,
1297  port_o::port_interface::M_AXI_WLAST, port_o::port_interface::M_AXI_WUSER,
1298  port_o::port_interface::M_AXI_ARVALID, port_o::port_interface::M_AXI_ARADDR,
1299  port_o::port_interface::M_AXI_ARID, port_o::port_interface::M_AXI_ARLEN,
1300  port_o::port_interface::M_AXI_ARSIZE, port_o::port_interface::M_AXI_ARBURST,
1301  port_o::port_interface::M_AXI_ARLOCK, port_o::port_interface::M_AXI_ARCACHE,
1302  port_o::port_interface::M_AXI_ARPROT, port_o::port_interface::M_AXI_ARQOS,
1303  port_o::port_interface::M_AXI_ARREGION, port_o::port_interface::M_AXI_ARUSER,
1304  port_o::port_interface::M_AXI_RREADY, port_o::port_interface::M_AXI_BREADY,
1305  port_o::port_interface::M_AXI_BUSER, port_o::port_interface::S_AXIL_AWVALID,
1306  port_o::port_interface::S_AXIL_AWREADY, port_o::port_interface::S_AXIL_AWADDR,
1307  port_o::port_interface::S_AXIL_WVALID, port_o::port_interface::S_AXIL_WREADY,
1308  port_o::port_interface::S_AXIL_WDATA, port_o::port_interface::S_AXIL_WSTRB,
1309  port_o::port_interface::S_AXIL_ARVALID, port_o::port_interface::S_AXIL_ARREADY,
1310  port_o::port_interface::S_AXIL_ARADDR, port_o::port_interface::S_AXIL_RVALID,
1311  port_o::port_interface::S_AXIL_RREADY, port_o::port_interface::S_AXIL_RDATA,
1312  port_o::port_interface::S_AXIL_RRESP, port_o::port_interface::S_AXIL_BVALID,
1313  port_o::port_interface::S_AXIL_BREADY, port_o::port_interface::S_AXIL_BRESP,
1314  port_o::port_interface::PI_S_AXIS_TREADY, port_o::port_interface::PI_S_AXIS_TDATA,
1315  port_o::port_interface::PI_M_AXIS_TVALID, port_o::port_interface::PI_M_AXIS_TDATA}))
1316  {
1317  portsToSkip.insert(port_out);
1318  std::string ext_name = port_name[0] == '_' ? port_name.substr(1) : port_name;
1319  structural_objectRef ext_port = interfaceObj->find_member(ext_name, port_o_K, interfaceObj);
1320  if(!ext_port)
1321  {
1322  if(port_out->get_kind() == port_vector_o_K)
1323  {
1324  ext_port = SM_minimal_interface->add_port_vector(ext_name, port_o::OUT,
1325  GetPointer<port_o>(port_out)->get_ports_size(),
1326  interfaceObj, port_out->get_typeRef());
1327  }
1328  else
1329  {
1330  ext_port =
1331  SM_minimal_interface->add_port(ext_name, port_o::OUT, interfaceObj, port_out->get_typeRef());
1332  }
1333  }
1334  port_o::fix_port_properties(port_out, ext_port);
1335  SM_minimal_interface->add_connection(port_out, ext_port);
1336  }
1337  else
1338  {
1339  THROW_ERROR("not yet supported port interface" + STR(GetPointer<port_o>(port_out)->get_port_interface()));
1340  }
1341  }
1342  if(portsToSkip.find(port_out) == portsToSkip.end() && portsToConnect.find(port_out) == portsToConnect.end() &&
1343  portsToSigConnect.find(port_out) == portsToSigConnect.end())
1344  {
1345  if(parameters->isOption(OPT_done_name) && port_name == DONE_PORT_NAME)
1346  {
1347  port_name = parameters->getOption<std::string>(OPT_done_name);
1348  }
1349  structural_objectRef ext_port;
1350  if(port_out->get_kind() == port_vector_o_K)
1351  {
1352  ext_port = SM_minimal_interface->add_port_vector(port_name, port_o::OUT,
1353  GetPointer<port_o>(port_out)->get_ports_size(),
1354  interfaceObj, port_out->get_typeRef());
1355  }
1356  else
1357  {
1359  {
1360  auto TM = HLSMgr->get_HLS_device()->get_technology_manager();
1361  std::string library_name = TM->get_library(VIEW_CONVERT_STD_INT);
1362  auto c_obj = SM_minimal_interface->add_module_from_technology_library(
1363  port_name + "_" + VIEW_CONVERT_STD_INT, VIEW_CONVERT_STD_INT, library_name, interfaceObj, TM);
1364  auto bit_size_port = port_out->get_typeRef()->size;
1365  structural_objectRef in1 = GetPointer<module>(c_obj)->get_in_port(0);
1366  in1->type_resize(bit_size_port);
1368  SM_minimal_interface->add_sign("out_" + c_obj->get_id(), interfaceObj, port_out->get_typeRef());
1369  SM_minimal_interface->add_connection(port_out, sign);
1370  SM_minimal_interface->add_connection(sign, in1);
1371  structural_objectRef out0 = GetPointer<module>(c_obj)->get_out_port(0);
1372  out0->type_resize(bit_size_port);
1373  THROW_ASSERT(out0->get_typeRef()->size, "size greater than one expected");
1376  ext_port = SM_minimal_interface->add_port(port_name, port_o::OUT, interfaceObj, vecbool);
1377  port_out = out0;
1378  }
1379  else if(port_out->get_typeRef()->type == structural_type_descriptor::UINT)
1380  {
1381  auto TM = HLSMgr->get_HLS_device()->get_technology_manager();
1382  std::string library_name = TM->get_library(VIEW_CONVERT_STD_UINT);
1383  auto c_obj = SM_minimal_interface->add_module_from_technology_library(
1384  port_name + "_" + VIEW_CONVERT_STD_UINT, VIEW_CONVERT_STD_UINT, library_name, interfaceObj, TM);
1385  auto bit_size_port = port_out->get_typeRef()->size;
1386  structural_objectRef in1 = GetPointer<module>(c_obj)->get_in_port(0);
1387  in1->type_resize(bit_size_port);
1389  SM_minimal_interface->add_sign("out_" + c_obj->get_id(), interfaceObj, port_out->get_typeRef());
1390  SM_minimal_interface->add_connection(port_out, sign);
1391  SM_minimal_interface->add_connection(sign, in1);
1392  structural_objectRef out0 = GetPointer<module>(c_obj)->get_out_port(0);
1393  out0->type_resize(bit_size_port);
1394  THROW_ASSERT(out0->get_typeRef()->size, "size greater than one expected");
1397  ext_port = SM_minimal_interface->add_port(port_name, port_o::OUT, interfaceObj, vecbool);
1398  port_out = out0;
1399  }
1400  else
1401  {
1402  ext_port = SM_minimal_interface->add_port(port_name, port_o::OUT, interfaceObj, port_out->get_typeRef());
1403  }
1404  }
1405  port_o::fix_port_properties(port_out, ext_port);
1406  SM_minimal_interface->add_connection(port_out, ext_port);
1407  }
1408  else if(portsToSigConnect.find(port_out) != portsToSigConnect.end())
1409  {
1410  structural_objectRef ext_port = interfaceObj->find_member(port_name, port_o_K, interfaceObj);
1411  if(!ext_port)
1412  {
1413  if(port_out->get_kind() == port_vector_o_K)
1414  {
1415  ext_port = SM_minimal_interface->add_port_vector(port_name, port_o::OUT,
1416  GetPointer<port_o>(port_out)->get_ports_size(),
1417  interfaceObj, port_out->get_typeRef());
1418  }
1419  else
1420  {
1421  if(port_out->get_typeRef()->type == structural_type_descriptor::UINT ||
1423  {
1424  THROW_ERROR("unexpected condition");
1425  }
1426  else
1427  {
1428  ext_port =
1429  SM_minimal_interface->add_port(port_name, port_o::OUT, interfaceObj, port_out->get_typeRef());
1430  }
1431  }
1432  }
1433  port_o::fix_port_properties(port_out, ext_port);
1434  SM_minimal_interface->add_connection(portsToSigConnect.find(port_out)->second, ext_port);
1435  }
1436  else if(port_out->get_kind() == port_vector_o_K && !GetPointer<port_o>(port_out)->find_bounded_object())
1437  {
1438  for(unsigned int p = 0; p < GetPointer<port_o>(port_out)->get_ports_size(); ++p)
1439  {
1440  structural_objectRef port_d = GetPointer<port_o>(port_out)->get_port(p);
1441  if(!GetPointer<port_o>(port_d)->find_bounded_object())
1442  {
1443  std::string name = "null_out_signal_" + port_out->get_owner()->get_id() + "_" + port_out->get_id() +
1444  "_" + port_d->get_id();
1445  structural_objectRef sign = SM_minimal_interface->add_sign(name, interfaceObj, port_d->get_typeRef());
1446  SM_minimal_interface->add_connection(port_d, sign);
1447  }
1448  }
1449  }
1450  }
1451 
1452  // in-out ports
1453  for(unsigned int i = 0; i < GetPointer<module>(wrappedObj)->get_in_out_port_size(); ++i)
1454  {
1455  structural_objectRef port_in_out = GetPointer<module>(wrappedObj)->get_in_out_port(i);
1456  structural_objectRef ext_port;
1457  if(port_in_out->get_kind() == port_vector_o_K)
1458  {
1459  ext_port = SM_minimal_interface->add_port_vector(GetPointer<port_o>(port_in_out)->get_id(), port_o::IO,
1460  GetPointer<port_o>(port_in_out)->get_ports_size(),
1461  interfaceObj, port_in_out->get_typeRef());
1462  }
1463  else
1464  {
1465  ext_port = SM_minimal_interface->add_port(GetPointer<port_o>(port_in_out)->get_id(), port_o::IO, interfaceObj,
1466  port_in_out->get_typeRef());
1467  }
1468  port_o::fix_port_properties(port_in_out, ext_port);
1469  SM_minimal_interface->add_connection(port_in_out, ext_port);
1470  }
1471 }
static void propagate_memory_parameters(const structural_objectRef src, const structural_managerRef tgt)
Propagates the memory parameters from the source (innermost) module to the target (outermost) one...
Definition: memory.cpp:654
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
#define STD_BRAM
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Definition: hls_step.hpp:205
Data structure representing the entire HLS information.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
#define START_PORT_NAME
Structure representing the most relevant information about the type of a structural object...
const std::string & get_id() const
Return the identifier associated with the structural_object.
#define GENERATED_LICENSE
const structural_objectRef get_circ() const
Get a reference to circ field.
void set_owner(const structural_objectRef new_owner)
set the owner of the structural object
Datastructure to represent a memory symbol in HLS.
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
Generate HDL testbench for the top-level kernel testing.
This class manages the circuit structures.
static std::vector< std::string > print_var_init(const tree_managerConstRef TreeM, unsigned int var, const memoryRef mem)
virtual structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const =0
Return the object named id of a given type which belongs to or it is associated with the object...
Class specification of the manager of the technology library data structures.
all objects that need to be stored in memory are allocated on an external memory
redefinition of map to manage ordered/unordered structures
#define VIEW_CONVERT_STD_UINT
static bool compareMemVarsPair(std::pair< unsigned int, memory_symbolRef > &first, std::pair< unsigned int, memory_symbolRef > &second)
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
s_type type
The type of the port or the signal.
unsigned long long size
The size of the object (in bit). The objects having a size are: ports, signals, channels, data, and actions.
#define CLOCK_PORT_NAME
standard name for ports
structural_managerRef top
Store the top description.
Definition: hls.hpp:164
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
#define DONE_PORT_NAME
HLSFlowStep_Type
Definition: hls_step.hpp:95
Class specification of the data structures used to manage technology information. ...
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
unsigned int treenode
Treenode id of the type.
redefinition of set to manage ordered/unordered structures
#define LIBRARY_STD
standard library where all built-in ports are defined.
utility function used to read files.
#define VIEW_CONVERT_STD_INT
static void fix_port_properties(structural_objectRef port_i, structural_objectRef cir_port)
copy the port properties from port_i to cir_port
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Base class to allocate memories in high-level synthesis.
Class to generate minimal interfaces for high-level synthesis.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
void type_resize(unsigned long long new_bit_size)
Just resize the size of the bits of the object.
int result[SIZE]
Definition: adpcm.c:800
This file collects some utility functions.
#define STD_BRAMN
structural_objectRef add_constant(std::string id, structural_objectRef owner, structural_type_descriptorRef type, std::string value, unsigned int treenode=0)
Create a new constant;.
structural_objectRef add_module_from_technology_library(const std::string &id, const std::string &fu_name, const std::string &library_name, const structural_objectRef owner, const technology_managerConstRef TM)
Create a new object starting from a library component.
DesignFlowStep_Status InternalExec() override
Execute the step.
#define GET_TYPE_SIZE(structural_obj)
Macro returning the size of the type of a structural object.
~minimal_interface() override
Destructor.
This class describes all classes used to represent a structural object.
const structural_type_descriptorRef & get_typeRef() const
Return the type descriptor of the structural_object.
std::string GetPath(std::filesystem::path path)
Definition: fileIO.hpp:140
Class specification of the tree_reindex support class.
static structural_objectRef add_sign(std::string id, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
Create a new signal.
const structural_objectRef get_owner() const
Return the owner.
hlsRef HLS
HLS data structure of the function to be analyzed.
for each memory at maximum n parallel direct accesses and n parallel indirect accesses ...
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.
for each memory at maximum one direct access and one indirect access
It collects all the common strings covering PandA copyrights issues.
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 int functionId
this is the identifier of the function to be implemented
Definition: hls.hpp:87
#define RESET_PORT_NAME
Wrapper to call graph.
Class implementation of the structural_manager.
uint32_t sign
unsigned counter[N_THREADS]
Definition: data.c:3
void build_wrapper(structural_objectRef wrappedObj, structural_objectRef interfaceObj, structural_managerRef SM_minimal_interface)
all objects that need to be stored in memory are allocated on BRAMs
static bool IsPointerType(const tree_nodeConstRef &type)
Return true if treenode index is a pointer.
minimal_interface(const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type=HLSFlowStep_Type::MINIMAL_INTERFACE_GENERATION)
Constructor.
Data structure definition for high-level synthesis flow.
static structural_objectRef add_port_vector(std::string id, port_o::port_direction pdir, unsigned int n_ports, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port_vector.
#define GENERATED_COPYRIGHT
Datastructure to represent memory information in high-level synthesis.
Class specification of the manager of the tree structures extracted from the raw file.
HLS specialization of generic_device.
static structural_objectRef add_sign_vector(std::string id, unsigned int n_signs, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
#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