diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c index a4783b429..8920fc8f7 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_unique_routing.c @@ -1060,10 +1060,8 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range, */ if ( ( 0 == rotated_rr_switch_block.get_x()) && (device_range.get_y() == rotated_rr_switch_block.get_y()) ) { - //rotated_rr_switch_block.swap_opin_node(TOP, BOTTOM); - //rotated_rr_switch_block.swap_chan_node(TOP, BOTTOM); - //rotated_rr_switch_block.mirror_side_chan_node_direction(TOP); - //rotated_rr_switch_block.mirror_side_chan_node_direction(BOTTOM); + rotated_rr_switch_block.swap_opin_node(TOP, BOTTOM); + rotated_rr_switch_block.swap_chan_node(TOP, BOTTOM); return rotated_rr_switch_block; } @@ -1076,14 +1074,10 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range, */ if ( (device_range.get_x() == rotated_rr_switch_block.get_x()) && (device_range.get_y() == rotated_rr_switch_block.get_y()) ) { - //rotated_rr_switch_block.swap_opin_node(TOP, BOTTOM); - //rotated_rr_switch_block.swap_chan_node(TOP, BOTTOM); - //rotated_rr_switch_block.mirror_side_chan_node_direction(TOP); - //rotated_rr_switch_block.mirror_side_chan_node_direction(BOTTOM); - //rotated_rr_switch_block.swap_opin_node(LEFT, RIGHT); - //rotated_rr_switch_block.swap_chan_node(LEFT, RIGHT); - //rotated_rr_switch_block.mirror_side_chan_node_direction(LEFT); - //rotated_rr_switch_block.mirror_side_chan_node_direction(RIGHT); + rotated_rr_switch_block.swap_opin_node(TOP, BOTTOM); + rotated_rr_switch_block.swap_chan_node(TOP, BOTTOM); + rotated_rr_switch_block.swap_opin_node(LEFT, RIGHT); + rotated_rr_switch_block.swap_chan_node(LEFT, RIGHT); return rotated_rr_switch_block; } /* 4. BOTTOM-RIGHT corner: @@ -1092,10 +1086,8 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range, */ if ( (device_range.get_x() == rotated_rr_switch_block.get_x()) && (0 == rotated_rr_switch_block.get_y()) ) { - //rotated_rr_switch_block.swap_opin_node(LEFT, RIGHT); - //rotated_rr_switch_block.swap_chan_node(LEFT, RIGHT); - //rotated_rr_switch_block.mirror_side_chan_node_direction(LEFT); - //rotated_rr_switch_block.mirror_side_chan_node_direction(RIGHT); + rotated_rr_switch_block.swap_opin_node(LEFT, RIGHT); + rotated_rr_switch_block.swap_chan_node(LEFT, RIGHT); return rotated_rr_switch_block; } @@ -1115,8 +1107,6 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range, rotated_rr_switch_block.swap_chan_node(TOP, BOTTOM); rotated_rr_switch_block.reverse_opin_node(TOP); rotated_rr_switch_block.reverse_opin_node(BOTTOM); - rotated_rr_switch_block.mirror_side_chan_node_direction(TOP); - rotated_rr_switch_block.mirror_side_chan_node_direction(BOTTOM); return rotated_rr_switch_block; } /* 3. RIGHT side: @@ -1128,8 +1118,6 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range, rotated_rr_switch_block.swap_chan_node(LEFT, RIGHT); rotated_rr_switch_block.reverse_opin_node(LEFT); rotated_rr_switch_block.reverse_opin_node(RIGHT); - rotated_rr_switch_block.mirror_side_chan_node_direction(LEFT); - rotated_rr_switch_block.mirror_side_chan_node_direction(RIGHT); return rotated_rr_switch_block; } /* 4. LEFT side: @@ -1218,7 +1206,11 @@ DeviceRRSwitchBlock build_device_rr_switch_blocks(int LL_num_rr_nodes, t_rr_node for (size_t ix = 0; ix <= sb_range.get_x(); ++ix) { for (size_t iy = 0; iy <= sb_range.get_y(); ++iy) { - RRSwitchBlock rr_sb = LL_device_rr_switch_block.get_switch_block(ix, iy); + //RRSwitchBlock rr_sb = LL_device_rr_switch_block.get_switch_block(ix, iy); + RRSwitchBlock rr_sb = build_rr_switch_block(sb_range, ix, iy, + LL_num_rr_nodes, LL_rr_node, + LL_rr_node_indices, + num_segments, LL_rr_indexed_data); RRSwitchBlock rotated_rr_sb = rotate_rr_switch_block_for_mirror(sb_range, rr_sb); DeviceCoordinator sb_coordinator = rr_sb.get_coordinator(); LL_device_rr_switch_block.add_rotatable_mirror(sb_coordinator, rotated_rr_sb); diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp index bd13188d8..95365149b 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.cpp @@ -104,12 +104,16 @@ bool RRChan::is_mirror(RRChan& cand) const { /* Mutators */ void RRChan::set(const RRChan& rr_chan) { + /* Ensure a clean start */ + this->clear(); + /* Assign type of this routing channel */ this->type_ = rr_chan.get_type(); /* Copy node and node_segments */ - this->reserve_node(rr_chan.get_chan_width()); + this->nodes_.resize(rr_chan.get_chan_width()); + this->node_segments_.resize(rr_chan.get_chan_width()); for (size_t inode = 0; inode < rr_chan.get_chan_width(); ++inode) { - this->nodes_.push_back(rr_chan.get_node(inode)); - this->node_segments_.push_back(rr_chan.get_node_segment(inode)); + this->nodes_[inode] = rr_chan.get_node(inode); + this->node_segments_[inode] = rr_chan.get_node_segment(inode); } return; } @@ -1106,7 +1110,10 @@ void RRSwitchBlock::add_chan_node(enum e_side node_side, RRChan& rr_chan, std::v /* fill the dedicated element in the vector */ chan_node_[side_manager.to_size_t()].set(rr_chan); - chan_node_direction_[side_manager.to_size_t()] = rr_chan_dir; + chan_node_direction_[side_manager.to_size_t()].resize(rr_chan_dir.size()); + for (size_t inode = 0; inode < rr_chan_dir.size(); ++inode) { + chan_node_direction_[side_manager.to_size_t()][inode] = rr_chan_dir[inode]; + } return; } diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h index 2c5db6fa0..7d318ec14 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/rr_blocks.h @@ -188,7 +188,6 @@ class RRSwitchBlock { void rotate_opin_node_in_group(size_t offset); /* rotate all the opin nodes by a given offset */ void rotate_side(enum e_side side, size_t offset); /* rotate all the channel and opin nodes by a given offset */ void rotate(size_t offset); /* rotate all the channel and opin nodes by a given offset */ - void mirror_side_chan_node_direction(enum e_side side); /* Mirror the node direction and port direction of routing track nodes on a side */ void swap_chan_node(enum e_side src_side, enum e_side des_side); /* swap the chan rr_nodes on two sides */ void swap_opin_node(enum e_side src_side, enum e_side des_side); /* swap the OPIN rr_nodes on two sides */ void swap_ipin_node(enum e_side src_side, enum e_side des_side); /* swap the IPIN rr_nodes on two sides */ @@ -200,6 +199,7 @@ class RRSwitchBlock { void clear_opin_nodes(enum e_side node_side); /* Clean the number of OPINs of a side */ void clear_one_side(enum e_side node_side); /* Clean chan/opin/ipin nodes at one side */ private: /* Internal Mutators */ + void mirror_side_chan_node_direction(enum e_side side); /* Mirror the node direction and port direction of routing track nodes on a side */ private: /* internal functions */ bool is_node_mirror (RRSwitchBlock& cand, enum e_side node_side, size_t track_id) const; size_t get_track_id_first_short_connection(enum e_side node_side) const;