Skip to content

Commit 5a8e572

Browse files
committed
[lib][rr_graph] update generated file for rrgraph io
1 parent bae00b0 commit 5a8e572

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

libs/librrgraph/src/io/gen/rr_graph_uxsdcxx.h

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* https://github.com/duck2/uxsdcxx
55
* Modify only if your build process doesn't involve regenerating this file.
66
*
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
1010
*/
1111

1212
#include <functional>
@@ -188,6 +188,8 @@ template <class T, typename Context>
188188
inline void write_rr_graph_xml(T &in, Context &context, std::ostream &os){
189189
in.start_write();
190190
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) << "\"";
191193
if((bool)in.get_rr_graph_tool_comment(context))
192194
os << " tool_comment=\"" << in.get_rr_graph_tool_comment(context) << "\"";
193195
if((bool)in.get_rr_graph_tool_name(context))
@@ -308,8 +310,8 @@ enum class gtok_t_rr_edges {EDGE};
308310
constexpr const char *gtok_lookup_t_rr_edges[] = {"edge"};
309311
enum class gtok_t_rr_graph {CHANNELS, SWITCHES, SEGMENTS, BLOCK_TYPES, GRID, RR_NODES, RR_EDGES};
310312
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"};
313315

314316

315317
/* 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
16071609
default: break;
16081610
}
16091611
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;
16101635
default: break;
16111636
}
16121637
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
22512276

22522277

22532278
/* 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+
22542287
inline int load_int(const char *in, const std::function<void(const char *)> * report_error){
22552288
int out;
22562289
out = std::strtol(in, NULL, 10);
@@ -3879,6 +3912,9 @@ inline void load_rr_graph(const pugi::xml_node &root, T &out, Context &context,
38793912
for(pugi::xml_attribute attr = root.first_attribute(); attr; attr = attr.next_attribute()){
38803913
atok_t_rr_graph in = lex_attr_t_rr_graph(attr.name(), report_error);
38813914
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;
38823918
case atok_t_rr_graph::TOOL_COMMENT:
38833919
out.set_rr_graph_tool_comment(attr.value(), context);
38843920
break;

libs/librrgraph/src/io/gen/rr_graph_uxsdcxx_capnp.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* https://github.com/duck2/uxsdcxx
55
* Modify only if your build process doesn't involve regenerating this file.
66
*
7-
* Cmdline: uxsdcxx/uxsdcap.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/uxsdcap.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
1010
*/
1111

1212
#include <functional>
@@ -434,6 +434,8 @@ inline void load_rr_graph_capnp(T &out, kj::ArrayPtr<const ::capnp::word> data,
434434
template <class T, typename Context>
435435
inline void write_rr_graph_capnp(T &in, Context &context, ucap::RrGraph::Builder &root) {
436436
in.start_write();
437+
if((bool)in.get_rr_graph_schema_file_id(context))
438+
root.setSchemaFileId(in.get_rr_graph_schema_file_id(context));
437439
if((bool)in.get_rr_graph_tool_comment(context))
438440
root.setToolComment(in.get_rr_graph_tool_comment(context));
439441
if((bool)in.get_rr_graph_tool_name(context))
@@ -946,6 +948,7 @@ inline void load_rr_graph_capnp_type(const ucap::RrGraph::Reader &root, T &out,
946948
(void)report_error;
947949
(void)stack;
948950

951+
out.set_rr_graph_schema_file_id(root.getSchemaFileId(), context);
949952
out.set_rr_graph_tool_comment(root.getToolComment().cStr(), context);
950953
out.set_rr_graph_tool_name(root.getToolName().cStr(), context);
951954
out.set_rr_graph_tool_version(root.getToolVersion().cStr(), context);

libs/librrgraph/src/io/gen/rr_graph_uxsdcxx_interface.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* https://github.com/duck2/uxsdcxx
55
* Modify only if your build process doesn't involve regenerating this file.
66
*
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
1010
*/
1111

1212
#include <functional>
@@ -536,8 +536,11 @@ class RrGraphBase {
536536
* <xs:attribute name="tool_name" type="xs:string" />
537537
* <xs:attribute name="tool_version" type="xs:string" />
538538
* <xs:attribute name="tool_comment" type="xs:string" />
539+
* <xs:attribute name="schema_file_id" type="xs:unsignedLong" />
539540
* </xs:complexType>
540541
*/
542+
virtual inline unsigned long get_rr_graph_schema_file_id(typename ContextTypes::RrGraphReadContext &ctx) = 0;
543+
virtual inline void set_rr_graph_schema_file_id(unsigned long schema_file_id, typename ContextTypes::RrGraphWriteContext &ctx) = 0;
541544
virtual inline const char * get_rr_graph_tool_comment(typename ContextTypes::RrGraphReadContext &ctx) = 0;
542545
virtual inline void set_rr_graph_tool_comment(const char * tool_comment, typename ContextTypes::RrGraphWriteContext &ctx) = 0;
543546
virtual inline const char * get_rr_graph_tool_name(typename ContextTypes::RrGraphReadContext &ctx) = 0;

0 commit comments

Comments
 (0)