|
4 | 4 | * https://github.com/duck2/uxsdcxx |
5 | 5 | * Modify only if your build process doesn't involve regenerating this file. |
6 | 6 | * |
7 | | - * Cmdline: uxsdcxx/uxsdcxx.py /home/soheil/vtr/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd |
8 | | - * Input file: /home/soheil/vtr/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd |
9 | | - * md5sum of input file: 040903603053940a1b24392c38663b59 |
| 7 | + * Cmdline: uxsdcxx/uxsdcxx.py /dsoft/amohaghegh/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd |
| 8 | + * Input file: /dsoft/amohaghegh/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd |
| 9 | + * md5sum of input file: e14523c72a5db9cc83592d3baaf45780 |
10 | 10 | */ |
11 | 11 |
|
12 | 12 | #include <functional> |
@@ -188,6 +188,8 @@ template <class T, typename Context> |
188 | 188 | inline void write_rr_graph_xml(T &in, Context &context, std::ostream &os){ |
189 | 189 | in.start_write(); |
190 | 190 | os << "<rr_graph"; |
| 191 | + if((bool)in.get_rr_graph_schema_file_id(context)) |
| 192 | + os << " schema_file_id=\"" << in.get_rr_graph_schema_file_id(context) << "\""; |
191 | 193 | if((bool)in.get_rr_graph_tool_comment(context)) |
192 | 194 | os << " tool_comment=\"" << in.get_rr_graph_tool_comment(context) << "\""; |
193 | 195 | if((bool)in.get_rr_graph_tool_name(context)) |
@@ -308,8 +310,8 @@ enum class gtok_t_rr_edges {EDGE}; |
308 | 310 | constexpr const char *gtok_lookup_t_rr_edges[] = {"edge"}; |
309 | 311 | enum class gtok_t_rr_graph {CHANNELS, SWITCHES, SEGMENTS, BLOCK_TYPES, GRID, RR_NODES, RR_EDGES}; |
310 | 312 | constexpr const char *gtok_lookup_t_rr_graph[] = {"channels", "switches", "segments", "block_types", "grid", "rr_nodes", "rr_edges"}; |
311 | | -enum class atok_t_rr_graph {TOOL_COMMENT, TOOL_NAME, TOOL_VERSION}; |
312 | | -constexpr const char *atok_lookup_t_rr_graph[] = {"tool_comment", "tool_name", "tool_version"}; |
| 313 | +enum class atok_t_rr_graph {SCHEMA_FILE_ID, TOOL_COMMENT, TOOL_NAME, TOOL_VERSION}; |
| 314 | +constexpr const char *atok_lookup_t_rr_graph[] = {"schema_file_id", "tool_comment", "tool_name", "tool_version"}; |
313 | 315 |
|
314 | 316 |
|
315 | 317 | /* Internal lexers. These convert the PugiXML node names to input tokens. */ |
@@ -1607,6 +1609,29 @@ inline atok_t_rr_graph lex_attr_t_rr_graph(const char *in, const std::function<v |
1607 | 1609 | default: break; |
1608 | 1610 | } |
1609 | 1611 | break; |
| 1612 | + case 14: |
| 1613 | + switch(*((triehash_uu64*)&in[0])){ |
| 1614 | + case onechar('s', 0, 64) | onechar('c', 8, 64) | onechar('h', 16, 64) | onechar('e', 24, 64) | onechar('m', 32, 64) | onechar('a', 40, 64) | onechar('_', 48, 64) | onechar('f', 56, 64): |
| 1615 | + switch(*((triehash_uu32*)&in[8])){ |
| 1616 | + case onechar('i', 0, 32) | onechar('l', 8, 32) | onechar('e', 16, 32) | onechar('_', 24, 32): |
| 1617 | + switch(in[12]){ |
| 1618 | + case onechar('i', 0, 8): |
| 1619 | + switch(in[13]){ |
| 1620 | + case onechar('d', 0, 8): |
| 1621 | + return atok_t_rr_graph::SCHEMA_FILE_ID; |
| 1622 | + break; |
| 1623 | + default: break; |
| 1624 | + } |
| 1625 | + break; |
| 1626 | + default: break; |
| 1627 | + } |
| 1628 | + break; |
| 1629 | + default: break; |
| 1630 | + } |
| 1631 | + break; |
| 1632 | + default: break; |
| 1633 | + } |
| 1634 | + break; |
1610 | 1635 | default: break; |
1611 | 1636 | } |
1612 | 1637 | noreturn_report(report_error, ("Found unrecognized attribute " + std::string(in) + " of <rr_graph>.").c_str()); |
@@ -2251,6 +2276,14 @@ inline enum_loc_side lex_enum_loc_side(const char *in, bool throw_on_invalid, co |
2251 | 2276 |
|
2252 | 2277 |
|
2253 | 2278 | /* Internal loading functions, which validate and load a PugiXML DOM tree into memory. */ |
| 2279 | +inline unsigned long load_unsigned_long(const char *in, const std::function<void(const char *)> * report_error){ |
| 2280 | + unsigned long out; |
| 2281 | + out = std::strtoull(in, NULL, 10); |
| 2282 | + if(errno != 0) |
| 2283 | + noreturn_report(report_error, ("Invalid value `" + std::string(in) + "` when loading into a unsigned long.").c_str()); |
| 2284 | + return out; |
| 2285 | +} |
| 2286 | + |
2254 | 2287 | inline int load_int(const char *in, const std::function<void(const char *)> * report_error){ |
2255 | 2288 | int out; |
2256 | 2289 | out = std::strtol(in, NULL, 10); |
@@ -3879,6 +3912,9 @@ inline void load_rr_graph(const pugi::xml_node &root, T &out, Context &context, |
3879 | 3912 | for(pugi::xml_attribute attr = root.first_attribute(); attr; attr = attr.next_attribute()){ |
3880 | 3913 | atok_t_rr_graph in = lex_attr_t_rr_graph(attr.name(), report_error); |
3881 | 3914 | switch(in){ |
| 3915 | + case atok_t_rr_graph::SCHEMA_FILE_ID: |
| 3916 | + out.set_rr_graph_schema_file_id(load_unsigned_long(attr.value(), report_error), context); |
| 3917 | + break; |
3882 | 3918 | case atok_t_rr_graph::TOOL_COMMENT: |
3883 | 3919 | out.set_rr_graph_tool_comment(attr.value(), context); |
3884 | 3920 | break; |
|
0 commit comments