PandA-2024.02
BackendFlow.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  */
43 #include "BackendFlow.hpp"
44 
45 #include "AlteraBackendFlow.hpp"
46 #include "DesignParameters.hpp"
47 #include "XilinxBackendFlow.hpp"
48 #include "quartus_13_wrapper.hpp"
49 #include "quartus_wrapper.hpp"
50 #if HAVE_TASTE
52 #endif
53 #include "BashBackendFlow.hpp"
54 #include "HDL_manager.hpp"
55 #include "LatticeBackendFlow.hpp"
57 #include "Parameter.hpp"
58 #include "SynthesisTool.hpp"
59 #include "ToolManager.hpp"
60 #include "area_info.hpp"
61 #include "bash_flow_wrapper.hpp"
62 #include "cpu_time.hpp"
63 #include "exceptions.hpp"
64 #include "fileIO.hpp"
65 #include "generic_device.hpp"
66 #include "lattice_flow_wrapper.hpp"
67 #include "map_wrapper.hpp"
68 #include "ngdbuild_wrapper.hpp"
70 #include "par_wrapper.hpp"
71 #include "polixml.hpp"
74 #include "structural_manager.hpp"
75 #include "structural_objects.hpp"
76 #include "technology_manager.hpp"
77 #include "technology_node.hpp"
78 #include "time_info.hpp"
79 #include "trce_wrapper.hpp"
80 #include "vivado_flow_wrapper.hpp"
81 #include "xml_dom_parser.hpp"
82 #include "xml_helper.hpp"
83 #include "xst_wrapper.hpp"
84 
85 #include <filesystem>
86 #include <iosfwd>
87 #include <utility>
88 
89 BackendFlow::BackendFlow(const ParameterConstRef _Param, std::string _flow_name, const generic_deviceRef _device)
90  : Param(_Param),
91  output_level(_Param->getOption<unsigned int>(OPT_output_level)),
92  flow_name(std::move(_flow_name)),
93  out_dir(Param->getOption<std::string>(OPT_output_directory) + "/" + flow_name),
94  device(_device),
95  root(nullptr),
96  default_flow_parameters(DesignParametersRef(new DesignParameters))
97 {
98  debug_level = Param->get_class_debug_level(GET_CLASS(*this));
99 
100  if(!std::filesystem::exists(out_dir))
101  {
102  std::filesystem::create_directories(out_dir);
103  }
104 }
105 
106 BackendFlow::~BackendFlow() = default;
107 
109 #if HAVE_TASTE
110  parameters
111 #endif
112 )
113 {
114  if(device)
115  {
116  if(!device->has_parameter("vendor"))
117  {
118  THROW_ERROR("Device vendor not specified");
119  }
120  auto vendor = device->get_parameter<std::string>("vendor");
121  boost::algorithm::to_lower(vendor);
122  if(vendor == "xilinx")
123  {
124 #if HAVE_TASTE
125  if(parameters->isOption(OPT_generate_taste_architecture) and
126  parameters->getOption<bool>(OPT_generate_taste_architecture))
127  {
128  return XILINX_TASTE_FPGA;
129  }
130 #endif
131  return XILINX_FPGA;
132  }
133  else if(vendor == "altera")
134  {
135  return ALTERA_FPGA;
136  }
137  else if(vendor == "lattice")
138  {
139  return LATTICE_FPGA;
140  }
141  else if(vendor == "nanoxplore")
142  {
143  return NANOXPLORE_FPGA;
144  }
145  else if(vendor == "generic")
146  {
147  return GENERIC;
148  }
149  else
150  {
151  THROW_ERROR("Device vendor \"" + vendor + "\" not supported");
152  }
153  }
154  return UNKNOWN;
155 }
156 
158  const generic_deviceRef _device)
159 {
160  type_t type = DetermineBackendFlowType(_device, Param);
161  switch(type)
162  {
163  case XILINX_FPGA:
164  return BackendFlowRef(new XilinxBackendFlow(Param, flow_name, _device));
165 #if HAVE_TASTE
166  case XILINX_TASTE_FPGA:
167  return BackendFlowRef(new XilinxTasteBackendFlow(Param, flow_name, _device));
168 #endif
169  case ALTERA_FPGA:
170  return BackendFlowRef(new AlteraBackendFlow(Param, flow_name, _device));
171  case LATTICE_FPGA:
172  return BackendFlowRef(new LatticeBackendFlow(Param, flow_name, _device));
173  case NANOXPLORE_FPGA:
174  return BackendFlowRef(new NanoXploreBackendFlow(Param, flow_name, _device));
175  case GENERIC:
176  return BackendFlowRef(new BashBackendFlow(Param, flow_name, _device));
177  case UNKNOWN:
178  default:
179  THROW_UNREACHABLE("Backend flow not supported");
180  }
181  return BackendFlowRef();
182 }
183 
184 std::string BackendFlow::GenerateSynthesisScripts(const std::string& fu_name, const structural_managerRef SM,
185  const std::list<std::string>& hdl_files,
186  const std::list<std::string>& aux_files)
187 {
188  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Generating synthesis scripts");
189  auto resource_name = "_" + fu_name;
190  std::string synthesis_file_list;
191  for(const auto& hdl_file : hdl_files)
192  {
193  synthesis_file_list += hdl_file + ";";
194  }
195  const structural_objectRef obj = SM->get_circ();
198  if(flow_name.size())
199  {
201  }
202 
203  for(const auto& aux_file : aux_files)
204  {
205  synthesis_file_list += aux_file + ";";
206  }
207  actual_parameters->parameter_values[PARAM_HDL_files] = synthesis_file_list;
208  const technology_managerRef TM = device->get_technology_manager();
209  std::string library = TM->get_library(resource_name);
210  bool is_combinational = false;
211  auto is_time_unit_PS =
212  device->has_parameter("USE_TIME_UNIT_PS") && device->get_parameter<int>("USE_TIME_UNIT_PS") == 1;
213  if(library.size())
214  {
215  const technology_nodeRef tn = TM->get_fu(resource_name, library);
217  STR((is_time_unit_PS ? 1000 : 1) * GetPointer<functional_unit>(tn)->get_clock_period());
219  STR(1000 * GetPointer<functional_unit>(tn)->get_clock_period());
220  if(GetPointer<functional_unit>(tn)->logical_type == functional_unit::COMBINATIONAL)
221  {
222  is_combinational = true;
223  }
224  }
225  else
226  {
227  library = TM->get_library(fu_name);
228  if(library.size())
229  {
230  const technology_nodeRef tn = TM->get_fu(fu_name, library);
232  STR((is_time_unit_PS ? 1000 : 1) * GetPointer<functional_unit>(tn)->get_clock_period());
234  STR(1000 * GetPointer<functional_unit>(tn)->get_clock_period());
235  if(GetPointer<functional_unit>(tn)->logical_type == functional_unit::COMBINATIONAL)
236  {
237  is_combinational = true;
238  }
239  if(GetPointer<functional_unit>(tn)->fu_template_name.size())
240  {
241  actual_parameters->parameter_values[PARAM_fu] = GetPointer<functional_unit>(tn)->fu_template_name;
242  }
243  else
244  {
246  }
247  }
248  }
250  bool time_constrained = false;
253  {
254  time_constrained = true;
255  }
257  if(!time_constrained)
258  {
260  STR((is_time_unit_PS ? 1000 : 1) * PARAM_clk_period_default);
261  actual_parameters->parameter_values[PARAM_clk_period_ps] = STR(1000 * PARAM_clk_period_default);
262  }
264  STR((is_time_unit_PS ? 1000 : 1) * 1000 / std::stod(actual_parameters->parameter_values[PARAM_clk_period]));
265 
266  if(Param->isOption(OPT_clock_name))
267  {
268  actual_parameters->parameter_values[PARAM_clk_name] = Param->getOption<std::string>(OPT_clock_name);
269  }
270  else
271  {
273  }
274  bool connect_iob = false;
275  if(Param->isOption(OPT_connect_iob) && Param->getOption<bool>(OPT_connect_iob))
276  {
277  connect_iob = true;
278  }
280  if(Param->isOption(OPT_top_design_name))
281  {
282  actual_parameters->parameter_values[PARAM_top_id] = Param->getOption<std::string>(OPT_top_design_name);
283  }
284  else
285  {
287  }
288  if(Param->isOption(OPT_backend_script_extensions))
289  {
292  Param->getOption<std::string>(OPT_backend_script_extensions);
293  }
294  else
295  {
297  }
298  if(Param->isOption(OPT_VHDL_library))
299  {
301  actual_parameters->parameter_values[PARAM_VHDL_library] = Param->getOption<std::string>(OPT_VHDL_library);
302  }
303  else
304  {
306  }
307  if(Param->isOption(OPT_parallel_backend))
308  {
309  if(Param->getOption<bool>(OPT_parallel_backend))
310  {
312  }
313  else
314  {
316  }
317  }
318 
320 
321  const auto ret = CreateScripts(actual_parameters);
322  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Generated synthesis scripts");
323  return ret;
324 }
325 
327 {
328  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Executing synthesis");
329  for(auto& step : steps)
330  {
331  step->tool->CheckExecution();
332  }
333 
334  ToolManagerRef tool(new ToolManager(Param));
336  std::vector<std::string> parameters, input_files, output_files;
337  const std::string synthesis_file_output =
338  Param->getOption<std::string>(OPT_output_temporary_directory) + "/synthesis_output";
339  tool->execute(parameters, input_files, output_files, synthesis_file_output, false);
340 
342  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Executed synthesis");
343 }
344 
346 {
347  return area_m;
348 }
349 
351 {
352  return time_m;
353 }
354 
356 {
357  parser->Exec();
358  root = parser->get_document()->get_root_node(); // deleted by DomParser.
359 
360  const xml_node::node_list list = root->get_children();
361  for(const auto& l : list)
362  {
363  const xml_element* child = GetPointer<xml_element>(l);
364  if(!child || child->get_name() != "flow")
365  {
366  continue;
367  }
368  std::string name;
369  LOAD_XVM(name, child);
370  if(name != flow_name)
371  {
372  continue;
373  }
374  xload(child);
375  }
376 }
377 
379 {
382  "wrong values: " + default_flow_parameters->chain_name + " vs. " + flow_name);
383 
384  const xml_node::node_list list = node->get_children();
385  for(const auto& l : list)
386  {
387  const xml_element* child = GetPointer<xml_element>(l);
388  if(!child)
389  {
390  continue;
391  }
392 
393  if(child->get_name() == "config")
394  {
395  LOAD_XVM(out_dir, child);
396  }
397 
399  if(child->get_name() == "step")
400  {
402  std::string id;
403  LOAD_XVM(id, child);
404  step->name = id;
405 
406  std::string config;
407  if(!CE_XVM(config, child))
408  {
409  THROW_ERROR("Missing configuration for component " + id);
410  }
411  LOAD_XVM(config, child);
412  step->config_name = config;
413 
414  std::string script_name;
415  if(CE_XVM(script_name, child))
416  {
417  LOAD_XVM(script_name, child);
418  step->script_name = config;
419  }
420 
421  SynthesisTool::type_t type = SynthesisTool::UNKNOWN;
422  if(id == XST_TOOL_ID)
423  {
424  type = SynthesisTool::XST;
425  if(step->script_name.size() == 0)
426  {
427  step->script_name = "xst.tcl";
428  }
429  }
430  else if(id == NGDBUILD_TOOL_ID)
431  {
432  type = SynthesisTool::NGDBUILD;
433  }
434  else if(id == MAP_TOOL_ID)
435  {
436  type = SynthesisTool::MAP;
437  }
438  else if(id == TRCE_TOOL_ID)
439  {
440  type = SynthesisTool::TRCE;
441  }
442  else if(id == PAR_TOOL_ID)
443  {
444  type = SynthesisTool::PAR;
445  }
446  else if(id == VIVADO_FLOW_TOOL_ID)
447  {
448  type = SynthesisTool::VIVADO_FLOW;
449  if(step->script_name.size() == 0)
450  {
451  step->script_name = "vivado.tcl";
452  }
453  }
454  else if(id == QUARTUS_SETUP_TOOL_ID)
455  {
456  type = SynthesisTool::QUARTUS_SETUP;
457  if(step->script_name.size() == 0)
458  {
459  step->script_name = "quartus_setup.tcl";
460  }
461  }
462  else if(id == QUARTUS_13_SETUP_TOOL_ID)
463  {
464  type = SynthesisTool::QUARTUS_13_SETUP;
465  if(step->script_name.size() == 0)
466  {
467  step->script_name = "quartus_setup.tcl";
468  }
469  }
470  else if(id == QUARTUS_FLOW_TOOL_ID)
471  {
472  type = SynthesisTool::QUARTUS_FLOW;
473  if(step->script_name.size() == 0)
474  {
475  step->script_name = "quartus_flow.tcl";
476  }
477  }
478  else if(id == QUARTUS_13_FLOW_TOOL_ID)
479  {
480  type = SynthesisTool::QUARTUS_13_FLOW;
481  if(step->script_name.size() == 0)
482  {
483  step->script_name = "quartus_flow.tcl";
484  }
485  }
486  else if(id == QUARTUS_POWER_TOOL_ID)
487  {
488  type = SynthesisTool::QUARTUS_POW;
489  if(step->script_name.size() == 0)
490  {
491  step->script_name = "quartus_pow_arguments";
492  }
493  }
494  else if(id == QUARTUS_REPORT_TOOL_ID)
495  {
496  type = SynthesisTool::QUARTUS_STA;
497  if(step->script_name.size() == 0)
498  {
499  step->script_name = "report_sta.tcl";
500  }
501  }
502  else if(id == QUARTUS_13_REPORT_TOOL_ID)
503  {
504  type = SynthesisTool::QUARTUS_13_STA;
505  if(step->script_name.size() == 0)
506  {
507  step->script_name = "report_sta.tcl";
508  }
509  }
510  else if(id == LATTICE_FLOW_TOOL_ID)
511  {
512  type = SynthesisTool::LATTICE_FLOW;
513  if(step->script_name.size() == 0)
514  {
515  step->script_name = "project.tcl";
516  }
517  }
518  else if(id == NXPYTHON_FLOW_TOOL_ID)
519  {
520  type = SynthesisTool::NXPYTHON_FLOW;
521  if(step->script_name.size() == 0)
522  {
523  step->script_name = "script.py";
524  }
525  }
526  else if(id == BASH_FLOW_TOOL_ID)
527  {
528  type = SynthesisTool::BASH_FLOW;
529  if(step->script_name.size() == 0)
530  {
531  step->script_name = "bash_script.sh";
532  }
533  }
534  else
535  {
536  THROW_ERROR("Step <" + id + "> is currently not supported");
537  }
538 
541  step->out_dir = step->tool->get_output_directory();
542 
544  step->tool->xload(root, step->config_name);
545 
546  add_backend_step(step);
547  }
548  }
549 }
550 
551 std::string BackendFlow::get_flow_name() const
552 {
553  return flow_name;
554 }
555 
557 {
559  steps.push_back(step);
560 }
561 
563 {
565  "-->creating scripts for module \"" + dp->component_name + "\" on chain \"" + dp->chain_name + "\"");
566 
567  CustomOrderedSet<std::string> module_undefined_parameters = undefined_parameters;
569  exec_params->component_name = dp->component_name;
570  THROW_ASSERT(exec_params->chain_name == dp->chain_name,
571  "Mismatching!! exec = \"" + exec_params->chain_name + "\" vs. dp = \"" + dp->chain_name + "\"");
572 
573  for(auto p = dp->parameter_values.begin(); p != dp->parameter_values.end(); ++p)
574  {
575  exec_params->parameter_values[p->first] = p->second;
577  "-->setting parameter \"" + p->first + "\" to value \"" + p->second + "\"");
578  if(module_undefined_parameters.find(p->first) != module_undefined_parameters.end())
579  {
581  "---removed parameter \"" + p->first + "\" from undefined parameters");
582  module_undefined_parameters.erase(p->first);
583  }
585  }
586 
587  if(module_undefined_parameters.size() > 0)
588  {
589  for(const auto& module_undefined_parameter : module_undefined_parameters)
590  {
591  PRINT_MSG("missing definition for parameter " + module_undefined_parameter);
592  }
593  THROW_ERROR("Some parameters still need to be defined: " + STR(module_undefined_parameters.size()));
594  }
595  else
596  {
597  INDENT_DBG_MEX(DEBUG_LEVEL_VERBOSE, debug_level, "---all the parameters have been correctly set");
598  }
599 
600  // Write the synthesis script
601  generated_synthesis_script = "./synthesize";
602  if(exec_params->chain_name.size())
603  {
604  generated_synthesis_script += "_" + exec_params->chain_name;
605  }
606  if(exec_params->component_name.size())
607  {
608  generated_synthesis_script += "_" + exec_params->component_name;
609  }
612 
613  std::ofstream script(generated_synthesis_script);
614  std::filesystem::permissions(generated_synthesis_script,
615  std::filesystem::perms::owner_exec | std::filesystem::perms::group_exec |
616  std::filesystem::perms::others_exec,
618  script << "#!/bin/bash" << std::endl;
619  script << "##########################################################" << std::endl;
620  script << "# Automatically generated by the PandA framework #" << std::endl;
621  script << "##########################################################" << std::endl << std::endl;
622  script << "# Synthesis script for COMPONENT: " << exec_params->component_name << std::endl << std::endl;
623 
624  WriteFlowConfiguration(script);
625 
626  for(const auto& step : steps)
627  {
628  THROW_ASSERT(step->tool, "Tool not valid for step: " + step->name);
629  script << "# STEP: " << step->name << std::endl;
630 
632  if(!std::filesystem::exists(step->out_dir))
633  {
634  THROW_ERROR("Output directory \"" + step->out_dir + "\" has not been created!");
635  }
636  std::filesystem::create_directory(step->out_dir);
637 
638  script << "cd " << GetCurrentPath() << std::endl;
639 
641  std::string script_path;
642  if(step->script_name.size())
643  {
644  script_path = step->tool->get_output_directory() + "/" + step->script_name;
645  }
646  step->tool->generate_synthesis_script(exec_params, script_path);
647 
648  script << step->tool->get_command_line(exec_params) << std::endl;
649  }
650 
652  {
653  create_xml_scripts(GetPath("exported_flow.xml"));
654  }
656  "<--Completed the generation of scripts for module \"" + exec_params->component_name +
657  "\" on chain \"" + exec_params->chain_name + "\"");
658 
660 }
661 
663  const CustomOrderedSet<std::string>& _undefined_parameters)
664 {
665  default_flow_parameters = _flow_parameters;
666  undefined_parameters = _undefined_parameters;
667 }
668 
669 void BackendFlow::create_xml_scripts(const std::string& xml_file)
670 {
671  xml_document doc;
672  doc.set_encoding("UTF-8");
673  doc.set_name("synthesis_tools");
674  xml_element* out_root = doc.add_child_element("synthesis_tools");
675 
676  for(const auto& step : steps)
677  {
678  THROW_ASSERT(step->tool, "Tool not valid for step: " + step->name);
679  out_root->add_child_element(step->tool->xwrite());
680  }
681 
682  doc.write_to_file_formatted(xml_file);
683 }
684 
686 {
688 }
Wrapper to trce by XILINX.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Collect information about resource area.
void add_backend_step(const BackendStepRef &step)
Adds a backend step to the list of the ones to be performed.
area_infoRef area_m
pointer to the data structure containing information about the resources
Wrapper to invoke a generic bash script.
Wrapper to NanoXplore synthesis tools *.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
technology_nodeRef get_fu(const std::string &fu_name, const std::string &Library) const
Return the reference to a component given its name.
const std::string & get_id() const
Return the identifier associated with the structural_object.
void create_xml_scripts(const std::string &xml_file)
Creates the XML script containing all the steps.
DesignParametersRef actual_parameters
set of design parameters with the actual values
#define GET_CLASS(obj)
Macro returning the actual type of an object.
static SynthesisToolRef create_synthesis_tool(type_t type, const ParameterConstRef &Param, const std::string &output_dir, const generic_deviceRef &device)
Factory method.
const structural_objectRef get_circ() const
Get a reference to circ field.
#define QUARTUS_13_FLOW_TOOL_ID
Wrapper to implement a synthesis tools by Lattice.
Wrapper to invoke vivado_flow tool by XILINX.
#define TRCE_TOOL_ID
#define PARAM_clk_freq
#define MAP_TOOL_ID
Definition: map_wrapper.hpp:50
exceptions managed by PandA
Collect information about resource performance.
#define PARAM_backend_script_extensions
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
Definition: xml_helper.hpp:88
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
CustomOrderedSet< std::string > undefined_parameters
list of undefined parameters
#define PARAM_clk_period_ps
std::string flow_name
string-based identifier of the flow
Class specification of the manager of the technology library data structures.
#define PARAM_VHDL_library
void parse_flow(const XMLDomParserRef parser)
Creates the synthesis flow based on the user&#39;s requirements.
#define QUARTUS_SETUP_TOOL_ID
superclass include
#define QUARTUS_POWER_TOOL_ID
time_infoRef time_m
pointer to the data structure containing timing information
const generic_deviceRef device
information about the target device
Include a set of utilities used to manage CPU time measures.
static type_t DetermineBackendFlowType(const generic_deviceRef device, const ParameterConstRef parameters)
Determines the type of the backend flow based on the target device.
int debug_level
debugging level of the class
Wrapper to implement a synthesis tools by Xilinx.
#define STR(s)
Macro which performs a lexical_cast to a string.
#define BASH_FLOW_TOOL_ID
superclass include
#define CLOCK_PORT_NAME
standard name for ports
std::string CreateScripts(const DesignParametersRef dp)
Creates the scripts for the specified tools in the right order, along with the overall configuration...
Wrapper to invoke nxpython_flow tool by NANOXPLORE.
#define PARAM_fu
used by Intel/Altera Characterization
virtual ~BackendFlow()
Destructor.
void configure(const std::string &_tool_, const std::string &setupscr, const std::string &_host_="", const std::string &_remote_path_="", bool force_remote=false)
Configuration of the tool.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Definition: exceptions.hpp:292
map_t parameter_values
Map between the name of the parameter and the corresponding string-based value.
Backend based on a simple bash script.
virtual std::string GenerateSynthesisScripts(const std::string &fu_name, const structural_managerRef SM, const std::list< std::string > &hdl_files, const std::list< std::string > &aux_files)
Generates the synthesis scripts for the specified design.
std::string get_name() const
Get the name of this node.
Definition: xml_node.hpp:132
void set_name(const std::string &_name)
Set the name of this node.
Definition: xml_node.hpp:141
std::vector< BackendStepRef > steps
ordered list of synthesis steps
enum { UNKNOWN=0, XST, NGDBUILD, MAP, PAR, TRCE, VIVADO_FLOW, QUARTUS_13_FLOW, QUARTUS_13_SETUP, QUARTUS_13_STA, QUARTUS_SETUP, QUARTUS_FLOW, QUARTUS_POW, QUARTUS_STA, LATTICE_FLOW, NXPYTHON_FLOW, BASH_FLOW } type_t
supported synthesis tools
Class specification of the data structures used to manage technology information. ...
This file contains the definition of the parameters for the synthesis tools.
xml_element * root
root node of the configuration device
#define LOAD_XVFM(variable, node, field)
LOAD XML Value for field Macro. Set a variable starting from an XML value. Conversion is performed if...
Definition: xml_helper.hpp:69
void set_initial_parameters(const DesignParametersRef &flow_parameters, const CustomOrderedSet< std::string > &undefined_parameters)
Sets parameters.
void write_to_file_formatted(const std::filesystem::path &filename)
Write the document to a file.
Wrapper to XST by XILINX.
#define LATTICE_FLOW_TOOL_ID
#define PARAM_has_script_extensions
XML DOM parser.
utility function used to read files.
static BackendFlowRef CreateFlow(const ParameterConstRef Param, const std::string &flow_name, const generic_deviceRef _device)
Creates the flow specification based on the given parameters.
virtual void ExecuteSynthesis()
Executes the synthesis with the implemented flow.
superclass include
#define PARAM_time_constrained
const ParameterConstRef Param
class containing all the parameters
Wrapper to par by XILINX.
std::list< xml_nodeRef > node_list
type for list of xml nodes
Definition: xml_node.hpp:90
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
Wrapper to invoke quartus_report tool by Altera.
void xload(const xml_element *node)
Loads the backend flow from an XML node.
BackendFlow(const ParameterConstRef Param, std::string flow_name, const generic_deviceRef _device)
Constructor.
Definition: BackendFlow.cpp:89
virtual void CheckSynthesisResults()=0
Checks the synthesis results and fills the corresponding data structures.
void set_encoding(const std::string &_encoding)
#define QUARTUS_FLOW_TOOL_ID
#define PARAM_clk_period_default
std::string out_dir
name of the output directory
This file contains the definition of the configurable flow for generating and executing synthesis scr...
Wrapper to ngdbuild by XILINX.
Wrapper to invoke quartus_report tool by Altera.
void add(int accelnum, int startidx, int endidx)
Definition: add.c:11
#define PARAM_top_id
#define NXPYTHON_FLOW_TOOL_ID
refcount< BackendStep > BackendStepRef
Definition: BackendFlow.hpp:88
Class to manage a wrapped tool.
This class describes all classes used to represent a structural object.
virtual void InitDesignParameters()
Initializes the parameters.
std::string GetPath(std::filesystem::path path)
Definition: fileIO.hpp:140
std::string component_name
Name of the component.
Wrapper to invoke lattice_flow tool by Lattice.
std::string get_flow_name() const
Returns the name of the flow.
#define QUARTUS_13_REPORT_TOOL_ID
Superclass include.
refcount< BackendFlow > BackendFlowRef
refcount definition of the class
std::string generated_synthesis_script
name of the synthesis script
Wrapper to implement a synthesis tools by Xilinx targeting Taste architecture.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
virtual void WriteFlowConfiguration(std::ostream &script)=0
Writes the proper flow configuration in the output script.
#define PARAM_connect_iob
this class is used to manage the command-line or XML options.
#define LOAD_XVM(variable, node)
LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed...
Definition: xml_helper.hpp:65
Wrapper to map by XILINX.
Some macro used to interface with the XML library.
node_list const & get_children()
Obtain the list of child nodes.
Definition: xml_node.hpp:310
DesignParametersRef default_flow_parameters
set of design parameters to be set
std::string GetCurrentPath()
Definition: fileIO.hpp:123
Class implementation of the structural_manager.
#define PARAM_clk_period
time_infoRef get_timing_results() const
Returns the timing information.
Generic device description.
enum { UNKNOWN, XILINX_FPGA, ALTERA_FPGA, LATTICE_FPGA, NANOXPLORE_FPGA, GENERIC, } type_t
implemented flow
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
#define PARAM_parallel_backend
#define PARAM_has_VHDL_library
#define PRINT_MSG(mex)
#define VIVADO_FLOW_TOOL_ID
#define XST_TOOL_ID
Definition: xst_wrapper.hpp:61
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
#define PAR_TOOL_ID
Definition: par_wrapper.hpp:50
area_infoRef get_used_resources() const
Returns the list of used resources.
#define NGDBUILD_TOOL_ID
#define PARAM_clk_name
DesignParametersRef clone() const
Returns a clone of the current parameter configuration.
refcount< DesignParameters > DesignParametersRef
refcount definition of the class
int execute(const std::vector< std::string > &parameters, const std::vector< std::string > &input_files, const std::vector< std::string > &output_files=std::vector< std::string >(), const std::string &log_file=std::string(), bool permissive=false)
Execute the tool.
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
Definition: xml_node.cpp:54
Wrapper to implement a synthesis tools by Altera.
Wrapper to quartus 14.0 and newer.
#define QUARTUS_REPORT_TOOL_ID
Superclass include.
#define PARAM_HDL_files
std::string get_library(const std::string &Name) const
Return the higher priority library where the given component is stored.
Wrapper to quartus 13.x and newer.
Abstract class for a generic synthesis tool.
std::string chain_name
Name of the flow.
#define PARAM_is_combinational
#define QUARTUS_13_SETUP_TOOL_ID
superclass include
#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:56 for PandA-2024.02 by doxygen 1.8.13