Skip to content

Commit 8a97e52

Browse files
authored
Merge pull request #2524 from verilog-to-routing/run_flat_graphic_warning
Fix the crash in graphics when run-flat is used
2 parents f31fc95 + b207bb9 commit 8a97e52

23 files changed

+168
-180
lines changed

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@
55

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
#include <algorithm>
9-
#include <kj/std/iostream.h>
10-
#include <limits>
11-
#include <map>
12-
#include <regex>
13-
#include <set>
14-
#include <stdlib.h>
15-
#include <string>
16-
#include <string.h>
17-
#include <zlib.h>
18-
#include <sstream>
19-
20-
#include "vtr_assert.h"
21-
#include "vtr_digest.h"
22-
#include "vtr_log.h"
23-
#include "vtr_memory.h"
24-
#include "vtr_util.h"
25-
26-
#include "arch_check.h"
27-
#include "arch_error.h"
28-
#include "arch_util.h"
29-
#include "arch_types.h"
30-
8+
# include <algorithm>
9+
# include <kj/std/iostream.h>
10+
# include <limits>
11+
# include <map>
12+
# include <regex>
13+
# include <set>
14+
# include <stdlib.h>
15+
# include <string>
16+
# include <string.h>
17+
# include <zlib.h>
18+
# include <sstream>
19+
20+
# include "vtr_assert.h"
21+
# include "vtr_digest.h"
22+
# include "vtr_log.h"
23+
# include "vtr_memory.h"
24+
# include "vtr_util.h"
25+
26+
# include "arch_check.h"
27+
# include "arch_error.h"
28+
# include "arch_util.h"
29+
# include "arch_types.h"
3130

3231
/*
3332
* FPGA Interchange Device frontend
@@ -2503,7 +2502,7 @@ struct ArchReader {
25032502
}
25042503
};
25052504

2506-
#endif // VTR_ENABLE_CAPNPROTO
2505+
#endif // VTR_ENABLE_CAPNPROTO
25072506

25082507
void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25092508
const bool /*timing_enabled*/,
@@ -2551,12 +2550,12 @@ void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25512550

25522551
ArchReader reader(arch, device_reader, FPGAInterchangeDeviceFile, PhysicalTileTypes, LogicalBlockTypes);
25532552
reader.read_arch();
2554-
#else // VTR_ENABLE_CAPNPROTO
2553+
#else // VTR_ENABLE_CAPNPROTO
25552554
// If CAPNPROTO is disabled, throw an error.
25562555
(void)FPGAInterchangeDeviceFile;
25572556
(void)arch;
25582557
(void)PhysicalTileTypes;
25592558
(void)LogicalBlockTypes;
25602559
throw vtr::VtrError("Unable to read FPGA interchange if CAPNPROTO is not enabled", __FILE__, __LINE__);
2561-
#endif // VTR_ENABLE_CAPNPROTO
2560+
#endif // VTR_ENABLE_CAPNPROTO
25622561
}

libs/libarchfpga/src/read_fpga_interchange_arch.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
#include "DeviceResources.capnp.h"
9-
#include "LogicalNetlist.capnp.h"
10-
#include "capnp/serialize.h"
11-
#include "capnp/serialize-packed.h"
12-
#include <fcntl.h>
13-
#include <unistd.h>
14-
15-
#endif // VTR_ENABLE_CAPNPROTO
8+
# include "DeviceResources.capnp.h"
9+
# include "LogicalNetlist.capnp.h"
10+
# include "capnp/serialize.h"
11+
# include "capnp/serialize-packed.h"
12+
# include <fcntl.h>
13+
# include <unistd.h>
14+
15+
#endif // VTR_ENABLE_CAPNPROTO
1616

1717
#ifdef __cplusplus
1818
extern "C" {

vpr/src/base/read_interchange_netlist.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313

1414
#ifdef VTR_ENABLE_CAPNPROTO
1515

16-
#include <cmath>
17-
#include <limits>
18-
#include <kj/std/iostream.h>
19-
#include <regex>
20-
#include <string>
21-
#include <unordered_map>
22-
#include <unordered_set>
23-
#include <zlib.h>
24-
#include <iostream>
25-
#include <sstream>
26-
27-
#include "LogicalNetlist.capnp.h"
28-
#include "capnp/serialize.h"
29-
#include "capnp/serialize-packed.h"
30-
31-
#include "vtr_assert.h"
32-
#include "vtr_hash.h"
33-
#include "vtr_util.h"
34-
#include "vtr_log.h"
35-
#include "vtr_logic.h"
36-
#include "vtr_time.h"
37-
#include "vtr_digest.h"
38-
39-
#include "vpr_types.h"
40-
#include "vpr_error.h"
41-
#include "globals.h"
42-
#include "arch_types.h"
16+
# include <cmath>
17+
# include <limits>
18+
# include <kj/std/iostream.h>
19+
# include <regex>
20+
# include <string>
21+
# include <unordered_map>
22+
# include <unordered_set>
23+
# include <zlib.h>
24+
# include <iostream>
25+
# include <sstream>
26+
27+
# include "LogicalNetlist.capnp.h"
28+
# include "capnp/serialize.h"
29+
# include "capnp/serialize-packed.h"
30+
31+
# include "vtr_assert.h"
32+
# include "vtr_hash.h"
33+
# include "vtr_util.h"
34+
# include "vtr_log.h"
35+
# include "vtr_logic.h"
36+
# include "vtr_time.h"
37+
# include "vtr_digest.h"
38+
39+
# include "vpr_types.h"
40+
# include "vpr_error.h"
41+
# include "globals.h"
42+
# include "arch_types.h"
4343

4444
struct NetlistReader {
4545
public:
@@ -524,7 +524,7 @@ struct NetlistReader {
524524
}
525525
};
526526

527-
#endif // VTR_ENABLE_CAPNPROTO
527+
#endif // VTR_ENABLE_CAPNPROTO
528528

529529
AtomNetlist read_interchange_netlist(const char* ic_netlist_file,
530530
t_arch& arch) {
@@ -572,12 +572,12 @@ AtomNetlist read_interchange_netlist(const char* ic_netlist_file,
572572

573573
return netlist;
574574

575-
#else // VTR_ENABLE_CAPNPROTO
575+
#else // VTR_ENABLE_CAPNPROTO
576576

577577
// If CAPNPROTO is not enabled, throw an error
578578
(void)ic_netlist_file;
579579
(void)arch;
580580
throw vtr::VtrError("Unable to read interchange netlist with CAPNPROTO disabled", __FILE__, __LINE__);
581581

582-
#endif // VTR_ENABLE_CAPNPROTO
582+
#endif // VTR_ENABLE_CAPNPROTO
583583
}

vpr/src/draw/draw_basic.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,10 @@ void draw_partial_route(const std::vector<RRNodeId>& rr_nodes_to_draw, ezgl::ren
660660
RRNodeId prev_node = rr_nodes_to_draw[i - 1];
661661
auto prev_type = rr_graph.node_type(RRNodeId(prev_node));
662662

663+
if (!is_inter_cluster_node(rr_graph, prev_node) || !is_inter_cluster_node(rr_graph, inode)) {
664+
continue;
665+
}
666+
663667
auto iedge = find_edge(prev_node, inode);
664668
auto switch_type = rr_graph.edge_switch(RRNodeId(prev_node), iedge);
665669

@@ -773,6 +777,10 @@ bool is_edge_valid_to_draw(RRNodeId current_node, RRNodeId prev_node) {
773777
int current_node_layer = rr_graph.node_layer(current_node);
774778
int prev_node_layer = rr_graph.node_layer(prev_node);
775779

780+
if (!(is_inter_cluster_node(rr_graph, current_node)) || !(is_inter_cluster_node(rr_graph, prev_node))) {
781+
return false;
782+
}
783+
776784
if (current_node_layer != prev_node_layer) {
777785
if (draw_state->cross_layer_display.visible && draw_state->draw_layer_display[current_node_layer].visible && draw_state->draw_layer_display[prev_node_layer].visible) {
778786
return true; //if both layers are enabled and cross layer connections are enabled

vpr/src/draw/draw_rr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ void draw_rr_pin(RRNodeId inode, const ezgl::color& color, ezgl::renderer* g) {
549549
char str[vtr::bufsize];
550550
auto& device_ctx = g_vpr_ctx.device();
551551
const auto& rr_graph = device_ctx.rr_graph;
552+
if (!is_inter_cluster_node(rr_graph, inode)) {
553+
return;
554+
}
552555

553556
int ipin = rr_graph.node_pin_num(RRNodeId(inode));
554557

@@ -581,6 +584,9 @@ void draw_rr_src_sink(RRNodeId inode, ezgl::color color, ezgl::renderer* g) {
581584

582585
auto& device_ctx = g_vpr_ctx.device();
583586
const auto& rr_graph = device_ctx.rr_graph;
587+
if (!is_inter_cluster_node(rr_graph, inode)) {
588+
return;
589+
}
584590

585591
int transparency_factor = get_rr_node_transparency(inode);
586592

vpr/src/noc/noc_link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NocLink::NocLink(NocLinkId link_id, NocRouterId source, NocRouterId sink, double
66
, source_router(source)
77
, sink_router(sink)
88
, bandwidth_usage(0.0)
9-
, bandwidth(bw) { }
9+
, bandwidth(bw) {}
1010

1111
// getters
1212
NocRouterId NocLink::get_source_router(void) const {

vpr/src/noc/noc_link.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NocLink {
5050
NocRouterId sink_router; /*!< The router which uses this link as an incoming edge*/
5151

5252
double bandwidth_usage; /*!< Represents the bandwidth of the data being transmitted on the link. Units in bits-per-second(bps)*/
53-
double bandwidth; /*!< Represents the maximum bits per second that can be transmitted over the link without causing congestion*/
53+
double bandwidth; /*!< Represents the maximum bits per second that can be transmitted over the link without causing congestion*/
5454

5555
public:
5656
NocLink(NocLinkId link_id, NocRouterId source_router, NocRouterId sink_router, double bw);
@@ -135,7 +135,6 @@ class NocLink {
135135
*/
136136
void set_bandwidth(double new_bandwidth);
137137

138-
139138
/**
140139
* @brief Returns the unique link ID. The ID can be used to index
141140
* vtr::vector<NoCLinkId, ...> instances.

vpr/src/noc/noc_storage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const NocLink& NocStorage::get_single_noc_link(NocLinkId id) const {
5656
return link_storage[id];
5757
}
5858

59-
NocLinkId NocStorage::get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const {
59+
NocLinkId NocStorage::get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const {
6060
NocLinkId link_id = NocLinkId::INVALID();
6161

6262
for (const auto& link : link_storage) {

vpr/src/noc/noc_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class NocStorage {
282282
* to the destination router. NocLinkId::INVALID() is such a link is not
283283
* found.
284284
*/
285-
NocLinkId get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const;
285+
NocLinkId get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const;
286286

287287
/**
288288
* @brief Given a unique link identifier, get the corresponding link

vpr/src/place/initial_noc_placement.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static void noc_routers_anneal(const t_noc_opts& noc_opts) {
188188
const double starting_prob = 0.5;
189189
const double prob_step = starting_prob / N_MOVES;
190190

191-
192191
// The checkpoint stored the placement with the lowest cost.
193192
NoCPlacementCheckpoint checkpoint;
194193

0 commit comments

Comments
 (0)