49 #include "config_PANDA_DATA_INSTALLDIR.hpp" 66 #define ALTERA_LE "ALTERA_LE" 67 #define ALTERA_LAB "ALTERA_LAB" 68 #define ALTERA_FMAX "ALTERA_FMAX" 69 #define ALTERA_FMAX_RESTRICTED "ALTERA_FMAX_RESTRICTED" 70 #define ALTERA_REGISTERS "ALTERA_REGISTERS" 71 #define ALTERA_IOPIN "ALTERA_IOPIN" 72 #define ALTERA_ALUT "ALTERA_ALUT" 73 #define ALTERA_ALM "ALTERA_ALM" 74 #define ALTERA_DSP "ALTERA_DSP" 75 #define ALTERA_MEM "ALTERA_MEM" 92 if(
Param->isOption(OPT_target_device_script))
94 auto xml_file_path =
Param->getOption<std::string>(OPT_target_device_script);
95 if(!std::filesystem::exists(xml_file_path))
97 THROW_ERROR(
"File \"" + xml_file_path +
"\" does not exist!");
104 std::string device_string;
105 if(
device->has_parameter(
"family"))
107 device_string =
device->get_parameter<std::string>(
"family");
111 device_string =
"CycloneII";
115 THROW_ERROR(
"Device family \"" + device_string +
"\" not supported!");
118 "Importing default scripts for target device family: " + device_string);
141 for(
const auto& iter_int : list_int)
143 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
149 if(EnodeC->get_name() ==
"application")
152 for(
const auto& iter_sec : list_sec)
154 const auto* nodeS = GetPointer<const xml_element>(iter_sec);
160 if(nodeS->get_name() ==
"section")
162 std::string stringID;
163 if(
CE_XVM(stringID, nodeS))
167 if(stringID ==
"QUARTUS_SYNTHESIS_SUMMARY")
170 for(
const auto& it_item : list_item)
172 const auto* nodeIt = GetPointer<const xml_element>(it_item);
173 if(!nodeIt or nodeIt->get_name() !=
"item")
178 if(
CE_XVM(stringID, nodeIt))
187 boost::replace_all(value,
",",
"");
199 catch(
const char* msg)
201 std::cerr << msg << std::endl;
203 catch(
const std::string& msg)
205 std::cerr << msg << std::endl;
207 catch(
const std::exception& ex)
209 std::cout <<
"Exception caught: " << ex.what() << std::endl;
213 std::cerr <<
"unknown exception" << std::endl;
215 THROW_ERROR(
"Error during QUARTUS_SH report parsing: " + fn);
248 const auto combinational_delay = [&]() ->
double {
255 return Param->getOption<
double>(OPT_clock_period) -
design_values.find(
"SLACK")->second;
263 if(combinational_delay >
Param->getOption<
double>(OPT_clock_period))
266 Param->getOption<std::string>(OPT_output_directory) +
"/" +
flow_name +
"/" +
274 auto device_string =
Param->getOption<std::string>(OPT_device_string);
275 std::string setupscr;
276 if(
Param->isOption(OPT_quartus_settings) and device_string.find(
"EP2C") == std::string::npos)
278 setupscr =
Param->getOption<std::string>(OPT_quartus_settings);
280 else if(
Param->isOption(OPT_quartus_13_settings))
282 setupscr =
Param->getOption<std::string>(OPT_quartus_13_settings);
286 script <<
"#configuration" << std::endl;
289 script << setupscr +
" >& /dev/null; ";
293 script <<
". " << setupscr <<
" >& /dev/null; ";
295 script << std::endl << std::endl;
305 std::ofstream sdc_file(sdc_filename.c_str());
309 " [get_ports " + clock +
"]\n";
312 (
Param->IsParameter(
"profile-top") &&
Param->GetParameter<
int>(
"profile-top") == 1)) &&
313 !
Param->isOption(OPT_backend_sdc_extensions))
315 sdc_file <<
"set_min_delay 0 -from [all_inputs] -to [all_registers]\n";
316 sdc_file <<
"set_min_delay 0 -from [all_registers] -to [all_outputs]\n";
318 " -from [all_inputs] -to [all_registers]\n";
320 " -from [all_registers] -to [all_outputs]\n";
322 " -from [all_inputs] -to [all_outputs]\n";
324 sdc_file <<
"derive_pll_clocks\n";
325 sdc_file <<
"derive_clock_uncertainty\n";
332 if(
Param->isOption(OPT_backend_sdc_extensions))
334 sdc_file <<
"source " +
Param->getOption<std::string>(OPT_backend_sdc_extensions) +
"\n";
343 auto device_family =
device->get_parameter<std::string>(
"family");
344 if(device_family.find(
'-') != std::string::npos)
346 device_family = device_family.substr(0, device_family.find(
'-'));
351 const auto file_list = string_to_container<std::vector<std::string>>(HDL_files,
";");
352 std::string sources_macro_list;
353 bool has_vhdl_library =
Param->isOption(OPT_VHDL_library);
354 std::string vhdl_library;
357 vhdl_library =
Param->getOption<std::string>(OPT_VHDL_library);
359 for(
const auto& v : file_list)
363 sources_macro_list +=
"set_global_assignment -name SOURCE_FILE " + v +
" -library " + vhdl_library +
"\n";
367 sources_macro_list +=
"set_global_assignment -name SOURCE_FILE " + v +
"\n";
374 for(
auto& step :
steps)
#define PARAM_sources_macro_list
#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 CheckSynthesisResults() override
Checks the synthesis results and fills the corresponding data-structures.
File containing functions and utilities to support the printing of debug messagges.
area_infoRef area_m
pointer to the data structure containing information about the resources
DesignParametersRef actual_parameters
set of design parameters with the actual values
#define GET_CLASS(obj)
Macro returning the actual type of an object.
~AlteraBackendFlow() override
Destructor.
std::map< std::string, double > design_values
design values reported by the tools
constants used in synthesis wrappers
void create_sdc(const DesignParametersRef dp)
Creates the constraint file.
void set_execution_time(double execution_time, unsigned int cycles=time_info::cycles_time_DEFAULT)
Collect information about resource performance.
#define ALTERA_LE
Header include.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
std::string flow_name
string-based identifier of the flow
void parse_flow(const XMLDomParserRef parser)
Creates the synthesis flow based on the user's requirements.
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
time_infoRef time_m
pointer to the data structure containing timing information
const generic_deviceRef device
information about the target device
void InitDesignParameters() override
Initializes the parameters.
int debug_level
debugging level of the class
Auxiliary methods for manipulating string.
void ExecuteSynthesis() override
Checks if the execution can be performed and, in case, performs the synthesis.
bool starts_with(const std::string &str, const std::string &pattern)
map_t parameter_values
Map between the name of the parameter and the corresponding string-based value.
#define STR_CST_synthesis_timing_violation_report
The file containing the timing violation report.
void CopyFile(std::filesystem::path file_source, std::filesystem::path file_target)
Copy file; if target already exist, overwrite.
std::string get_name() const
Get the name of this node.
std::vector< BackendStepRef > steps
ordered list of synthesis steps
This file contains the definition of the parameters for the synthesis tools.
void WriteFlowConfiguration(std::ostream &script) override
Writes the proper flow configuration in the output script.
refcount< XMLDomParser > XMLDomParserRef
void xparse_utilization(const std::string &fn)
Parses device utilization.
utility function used to read files.
virtual void ExecuteSynthesis()
Executes the synthesis with the implemented flow.
This file collects some utility functions and macros.
void Exec()
Parse an XML document from a file.
const ParameterConstRef Param
class containing all the parameters
std::list< xml_nodeRef > node_list
type for list of xml nodes
std::map< std::string, std::string > default_data
map between the identifiers of the synthesis flows and the corresponding implementations ...
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
std::string out_dir
name of the output directory
Classes for handling configuration files.
AlteraBackendFlow(const ParameterConstRef Param, const std::string &flow_name, const generic_deviceRef _device)
Constructor.
#define PARAM_quartus_report
This class describes all classes used to represent a structural object.
static area_infoRef factory(const ParameterConstRef &Param)
Factory method.
std::string GetPath(std::filesystem::path path)
std::string component_name
Name of the component.
unsigned int output_level
verbosity level of the class
std::string get_flow_name() const
Returns the name of the flow.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
xml_documentRef get_document()
Obtain the parsed document.
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...
Wrapper to synthesis tools by Altera.
node_list const & get_children()
Obtain the list of child nodes.
Generic device description.
#define PRINT_OUT_MEX(profLevel, curprofLevel, mex)
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
std::string relocate_compiler_path(const std::string &path, bool resolve_path=false)
static time_infoRef factory(const ParameterConstRef Param)
Wrapper to implement a synthesis tools by Altera.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...