42 #include "config_PANDA_DATA_INSTALLDIR.hpp" 55 : Param(_Param), TM(_TM), debug_level(_Param->get_class_debug_level(
GET_CLASS(*this)))
69 for(
const auto& n : c_list)
71 if(n->get_name() ==
"device")
73 const auto* dev_xml = GetPointer<const xml_element>(n);
78 for(
const auto& n : c_list)
81 if(n->get_name() ==
"technology" and
82 (not
Param->isOption(OPT_input_format) or
85 const auto* tech_xml = GetPointer<const xml_element>(n);
97 auto vendor = get_parameter<std::string>(
"vendor");
102 auto family = get_parameter<std::string>(
"family");
107 auto model = get_parameter<std::string>(
"model");
112 auto package = get_parameter<std::string>("package");
117 auto speed_grade = get_parameter<std::string>(
"speed_grade");
122 if(p->first ==
"vendor" || p->first ==
"family" || p->first ==
"model" || p->first ==
"package" ||
123 p->first ==
"speed_grade" || p->first ==
"clock_period")
135 std::map<std::string, std::string> default_device_data;
137 default_device_data[
"xc4vlx100-10ff1513"] =
"xc4vlx100-10ff1513.data";
138 default_device_data[
"xc5vlx50-3ff1153"] =
"xc5vlx50-3ff1153.data";
139 default_device_data[
"xc5vlx110t-1ff1136"] =
"xc5vlx110t-1ff1136.data";
140 default_device_data[
"xc5vlx330t-2ff1738"] =
"xc5vlx330t-2ff1738.data";
141 default_device_data[
"xc6vlx240t-1ff1156"] =
"xc6vlx240t-1ff1156.data";
142 default_device_data[
"xc7z020-1clg484"] =
"xc7z020-1clg484.data";
143 default_device_data[
"xc7z020-1clg484-VVD"] =
"xc7z020-1clg484-VVD.data";
144 default_device_data[
"xc7z045-2ffg900-VVD"] =
"xc7z045-2ffg900-VVD.data";
145 default_device_data[
"xc7z020-1clg484-YOSYS-VVD"] =
"xc7z020-1clg484-YOSYS-VVD.data";
146 default_device_data[
"xc7vx485t-2ffg1761-VVD"] =
"xc7vx485t-2ffg1761-VVD.data";
147 default_device_data[
"xc7vx690t-3ffg1930-VVD"] =
"xc7vx690t-3ffg1930-VVD.data";
148 default_device_data[
"xc7vx330t-1ffg1157"] =
"xc7vx330t-1ffg1157.data";
149 default_device_data[
"xc7a100t-1csg324-VVD"] =
"xc7a100t-1csg324-VVD.data";
150 default_device_data[
"xcku060-3ffva1156-VVD"] =
"xcku060-3ffva1156-VVD.data";
151 default_device_data[
"xcu280-2Lfsvh2892-VVD"] =
"xcu280-2Lfsvh2892-VVD.data";
152 default_device_data[
"xcu55c-2Lfsvh2892-VVD"] =
"xcu55c-2Lfsvh2892-VVD.data";
154 default_device_data[
"EP2C70F896C6"] =
"EP2C70F896C6.data";
155 default_device_data[
"EP2C70F896C6-R"] =
"EP2C70F896C6-R.data";
156 default_device_data[
"5CSEMA5F31C6"] =
"5CSEMA5F31C6.data";
157 default_device_data[
"EP4SGX530KH40C2"] =
"EP4SGX530KH40C2.data";
158 default_device_data[
"5SGXEA7N2F45C1"] =
"5SGXEA7N2F45C1.data";
159 default_device_data[
"LFE335EA8FN484C"] =
"LFE335EA8FN484C.data";
160 default_device_data[
"LFE5UM85F8BG756C"] =
"LFE5UM85F8BG756C.data";
161 default_device_data[
"LFE5U85F8BG756C"] =
"LFE5U85F8BG756C.data";
162 default_device_data[
"nx1h35S"] =
"nx1h35S.data";
163 default_device_data[
"nx1h140tsp"] =
"nx1h140tsp.data";
164 default_device_data[
"nx2h540tsc"] =
"nx2h540tsc.data";
166 default_device_data[
"nangate45"] =
"nangate45.data";
167 default_device_data[
"asap7-BC"] =
"asap7-BC.data";
168 default_device_data[
"asap7-TC"] =
"asap7-TC.data";
169 default_device_data[
"asap7-WC"] =
"asap7-WC.data";
171 auto output_level =
Param->getOption<
unsigned int>(OPT_output_level);
176 for(
auto d = default_device_data.begin(); d != default_device_data.end(); ++d)
183 if(
Param->isOption(OPT_target_device_file))
185 const auto file_devices =
Param->getOption<std::list<std::string>>(OPT_target_device_file);
186 for(
const auto& file_device : file_devices)
194 auto device_string =
Param->getOption<std::string>(OPT_device_string);
196 if(default_device_data.find(device_string) != default_device_data.end())
201 default_device_data[device_string])));
205 THROW_ERROR(
"Target device not supported: " + device_string);
211 for(
const auto&
parser : parsers)
216 const xml_element* node = parser->get_document()->get_root_node();
223 catch(
const char* msg)
225 std::cerr << msg << std::endl;
227 catch(
const std::string& msg)
229 std::cerr << msg << std::endl;
231 catch(
const std::exception& ex)
233 std::cout <<
"Exception caught: " << ex.what() << std::endl;
237 std::cerr <<
"unknown exception" << std::endl;
239 THROW_ERROR(
"Error during XML parsing of device files");
245 for(
const auto& t : t_list)
247 const auto* t_elem = GetPointer<const xml_element>(t);
256 bool is_bash_var =
false;
257 if(
CE_XVM(is_bash_var, t_elem))
269 if(t_elem->get_name() ==
"model")
273 if(t_elem->get_name() ==
"speed_grade")
277 if(t_elem->get_name() ==
"package")
282 std::string device_string =
Param->getOption<std::string>(
"device_name") +
283 Param->getOption<std::string>(
"device_speed") +
284 Param->getOption<std::string>(
"device_package");
285 const_cast<Parameter*
>(
Param.
get())->setOption(OPT_device_string, device_string);
#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;.
File containing functions and utilities to support the printing of debug messagges.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
void xload(const xml_element *node)
XML load specialization.
int debug_level
The debug level.
exceptions managed by PandA
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
void load_devices()
Load device characteristics.
virtual ~generic_device()
Destructor of the class.
Class specification of the manager of the technology library data structures.
refcount< generic_device > generic_deviceRef
refcount definition for the class
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
Auxiliary methods for manipulating string.
std::map< std::string, std::string > vars
map between bash variables and values
static generic_deviceRef factory(const ParameterConstRef &Param, const technology_managerRef &TM)
Factory method.
const ParameterConstRef Param
class containing all the parameters
refcount< XMLDomParser > XMLDomParserRef
utility function used to read files.
void xwrite(xml_element *node)
XML write specialization.
std::list< xml_nodeRef > node_list
type for list of xml nodes
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
const technology_managerRef TM
technology manager
std::map< std::string, std::string > parameters
Map of the technology parameter.
#define WRITE_XNVM2(name, value, node)
WRITE XML Name Value Macro second version. Insert a value in an XML tree given the name of the attrib...
std::string GetPath(std::filesystem::path path)
bool has_parameter(const std::string &key) const
Check if parameter exist.
technology_managerRef get_technology_manager() const
Returns the technology manager.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Parameters_FileFormat
File formats.
generic_device(const ParameterConstRef &Param, const technology_managerRef &TM)
Constructor of the class.
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...
Some macro used to interface with the XML library.
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.
std::string relocate_compiler_path(const std::string &path, bool resolve_path=false)
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
void xload_device_parameters(const xml_element *dev_xml)
XML load of device parameters.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...