Skip to content

Commit 0bfa264

Browse files
Merge pull request #3157 from verilog-to-routing/sm_remove_twist_attr
Removed twist attribute from RR graph
2 parents 8164e63 + 0317505 commit 0bfa264

File tree

12 files changed

+38
-173
lines changed

12 files changed

+38
-173
lines changed

libs/librrgraph/src/base/rr_graph_builder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) {
2626
e_rr_type node_type = node_storage_.node_type(node);
2727
short node_ptc_num = node_storage_.node_ptc_num(node);
2828
short node_layer = node_storage_.node_layer(node);
29-
short node_twist = node_storage_.node_ptc_twist(node);
30-
int node_offset = 0;
3129

3230
for (int ix = node_storage_.node_xlow(node); ix <= node_storage_.node_xhigh(node); ix++) {
3331
for (int iy = node_storage_.node_ylow(node); iy <= node_storage_.node_yhigh(node); iy++) {
34-
node_ptc_num += node_twist * node_offset;
35-
node_offset++;
3632

3733
switch (node_type) {
3834
case e_rr_type::SOURCE:

libs/librrgraph/src/base/rr_graph_builder.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ class RRGraphBuilder {
205205
node_storage_.set_node_layer(id, layer);
206206
}
207207

208-
/** @brief set the ptc twist increment number for TILEABLE rr graphs (for more information see rr_graph_storage.h twist increment comment) */
209-
inline void set_node_ptc_twist_incr(RRNodeId id, int twist){
210-
node_storage_.set_node_ptc_twist_incr(id, twist);
211-
}
212-
213208

214209
/** @brief set_node_pin_num() is designed for logic blocks, which are IPIN and OPIN nodes */
215210
inline void set_node_pin_num(RRNodeId id, int new_pin_num) {
@@ -325,11 +320,6 @@ class RRGraphBuilder {
325320
node_storage_.resize(size);
326321
}
327322

328-
/** @brief This function resize node ptc twist increment; Since it is only used for tileable rr-graph, we don't put it in general resize function*/
329-
inline void resize_ptc_twist_incr(size_t size){
330-
node_storage_.resize(size);
331-
}
332-
333323
/** @brief This function resize rr_switch to accomidate size RR Switch. */
334324
inline void resize_switches(size_t size) {
335325
rr_switch_inf_.resize(size);

libs/librrgraph/src/base/rr_graph_storage.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,6 @@ void t_rr_graph_storage::set_node_layer(RRNodeId id, short layer) {
635635
node_layer_[id] = layer;
636636
}
637637

638-
void t_rr_graph_storage::set_node_ptc_twist_incr(RRNodeId id, short twist_incr){
639-
VTR_ASSERT(!node_ptc_twist_incr_.empty());
640-
node_ptc_twist_incr_[id] = twist_incr;
641-
}
642-
643638
void t_rr_graph_storage::set_node_ptc_num(RRNodeId id, int new_ptc_num) {
644639
node_ptc_[id].ptc_.pin_num = new_ptc_num; //TODO: eventually remove
645640
}
@@ -821,7 +816,6 @@ t_rr_graph_view t_rr_graph_storage::view() const {
821816
vtr::make_const_array_view_id(node_fan_in_),
822817
vtr::make_const_array_view_id(node_layer_),
823818
node_name_,
824-
vtr::make_const_array_view_id(node_ptc_twist_incr_),
825819
vtr::make_const_array_view_id(edge_src_node_),
826820
vtr::make_const_array_view_id(edge_dest_node_),
827821
vtr::make_const_array_view_id(edge_switch_),

libs/librrgraph/src/base/rr_graph_storage.h

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,6 @@ class t_rr_graph_storage {
251251
return std::nullopt; // Return an empty optional if key is not found
252252
}
253253

254-
/** @brief Find the twist number that RR node uses to change ptc number across the same track.
255-
* By default this number is zero, meaning that ptc number across the same track should be the same.
256-
* This number is only meaningful for CHANX/CHANY nodes, not the other nodes.
257-
*/
258-
short node_ptc_twist(RRNodeId id) const{
259-
//check whether node_ptc_twist_incr has been allocated
260-
if(node_ptc_twist_incr_.empty()){
261-
return 0;
262-
}
263-
return node_ptc_twist_incr_[id];
264-
}
265-
266254
/**
267255
* @brief Returns the node ID of the virtual sink for the specified clock network name.
268256
*
@@ -504,7 +492,6 @@ class t_rr_graph_storage {
504492
node_ptc_.reserve(node_storage_.capacity());
505493
node_ptc_.resize(node_storage_.size());
506494
node_layer_.resize(node_storage_.size());
507-
node_ptc_twist_incr_.resize(node_storage_.size());
508495
}
509496

510497
/** @brief Reserve storage for RR nodes. */
@@ -525,11 +512,6 @@ class t_rr_graph_storage {
525512
node_layer_.resize(size);
526513
}
527514

528-
/** @brief We only allocate the ptc twist increment array while building tileable rr-graphs */
529-
void resize_ptc_twist_incr(size_t size){
530-
node_ptc_twist_incr_.resize(size);
531-
}
532-
533515
/** @brief Number of RR nodes that can be accessed. */
534516
size_t size() const {
535517
return node_storage_.size();
@@ -551,7 +533,6 @@ class t_rr_graph_storage {
551533
node_layer_.clear();
552534
node_name_.clear();
553535
virtual_clock_network_root_idx_.clear();
554-
node_ptc_twist_incr_.clear();
555536
edge_src_node_.clear();
556537
edge_dest_node_.clear();
557538
edge_switch_.clear();
@@ -585,7 +566,6 @@ class t_rr_graph_storage {
585566
node_first_edge_.shrink_to_fit();
586567
node_fan_in_.shrink_to_fit();
587568
node_layer_.shrink_to_fit();
588-
node_ptc_twist_incr_.shrink_to_fit();
589569
edge_src_node_.shrink_to_fit();
590570
edge_dest_node_.shrink_to_fit();
591571
edge_switch_.shrink_to_fit();
@@ -620,7 +600,6 @@ class t_rr_graph_storage {
620600
void set_node_name(RRNodeId id, const std::string& new_name);
621601
void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2);
622602
void set_node_layer(RRNodeId id, short layer);
623-
void set_node_ptc_twist_incr(RRNodeId id, short twist);
624603
void set_node_cost_index(RRNodeId, RRIndexedDataId new_cost_index);
625604
void set_node_rc_index(RRNodeId, NodeRCIndex new_rc_index);
626605
void set_node_capacity(RRNodeId, short new_capacity);
@@ -872,15 +851,6 @@ class t_rr_graph_storage {
872851
*/
873852
std::unordered_map<std::string, RRNodeId> virtual_clock_network_root_idx_;
874853

875-
/** @brief
876-
*Twist Increment number is defined for CHANX/CHANY nodes; it is useful for layout of tileable FPGAs used by openFPGA.
877-
*It gives us a new track index in each tile a longer wire crosses, which enables us to make long wires with a repeated single-tile pattern that "twists" the wires as they cross the tile.
878-
*For example, an L4 wire would change tracks 4 times with metal shorts [e.g. 0, 2, 4, 6] and track 6 would drive a switch -- together this implements an L4 wire with only one layout tile.
879-
* Twist increment number is only meaningful for CHANX and CHANY nodes; it is 0 for other node types.
880-
* We also don't bother allocating this storage if the FPGA is not specified to be tileable; instead in that case the twist for all nodes will always be returned as 0.
881-
*/
882-
vtr::vector<RRNodeId, short> node_ptc_twist_incr_;
883-
884854
/** @brief Edge storage */
885855
vtr::vector<RREdgeId, RRNodeId> edge_src_node_;
886856
vtr::vector<RREdgeId, RRNodeId> edge_dest_node_;
@@ -954,7 +924,6 @@ class t_rr_graph_view {
954924
const vtr::array_view_id<RRNodeId, const t_edge_size> node_fan_in,
955925
const vtr::array_view_id<RRNodeId, const short> node_layer,
956926
const std::unordered_map<RRNodeId, std::string>& node_name,
957-
const vtr::array_view_id<RRNodeId, const short> node_ptc_twist_incr,
958927
const vtr::array_view_id<RREdgeId, const RRNodeId> edge_src_node,
959928
const vtr::array_view_id<RREdgeId, const RRNodeId> edge_dest_node,
960929
const vtr::array_view_id<RREdgeId, const short> edge_switch,
@@ -965,7 +934,6 @@ class t_rr_graph_view {
965934
, node_fan_in_(node_fan_in)
966935
, node_layer_(node_layer)
967936
, node_name_(node_name)
968-
, node_ptc_twist_incr_(node_ptc_twist_incr)
969937
, edge_src_node_(edge_src_node)
970938
, edge_dest_node_(edge_dest_node)
971939
, edge_switch_(edge_switch)
@@ -1055,20 +1023,6 @@ class t_rr_graph_view {
10551023
return std::nullopt; // Return an empty optional if key is not found
10561024
}
10571025

1058-
/**
1059-
* @brief Retrieve the twist number (if available) that the given RRNodeId used for its PTC number.
1060-
*
1061-
* @param id The RRNodeId for which to retrieve the twist number.
1062-
* @return The twist number used for the PTC number, or a default value if not available.
1063-
*/
1064-
short node_ptc_twist_incr(RRNodeId id) const{
1065-
//check if ptc twist increment allocated
1066-
if(node_ptc_twist_incr_.empty()){
1067-
return 0; //if it is not allocated we just assume that is zero
1068-
}
1069-
return node_ptc_twist_incr_[id];
1070-
}
1071-
10721026
/**
10731027
* @brief Prefetches hot RR node data required for optimization.
10741028
*
@@ -1183,7 +1137,6 @@ class t_rr_graph_view {
11831137
vtr::array_view_id<RRNodeId, const t_edge_size> node_fan_in_;
11841138
vtr::array_view_id<RRNodeId, const short> node_layer_;
11851139
const std::unordered_map<RRNodeId, std::string>& node_name_;
1186-
vtr::array_view_id<RRNodeId, const short> node_ptc_twist_incr_;
11871140
vtr::array_view_id<RREdgeId, const RRNodeId> edge_src_node_;
11881141
vtr::array_view_id<RREdgeId, const RRNodeId> edge_dest_node_;
11891142
vtr::array_view_id<RREdgeId, const short> edge_switch_;

libs/librrgraph/src/base/rr_graph_view.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@ class RRGraphView {
223223
return node_storage_.node_layer(node);
224224
}
225225

226-
/** @brief Return the ptc number twist of a specified node.
227-
*/
228-
inline short node_ptc_twist(RRNodeId node) const {
229-
return node_storage_.node_ptc_twist(node);
230-
}
231-
232226
/** @brief Return the first outgoing edge of a specified node.
233227
*/
234228
inline RREdgeId node_first_edge(RRNodeId node) const {

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

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +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/mohagh18/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
8-
* Input file: /home/mohagh18/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
9-
10-
* md5sum of input file: 65eddcc840064bbb91d7f4cf0b8bf821
7+
* Cmdline: uxsdcxx/uxsdcxx.py /home/smahmoudi/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
8+
* Input file: /home/smahmoudi/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
9+
* md5sum of input file: dcf32619cae0c49d168a2575bdb00896
1110
*/
1211

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

204203

205-
#if defined(_MSC_VER)
206-
typedef const uint32_t __declspec(align(1)) triehash_uu32;
207-
typedef const uint64_t __declspec(align(1)) triehash_uu64;
208-
#else
209204
typedef const uint32_t __attribute__((aligned(1))) triehash_uu32;
210205
typedef const uint64_t __attribute__((aligned(1))) triehash_uu64;
211206
static_assert(alignof(triehash_uu32) == 1, "Unaligned 32-bit access not found.");
212207
static_assert(alignof(triehash_uu64) == 1, "Unaligned 64-bit access not found.");
213-
#endif
214208
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
215209
#define onechar(c, s, l) (((uint64_t)(c)) << (s))
216210
#else
@@ -281,8 +275,8 @@ constexpr const char *atok_lookup_t_grid_loc[] = {"block_type_id", "height_offse
281275
enum class gtok_t_grid_locs {GRID_LOC};
282276
constexpr const char *gtok_lookup_t_grid_locs[] = {"grid_loc"};
283277

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

287281

288282
enum class atok_t_node_timing {C, R};
@@ -1170,14 +1164,6 @@ inline atok_t_node_loc lex_attr_t_node_loc(const char *in, const std::function<v
11701164
default: break;
11711165
}
11721166
break;
1173-
case onechar('t', 0, 32) | onechar('w', 8, 32) | onechar('i', 16, 32) | onechar('s', 24, 32):
1174-
switch(in[4]){
1175-
case onechar('t', 0, 8):
1176-
return atok_t_node_loc::TWIST;
1177-
break;
1178-
default: break;
1179-
}
1180-
break;
11811167
case onechar('x', 0, 32) | onechar('h', 8, 32) | onechar('i', 16, 32) | onechar('g', 24, 32):
11821168
switch(in[4]){
11831169
case onechar('h', 0, 8):
@@ -2475,7 +2461,7 @@ inline void load_grid_loc_required_attributes(const pugi::xml_node &root, int *
24752461
}
24762462

24772463
inline void load_node_loc_required_attributes(const pugi::xml_node &root, int * ptc, int * xhigh, int * xlow, int * yhigh, int * ylow, const std::function<void(const char *)> * report_error){
2478-
std::bitset<8> astate = 0;
2464+
std::bitset<7> astate = 0;
24792465
for(pugi::xml_attribute attr = root.first_attribute(); attr; attr = attr.next_attribute()){
24802466
atok_t_node_loc in = lex_attr_t_node_loc(attr.name(), report_error);
24812467
if(astate[(int)in] == 0) astate[(int)in] = 1;
@@ -2490,9 +2476,6 @@ inline void load_node_loc_required_attributes(const pugi::xml_node &root, int *
24902476
case atok_t_node_loc::SIDE:
24912477
/* Attribute side set after element init */
24922478
break;
2493-
case atok_t_node_loc::TWIST:
2494-
/* Attribute twist set after element init */
2495-
break;
24962479
case atok_t_node_loc::XHIGH:
24972480
*xhigh = load_int(attr.value(), report_error);
24982481
break;
@@ -2508,7 +2491,7 @@ inline void load_node_loc_required_attributes(const pugi::xml_node &root, int *
25082491
default: break; /* Not possible. */
25092492
}
25102493
}
2511-
std::bitset<8> test_astate = astate | std::bitset<8>(0b00001101);
2494+
std::bitset<7> test_astate = astate | std::bitset<7>(0b0000101);
25122495
if(!test_astate.all()) attr_error(test_astate, atok_lookup_t_node_loc, report_error);
25132496
}
25142497

@@ -3432,9 +3415,6 @@ inline void load_node_loc(const pugi::xml_node &root, T &out, Context &context,
34323415
case atok_t_node_loc::SIDE:
34333416
out.set_node_loc_side(lex_enum_loc_side(attr.value(), true, report_error), context);
34343417
break;
3435-
case atok_t_node_loc::TWIST:
3436-
out.set_node_loc_twist(load_int(attr.value(), report_error), context);
3437-
break;
34383418
case atok_t_node_loc::XHIGH:
34393419
/* Attribute xhigh is already set */
34403420
break;
@@ -4175,8 +4155,6 @@ inline void write_node(T &in, std::ostream &os, Context &context){
41754155
os << " ptc=\"" << in.get_node_loc_ptc(child_context) << "\"";
41764156
if((bool)in.get_node_loc_side(child_context))
41774157
os << " side=\"" << lookup_loc_side[(int)in.get_node_loc_side(child_context)] << "\"";
4178-
if((bool)in.get_node_loc_twist(child_context))
4179-
os << " twist=\"" << in.get_node_loc_twist(child_context) << "\"";
41804158
os << " xhigh=\"" << in.get_node_loc_xhigh(child_context) << "\"";
41814159
os << " xlow=\"" << in.get_node_loc_xlow(child_context) << "\"";
41824160
os << " yhigh=\"" << in.get_node_loc_yhigh(child_context) << "\"";

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +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/mohagh18/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
8-
* Input file: /home/mohagh18/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
9-
10-
* md5sum of input file: 65eddcc840064bbb91d7f4cf0b8bf821
7+
* Cmdline: uxsdcxx/uxsdcap.py /home/smahmoudi/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
8+
* Input file: /home/smahmoudi/vtr-verilog-to-routing/libs/librrgraph/src/io/rr_graph.xsd
9+
* md5sum of input file: dcf32619cae0c49d168a2575bdb00896
1110
*/
1211

1312
#include <functional>
@@ -764,7 +763,6 @@ inline void load_node_loc_capnp_type(const ucap::NodeLoc::Reader &root, T &out,
764763

765764
out.set_node_loc_layer(root.getLayer(), context);
766765
out.set_node_loc_side(conv_enum_loc_side(root.getSide(), report_error), context);
767-
out.set_node_loc_twist(root.getTwist(), context);
768766
}
769767

770768
template<class T, typename Context>
@@ -1224,8 +1222,6 @@ inline void write_node_capnp_type(T &in, ucap::Node::Builder &root, Context &con
12241222
node_loc.setPtc(in.get_node_loc_ptc(child_context));
12251223
if((bool)in.get_node_loc_side(child_context))
12261224
node_loc.setSide(conv_to_enum_loc_side(in.get_node_loc_side(child_context)));
1227-
if((bool)in.get_node_loc_twist(child_context))
1228-
node_loc.setTwist(in.get_node_loc_twist(child_context));
12291225
node_loc.setXhigh(in.get_node_loc_xhigh(child_context));
12301226
node_loc.setXlow(in.get_node_loc_xlow(child_context));
12311227
node_loc.setYhigh(in.get_node_loc_yhigh(child_context));

0 commit comments

Comments
 (0)