PandA-2024.02
EucalyptusParameter.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 "EucalyptusParameter.hpp"
45 
46 #include "generic_device.hpp"
47 #include "language_writer.hpp"
48 
49 #define TOOL_OPT_BASE 256
50 #define INPUT_OPT_CHARACTERIZE (1 + TOOL_OPT_BASE)
51 #define INPUT_OPT_TARGET_DATAFILE (1 + INPUT_OPT_CHARACTERIZE)
52 #define INPUT_OPT_TARGET_SCRIPTFILE (1 + INPUT_OPT_TARGET_DATAFILE)
53 #define OPT_LATTICE_ROOT (1 + INPUT_OPT_TARGET_SCRIPTFILE)
54 #define OPT_XILINX_ROOT (1 + OPT_LATTICE_ROOT)
55 #define OPT_MENTOR_ROOT (1 + OPT_XILINX_ROOT)
56 #define OPT_MENTOR_OPTIMIZER (1 + OPT_MENTOR_ROOT)
57 #define OPT_ALTERA_ROOT (1 + OPT_MENTOR_OPTIMIZER)
58 #define OPT_NANOXPLORE_ROOT (1 + OPT_ALTERA_ROOT)
59 #define OPT_NANOXPLORE_BYPASS (1 + OPT_NANOXPLORE_ROOT)
60 #define OPT_PARALLEL_BACKEND (1 + OPT_NANOXPLORE_BYPASS)
61 
62 #include "utility.hpp"
63 #include "utility/fileIO.hpp"
64 #include <filesystem>
65 #include <getopt.h>
66 
67 void EucalyptusParameter::PrintProgramName(std::ostream& os) const
68 {
69  os << "" << std::endl;
70  os << "********************************************************************************" << std::endl;
71  os << " _____ _ _" << std::endl;
72  os << " | ____| _ ___ __ _| |_ _ _ __ | |_ _ _ ___" << std::endl;
73  os << " | _|| | | |/ __/ _` | | | | | '_ \\| __| | | / __|" << std::endl;
74  os << " | |__| |_| | (_| (_| | | |_| | |_) | |_| |_| \\__ \\" << std::endl;
75  os << R"( |_____\__,_|\___\__,_|_|\__, | .__/ \__|\__,_|___/)" << std::endl;
76  os << " |___/|_|" << std::endl;
77  os << "********************************************************************************" << std::endl;
78 }
79 
80 void EucalyptusParameter::PrintHelp(std::ostream& os) const
81 {
82  os << "Usage: " << std::endl;
83  os << " " << getOption<std::string>(OPT_program_name) << " [options]" << std::endl;
84  os << "\n"
85  << "Options: \n";
87  os << "\n"
88  << " Library Estimation:\n"
89  << " --target-device=<file> Specify the type of the device, separated by commas (e.g.,: "
90  "\"xc7z020,-1,clg484\")\n"
91  << " --target-datafile=file Specify a data XML file describing some defaults value for the target "
92  "device.\n"
93  << " --target-scriptfile=file Specify a script XML file including the scripts for the synthesis w.r.t. "
94  "the target device.\n"
95  << " --clock-period=value Specify the period of the clock signal (default 10 nanoseconds)\n"
96  << " --characterize=<component_name> Characterize the given component\n"
97  << std::endl;
98  // options defining where backend tools could be found
99  os << " Backend configuration:\n\n"
100  << " --mentor-visualizer\n"
101  << " Simulate the RTL implementation and then open Mentor Visualizer.\n"
102  << " (Mentor root has to be correctly set, see --mentor-root)\n\n"
103  << " --mentor-optimizer=<0|1>\n"
104  << " Enable or disable mentor optimizer. (default=enabled)\n\n"
105  << " --nanoxplore-bypass=<name>\n"
106  << " Define NanoXplore bypass when using NanoXplore. User may set NANOXPLORE_BYPASS\n"
107  << " variable otherwise.\n\n"
108  << " --altera-root=<path>\n"
109  << " Define Altera tools path. Given path is searched for Quartus.\n"
110  << " (default=/opt/altera:/opt/intelFPGA)\n\n"
111  << " --lattice-root=<path>\n"
112  << " Define Lattice tools path. Given path is searched for Diamond.\n"
113  << " (default=/opt/diamond:/usr/local/diamond)\n\n"
114  << " --mentor-root=<path>\n"
115  << " Define Mentor tools path. Given directory is searched for Modelsim and Visualizer\n"
116  << " (default=/opt/mentor)\n\n"
117  << " --nanoxplore-root=<path>\n"
118  << " Define NanoXplore tools path. Given directory is searched for NXMap.\n"
119  << " (default=/opt/NanoXplore)\n\n"
120  << " --xilinx-root=<path>\n"
121  << " Define Xilinx tools path. Given directory is searched for both ISE and Vivado\n"
122  << " (default=/opt/Xilinx)\n\n"
123  << std::endl;
124 }
125 
126 EucalyptusParameter::EucalyptusParameter(const std::string& _program_name, int _argc, char** const _argv)
127  : Parameter(_program_name, _argc, _argv)
128 {
129  SetDefaults();
130 }
131 
133 {
135 
137  int option_index;
138 
139  // Short option. An option character in this string can be followed by a colon (`:') to indicate that it
140  // takes a required argument. If an option character is followed by two colons (`::'), its argument is optional;
141  // this is a GNU extension.
142  const char* const short_options = COMMON_SHORT_OPTIONS_STRING "w:";
143 
144  const struct option long_options[] = {COMMON_LONG_OPTIONS,
145  {"characterize", required_argument, nullptr, INPUT_OPT_CHARACTERIZE},
146  {"clock-period", required_argument, nullptr, 0},
147  {"target-datafile", required_argument, nullptr, INPUT_OPT_TARGET_DATAFILE},
148  {"target-device", required_argument, nullptr, 0},
149  {"target-scriptfile", required_argument, nullptr, INPUT_OPT_TARGET_SCRIPTFILE},
150  {"writer", required_argument, nullptr, 'w'},
151  {"altera-root", optional_argument, nullptr, OPT_ALTERA_ROOT},
152  {"lattice-root", optional_argument, nullptr, OPT_LATTICE_ROOT},
153  {"mentor-root", optional_argument, nullptr, OPT_MENTOR_ROOT},
154  {"mentor-optimizer", optional_argument, nullptr, OPT_MENTOR_OPTIMIZER},
155  {"nanoxplore-root", optional_argument, nullptr, OPT_NANOXPLORE_ROOT},
156  {"nanoxplore-bypass", optional_argument, nullptr, OPT_NANOXPLORE_BYPASS},
157  {"xilinx-root", optional_argument, nullptr, OPT_XILINX_ROOT},
158  {"parallel-backend", no_argument, nullptr, OPT_PARALLEL_BACKEND},
159  {nullptr, 0, nullptr, 0}};
160 
161  if(argc == 1) // Bambu called without arguments, it simple prints help message
162  {
163  PrintUsage(std::cout);
164  return EXIT_SUCCESS;
165  }
166 
167  while(true)
168  {
169  int next_option = getopt_long(argc, argv, short_options, long_options, &option_index);
170 
171  // no more options are available
172  if(next_option == -1)
173  {
174  break;
175  }
176 
177  switch(next_option)
178  {
180  {
181  setOption(OPT_component_name, optarg);
182  break;
183  }
185  {
186  setOption(OPT_target_device_file, optarg);
187  break;
188  }
190  {
191  setOption(OPT_target_device_script, optarg);
192  break;
193  }
194  case OPT_ALTERA_ROOT:
195  {
196  setOption(OPT_altera_root, GetPath(optarg));
197  break;
198  }
199  case OPT_LATTICE_ROOT:
200  {
201  setOption(OPT_lattice_root, GetPath(optarg));
202  break;
203  }
204  case OPT_MENTOR_ROOT:
205  {
206  setOption(OPT_mentor_root, GetPath(optarg));
207  break;
208  }
210  {
211  setOption(OPT_mentor_optimizer, static_cast<bool>(std::stoi(optarg)));
212  break;
213  }
214  case OPT_NANOXPLORE_ROOT:
215  {
216  setOption(OPT_nanoxplore_root, GetPath(optarg));
217  break;
218  }
220  {
221  setOption(OPT_nanoxplore_bypass, std::string(optarg));
222  break;
223  }
224  case OPT_XILINX_ROOT:
225  {
226  setOption(OPT_xilinx_root, GetPath(optarg));
227  break;
228  }
230  {
231  setOption(OPT_parallel_backend, true);
232  break;
233  }
235  case 'w':
236  {
237  if(std::string(optarg) == "V")
238  {
239  setOption(OPT_writer_language, static_cast<int>(HDLWriter_Language::VERILOG));
240  }
241  else if(std::string(optarg) == "H")
242  {
243  setOption(OPT_writer_language, static_cast<int>(HDLWriter_Language::VHDL));
244  }
245  else
246  {
247  throw "BadParameters: backend language not correctly specified";
248  }
249  break;
250  }
251  case 0:
252  {
253  if(long_options[option_index].name == std::string("target-device"))
254  {
255  std::string tmp_string = optarg;
256  std::vector<std::string> values =
257  string_to_container<std::vector<std::string>>(tmp_string, std::string(","));
258  setOption("device_name", "");
259  setOption("device_speed", "");
260  setOption("device_package", "");
261  setOption("device_synthesis_tool", "");
262  if(values.size() == 2)
263  {
264  setOption(OPT_device_string, values[1]);
265  }
266  else if(values.size() == 3)
267  {
268  setOption("device_name", values[0]);
269  setOption("device_speed", values[1]);
270  setOption("device_package", values[2]);
271  }
272  else if(values.size() == 4)
273  {
274  setOption("device_name", values[0]);
275  setOption("device_speed", values[1]);
276  setOption("device_package", values[2]);
277  setOption("device_synthesis_tool", values[3]);
278  }
279  else
280  {
281  THROW_ERROR("Malformed device: " + tmp_string);
282  }
283  }
284  else if(long_options[option_index].name == std::string("clock-period"))
285  {
286  setOption(OPT_clock_period, optarg);
287  }
288  else
289  {
290  THROW_ERROR("Not supported option: " + std::string(long_options[option_index].name));
291  }
292  break;
293  }
295  default:
296  {
297  bool exit_success = false;
298  bool res = ManageDefaultOptions(next_option, optarg, exit_success);
299  if(exit_success)
300  {
301  return EXIT_SUCCESS;
302  }
303  if(res)
304  {
305  std::cerr << optarg << std::endl;
306  return PARAMETER_NOTPARSED;
307  }
308  }
309  }
310  }
311  std::string cat_args;
312 
313  for(int i = 0; i < argc; i++)
314  {
315  cat_args += std::string(argv[i]) + " ";
316  }
317 
318  if(getOption<int>(OPT_output_level) >= OUTPUT_LEVEL_MINIMUM)
319  {
320  std::cerr << " == Eucalyptus executed with: ";
321  std::cerr << cat_args;
322  std::cerr << std::endl << std::endl;
323  }
324  CheckParameters();
325 
326  return PARAMETER_PARSED;
327 }
328 
330 {
332  const auto sorted_dirs = [](const std::string& parent_dir) {
333  std::vector<std::filesystem::path> sorted_paths;
334  std::copy(std::filesystem::directory_iterator(parent_dir), std::filesystem::directory_iterator(),
335  std::back_inserter(sorted_paths));
336  std::sort(sorted_paths.begin(), sorted_paths.end(), NaturalVersionOrder);
337  return sorted_paths;
338  };
339 
340  const auto altera_dirs = SplitString(getOption<std::string>(OPT_altera_root), ":");
341  removeOption(OPT_altera_root);
342  const auto search_quartus = [&](const std::string& dir) {
343  if(std::filesystem::exists(dir + "/quartus/bin/quartus_sh"))
344  {
345  if(system(STR("bash -c \"if [ $(" + dir +
346  "/quartus/bin/quartus_sh --version | grep Version | sed -E 's/Version ([0-9]+).*/\\1/') -lt 14 "
347  "]; then exit 1; else exit 0; fi\" > /dev/null 2>&1")
348  .c_str()))
349  {
350  setOption(OPT_quartus_13_settings, "export PATH=$PATH:" + dir + "/quartus/bin/");
351  if(system(STR("bash -c \"" + dir + "/quartus/bin/quartus_sh --help | grep '--64bit'\" > /dev/null 2>&1")
352  .c_str()) == 0)
353  {
354  setOption(OPT_quartus_13_64bit, true);
355  }
356  else
357  {
358  setOption(OPT_quartus_13_64bit, false);
359  }
360  }
361  else
362  {
363  setOption(OPT_quartus_settings, "export PATH=$PATH:" + dir + "/quartus/bin/");
364  }
365  }
366  };
367  for(const auto& altera_dir : altera_dirs)
368  {
369  if(std::filesystem::is_directory(altera_dir))
370  {
371  for(const auto& ver_dir : sorted_dirs(altera_dir))
372  {
373  if(std::filesystem::is_directory(ver_dir))
374  {
375  search_quartus(ver_dir.string());
376  }
377  }
378  search_quartus(altera_dir);
379  }
380  }
381 
383  const auto lattice_dirs = SplitString(getOption<std::string>(OPT_lattice_root), ":");
384  removeOption(OPT_lattice_root);
385  auto has_lattice = 0; // 0 = not found, 1 = 32-bit version, 2 = 64-bit version
386  const auto search_lattice = [&](const std::string& dir) {
387  if(std::filesystem::exists(dir + "/bin/lin/diamondc"))
388  {
389  has_lattice = 1;
390  setOption(OPT_lattice_root, dir);
391  }
392  else if(std::filesystem::exists(dir + "/bin/lin64/diamondc"))
393  {
394  has_lattice = 2;
395  setOption(OPT_lattice_root, dir);
396  }
397  if(std::filesystem::exists(dir + "/cae_library/synthesis/verilog/pmi_def.v"))
398  {
399  setOption(OPT_lattice_pmi_def, dir + "/cae_library/synthesis/verilog/pmi_def.v");
400  }
401  if(std::filesystem::exists(dir + "/cae_library/simulation/verilog/pmi/pmi_dsp_mult.v") &&
402  std::filesystem::exists(dir + "/cae_library/simulation/verilog/pmi/pmi_ram_dp_true_be.v"))
403  {
404  setOption(OPT_lattice_inc_dirs, dir + "/cae_library/");
405  }
406  };
407  for(const auto& lattice_dir : lattice_dirs)
408  {
409  if(std::filesystem::is_directory(lattice_dir))
410  {
411  for(const auto& ver_dir : sorted_dirs(lattice_dir))
412  {
413  if(std::filesystem::is_directory(ver_dir))
414  {
415  search_lattice(ver_dir.string());
416  }
417  }
418  search_lattice(lattice_dir);
419  }
420  }
421  if(has_lattice == 1)
422  {
423  const auto lattice_dir = getOption<std::string>(OPT_lattice_root);
424  setOption(OPT_lattice_settings, "export TEMP=/tmp;export LSC_INI_PATH=\"\";"
425  "export LSC_DIAMOND=true;"
426  "export TCL_LIBRARY=" +
427  lattice_dir +
428  "/tcltk/lib/tcl8.5;"
429  "export FOUNDRY=" +
430  lattice_dir +
431  "/ispfpga;"
432  "export PATH=$FOUNDRY/bin/lin:" +
433  lattice_dir + "/bin/lin:$PATH");
434  }
435  else if(has_lattice == 2)
436  {
437  const auto lattice_dir = getOption<std::string>(OPT_lattice_root);
438  setOption(OPT_lattice_settings, "export TEMP=/tmp;export LSC_INI_PATH=\"\";"
439  "export LSC_DIAMOND=true;"
440  "export TCL_LIBRARY=" +
441  lattice_dir +
442  "/tcltk/lib/tcl8.5;"
443  "export FOUNDRY=" +
444  lattice_dir +
445  "/ispfpga;"
446  "export PATH=$FOUNDRY/bin/lin64:" +
447  lattice_dir + "/bin/lin64:$PATH");
448  }
449 
451  const auto mentor_dirs = SplitString(getOption<std::string>(OPT_mentor_root), ":");
452  removeOption(OPT_mentor_root);
453  const auto search_mentor = [&](const std::string& dir) {
454  if(std::filesystem::exists(dir + "/bin/vsim"))
455  {
456  setOption(OPT_mentor_modelsim_bin, dir + "/bin");
457  }
458  };
459  for(const auto& mentor_dir : mentor_dirs)
460  {
461  if(std::filesystem::is_directory(mentor_dir))
462  {
463  for(const auto& ver_dir : sorted_dirs(mentor_dir))
464  {
465  if(std::filesystem::is_directory(ver_dir))
466  {
467  search_mentor(ver_dir.string());
468  }
469  }
470  search_mentor(mentor_dir);
471  }
472  }
473 
475  const auto nanox_dirs = SplitString(getOption<std::string>(OPT_nanoxplore_root), ":");
476  removeOption(OPT_nanoxplore_root);
477  const auto search_xmap = [&](const std::string& dir) {
478  if(std::filesystem::exists(dir + "/bin/nxpython"))
479  {
480  setOption(OPT_nanoxplore_root, dir);
481  }
482  };
483  for(const auto& nanox_dir : nanox_dirs)
484  {
485  if(std::filesystem::is_directory(nanox_dir))
486  {
487  for(const auto& ver_dir : sorted_dirs(nanox_dir))
488  {
489  if(std::filesystem::is_directory(ver_dir))
490  {
491  search_xmap(ver_dir.string());
492  }
493  }
494  search_xmap(nanox_dir);
495  }
496  }
497 
499  const auto target_64 = true;
500  const auto xilinx_dirs = SplitString(getOption<std::string>(OPT_xilinx_root), ":");
501  removeOption(OPT_xilinx_root);
502  const auto search_xilinx = [&](const std::string& dir) {
503  if(std::filesystem::exists(dir + "/ISE"))
504  {
505  if(target_64 && std::filesystem::exists(dir + "/settings64.sh"))
506  {
507  setOption(OPT_xilinx_settings, dir + "/settings64.sh");
508  }
509  else if(std::filesystem::exists(dir + "/settings32.sh"))
510  {
511  setOption(OPT_xilinx_settings, dir + "/settings32.sh");
512  }
513  if(std::filesystem::exists(dir + "/ISE/verilog/src/glbl.v"))
514  {
515  setOption(OPT_xilinx_glbl, dir + "/ISE/verilog/src/glbl.v");
516  }
517  }
518  };
519  const auto search_xilinx_vivado = [&](const std::string& dir) {
520  if(std::filesystem::exists(dir + "/ids_lite"))
521  {
522  if(target_64 && std::filesystem::exists(dir + "/settings64.sh"))
523  {
524  setOption(OPT_xilinx_vivado_settings, dir + "/settings64.sh");
525  }
526  else if(std::filesystem::exists(dir + "/settings32.sh"))
527  {
528  setOption(OPT_xilinx_vivado_settings, dir + "/settings32.sh");
529  }
530  if(std::filesystem::exists(dir + "/data/verilog/src/glbl.v"))
531  {
532  setOption(OPT_xilinx_glbl, dir + "/data/verilog/src/glbl.v");
533  }
534  }
535  };
536  for(const auto& xilinx_dir : xilinx_dirs)
537  {
538  if(std::filesystem::is_directory(xilinx_dir))
539  {
540  for(const auto& ver_dir : sorted_dirs(xilinx_dir))
541  {
542  if(std::filesystem::is_directory(ver_dir))
543  {
544  for(const auto& ise_dir : std::filesystem::directory_iterator(ver_dir))
545  {
546  const auto ise_path = ise_dir.path().string();
547  if(std::filesystem::is_directory(ise_dir) && ise_path.find("ISE") > ise_path.find_last_of('/'))
548  {
549  search_xilinx(ise_path);
550  }
551  }
552  }
553  }
554  search_xilinx(xilinx_dir);
555  }
556  }
557  for(const auto& xilinx_dir : xilinx_dirs)
558  {
559  if(std::filesystem::is_directory(xilinx_dir))
560  {
561  for(const auto& vivado_dir : std::filesystem::directory_iterator(xilinx_dir))
562  {
563  const auto vivado_path = vivado_dir.path().string();
564  if(std::filesystem::is_directory(vivado_dir) && vivado_path.find("Vivado") > vivado_path.find_last_of('/'))
565  {
566  for(const auto& ver_dir : sorted_dirs(vivado_path))
567  {
568  if(std::filesystem::is_directory(ver_dir))
569  {
570  search_xilinx_vivado(ver_dir.string());
571  }
572  }
573  }
574  }
575  search_xilinx_vivado(xilinx_dir);
576  }
577  }
578 
580  setOption(OPT_verilator, system("which verilator > /dev/null 2>&1") == 0);
581 
582  if(isOption(OPT_simulator))
583  {
584  if(getOption<std::string>(OPT_simulator) == "MODELSIM" && !isOption(OPT_mentor_modelsim_bin))
585  {
586  THROW_ERROR("Mentor Modelsim was not detected by Bambu. Please check --mentor-root option is correct.");
587  }
588  else if(getOption<std::string>(OPT_simulator) == "XSIM" && !isOption(OPT_xilinx_vivado_settings))
589  {
590  THROW_ERROR("Xilinx XSim was not detected by Bambu. Please check --xilinx-root option is correct.");
591  }
592  else if(getOption<std::string>(OPT_simulator) == "VERILATOR" && !isOption(OPT_verilator))
593  {
594  THROW_ERROR("Verilator was not detected by Bambu. Please make sure it is installed in the system.");
595  }
596  }
597  else
598  {
599  if(isOption(OPT_mentor_modelsim_bin))
600  {
601  setOption(OPT_simulator, "MODELSIM");
602  }
603  else if(isOption(OPT_xilinx_vivado_settings))
604  {
605  setOption(OPT_simulator, "XSIM");
606  }
607  else if(isOption(OPT_verilator))
608  {
609  setOption(OPT_simulator, "VERILATOR");
610  }
611  else
612  {
613  THROW_ERROR("No valid simulator was found in the system.");
614  }
615  }
616 
617  if(not isOption(OPT_device_string))
618  {
619  std::string device_string = getOption<std::string>("device_name") + getOption<std::string>("device_speed") +
620  getOption<std::string>("device_package");
621  if(isOption("device_synthesis_tool") && !getOption<std::string>("device_synthesis_tool").empty())
622  {
623  device_string += "-" + getOption<std::string>("device_synthesis_tool");
624  }
625  setOption(OPT_device_string, device_string);
626  }
627 }
628 
630 {
631  // ---------- general options ----------- //
633  setOption(OPT_output_level, OUTPUT_LEVEL_MINIMUM);
634  setOption(OPT_debug_level, DEBUG_LEVEL_MINIMUM);
635 
636  setOption(OPT_altera_root, "/opt/altera:/opt/intelFPGA");
637  setOption(OPT_lattice_root, "/opt/diamond:/usr/local/diamond");
638  setOption(OPT_mentor_root, "/opt/mentor");
639  setOption(OPT_mentor_optimizer, true);
640  setOption(OPT_nanoxplore_root, "/opt/NanoXplore");
641  setOption(OPT_xilinx_root, "/opt/Xilinx");
642 
644  setOption("device_name", "xc7z020");
645  setOption("device_speed", "-1");
646  setOption("device_package", "clg484");
647  setOption("device_synthesis_tool", "VVD");
648  setOption(OPT_connect_iob, false);
649  setOption(OPT_clock_period_resource_fraction, 1.0);
650  setOption(OPT_parallel_backend, false);
651 
653  setOption(OPT_writer_language, static_cast<int>(HDLWriter_Language::VERILOG));
654  setOption(OPT_reset_type, "no");
655  setOption(OPT_reg_init_value, false);
656 
657  setOption(OPT_output_directory, GetCurrentPath() + "/HLS_output/");
658  setOption(OPT_reset_level, false);
659  setOption(OPT_mixed_design, true);
660 }
#define INPUT_OPT_TARGET_SCRIPTFILE
int exit_code
NOTE: this file must be included only by source code of the executable (i.e., the file with the main)...
void setOption(const std::string &name, const G value)
Sets the value of an option.
Definition: Parameter.hpp:516
EucalyptusParameter(const std::string &program_name, int argc, char **const argv)
Constructor.
char **const argv
The input parameters;.
Definition: Parameter.hpp:311
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
#define COMMON_SHORT_OPTIONS_STRING
define the default tool short option string
Definition: Parameter.hpp:201
bool NaturalVersionOrder(const std::filesystem::path &_x, const std::filesystem::path &_y)
Definition: fileIO.cpp:195
#define OPT_NANOXPLORE_BYPASS
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
void PrintUsage(std::ostream &os) const
Print the usage of this tool = PrintHeader() + PrintHelp()
Definition: Parameter.cpp:392
#define OPT_LATTICE_ROOT
#define STR(s)
Macro which performs a lexical_cast to a string.
#define OPT_ALTERA_ROOT
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
#define INPUT_OPT_CHARACTERIZE
#define PARAMETER_PARSED
An integer value to return if parameters have been right parsed.
Definition: Parameter.hpp:93
virtual void CheckParameters()=0
Checks the compatibility among the different parameters and determines the implications.
Definition: Parameter.cpp:139
utility function used to read files.
This file collects some utility functions and macros.
#define OPT_MENTOR_ROOT
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
int Exec() override
Execute parameter parsing.
#define COMMON_LONG_OPTIONS
define default TOOL long options
Definition: Parameter.hpp:204
#define OPT_XILINX_ROOT
#define INPUT_OPT_TARGET_DATAFILE
std::string GetPath(std::filesystem::path path)
Definition: fileIO.hpp:140
void PrintHelp(std::ostream &os) const override
Print the usage of this tool.
#define OPT_NANOXPLORE_ROOT
void CheckParameters() override
Check the compatibility among the different parameters and compute implicated parameters.
std::string GetCurrentPath()
Definition: fileIO.hpp:123
void SetDefaults() override
Sets the default values with respect to the tool.
void PrintGeneralOptionsUsage(std::ostream &os) const
Print the usage of the general common options.
Definition: Parameter.cpp:1105
Generic device description.
bool isOption(const std::string &name) const
Tests if an option has been stored.
Definition: Parameter.hpp:548
int argc
The number of input paramters.
Definition: Parameter.hpp:308
#define OPT_MENTOR_OPTIMIZER
bool ManageDefaultOptions(int next_option, char *optarg_param, bool &exit_success)
Manage default options (common to all tools)
Definition: Parameter.cpp:398
void PrintProgramName(std::ostream &os) const override
Print the name of the program to be included in the header.
#define OPT_PARALLEL_BACKEND
#define DEBUG_LEVEL_MINIMUM
minimum debugging print is performed.
#define PARAMETER_NOTPARSED
Definition: Parameter.hpp:94
bool removeOption(const enum enum_option name)
Remove an option.
Definition: Parameter.hpp:578

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