Skip to content

Commit

Permalink
resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
tinayang3024 committed May 13, 2019
1 parent ce211d5 commit 3244721
Show file tree
Hide file tree
Showing 18 changed files with 783 additions and 472 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ Professors: Kenneth Kent, Vaughn Betz, Jonathan Rose, Jason Anderson, Peter Jami

Research Assistants: Aaron Graham

Graduate Students: Kevin Murray, Jason Luu, Oleg Petelin, Jeffrey Goeders, Chi Wai Yu, Andrew Somerville, Ian Kuon, Alexander Marquardt, Andy Ye, Wei Mark Fang, Tim Liu, Charles Chiasson, Panagiotis (Panos) Patros
Graduate Students: Kevin Murray, Jason Luu, Oleg Petelin, Mohamed Eldafrawy, Jeffrey Goeders, Chi Wai Yu, Andrew Somerville, Ian Kuon, Alexander Marquardt, Andy Ye, Wei Mark Fang, Tim Liu, Charles Chiasson, Panagiotis (Panos) Patros

Summer Students: Opal Densmore, Ted Campbell, Cong Wang, Peter Milankov, Scott Whitty, Michael Wainberg, Suya Liu, Miad Nasr, Nooruddin Ahmed, Thien Yu, Long Yu Wang, Matthew J.P. Walker, Amer Hesson, Sheng Zhong, Hanqing Zeng, Vidya Sankaranarayanan, Jia Min Wang, Eugene Sha, Jean-Philippe Legault, Richard Ren, Dingyu Yang

Companies: Altera Corporation, Texas Instruments
Companies: Intel, Huawei, Lattice, Altera Corporation, Texas Instruments, Google

Funding Agencies: NSERC, Semiconductor Research Corporation
6 changes: 3 additions & 3 deletions utils/fasm/src/fasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ void FasmWriterVisitor::visit_clb_impl(ClusterBlockId blk_id, const t_pb* clb) {

root_clb_ = clb->pb_graph_node;

int x = place_ctx.block_locs[blk_id].x;
int y = place_ctx.block_locs[blk_id].y;
int z = place_ctx.block_locs[blk_id].z;
int x = place_ctx.block_locs[blk_id].loc.x;
int y = place_ctx.block_locs[blk_id].loc.y;
int z = place_ctx.block_locs[blk_id].loc.z;
auto &grid_loc = device_ctx.grid[x][y];
blk_type_ = grid_loc.type;

Expand Down
20 changes: 10 additions & 10 deletions vpr/src/base/read_place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ void read_place(const char* net_file,
}

//Set the location
place_ctx.block_locs[blk_id].x = block_x;
place_ctx.block_locs[blk_id].y = block_y;
place_ctx.block_locs[blk_id].z = block_z;
place_ctx.block_locs[blk_id].loc.x = block_x;
place_ctx.block_locs[blk_id].loc.y = block_y;
place_ctx.block_locs[blk_id].loc.z = block_z;

} else {
//Unrecognized
Expand Down Expand Up @@ -162,7 +162,7 @@ void read_user_pad_loc(const char *pad_loc_file) {
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
if (is_io_type(cluster_ctx.clb_nlist.block_type(blk_id))) {
insert_in_hash_table(hash_table, cluster_ctx.clb_nlist.block_name(blk_id).c_str(), size_t(blk_id));
place_ctx.block_locs[blk_id].x = OPEN; /* Mark as not seen yet. */
place_ctx.block_locs[blk_id].loc.x = OPEN; /* Mark as not seen yet. */
}
}

Expand Down Expand Up @@ -234,7 +234,7 @@ void read_user_pad_loc(const char *pad_loc_file) {
int i = xtmp;
int j = ytmp;

if (place_ctx.block_locs[bnum].x != OPEN) {
if (place_ctx.block_locs[bnum].loc.x != OPEN) {
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(),
"Block %s is listed twice in pad file.\n", bname);
}
Expand All @@ -244,9 +244,9 @@ void read_user_pad_loc(const char *pad_loc_file) {
"Block #%zu (%s) location, (%d,%d) is out of range.\n", size_t(bnum), bname, i, j);
}

place_ctx.block_locs[bnum].x = i; /* Will be reloaded by initial_placement anyway. */
place_ctx.block_locs[bnum].y = j; /* We need to set .x only as a done flag. */
place_ctx.block_locs[bnum].z = k;
place_ctx.block_locs[bnum].loc.x = i; /* Will be reloaded by initial_placement anyway. */
place_ctx.block_locs[bnum].loc.y = j; /* We need to set .x only as a done flag. */
place_ctx.block_locs[bnum].loc.z = k;
place_ctx.block_locs[bnum].is_fixed = true;

auto type = device_ctx.grid[i][j].type;
Expand All @@ -267,7 +267,7 @@ void read_user_pad_loc(const char *pad_loc_file) {

for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
auto type = cluster_ctx.clb_nlist.block_type(blk_id);
if (is_io_type(type) && place_ctx.block_locs[blk_id].x == OPEN) {
if (is_io_type(type) && place_ctx.block_locs[blk_id].loc.x == OPEN) {
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, 0,
"IO block %s location was not specified in the pad file.\n", cluster_ctx.clb_nlist.block_name(blk_id).c_str());
}
Expand Down Expand Up @@ -307,7 +307,7 @@ void print_place(const char* net_file,
if (strlen(cluster_ctx.clb_nlist.block_name(blk_id).c_str()) < 8)
fprintf(fp, "\t");

fprintf(fp, "%d\t%d\t%d", place_ctx.block_locs[blk_id].x, place_ctx.block_locs[blk_id].y, place_ctx.block_locs[blk_id].z);
fprintf(fp, "%d\t%d\t%d", place_ctx.block_locs[blk_id].loc.x, place_ctx.block_locs[blk_id].loc.y, place_ctx.block_locs[blk_id].loc.z);
fprintf(fp, "\t#%zu\n", size_t(blk_id));
}
}
Expand Down
4 changes: 2 additions & 2 deletions vpr/src/base/read_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ static void process_global_blocks(ifstream &fp, ClusterNetId inet, const char* f
"Block %s for block number %lu specified in the routing file does not match given %s",
tokens[1].c_str(), size_t(bnum), cluster_ctx.clb_nlist.block_name(bnum).c_str());
}
if (place_ctx.block_locs[bnum].x != x || place_ctx.block_locs[bnum].y != y) {
if (place_ctx.block_locs[bnum].loc.x != x || place_ctx.block_locs[bnum].loc.y != y) {
vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
"The placement coordinates (%d, %d) of %d block does not match given (%d, %d)",
x, y, place_ctx.block_locs[bnum].x, place_ctx.block_locs[bnum].y);
x, y, place_ctx.block_locs[bnum].loc.x, place_ctx.block_locs[bnum].loc.y);
}

int pin_index = cluster_ctx.clb_nlist.net_pin_physical_index(inet, pin_counter);
Expand Down
173 changes: 156 additions & 17 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <vector>
#include <unordered_map>
#include <unordered_set>
#include "arch_types.h"
#include "atom_netlist_fwd.h"
#include "clustered_netlist_fwd.h"
Expand Down Expand Up @@ -413,6 +414,155 @@ struct t_bb {
int ymax = 0;
};

//An offset between placement locations (t_pl_loc)
//
// x: x-offset
// y: y-offset
// z: z-offset
struct t_pl_offset {

t_pl_offset() = default;
t_pl_offset(int xoffset, int yoffset, int zoffset)
: x(xoffset), y(yoffset), z(zoffset) {}

int x = 0;
int y = 0;
int z = 0;

t_pl_offset& operator+=(const t_pl_offset& rhs) {
x += rhs.x;
y += rhs.y;
z += rhs.z;
return *this;
}

t_pl_offset& operator-=(const t_pl_offset& rhs) {
x -= rhs.x;
y -= rhs.y;
z -= rhs.z;
return *this;
}

friend t_pl_offset operator+(t_pl_offset lhs, const t_pl_offset& rhs) {
lhs += rhs;
return lhs;
}

friend t_pl_offset operator-(t_pl_offset lhs, const t_pl_offset& rhs) {
lhs -= rhs;
return lhs;
}

friend t_pl_offset operator-(const t_pl_offset& other) {
return t_pl_offset(-other.x, -other.y, -other.z);
}
friend t_pl_offset operator+(const t_pl_offset& other) {
return t_pl_offset(+other.x, +other.y, +other.z);
}

friend bool operator<(const t_pl_offset& lhs, const t_pl_offset& rhs) {
return std::tie(lhs.x, lhs.y, lhs.z) < std::tie(rhs.x, rhs.y, rhs.z);
}

friend bool operator==(const t_pl_offset& lhs, const t_pl_offset& rhs) {
return std::tie(lhs.x, lhs.y, lhs.z) == std::tie(rhs.x, rhs.y, rhs.z);
}

friend bool operator!=(const t_pl_offset& lhs, const t_pl_offset& rhs) {
return !(lhs == rhs);
}
};

namespace std {
template <>
struct hash<t_pl_offset> {
std::size_t operator()(const t_pl_offset& v) const noexcept {
std::size_t seed = std::hash<int>{}(v.x);
vtr::hash_combine(seed, v.y);
vtr::hash_combine(seed, v.z);
return seed;
}
};
}


//A placement location coordinate
//
// x: x-coordinate
// y: y-coordinate
// z: z-coordinate (capacity postion)
//
//Note that t_pl_offset should be used to represent an
//offset between t_pl_loc.
struct t_pl_loc {

t_pl_loc() = default;
t_pl_loc(int xloc, int yloc, int zloc)
: x(xloc), y(yloc), z(zloc) {}

int x = OPEN;
int y = OPEN;
int z = OPEN;

t_pl_loc& operator+=(const t_pl_offset& rhs) {
x += rhs.x;
y += rhs.y;
z += rhs.z;
return *this;
}

t_pl_loc& operator-=(const t_pl_offset& rhs) {
x -= rhs.x;
y -= rhs.y;
z -= rhs.z;
return *this;
}

friend t_pl_loc operator+(t_pl_loc lhs, const t_pl_offset& rhs) {
lhs += rhs;
return lhs;
}
friend t_pl_loc operator+(t_pl_offset lhs, const t_pl_loc& rhs) {
return rhs + lhs;
}

friend t_pl_loc operator-(t_pl_loc lhs, const t_pl_offset& rhs) {
lhs -= rhs;
return lhs;
}
friend t_pl_loc operator-(t_pl_offset lhs, const t_pl_loc& rhs) {
return rhs - lhs;
}

friend t_pl_offset operator-(const t_pl_loc& lhs, const t_pl_loc& rhs) {
return t_pl_offset(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
}

friend bool operator<(const t_pl_loc& lhs, const t_pl_loc& rhs) {
return std::tie(lhs.x, lhs.y, lhs.z) < std::tie(rhs.x, rhs.y, rhs.z);
}

friend bool operator==(const t_pl_loc& lhs, const t_pl_loc& rhs) {
return std::tie(lhs.x, lhs.y, lhs.z) == std::tie(rhs.x, rhs.y, rhs.z);
}

friend bool operator!=(const t_pl_loc& lhs, const t_pl_loc& rhs) {
return !(lhs == rhs);
}
};

namespace std {
template <>
struct hash<t_pl_loc> {
std::size_t operator()(const t_pl_loc& v) const noexcept {
std::size_t seed = std::hash<int>{}(v.x);
vtr::hash_combine(seed, v.y);
vtr::hash_combine(seed, v.z);
return seed;
}
};
}

/* capacity: Capacity of this region, in tracks. *
* occupancy: Expected number of tracks that will be occupied. *
* cost: Current cost of this usage. */
Expand All @@ -432,12 +582,8 @@ struct t_place_region {
* xnew: the x_coord that the block is moved to */
struct t_pl_moved_block {
ClusterBlockId block_num;
int xold;
int xnew;
int yold;
int ynew;
int zold;
int znew;
t_pl_loc old_loc;
t_pl_loc new_loc;
};

/* Stores the list of blocks to be moved in a swap during *
Expand All @@ -449,14 +595,9 @@ struct t_pl_moved_block {
* [0...num_moved_blocks-1] */
struct t_pl_blocks_to_be_moved {
int num_moved_blocks;
t_pl_moved_block * moved_blocks;
};

/* legal positions for type */
struct t_legal_pos {
int x;
int y;
int z;
std::vector<t_pl_moved_block> moved_blocks;
std::unordered_set<t_pl_loc> moved_from;
std::unordered_set<t_pl_loc> moved_to;
};

/* Represents the placement location of a clustered block
Expand All @@ -466,9 +607,7 @@ struct t_legal_pos {
* is_fixed: true if this block's position is fixed by the user and shouldn't be moved during annealing
* nets_and_pins_synced_to_z_coordinate: true if the associated clb's pins have been synced to the z location (i.e. after placement) */
struct t_block_loc {
int x = OPEN;
int y = OPEN;
int z = OPEN;
t_pl_loc loc;

bool is_fixed = false;
bool nets_and_pins_synced_to_z_coordinate = false;
Expand Down
10 changes: 5 additions & 5 deletions vpr/src/draw/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,7 @@ static void highlight_blocks(float abs_x, float abs_y, t_event_buttonPressed but
} else {
/* Highlight block and fan-in/fan-outs. */
draw_highlight_blocks_color(cluster_ctx.clb_nlist.block_type(clb_index), clb_index);
sprintf(msg, "Block #%zu (%s) at (%d, %d) selected.", size_t(clb_index), cluster_ctx.clb_nlist.block_name(clb_index).c_str(), place_ctx.block_locs[clb_index].x, place_ctx.block_locs[clb_index].y);
sprintf(msg, "Block #%zu (%s) at (%d, %d) selected.", size_t(clb_index), cluster_ctx.clb_nlist.block_name(clb_index).c_str(), place_ctx.block_locs[clb_index].loc.x, place_ctx.block_locs[clb_index].loc.y);
}

update_message(msg);
Expand Down Expand Up @@ -3794,12 +3794,12 @@ static void draw_placement_macros() {
ClusterBlockId blk = member->blk_index;

if (imember == 0) {
x_root = place_ctx.block_locs[blk].x;
y_root = place_ctx.block_locs[blk].y;
x_root = place_ctx.block_locs[blk].loc.x;
y_root = place_ctx.block_locs[blk].loc.y;
}

int x = x_root + member->x_offset;
int y = y_root + member->y_offset;
int x = x_root + member->offset.x;
int y = y_root + member->offset.y;

xlow = std::min(xlow, x);
ylow = std::min(ylow, y);
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/draw/draw_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ float t_draw_coords::get_tile_height() {

t_bound_box t_draw_coords::get_pb_bbox(ClusterBlockId clb_index, const t_pb_graph_node& pb_gnode) {
auto& place_ctx = g_vpr_ctx.placement();
return get_pb_bbox(place_ctx.block_locs[clb_index].x, place_ctx.block_locs[clb_index].y ,place_ctx.block_locs[clb_index].z, pb_gnode);
return get_pb_bbox(place_ctx.block_locs[clb_index].loc.x, place_ctx.block_locs[clb_index].loc.y ,place_ctx.block_locs[clb_index].loc.z, pb_gnode);
}

t_bound_box t_draw_coords::get_pb_bbox(int grid_x, int grid_y, int sub_block_index, const t_pb_graph_node& pb_gnode) {
Expand Down
Loading

0 comments on commit 3244721

Please sign in to comment.