Skip to content

Commit a36e063

Browse files
committed
Add ID to .route file and simplify placement ID
1 parent e8a5f57 commit a36e063

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
lines changed

vpr/SRC/base/globals.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ t_type_ptr IO_TYPE = NULL;
4545
t_type_ptr EMPTY_TYPE = NULL;
4646
t_type_ptr FILL_TYPE = NULL;
4747

48+
std::string g_placement_id; //SHA256 digest of .place file
49+
4850
/******** Physical architecture ********/
4951

5052
int nx = 0;
@@ -67,6 +69,8 @@ struct s_grid_tile **grid = NULL; /* [0..(nx+1)][0..(ny+1)] Physical block list
6769
struct s_trace **trace_head = NULL; /* [0..(num_nets-1)] */
6870
struct s_trace **trace_tail = NULL; /* [0..(num_nets-1)] */
6971

72+
std::string g_routing_id; //SHA256 digest of .route file
73+
7074
/******** Structures defining the FPGA routing architecture ********/
7175

7276
int num_rr_nodes = 0;

vpr/SRC/base/globals.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ extern struct s_block *block;
7171
/* New external-to-complex block, post-packed netlist*/
7272
extern t_netlist g_clbs_nlist;
7373

74+
extern std::string g_placement_id; //SHA256 digest of .place file
75+
7476
/********************************************************************
7577
Physical FPGA architecture globals
7678
*********************************************************************/
@@ -107,6 +109,8 @@ extern t_chan_width chan_width;
107109
/* [0..num_nets-1] of linked list start pointers. Defines the routing. */
108110
extern struct s_trace **trace_head, **trace_tail;
109111

112+
extern std::string g_routing_id; //SHA256 digest of .route file
113+
110114
/* Structures to define the routing architecture of the FPGA. */
111115
extern int num_rr_nodes;
112116
extern t_rr_node *rr_node; /* [0..num_rr_nodes-1] */

vpr/SRC/base/netlist.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct t_vnet{
7777
struct t_netlist{
7878
//vector<t_blocks> blocks; To-do: Need to implement later
7979
vector<t_vnet> net;
80+
8081
std::string netlist_id;
8182
};
8283

vpr/SRC/base/place_and_route.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ bool place_and_route(struct s_placer_opts placer_opts,
7878

7979
if (!placer_opts.doPlacement || placer_opts.place_freq == PLACE_NEVER) {
8080
/* Read the placement from a file */
81-
<<<<<<< HEAD
82-
read_place(place_file, arch_file, net_file, nx, ny, num_blocks, block);
83-
=======
84-
read_place(filename_opts.ArchFile, filename_opts.NetFile, filename_opts.PlaceFile, arch, nx, ny, num_blocks, block);
85-
>>>>>>> Add netlist and architecture SHA256 ID consistency checks when reading placement file
81+
read_place(filename_opts.NetFile, filename_opts.PlaceFile, nx, ny, num_blocks, block);
8682
sync_grid_to_blocks(num_blocks, nx, ny, grid);
8783
} else {
8884
VTR_ASSERT((PLACE_ONCE == placer_opts.place_freq) || (PLACE_ALWAYS == placer_opts.place_freq));
@@ -93,7 +89,7 @@ bool place_and_route(struct s_placer_opts placer_opts,
9389
timing_inf,
9490
#endif
9591
arch->Directs, arch->num_directs);
96-
print_place(filename_opts.ArchFile, arch->architecture_id, filename_opts.NetFile, g_clbs_nlist.netlist_id.c_str(), filename_opts.PlaceFile);
92+
print_place(filename_opts.NetFile, g_clbs_nlist.netlist_id.c_str(), filename_opts.PlaceFile);
9793
end = clock();
9894

9995
vtr::printf_info("Placement took %g seconds.\n", (float)(end - begin) / CLOCKS_PER_SEC);
@@ -166,7 +162,7 @@ bool place_and_route(struct s_placer_opts placer_opts,
166162

167163
vtr::printf_info("Circuit successfully routed with a channel width factor of %d.\n", width_fac);
168164

169-
print_route(filename_opts.RouteFile);
165+
print_route(filename_opts.PlaceFile, filename_opts.RouteFile);
170166

171167
if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_ROUTING_SINK_DELAYS)) {
172168
print_sink_delays(getEchoFileName(E_ECHO_ROUTING_SINK_DELAYS));
@@ -485,8 +481,7 @@ static int binary_search_place_and_route(struct s_placer_opts placer_opts,
485481
saved_clb_opins_used_locally);
486482

487483
if (placer_opts.place_freq == PLACE_ALWAYS) {
488-
print_place(filename_opts.ArchFile, arch->architecture_id,
489-
filename_opts.NetFile, g_clbs_nlist.netlist_id.c_str(),
484+
print_place(filename_opts.NetFile, g_clbs_nlist.netlist_id.c_str(),
490485
filename_opts.PlaceFile);
491486
}
492487
}
@@ -536,7 +531,7 @@ static int binary_search_place_and_route(struct s_placer_opts placer_opts,
536531
}
537532
vtr::printf_info("Best routing used a channel width factor of %d.\n", final);
538533

539-
print_route(filename_opts.RouteFile);
534+
print_route(filename_opts.PlaceFile, filename_opts.RouteFile);
540535

541536
if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_ROUTING_SINK_DELAYS)) {
542537
print_sink_delays(getEchoFileName(E_ECHO_ROUTING_SINK_DELAYS));

vpr/SRC/pack/output_clustering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using namespace std;
1111

1212
#include "vtr_assert.h"
1313
#include "vtr_log.h"
14+
#include "vtr_digest.h"
1415

1516
#include "vpr_types.h"
1617
#include "vpr_error.h"
@@ -676,4 +677,7 @@ void output_clustering(t_block *clb, int num_clusters, const vector < vector <t_
676677
free_pb_graph_pin_lookup_from_index (pb_graph_pin_lookup_from_index_by_type[itype]);
677678
}
678679
delete[] pb_graph_pin_lookup_from_index_by_type;
680+
681+
//Calculate the ID of the clustering
682+
g_clbs_nlist.netlist_id = vtr::secure_digest_file(out_fname);
679683
}

vpr/SRC/route/route_common.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ using namespace std;
99
#include "vtr_assert.h"
1010
#include "vtr_util.h"
1111
#include "vtr_log.h"
12+
#include "vtr_digest.h"
1213

1314
#include "vpr_types.h"
1415
#include "vpr_error.h"
@@ -1301,7 +1302,7 @@ alloc_linked_f_pointer(void) {
13011302
return (temp_ptr);
13021303
}
13031304

1304-
void print_route(const char *route_file) {
1305+
void print_route(const char* placement_file, const char* route_file) {
13051306

13061307
/* Prints out the routing to file route_file. */
13071308

@@ -1314,6 +1315,8 @@ void print_route(const char *route_file) {
13141315

13151316
fp = fopen(route_file, "w");
13161317

1318+
fprintf(fp, "Placement_File: %s Placement_ID: %s\n", placement_file, g_placement_id.c_str());
1319+
13171320
fprintf(fp, "Array size: %d x %d logic blocks.\n", nx, ny);
13181321
fprintf(fp, "\nRouting:");
13191322
for (inet = 0; inet < g_clbs_nlist.net.size(); inet++) {
@@ -1422,6 +1425,9 @@ void print_route(const char *route_file) {
14221425
fclose(fp);
14231426
}
14241427

1428+
//Save the digest of the route file
1429+
g_routing_id = vtr::secure_digest_file(route_file);
1430+
14251431
}
14261432

14271433
/* TODO: jluu: I now always enforce logically equivalent outputs to use at most one output pin, should rethink how to do this */

vpr/SRC/route/route_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ void restore_routing(struct s_trace **best_routing,
3838

3939
void get_serial_num(void);
4040

41-
void print_route(const char *name);
41+
void print_route(const char* place_file, const char* route_file);

0 commit comments

Comments
 (0)