53 #include "config_HAVE_BAMBU_RESULTS_XML.hpp" 54 #include "config_HAVE_FROM_AADL_ASN_BUILT.hpp" 55 #include "config_HAVE_FROM_C_BUILT.hpp" 56 #include "config_HAVE_HLS_BUILT.hpp" 57 #include "config_HAVE_HOST_PROFILING_BUILT.hpp" 58 #include "config_HAVE_TECHNOLOGY_BUILT.hpp" 59 #include "config_HAVE_TO_C_BUILT.hpp" 60 #include "config_RELEASE.hpp" 62 #include <boost/algorithm/string.hpp> 63 #include <boost/lexical_cast.hpp> 64 #include <boost/preprocessor/cat.hpp> 65 #include <boost/preprocessor/seq/for_each.hpp> 82 enum class SDCScheduling_Algorithm;
84 #if HAVE_HOST_PROFILING_BUILT 93 #define PARAMETER_PARSED INT_MIN 94 #define PARAMETER_NOTPARSED INT_MAX 96 #define BAMBU_OPTIONS \ 97 (chaining)(chaining_algorithm)(constraints_file)(context_switch)(controller_architecture)(datapath_architecture)( \ 98 distram_threshold)(DSP_allocation_coefficient)(DSP_margin_combinational)(DSP_margin_pipelined)(DSP_fracturing)( \ 99 estimate_logic_and_connections)(evaluation)(evaluation_mode)(evaluation_objectives)(experimental_setup)( \ 100 export_core)(export_core_mode)(fsm_encoding)(fu_binding_algorithm)(generate_testbench)(generate_vcd)(hls_flow)( \ 101 hls_div)(hls_fpdiv)(interface)(interface_type)(additional_top)(data_bus_bitsize)(addr_bus_bitsize)( \ 102 libm_std_rounding)(liveness_algorithm)(scheduling_mux_margins)(scheduling_priority)(scheduling_algorithm)( \ 103 simulate)(simulator)(simulation_output)(speculative)(pipelining)(storage_value_insertion_algorithm)(stg)( \ 104 stg_algorithm)(register_allocation_algorithm)(register_grouping)(registered_inputs)(resp_model)( \ 105 datapath_interconnection_algorithm)(insert_memory_profile)(top_file)(assert_debug)( \ 106 memory_allocation_algorithm)(memory_allocation_policy)(xml_memory_allocation)(rom_duplication)(base_address)( \ 107 reset_type)(reset_level)(reg_init_value)(clock_period_resource_fraction)(channels_type)(channels_number)( \ 108 memory_controller_type)(soft_float)(soft_fp)(fp_subnormal)(max_sim_cycles)(sparse_memory)(max_ulp)( \ 109 skip_pipe_parameter)(gcc_serialize_memory_accesses)(unaligned_access)(aligned_access)( \ 110 backend_script_extensions)(backend_sdc_extensions)(VHDL_library)(bitvalue_ipa)(use_asynchronous_memories)( \ 111 do_not_chain_memories)(bram_high_latency)(cdfc_module_binding_algorithm)(function_allocation_algorithm)( \ 112 testbench_input_string)(testbench_input_file)(testbench_argv)(testbench_param_size)(testbench_map_mode)( \ 113 weighted_clique_register_algorithm)(disable_function_proxy)(memory_mapped_top)(expose_globals)(connect_iob)( \ 114 profiling_output)(disable_bounded_function)(discrepancy)(discrepancy_force)(discrepancy_hw)( \ 115 discrepancy_no_load_pointers)(discrepancy_only)(discrepancy_permissive_ptrs)(generate_taste_architecture)( \ 116 initial_internal_address)(mem_delay_read)(mem_delay_write)(tb_queue_size)(memory_banks_number)(mixed_design)( \ 117 no_parse_c_python)(num_accelerators)(technology_file)(tb_extra_gcc_options)(timing_violation_abort)( \ 118 top_design_name)(serialize_output)(use_ALUs)(range_analysis_mode)(fp_format)(fp_format_propagate)( \ 119 fp_format_interface)(fp_rounding_mode)(fp_exception_mode)(parallel_backend)(architecture_xml)(lattice_root)( \ 120 lattice_settings)(lattice_pmi_def)(lattice_inc_dirs)(xilinx_root)(xilinx_settings)(xilinx_vivado_settings)( \ 121 xilinx_glbl)(mentor_root)(mentor_modelsim_bin)(mentor_optimizer)(verilator)(verilator_timescale_override)( \ 122 verilator_parallel)(altera_root)(quartus_settings)(quartus_13_settings)(quartus_13_64bit)(nanoxplore_root)( \ 123 nanoxplore_settings)(nanoxplore_bypass)(shared_input_registers)(inline_functions)(constraints_functions)( \ 126 #define FRAMEWORK_OPTIONS \ 127 (benchmark_name)(cat_args)(find_max_transformations)(max_transformations)(compatible_compilers)(compute_size_of)( \ 128 configuration_name)(debug_level)(default_compiler)(dot_directory)(host_compiler)(ilp_max_time)(ilp_solver)( \ 129 input_file)(input_format)(no_clean)(no_parse_files)(no_return_zero)(output_file)(output_level)( \ 130 output_temporary_directory)(output_directory)(panda_parameter)(parse_pragma)(pretty_print)(print_dot)( \ 131 profiling_method)(program_name)(read_parameter_xml)(revision)(seed)(test_multiple_non_deterministic_flows)( \ 132 test_single_non_deterministic_flow)(top_functions_names)(xml_input_configuration)(xml_output_configuration)( \ 133 write_parameter_xml)(ignore_parallelism)(ignore_mapping)(mapping)(sequence_length)(without_transformation)( \ 134 blackbox)(input_libraries)(frontend_statistics)(exec_argv)(path) 136 #define COMPILER_OPTIONS \ 137 (gcc_config)(gcc_costs)(gcc_defines)(gcc_extra_options)(gcc_include_sysdir)(gcc_includes)(gcc_libraries)( \ 138 gcc_library_directories)(gcc_openmp_simd)(compiler_opt_level)(gcc_m32_mx32)(gcc_optimizations)( \ 139 gcc_optimization_set)(gcc_parameters)(gcc_plugindir)(gcc_read_xml)(gcc_standard)(gcc_undefines)(gcc_warnings)( \ 140 gcc_c)(gcc_E)(gcc_S)(gcc_write_xml) 142 #define SYNTHESIS_OPTIONS \ 143 (clock_period)(clock_name)(reset_name)(start_name)(done_name)(device_string)(synthesis_flow)(target_device_file)( \ 144 target_device_script)(top_component)(writer_language) 146 #define SPIDER_OPTIONS \ 147 (accuracy)(aggregated_features)(cross_validation)(experimental_setup_file)(latex_format_file)(max_bound)( \ 148 maximum_error)(min_bound)(minimum_significance)(normalization_file)(normalization_sequences)(output_format)( \ 149 precision)(processing_element_type)(skip_rows)(surviving_benchmarks) 151 #define EUCALIPTUS_OPTIONS (component_name) 153 #define TREE_PANDA_COMPILER_OPTIONS (archive_files)(obj_files)(compress_archive) 155 #define OPTIONS_ENUM(r, data, elem) BOOST_PP_CAT(OPT_, elem), 184 #define DEFAULT_OPT_BASE 512 185 #define OPT_READ_PARAMETERS_XML DEFAULT_OPT_BASE 186 #define OPT_WRITE_PARAMETERS_XML (1 + OPT_READ_PARAMETERS_XML) 187 #define OPT_DEBUG_CLASSES (1 + OPT_WRITE_PARAMETERS_XML) 188 #define OPT_BENCHMARK_NAME (1 + OPT_DEBUG_CLASSES) 189 #define OPT_BENCHMARK_FAKE_PARAMETERS (1 + OPT_BENCHMARK_NAME) 190 #define INPUT_OPT_ERROR_ON_WARNING (1 + OPT_BENCHMARK_FAKE_PARAMETERS) 191 #define OPT_OUTPUT_TEMPORARY_DIRECTORY (1 + INPUT_OPT_ERROR_ON_WARNING) 192 #define INPUT_OPT_PRINT_DOT (1 + OPT_OUTPUT_TEMPORARY_DIRECTORY) 193 #define INPUT_OPT_SEED (1 + INPUT_OPT_PRINT_DOT) 194 #define INPUT_OPT_NO_CLEAN (1 + INPUT_OPT_SEED) 195 #define INPUT_OPT_CONFIGURATION_NAME (1 + INPUT_OPT_NO_CLEAN) 196 #define INPUT_OPT_MAX_TRANSFORMATIONS (1 + INPUT_OPT_CONFIGURATION_NAME) 197 #define INPUT_OPT_FIND_MAX_TRANSFORMATIONS (1 + INPUT_OPT_MAX_TRANSFORMATIONS) 198 #define INPUT_OPT_PANDA_PARAMETER (1 + INPUT_OPT_FIND_MAX_TRANSFORMATIONS) 201 #define COMMON_SHORT_OPTIONS_STRING "hVv:d:" 204 #define COMMON_LONG_OPTIONS \ 205 {"help", no_argument, nullptr, 'h'}, {"verbosity", required_argument, nullptr, 'v'}, \ 206 {"version", no_argument, nullptr, 'V'}, \ 207 {"read-parameters-XML", required_argument, nullptr, OPT_READ_PARAMETERS_XML}, \ 208 {"write-parameters-XML", required_argument, nullptr, OPT_WRITE_PARAMETERS_XML}, \ 209 {"debug", required_argument, nullptr, 'd'}, {"debug-classes", required_argument, nullptr, OPT_DEBUG_CLASSES}, \ 210 {"no-clean", no_argument, nullptr, INPUT_OPT_NO_CLEAN}, \ 211 {"benchmark-name", required_argument, nullptr, OPT_BENCHMARK_NAME}, \ 212 {"configuration-name", required_argument, nullptr, INPUT_OPT_CONFIGURATION_NAME}, \ 213 {"benchmark-fake-parameters", required_argument, nullptr, OPT_BENCHMARK_FAKE_PARAMETERS}, \ 214 {"output-temporary-directory", required_argument, nullptr, OPT_OUTPUT_TEMPORARY_DIRECTORY}, \ 215 {"error-on-warning", no_argument, nullptr, INPUT_OPT_ERROR_ON_WARNING}, \ 216 {"print-dot", no_argument, nullptr, INPUT_OPT_PRINT_DOT}, {"seed", required_argument, nullptr, INPUT_OPT_SEED}, \ 217 {"max-transformations", required_argument, nullptr, INPUT_OPT_MAX_TRANSFORMATIONS}, \ 218 {"find-max-transformations", no_argument, nullptr, INPUT_OPT_FIND_MAX_TRANSFORMATIONS}, \ 220 "panda-parameter", required_argument, nullptr, INPUT_OPT_PANDA_PARAMETER \ 223 #define INPUT_OPT_CUSTOM_OPTIONS 1024 224 #define INPUT_OPT_COMPUTE_SIZEOF (1 + INPUT_OPT_CUSTOM_OPTIONS) 225 #define INPUT_OPT_COMPILER (1 + INPUT_OPT_COMPUTE_SIZEOF) 226 #define INPUT_OPT_GCC_CONFIG (1 + INPUT_OPT_COMPILER) 227 #define INPUT_OPT_INCLUDE_SYSDIR (1 + INPUT_OPT_GCC_CONFIG) 228 #define INPUT_OPT_PARAM (1 + INPUT_OPT_INCLUDE_SYSDIR) 229 #define INPUT_OPT_READ_GCC_XML (1 + INPUT_OPT_PARAM) 230 #define INPUT_OPT_STD (1 + INPUT_OPT_READ_GCC_XML) 231 #define INPUT_OPT_USE_RAW (1 + INPUT_OPT_STD) 232 #define INPUT_OPT_WRITE_GCC_XML (1 + INPUT_OPT_USE_RAW) 233 #define LAST_GCC_OPT INPUT_OPT_WRITE_GCC_XML 236 #define GCC_SHORT_OPTIONS_STRING "cf:I:D:U:O::l:L:W:Em:g::" 239 #define GCC_LONG_OPTIONS_RAW_XML \ 240 {"use-raw", no_argument, nullptr, INPUT_OPT_USE_RAW}, \ 241 {"read-GCC-XML", required_argument, nullptr, INPUT_OPT_READ_GCC_XML}, \ 242 {"write-GCC-XML", required_argument, nullptr, INPUT_OPT_WRITE_GCC_XML}, 244 #define GCC_LONG_OPTIONS_RAW_XML {"use-raw", no_argument, nullptr, INPUT_OPT_USE_RAW}, 246 #define GCC_LONG_OPTIONS_COMPILER {"compiler", required_argument, nullptr, INPUT_OPT_COMPILER}, 248 #define GCC_LONG_OPTIONS \ 249 GCC_LONG_OPTIONS_COMPILER{"std", required_argument, nullptr, INPUT_OPT_STD}, \ 250 GCC_LONG_OPTIONS_RAW_XML{"param", required_argument, nullptr, INPUT_OPT_PARAM}, \ 251 {"Include-sysdir", no_argument, nullptr, INPUT_OPT_INCLUDE_SYSDIR}, \ 252 {"gcc-config", no_argument, nullptr, INPUT_OPT_GCC_CONFIG}, \ 253 {"compute-sizeof", no_argument, nullptr, INPUT_OPT_COMPUTE_SIZEOF}, \ 255 "extra-gcc-options", required_argument, nullptr, INPUT_OPT_CUSTOM_OPTIONS \ 264 #if HAVE_FROM_AADL_ASN_BUILT 268 #if HAVE_FROM_C_BUILT 278 #if HAVE_FROM_C_BUILT 286 #if HAVE_BAMBU_RESULTS_XML 287 FF_XML_BAMBU_RESULTS,
295 #if HAVE_TECHNOLOGY_BUILT 335 void load_xml_configuration_file_rec(
const xml_element* node);
344 bool ManageDefaultOptions(
int next_option,
char* optarg_param,
bool& exit_success);
346 #if HAVE_FROM_C_BUILT 353 bool ManageGccOptions(
int next_option,
char* optarg_param);
360 void PrintGeneralOptionsUsage(std::ostream& os)
const;
366 void PrintOutputOptionsUsage(std::ostream& os)
const;
368 #if HAVE_FROM_C_BUILT 373 void PrintGccOptionsUsage(std::ostream& os)
const;
379 virtual void SetDefaults() = 0;
384 void SetCommonDefaults();
390 virtual void PrintProgramName(std::ostream& os)
const = 0;
396 virtual void PrintHelp(std::ostream& os)
const = 0;
406 Parameter(
const std::string& program_name,
int argc,
char**
const argv,
int debug_level = 0);
423 void load_xml_configuration_file(
const std::string&
filename);
429 void write_xml_configuration_file(
const std::string&
filename);
434 virtual int Exec() = 0;
440 virtual void CheckParameters() = 0;
456 template <
typename G>
457 void getOption(
const std::string& name, G& variable)
const 459 THROW_ASSERT(Options.find(name) != Options.end(),
"Option \"" + name +
"\" not stored");
460 variable = boost::lexical_cast<G>(Options.find(name)->second);
468 template <
typename G>
471 getOption(std::string(name), variable);
479 template <
typename G>
482 THROW_ASSERT(Options.find(name) != Options.end(),
"Option \"" + name +
"\" not stored");
483 return boost::lexical_cast<G>(Options.find(name)->second);
491 template <
typename G>
494 return getOption<G>(std::string(name));
502 template <
typename G>
505 THROW_ASSERT(enum_options.find(name) != enum_options.end(),
506 "Option \"" + (option_name.find(name))->second +
"\" not stored");
507 return boost::lexical_cast<G>(enum_options.find(name)->second);
515 template <
typename G>
518 Options[name] =
STR(value);
526 template <
typename G>
529 Options[std::string(name)] =
STR(value);
537 template <
typename G>
540 enum_options[name] =
STR(value);
550 return Options.find(name) != Options.end();
560 return isOption(std::string(name));
570 return enum_options.find(name) != enum_options.end();
584 enum_options.erase(name);
595 return removeOption(std::string(name));
618 int get_class_debug_level(
const std::string& class_name,
int debug_level = -1)
const;
626 int GetFunctionDebugLevel(
const std::string& class_name,
const std::string& function_name)
const;
628 void print(std::ostream& os)
const;
633 void add_debug_class(
const std::string& class_name);
639 void PrintUsage(std::ostream& os)
const;
644 std::string PrintVersion()
const;
649 virtual void PrintFullHeader(std::ostream& os)
const;
655 void PrintBugReport(std::ostream& os)
const;
670 template <
typename G>
673 THROW_ASSERT(panda_parameters.find(name) != panda_parameters.end(),
"Parameter \"" + name +
"\" not stored");
674 return boost::lexical_cast<G>(panda_parameters.find(name)->second);
682 bool IsParameter(
const std::string& name)
const;
687 const std::vector<std::string> CGetArgv()
const;
699 #if HAVE_HOST_PROFILING_BUILT 707 #if HAVE_FROM_C_BUILT 712 #if HAVE_FROM_C_BUILT OptionMap()=default
Constructor.
void setOption(const enum enum_option name, const G value)
Sets the value of an option.
std::map< enum enum_option, std::string > enum_options
Map between an enum option and the related string-form value.
#define TREE_PANDA_COMPILER_OPTIONS
void setOption(const std::string &name, const G value)
Sets the value of an option.
void setOption(const char *name, const G value)
Sets the value of an option.
char **const argv
The input parameters;.
bool isOption(const char *name) const
Tests if an option has been stored.
(Input) XML benchhmarks to be execluded from training set
CustomOrderedMap< T, U > CustomMap
(Output) XML weights of single operations computed
exceptions managed by PandA
MemoryAllocation_ChannelsType
The number of channels.
void print(std::ostream &os) const
CliqueCovering_Algorithm
Defines all clique covering algorithm.
G getOption(const char *name) const
Returns the value of an option.
redefinition of map to manage ordered/unordered structures
CompilerWrapper_OptimizationSet
Possible optimization sets.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
bool isOption(const enum enum_option name) const
Tests if an option has been stored.
friend std::ostream & operator<<(std::ostream &os, const Parameter &s)
Friend definition of the << operator.
#define FRAMEWORK_OPTIONS
G GetParameter(const std::string &name) const
Returns the value of a parameter.
#define EUCALIPTUS_OPTIONS
unsigned map[NUM_VERTICES]
HostProfiling_Method
Different profiling method.
G getOption(const std::string &name) const
Returns the value of an option.
enum_option
Possible options.
redefinition of set to manage ordered/unordered structures
CompilerWrapper_CompilerTarget
target of the compiler
(Input) XML storing symbolic symulation results
(Input) comma separated value
~OptionMap()=default
Destructor.
(Input) task graph for free
OptionMap Options
Map between the name of the option and the related string-form value.
bool removeOption(const std::string &name)
Remove an option.
Template definition of refcount.
ActorGraphBackend_Type
C thread backend to be used.
int debug_level
debug level
ParametricListBased_Metric
G getOption(const enum enum_option name) const
Returns the value of an option.
CustomUnorderedSet< std::string > debug_classes
Classes to be debugged.
#define SYNTHESIS_OPTIONS
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Parameters_FileFormat
File formats.
(Input/Output) XML symbolic weights
(Input) XML storing experimental setup
(Input) XML storing format of latex table to be produced
void getOption(const std::string &name, G &variable) const
Returns the value of an option.
#define OPTIONS_ENUM(r, data, elem)
bool isOption(const std::string &name) const
Tests if an option has been stored.
int argc
The number of input paramters.
void getOption(const char *name, G &variable) const
Returns the value of an option.
bool removeOption(const char *name)
Remove an option.
MemoryAllocation_Policy
The allocation memory polycy.
CustomMap< std::string, std::string > panda_parameters
Map between the name of a parameter and the related string-form value.
bool removeOption(const enum enum_option name)
Remove an option.
std::map< enum enum_option, std::string > option_name
Name of the enum options.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...