Skip to content

Commit 702c6c6

Browse files
committed
[temp][lib] revert capnp support
1 parent 06a76d9 commit 702c6c6

File tree

5 files changed

+83
-157
lines changed

5 files changed

+83
-157
lines changed

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

Lines changed: 34 additions & 69 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 /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
8+
* Input file: /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
9+
* md5sum of input file: 5d51b89242fe6e463629ac43a72e4606
1010
*/
1111

1212
#include <functional>
@@ -201,10 +201,15 @@ inline void write_rr_graph_xml(T &in, Context &context, std::ostream &os){
201201
}
202202

203203

204+
#if defined(_MSC_VER)
205+
typedef const uint32_t __declspec(align(1)) triehash_uu32;
206+
typedef const uint64_t __declspec(align(1)) triehash_uu64;
207+
#else
204208
typedef const uint32_t __attribute__((aligned(1))) triehash_uu32;
205209
typedef const uint64_t __attribute__((aligned(1))) triehash_uu64;
206210
static_assert(alignof(triehash_uu32) == 1, "Unaligned 32-bit access not found.");
207211
static_assert(alignof(triehash_uu64) == 1, "Unaligned 64-bit access not found.");
212+
#endif
208213
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
209214
#define onechar(c, s, l) (((uint64_t)(c)) << (s))
210215
#else
@@ -275,8 +280,8 @@ constexpr const char *atok_lookup_t_grid_loc[] = {"block_type_id", "height_offse
275280
enum class gtok_t_grid_locs {GRID_LOC};
276281
constexpr const char *gtok_lookup_t_grid_locs[] = {"grid_loc"};
277282

278-
enum class atok_t_node_loc {LAYER_HIGH, LAYER_LOW, PTC, SIDE, XHIGH, XLOW, YHIGH, YLOW};
279-
constexpr const char *atok_lookup_t_node_loc[] = {"layer_high", "layer_low", "ptc", "side", "xhigh", "xlow", "yhigh", "ylow"};
283+
enum class atok_t_node_loc {LAYER, PTC, SIDE, TWIST, XHIGH, XLOW, YHIGH, YLOW};
284+
constexpr const char *atok_lookup_t_node_loc[] = {"layer", "ptc", "side", "twist", "xhigh", "xlow", "yhigh", "ylow"};
280285

281286

282287
enum class atok_t_node_timing {C, R};
@@ -1156,49 +1161,34 @@ inline atok_t_node_loc lex_attr_t_node_loc(const char *in, const std::function<v
11561161
break;
11571162
case 5:
11581163
switch(*((triehash_uu32*)&in[0])){
1159-
case onechar('x', 0, 32) | onechar('h', 8, 32) | onechar('i', 16, 32) | onechar('g', 24, 32):
1164+
case onechar('l', 0, 32) | onechar('a', 8, 32) | onechar('y', 16, 32) | onechar('e', 24, 32):
11601165
switch(in[4]){
1161-
case onechar('h', 0, 8):
1162-
return atok_t_node_loc::XHIGH;
1166+
case onechar('r', 0, 8):
1167+
return atok_t_node_loc::LAYER;
11631168
break;
11641169
default: break;
11651170
}
11661171
break;
1167-
case onechar('y', 0, 32) | onechar('h', 8, 32) | onechar('i', 16, 32) | onechar('g', 24, 32):
1172+
case onechar('t', 0, 32) | onechar('w', 8, 32) | onechar('i', 16, 32) | onechar('s', 24, 32):
11681173
switch(in[4]){
1169-
case onechar('h', 0, 8):
1170-
return atok_t_node_loc::YHIGH;
1174+
case onechar('t', 0, 8):
1175+
return atok_t_node_loc::TWIST;
11711176
break;
11721177
default: break;
11731178
}
11741179
break;
1175-
default: break;
1176-
}
1177-
break;
1178-
case 9:
1179-
switch(*((triehash_uu64*)&in[0])){
1180-
case onechar('l', 0, 64) | onechar('a', 8, 64) | onechar('y', 16, 64) | onechar('e', 24, 64) | onechar('r', 32, 64) | onechar('_', 40, 64) | onechar('l', 48, 64) | onechar('o', 56, 64):
1181-
switch(in[8]){
1182-
case onechar('w', 0, 8):
1183-
return atok_t_node_loc::LAYER_LOW;
1180+
case onechar('x', 0, 32) | onechar('h', 8, 32) | onechar('i', 16, 32) | onechar('g', 24, 32):
1181+
switch(in[4]){
1182+
case onechar('h', 0, 8):
1183+
return atok_t_node_loc::XHIGH;
11841184
break;
11851185
default: break;
11861186
}
11871187
break;
1188-
default: break;
1189-
}
1190-
break;
1191-
case 10:
1192-
switch(*((triehash_uu64*)&in[0])){
1193-
case onechar('l', 0, 64) | onechar('a', 8, 64) | onechar('y', 16, 64) | onechar('e', 24, 64) | onechar('r', 32, 64) | onechar('_', 40, 64) | onechar('h', 48, 64) | onechar('i', 56, 64):
1194-
switch(in[8]){
1195-
case onechar('g', 0, 8):
1196-
switch(in[9]){
1197-
case onechar('h', 0, 8):
1198-
return atok_t_node_loc::LAYER_HIGH;
1199-
break;
1200-
default: break;
1201-
}
1188+
case onechar('y', 0, 32) | onechar('h', 8, 32) | onechar('i', 16, 32) | onechar('g', 24, 32):
1189+
switch(in[4]){
1190+
case onechar('h', 0, 8):
1191+
return atok_t_node_loc::YHIGH;
12021192
break;
12031193
default: break;
12041194
}
@@ -1634,7 +1624,7 @@ template<std::size_t N>
16341624
constexpr const char *lookup_switch_type[] = {"UXSD_INVALID", "mux", "tristate", "pass_gate", "short", "buffer"};
16351625
constexpr const char *lookup_segment_res_type[] = {"UXSD_INVALID", "GENERAL", "GCLK"};
16361626
constexpr const char *lookup_pin_type[] = {"UXSD_INVALID", "OPEN", "OUTPUT", "INPUT"};
1637-
constexpr const char *lookup_node_type[] = {"UXSD_INVALID", "CHANX", "CHANY", "CHANZ", "SOURCE", "SINK", "OPIN", "IPIN", "MUX"};
1627+
constexpr const char *lookup_node_type[] = {"UXSD_INVALID", "CHANX", "CHANY", "SOURCE", "SINK", "OPIN", "IPIN"};
16381628
constexpr const char *lookup_node_direction[] = {"UXSD_INVALID", "INC_DIR", "DEC_DIR", "BI_DIR", "NONE"};
16391629
constexpr const char *lookup_node_clk_res_type[] = {"UXSD_INVALID", "VIRTUAL_SINK"};
16401630
constexpr const char *lookup_loc_side[] = {"UXSD_INVALID", "LEFT", "RIGHT", "TOP", "BOTTOM", "RIGHT_LEFT", "RIGHT_BOTTOM", "RIGHT_BOTTOM_LEFT", "TOP_RIGHT", "TOP_BOTTOM", "TOP_LEFT", "TOP_RIGHT_BOTTOM", "TOP_RIGHT_LEFT", "TOP_BOTTOM_LEFT", "TOP_RIGHT_BOTTOM_LEFT", "BOTTOM_LEFT"};
@@ -1813,24 +1803,6 @@ inline enum_pin_type lex_enum_pin_type(const char *in, bool throw_on_invalid, co
18131803
inline enum_node_type lex_enum_node_type(const char *in, bool throw_on_invalid, const std::function<void(const char *)> * report_error){
18141804
unsigned int len = strlen(in);
18151805
switch(len){
1816-
case 3:
1817-
switch(in[0]){
1818-
case onechar('M', 0, 8):
1819-
switch(in[1]){
1820-
case onechar('U', 0, 8):
1821-
switch(in[2]){
1822-
case onechar('X', 0, 8):
1823-
return enum_node_type::MUX;
1824-
break;
1825-
default: break;
1826-
}
1827-
break;
1828-
default: break;
1829-
}
1830-
break;
1831-
default: break;
1832-
}
1833-
break;
18341806
case 4:
18351807
switch(*((triehash_uu32*)&in[0])){
18361808
case onechar('I', 0, 32) | onechar('P', 8, 32) | onechar('I', 16, 32) | onechar('N', 24, 32):
@@ -1855,9 +1827,6 @@ inline enum_node_type lex_enum_node_type(const char *in, bool throw_on_invalid,
18551827
case onechar('Y', 0, 8):
18561828
return enum_node_type::CHANY;
18571829
break;
1858-
case onechar('Z', 0, 8):
1859-
return enum_node_type::CHANZ;
1860-
break;
18611830
default: break;
18621831
}
18631832
break;
@@ -2511,18 +2480,18 @@ inline void load_node_loc_required_attributes(const pugi::xml_node &root, int *
25112480
if(astate[(int)in] == 0) astate[(int)in] = 1;
25122481
else noreturn_report(report_error, ("Duplicate attribute " + std::string(attr.name()) + " in <node_loc>.").c_str());
25132482
switch(in){
2514-
case atok_t_node_loc::LAYER_HIGH:
2515-
/* Attribute layer_high set after element init */
2516-
break;
2517-
case atok_t_node_loc::LAYER_LOW:
2518-
/* Attribute layer_low set after element init */
2483+
case atok_t_node_loc::LAYER:
2484+
/* Attribute layer set after element init */
25192485
break;
25202486
case atok_t_node_loc::PTC:
25212487
/* Attribute ptc set after element init */
25222488
break;
25232489
case atok_t_node_loc::SIDE:
25242490
/* Attribute side set after element init */
25252491
break;
2492+
case atok_t_node_loc::TWIST:
2493+
/* Attribute twist set after element init */
2494+
break;
25262495
case atok_t_node_loc::XHIGH:
25272496
*xhigh = load_int(attr.value(), report_error);
25282497
break;
@@ -2538,7 +2507,7 @@ inline void load_node_loc_required_attributes(const pugi::xml_node &root, int *
25382507
default: break; /* Not possible. */
25392508
}
25402509
}
2541-
std::bitset<8> test_astate = astate | std::bitset<8>(0b00001011);
2510+
std::bitset<8> test_astate = astate | std::bitset<8>(0b00001101);
25422511
if(!test_astate.all()) attr_error(test_astate, atok_lookup_t_node_loc, report_error);
25432512
}
25442513

@@ -3453,11 +3422,8 @@ inline void load_node_loc(const pugi::xml_node &root, T &out, Context &context,
34533422
for(pugi::xml_attribute attr = root.first_attribute(); attr; attr = attr.next_attribute()){
34543423
atok_t_node_loc in = lex_attr_t_node_loc(attr.name(), report_error);
34553424
switch(in){
3456-
case atok_t_node_loc::LAYER_HIGH:
3457-
out.set_node_loc_layer_high(load_int(attr.value(), report_error), context);
3458-
break;
3459-
case atok_t_node_loc::LAYER_LOW:
3460-
out.set_node_loc_layer_low(load_int(attr.value(), report_error), context);
3425+
case atok_t_node_loc::LAYER:
3426+
out.set_node_loc_layer(load_int(attr.value(), report_error), context);
34613427
break;
34623428
case atok_t_node_loc::PTC:
34633429
out.set_node_loc_ptc(attr.value(), context);
@@ -4199,8 +4165,7 @@ inline void write_node(T &in, std::ostream &os, Context &context){
41994165
{
42004166
auto child_context = in.get_node_loc(context);
42014167
os << "<loc";
4202-
os << " layer_high=\"" << in.get_node_loc_layer_high(child_context) << "\"";
4203-
os << " layer_low=\"" << in.get_node_loc_layer_low(child_context) << "\"";
4168+
os << " layer=\"" << in.get_node_loc_layer(child_context) << "\"";
42044169
os << " ptc=\"" << in.get_node_loc_ptc(child_context) << "\"";
42054170
if((bool)in.get_node_loc_side(child_context))
42064171
os << " side=\"" << lookup_loc_side[(int)in.get_node_loc_side(child_context)] << "\"";

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

Lines changed: 5 additions & 15 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 /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
8+
* Input file: /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
9+
* md5sum of input file: 5d51b89242fe6e463629ac43a72e4606
1010
*/
1111

1212
#include <functional>
@@ -220,8 +220,6 @@ inline enum_node_type conv_enum_node_type(ucap::NodeType e, const std::function<
220220
return enum_node_type::CHANX;
221221
case ucap::NodeType::CHANY:
222222
return enum_node_type::CHANY;
223-
case ucap::NodeType::CHANZ:
224-
return enum_node_type::CHANZ;
225223
case ucap::NodeType::SOURCE:
226224
return enum_node_type::SOURCE;
227225
case ucap::NodeType::SINK:
@@ -230,8 +228,6 @@ inline enum_node_type conv_enum_node_type(ucap::NodeType e, const std::function<
230228
return enum_node_type::OPIN;
231229
case ucap::NodeType::IPIN:
232230
return enum_node_type::IPIN;
233-
case ucap::NodeType::MUX:
234-
return enum_node_type::MUX;
235231
default:
236232
(*report_error)("Unknown enum_node_type");
237233
throw std::runtime_error("Unreachable!");
@@ -246,8 +242,6 @@ inline ucap::NodeType conv_to_enum_node_type(enum_node_type e) {
246242
return ucap::NodeType::CHANX;
247243
case enum_node_type::CHANY:
248244
return ucap::NodeType::CHANY;
249-
case enum_node_type::CHANZ:
250-
return ucap::NodeType::CHANZ;
251245
case enum_node_type::SOURCE:
252246
return ucap::NodeType::SOURCE;
253247
case enum_node_type::SINK:
@@ -256,8 +250,6 @@ inline ucap::NodeType conv_to_enum_node_type(enum_node_type e) {
256250
return ucap::NodeType::OPIN;
257251
case enum_node_type::IPIN:
258252
return ucap::NodeType::IPIN;
259-
case enum_node_type::MUX:
260-
return ucap::NodeType::MUX;
261253
default:
262254
throw std::runtime_error("Unknown enum_node_type");
263255
}
@@ -769,8 +761,7 @@ inline void load_node_loc_capnp_type(const ucap::NodeLoc::Reader &root, T &out,
769761
(void)report_error;
770762
(void)stack;
771763

772-
out.set_node_loc_layer_high(root.getLayerHigh(), context);
773-
out.set_node_loc_layer_low(root.getLayerLow(), context);
764+
out.set_node_loc_layer(root.getLayer(), context);
774765
out.set_node_loc_ptc(root.getPtc().cStr(), context);
775766
out.set_node_loc_side(conv_enum_loc_side(root.getSide(), report_error), context);
776767
}
@@ -1228,8 +1219,7 @@ inline void write_node_capnp_type(T &in, ucap::Node::Builder &root, Context &con
12281219
{
12291220
auto child_context = in.get_node_loc(context);
12301221
auto node_loc = root.initLoc();
1231-
node_loc.setLayerHigh(in.get_node_loc_layer_high(child_context));
1232-
node_loc.setLayerLow(in.get_node_loc_layer_low(child_context));
1222+
node_loc.setLayer(in.get_node_loc_layer(child_context));
12331223
node_loc.setPtc(in.get_node_loc_ptc(child_context));
12341224
if((bool)in.get_node_loc_side(child_context))
12351225
node_loc.setSide(conv_to_enum_loc_side(in.get_node_loc_side(child_context)));

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

Lines changed: 7 additions & 10 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 /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
8+
* Input file: /home/soheil/vpr_repos/libs/librrgraph/src/io/rr_graph.xsd
9+
* md5sum of input file: 5d51b89242fe6e463629ac43a72e4606
1010
*/
1111

1212
#include <functional>
@@ -27,7 +27,7 @@ enum class enum_segment_res_type {UXSD_INVALID = 0, GENERAL, GCLK};
2727

2828
enum class enum_pin_type {UXSD_INVALID = 0, OPEN, OUTPUT, INPUT};
2929

30-
enum class enum_node_type {UXSD_INVALID = 0, CHANX, CHANY, CHANZ, SOURCE, SINK, OPIN, IPIN, MUX};
30+
enum class enum_node_type {UXSD_INVALID = 0, CHANX, CHANY, SOURCE, SINK, OPIN, IPIN};
3131

3232
enum class enum_node_direction {UXSD_INVALID = 0, INC_DIR, DEC_DIR, BI_DIR, NONE};
3333

@@ -371,8 +371,7 @@ class RrGraphBase {
371371

372372
/** Generated for complex type "node_loc":
373373
* <xs:complexType name="node_loc">
374-
* <xs:attribute name="layer_low" type="xs:int" default="0" />
375-
* <xs:attribute name="layer_high" type="xs:int" default="0" />
374+
* <xs:attribute name="layer" type="xs:int" default="0" />
376375
* <xs:attribute name="xlow" type="xs:int" use="required" />
377376
* <xs:attribute name="ylow" type="xs:int" use="required" />
378377
* <xs:attribute name="xhigh" type="xs:int" use="required" />
@@ -381,10 +380,8 @@ class RrGraphBase {
381380
* <xs:attribute name="ptc" type="xs:string" use="required" />
382381
* </xs:complexType>
383382
*/
384-
virtual inline int get_node_loc_layer_high(typename ContextTypes::NodeLocReadContext &ctx) = 0;
385-
virtual inline void set_node_loc_layer_high(int layer_high, typename ContextTypes::NodeLocWriteContext &ctx) = 0;
386-
virtual inline int get_node_loc_layer_low(typename ContextTypes::NodeLocReadContext &ctx) = 0;
387-
virtual inline void set_node_loc_layer_low(int layer_low, typename ContextTypes::NodeLocWriteContext &ctx) = 0;
383+
virtual inline int get_node_loc_layer(typename ContextTypes::NodeLocReadContext &ctx) = 0;
384+
virtual inline void set_node_loc_layer(int layer, typename ContextTypes::NodeLocWriteContext &ctx) = 0;
388385
virtual inline const char * get_node_loc_ptc(typename ContextTypes::NodeLocReadContext &ctx) = 0;
389386
virtual inline void set_node_loc_ptc(const char * ptc, typename ContextTypes::NodeLocWriteContext &ctx) = 0;
390387
virtual inline enum_loc_side get_node_loc_side(typename ContextTypes::NodeLocReadContext &ctx) = 0;

0 commit comments

Comments
 (0)