47 #include "config_HAVE_PRAGMA_BUILT.hpp" 49 #include "config_NPROFILE.hpp" 80 #if HAVE_FROM_AADL_ASN_BUILT 114 int main(
int argc,
char* argv[])
116 srand(static_cast<unsigned int>(time(
nullptr)));
132 switch(parameters->Exec())
137 std::string cat_args;
138 for(
int i = 0; i < argc; i++)
140 cat_args += std::string(argv[i]) +
" ";
144 " == Bambu executed with: " + cat_args +
"\n");
150 if(not(parameters->getOption<
bool>(OPT_no_clean)))
152 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
167 auto output_level = parameters->getOption<
int>(OPT_output_level);
170 parameters->PrintFullHeader(std::cerr);
174 if(parameters->getOption<
bool>(OPT_gcc_include_sysdir))
178 std::vector<std::string> system_includes;
179 compiler_wrapper->GetSystemIncludes(system_includes);
180 std::vector<std::string>::const_iterator system_include, system_include_end = system_includes.end();
181 for(system_include = system_includes.begin(); system_include != system_include_end; ++system_include)
185 if(not(parameters->getOption<
bool>(OPT_no_clean)))
187 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
192 if(parameters->getOption<
bool>(OPT_gcc_config))
196 compiler_wrapper->GetCompilerConfig();
197 if(not(parameters->getOption<
bool>(OPT_no_clean)))
199 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
203 if(!parameters->isOption(OPT_input_file))
206 if(not(parameters->getOption<
bool>(OPT_no_clean)))
208 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
214 "Parameters parsed in " +
print_cpu_time(cpu_time) +
" seconds\n");
228 const DesignFlowStepFactoryConstRef frontend_flow_step_factory(
230 design_flow_manager->RegisterFactory(frontend_flow_step_factory);
231 const DesignFlowStepFactoryConstRef hls_flow_step_factory(
233 design_flow_manager->RegisterFactory(hls_flow_step_factory);
234 const DesignFlowStepFactoryConstRef c_backend_step_factory(
236 design_flow_manager->RegisterFactory(c_backend_step_factory);
237 const DesignFlowStepFactoryConstRef technology_flow_step_factory(
239 design_flow_manager->RegisterFactory(technology_flow_step_factory);
240 #if HAVE_FROM_AADL_ASN_BUILT 241 const DesignFlowStepFactoryConstRef parser_flow_step_factory(
243 design_flow_manager->RegisterFactory(parser_flow_step_factory);
248 design_flow_manager->AddStep(GetPointer<const HLSFlowStepFactory>(hls_flow_step_factory)
250 design_flow_manager->Exec();
254 if(parameters->getOption<
bool>(OPT_find_max_transformations))
257 GetPointer<const FrontendFlowStepFactory>(frontend_flow_step_factory)
258 ->CreateApplicationFrontendFlowStep(FrontendFlowStepType::FIND_MAX_TRANSFORMATIONS);
259 design_flow_manager->AddStep(find_max_transformations);
260 design_flow_manager->Exec();
263 if(parameters->isOption(OPT_test_multiple_non_deterministic_flows))
267 GetPointer<const DesignFlowFactory>(design_flow_factory)
269 design_flow_manager->AddStep(non_deterministic_flows);
270 design_flow_manager->Exec();
275 if(parameters->isOption(OPT_pretty_print))
277 const auto c_backend =
278 GetPointer<const CBackendStepFactory>(c_backend_step_factory)
280 CBackendInformation::CB_SEQUENTIAL, parameters->getOption<std::string>(OPT_pretty_print))));
281 design_flow_manager->AddStep(c_backend);
284 std::pair<HLSFlowStep_Type, HLSFlowStepSpecializationConstRef> hls_flow_step(
286 design_flow_manager->AddSteps(
287 GetPointer<const HLSFlowStepFactory>(hls_flow_step_factory)->CreateHLSFlowSteps(hls_flow_step));
288 design_flow_manager->Exec();
289 if(not(parameters->getOption<
bool>(OPT_no_clean)))
291 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
293 if(parameters->isOption(OPT_serialize_output) && parameters->isOption(OPT_output_file))
295 std::ofstream ofile(parameters->getOption<std::string>(OPT_output_file), std::ios::out);
296 for(
const auto& files : {HLSMgr->aux_files, HLSMgr->hdl_files})
298 for(
const auto&
file : files)
300 std::cerr <<
"File name: " <<
file <<
"\n";
301 std::ifstream ifile(file, std::ios::in);
302 ofile << ifile.rdbuf();
310 catch(
const char*
str)
316 std::cerr << str << std::endl;
318 catch(
const std::string& str)
324 std::cerr << str << std::endl;
326 catch(std::exception& e)
328 std::cerr << e.what() << std::endl;
340 std::cerr <<
"Unknown error type" << std::endl;
347 parameters->PrintUsage(std::cout);
354 parameters->PrintBugReport(std::cout);
362 if(parameters && not(parameters->getOption<
bool>(OPT_no_clean)))
364 std::filesystem::remove_all(parameters->getOption<std::string>(OPT_output_temporary_directory));
Class to compute evaluations about high-level synthesis.
Data structure representing the entire HLS information.
Factory class to create c backend.
int exit_code
NOTE: this file must be included only by source code of the executable (i.e., the file with the main)...
#define OUTPUT_LEVEL_NONE
no output print is performed.
Definition of the class representing a generic C application.
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
Include a set of utilities used to manage CPU time measures.
#define START_TIME(time_var)
Macro used to store the start time into time_var.
Factory for hls flow step.
Manager for pragma annotations.
int main(int argc, char *argv[])
Autoheader includes.
#define PARAMETER_PARSED
An integer value to return if parameters have been right parsed.
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
Factory for technology flow step.
refcount< Parameter > ParameterRef
refcount< HLS_manager > HLS_managerRef
refcount definition of the class
This class contains the base representation for a generic frontend flow step.
Classes specification of the tree_node data structures.
Factory for parser flow step.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
This file collects some utility functions.
std::string print_cpu_time(long int t)
massage a long which represents a time interval in milliseconds, into a string suitable for output ...
Factory for creating design flows.
technology_managerRef get_technology_manager() const
Returns the technology manager.
This class contains the methods to create a frontend flow step.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
This class contains the base representation for design flow.
Main class for wrapping the frontend compiler.
#define PRINT_OUT_MEX(profLevel, curprofLevel, mex)
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
Class specification of the manager of the tree structures extracted from the raw file.
HLS specialization of generic_device.
static HLS_deviceRef factory(const ParameterRef &Param)
Factory method from XML file.
#define PARAMETER_NOTPARSED
Implementation of the wrapper to Gcc for C sources.