42 #include "config_PANDA_DATA_INSTALLDIR.hpp" 58 #define NANOXPLORE_FE "NANOXPLORE_FE" 59 #define NANOXPLORE_LUTS "NANOXPLORE_LUTS" 60 #define NANOXPLORE_SLACK "NANOXPLORE_SLACK" 61 #define NANOXPLORE_REGISTERS "NANOXPLORE_REGISTERS" 62 #define NANOXPLORE_IOPIN "NANOXPLORE_IOPIN" 63 #define NANOXPLORE_DSP "NANOXPLORE_DSPS" 64 #define NANOXPLORE_MEM "NANOXPLORE_MEM" 65 #define NANOXPLORE_POWER "NANOXPLORE_POWER" 73 if(!
Param->isOption(OPT_nanoxplore_root))
75 THROW_WARNING(
"NanoXplore install directory was not specified, fallback on path. Specifying NanoXplore root " 76 "through --nanoxplore-root option is preferred.");
78 const auto lic_path = std::getenv(
"LM_LICENSE_FILE");
79 const auto nx_lic_path = std::getenv(
"NXLMD_LICENSE_FILE");
80 if((!lic_path || std::string(lic_path) ==
"") && (!nx_lic_path || std::string(nx_lic_path) ==
""))
82 THROW_WARNING(
"NanoXplore license file has not been specified. User must set LM_LICENSE_FILE or " 83 "NXLMD_LICENSE_FILE variable to point to the license file location.");
85 const auto bypass_name = std::getenv(
"NANOXPLORE_BYPASS");
86 if((!bypass_name || std::string(bypass_name) ==
"") && !
Param->isOption(OPT_nanoxplore_bypass))
88 THROW_WARNING(
"NanoXplore bypass was not specified. User may set NANOXPLORE_BYPASS variable or use " 89 "--nanoxplore-bypass option.");
97 if(
Param->isOption(OPT_target_device_script))
99 auto xml_file_path =
Param->getOption<std::string>(OPT_target_device_script);
100 if(!std::filesystem::exists(xml_file_path))
102 THROW_ERROR(
"File \"" + xml_file_path +
"\" does not exist!");
109 std::string device_string;
110 if(
device->has_parameter(
"family"))
112 device_string =
device->get_parameter<std::string>(
"family");
116 device_string =
"NG-MEDIUM";
120 THROW_ERROR(
"Device family \"" + device_string +
"\" not supported!");
123 "---Importing default scripts for target device family: " + device_string);
146 for(
const auto& iter_int : list_int)
148 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
154 if(EnodeC->get_name() ==
"application")
157 for(
const auto& iter_sec : list_sec)
159 const auto* nodeS = GetPointer<const xml_element>(iter_sec);
165 if(nodeS->get_name() ==
"section")
167 std::string stringID;
168 if(
CE_XVM(stringID, nodeS))
172 if(stringID ==
"NANOXPLORE_SYNTHESIS_SUMMARY")
175 for(
const auto& it_item : list_item)
177 const auto* nodeIt = GetPointer<const xml_element>(it_item);
178 if(!nodeIt or nodeIt->get_name() !=
"item")
183 if(
CE_XVM(stringID, nodeIt))
192 boost::replace_all(value,
",",
"");
204 catch(
const char* msg)
206 std::cerr << msg << std::endl;
208 catch(
const std::string& msg)
210 std::cerr << msg << std::endl;
212 catch(
const std::exception& ex)
214 std::cout <<
"Exception caught: " << ex.what() << std::endl;
218 std::cerr <<
"unknown exception" << std::endl;
220 THROW_ERROR(
"Error during NanoXplore report parsing: " + fn);
232 area_m->set_resource_value(area_info::FUNCTIONAL_ELEMENTS,
design_values[NANOXPLORE_FE]);
244 double exec_time = clk_val - del_val;
245 if(clk_val < del_val)
247 THROW_ERROR(
"the timing analysis is not consistent with the specified clock period");
256 (
Param->IsParameter(
"DumpingTimingReport") &&
Param->GetParameter<
int>(
"DumpingTimingReport"))) &&
268 script <<
"#configuration" << std::endl;
269 if(
Param->isOption(OPT_nanoxplore_root))
271 const auto nxroot =
Param->getOption<std::string>(OPT_nanoxplore_root);
272 script <<
"export PATH=$PATH:" + nxroot +
"/bin" << std::endl << std::endl;
274 script <<
"if [ ! -z \"$NXLMD_LICENSE_FILE\" ]; then" << std::endl;
275 script <<
" if [[ \"$NXLMD_LICENSE_FILE\" != \"$LM_LICENSE_FILE\" ]]; then" << std::endl;
276 script <<
" export LM_LICENSE_FILE=\"$NXLMD_LICENSE_FILE\"" << std::endl;
277 script <<
" fi" << std::endl;
278 script <<
"fi" << std::endl << std::endl;
279 if(
Param->isOption(OPT_nanoxplore_bypass))
281 script <<
"export NANOXPLORE_BYPASS=\"" <<
Param->getOption<std::string>(OPT_nanoxplore_bypass) <<
"\"" 297 bool xpwr_enabled =
false;
298 if(
Param->isOption(
"power_optimization") &&
Param->getOption<
bool>(
"power_optimization"))
303 const auto family =
device->get_parameter<std::string>(
"family");
304 const auto device_name =
device->get_parameter<std::string>(
"model");
305 const auto package = device->get_parameter<std::string>("package");
306 const auto speed_grade =
device->get_parameter<std::string>(
"speed_grade");
307 std::string device_string = device_name +
package + speed_grade;
312 std::vector<std::string> file_list = string_to_container<std::vector<std::string>>(HDL_files,
";");
313 std::string sources_macro_list;
314 for(
unsigned int v = 0; v < file_list.size(); v++)
318 sources_macro_list +=
", ";
320 sources_macro_list +=
"'" + file_list[v] +
"'";
324 for(
auto& step :
steps)
#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.
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
#define PARAM_nxpython_report
Wrapper to NanoXplore synthesis tools *.
#define PARAM_nxpython_timing_report
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
void ExecuteSynthesis() override
Checks if the execution can be performed and, in case, performs the synthesis.
DesignParametersRef actual_parameters
set of design parameters with the actual values
#define GET_CLASS(obj)
Macro returning the actual type of an object.
void WriteFlowConfiguration(std::ostream &script) override
Writes the proper flow configuration in the output script.
constants used in synthesis wrappers
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
void set_execution_time(double execution_time, unsigned int cycles=time_info::cycles_time_DEFAULT)
Collect information about resource performance.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
void parse_flow(const XMLDomParserRef parser)
Creates the synthesis flow based on the user's requirements.
time_infoRef time_m
pointer to the data structure containing timing information
const generic_deviceRef device
information about the target device
int debug_level
debugging level of the class
void CheckSynthesisResults() override
Checks the synthesis results and fills the corresponding data structures.
#define THROW_WARNING(str_expr)
helper function used to throw a warning in a standard way: though it uses PRINT_DBG_MEX, the debug level used is such that the message is always printed
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
void InitDesignParameters() override
Initializes the parameters.
map_t parameter_values
Map between the name of the parameter and the corresponding string-based value.
std::string get_name() const
Get the name of this node.
std::vector< BackendStepRef > steps
ordered list of synthesis steps
#define NANOXPLORE_REGISTERS
This file contains the definition of the parameters for the synthesis tools.
#define PARAM_nxpython_sources_macro_list
NanoXploreBackendFlow(const ParameterConstRef Param, const std::string &flow_name, const generic_deviceRef _device)
Constructor.
refcount< XMLDomParser > XMLDomParserRef
utility function used to read files.
~NanoXploreBackendFlow() override
Destructor.
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
Classes for handling configuration files.
Wrapper to synthesis tools by NanoXplore.
static area_infoRef factory(const ParameterConstRef &Param)
Factory method.
std::string GetPath(std::filesystem::path path)
#define OUTPUT_LEVEL_VERY_PEDANTIC
verbose debugging print is performed.
unsigned int output_level
verbosity level of the class
std::map< std::string, double > design_values
results from the synthesis
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...
node_list const & get_children()
Obtain the list of child nodes.
Generic device description.
void xparse_utilization(const std::string &fn)
Parses device utilization.
#define PRINT_OUT_MEX(profLevel, curprofLevel, mex)
void CopyStdout(const std::string &filename)
Copy a file to the standard output.
#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)
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...