Skip to content

Commit 8e03da9

Browse files
committed
Merge branches 'add-c-internal', 'add-issue-template', 'avoid-criticality-issue', 'connection_box_cleanup', 'disable-check-route-option', 'symbiflow-badger', 'timing-graph-builder-fix' and 'rr-graph-binary-read-write' into master+wip
Signed-off-by: Alessandro Comodi <[email protected]>
8 parents 6407c12 + 7b0dde2 + 02678ef + 15a9ef2 + 7777fd7 + d2abce7 + 56ed9e8 + e710b4b commit 8e03da9

31 files changed

+1474
-44
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

.github/ISSUE_TEMPLATE/vtr-change.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: VTR change
3+
about: Describe purpose and lifecycle of a local change we made to VTR
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Why did we need this? (what does this change enable us to do)
11+
<!--- i.e. what does this change enable us to do? -->
12+
13+
### What did it change?
14+
<!--- i.e. technical description what the change does -->
15+
16+
### Should it be merged upstream - if not, when can we delete it?
17+
18+
### What is needed to get this merged / deleted?
19+
20+
* [ ] is the implementation work to make suitable for merging / deletion completed?
21+
* [ ] Is there an associated test? <!--- i.e. how will we prevent it from regressing? -->
22+
* [ ] is this currently part of the Conda package?
23+
* [ ] is this properly cleaned up in our local repositories? <!--- add subtasks here if needed) -->
24+
25+
### Tracker / branch / PR & other useful links

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
2+
SymbiFlow WIP changes for Verilog to Routing (VTR)
3+
==================================================
4+
5+
This branch contains work in progress changes for using Verilog to Routing
6+
(VTR) as part of SymbiFlow.
7+
8+
---
9+
110
# Verilog to Routing (VTR)
2-
[![Build Status](https://travis-ci.org/verilog-to-routing/vtr-verilog-to-routing.svg?branch=master)](https://travis-ci.org/verilog-to-routing/vtr-verilog-to-routing) [![Documentation Status](https://readthedocs.org/projects/vtr/badge/?version=latest)](http://docs.verilogtorouting.org/en/latest/?badge=latest)
11+
[![Build Status](https://travis-ci.com/SymbiFlow/vtr-verilog-to-routing.svg?branch=master)](https://travis-ci.com/SymbiFlow/vtr-verilog-to-routing) [![Documentation Status](https://readthedocs.org/projects/vtr/badge/?version=latest)](http://docs.verilogtorouting.org/en/latest/?badge=latest)
312

413
## Introduction
514
The Verilog-to-Routing (VTR) project is a world-wide collaborative effort to provide a open-source framework for conducting FPGA architecture and CAD research and development.

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
347347
RouterOpts->max_convergence_count = Options.router_max_convergence_count;
348348
RouterOpts->reconvergence_cpd_threshold = Options.router_reconvergence_cpd_threshold;
349349
RouterOpts->first_iteration_timing_report_file = Options.router_first_iteration_timing_report_file;
350-
351350
RouterOpts->strict_checks = Options.strict_checks;
351+
RouterOpts->disable_check_route = Options.disable_check_route;
352352
}
353353

354354
static void SetupAnnealSched(const t_options& Options,

vpr/src/base/echo_files.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ void alloc_and_load_echo_file_info() {
112112
setEchoFileName(E_ECHO_CHAN_DETAILS, "chan_details.txt");
113113
setEchoFileName(E_ECHO_SBLOCK_PATTERN, "sblock_pattern.txt");
114114
setEchoFileName(E_ECHO_ENDPOINT_TIMING, "endpoint_timing.echo.json");
115+
116+
setEchoFileName(E_ECHO_LOOKAHEAD_MAP, "lookahead_map.echo");
115117
}
116118

117119
void free_echo_file_info() {

vpr/src/base/echo_files.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum e_echo_files {
4343
E_ECHO_CHAN_DETAILS,
4444
E_ECHO_SBLOCK_PATTERN,
4545
E_ECHO_ENDPOINT_TIMING,
46+
E_ECHO_LOOKAHEAD_MAP,
4647

4748
//Timing Graphs
4849
E_ECHO_PRE_PACKING_TIMING_GRAPH,

vpr/src/base/read_options.cpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ struct ParseRouterLookahead {
648648
conv_value.set_value(e_router_lookahead::CLASSIC);
649649
else if (str == "map")
650650
conv_value.set_value(e_router_lookahead::MAP);
651+
else if (str == "connection_box_map")
652+
conv_value.set_value(e_router_lookahead::CONNECTION_BOX_MAP);
651653
else {
652654
std::stringstream msg;
653655
msg << "Invalid conversion from '"
@@ -661,17 +663,22 @@ struct ParseRouterLookahead {
661663

662664
ConvertedValue<std::string> to_str(e_router_lookahead val) {
663665
ConvertedValue<std::string> conv_value;
664-
if (val == e_router_lookahead::CLASSIC)
666+
if (val == e_router_lookahead::CLASSIC) {
665667
conv_value.set_value("classic");
666-
else {
667-
VTR_ASSERT(val == e_router_lookahead::MAP);
668+
} else if (val == e_router_lookahead::MAP) {
668669
conv_value.set_value("map");
670+
} else if (val == e_router_lookahead::CONNECTION_BOX_MAP) {
671+
conv_value.set_value("connection_box_map");
672+
} else {
673+
std::stringstream msg;
674+
msg << "Unrecognized e_router_lookahead";
675+
conv_value.set_error(msg.str());
669676
}
670677
return conv_value;
671678
}
672679

673680
std::vector<std::string> default_choices() {
674-
return {"classic", "map"};
681+
return {"classic", "map", "connection_box_map"};
675682
}
676683
};
677684

@@ -949,6 +956,16 @@ static argparse::ArgumentParser create_arg_parser(std::string prog_name, t_optio
949956
"This option should be only used for development purposes.")
950957
.default_value("");
951958

959+
gen_grp.add_argument<bool, ParseOnOff>(args.allow_dangling_combinational_nodes, "--allow_dangling_combinational_nodes")
960+
.help(
961+
"Option to allow dangling combinational nodes in the timing graph.\n"
962+
"This option should normally be off, as dangling combinational nodes are unusual\n"
963+
"in the timing graph and may indicate a problem in the circuit or architecture.\n"
964+
"Unless you understand why your architecture/circuit can have valid dangling combinational nodes, this option should be off.\n"
965+
"In general this is a dev-only option and should not be turned on by the end-user.")
966+
.default_value("off")
967+
.show_in(argparse::ShowIn::HELP_ONLY);
968+
952969
auto& file_grp = parser.add_argument_group("file options");
953970

954971
file_grp.add_argument(args.BlifFile, "--circuit_file")
@@ -1551,6 +1568,11 @@ static argparse::ArgumentParser create_arg_parser(std::string prog_name, t_optio
15511568
.default_value("")
15521569
.show_in(argparse::ShowIn::HELP_ONLY);
15531570

1571+
route_timing_grp.add_argument<bool, ParseOnOff>(args.disable_check_route, "--disable_check_route")
1572+
.help("Disables check_route once routing step has finished or when routing file is loaded")
1573+
.default_value("off")
1574+
.show_in(argparse::ShowIn::HELP_ONLY);
1575+
15541576
route_timing_grp.add_argument(args.router_debug_net, "--router_debug_net")
15551577
.help(
15561578
"Controls when router debugging is enabled.\n"

vpr/src/base/read_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct t_options {
5252
argparse::ArgValue<bool> strict_checks;
5353
argparse::ArgValue<std::string> disable_errors;
5454
argparse::ArgValue<std::string> suppress_warnings;
55+
argparse::ArgValue<bool> allow_dangling_combinational_nodes;
5556

5657
/* Atom netlist options */
5758
argparse::ArgValue<bool> absorb_buffer_luts;
@@ -120,6 +121,7 @@ struct t_options {
120121
argparse::ArgValue<bool> verify_binary_search;
121122
argparse::ArgValue<e_router_algorithm> RouterAlgorithm;
122123
argparse::ArgValue<int> min_incremental_reroute_fanout;
124+
argparse::ArgValue<bool> disable_check_route;
123125

124126
/* Timing-driven router options only */
125127
argparse::ArgValue<float> astar_fac;

vpr/src/base/vpr_api.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void vpr_init(const int argc, const char** argv, t_options* options, t_vpr_setup
304304
auto& timing_ctx = g_vpr_ctx.mutable_timing();
305305
{
306306
vtr::ScopedStartFinishTimer t("Build Timing Graph");
307-
timing_ctx.graph = TimingGraphBuilder(atom_ctx.nlist, atom_ctx.lookup).timing_graph();
307+
timing_ctx.graph = TimingGraphBuilder(atom_ctx.nlist, atom_ctx.lookup).timing_graph(options->allow_dangling_combinational_nodes);
308308
VTR_LOG(" Timing Graph Nodes: %zu\n", timing_ctx.graph->nodes().size());
309309
VTR_LOG(" Timing Graph Edges: %zu\n", timing_ctx.graph->edges().size());
310310
VTR_LOG(" Timing Graph Levels: %zu\n", timing_ctx.graph->levels().size());
@@ -666,7 +666,9 @@ RouteStatus vpr_route_flow(t_vpr_setup& vpr_setup, const t_arch& arch) {
666666
std::string graphics_msg;
667667
if (route_status.success()) {
668668
//Sanity check the routing
669-
check_route(router_opts.route_type);
669+
if (!router_opts.disable_check_route) {
670+
check_route(router_opts.route_type);
671+
}
670672
get_serial_num();
671673

672674
//Update status

vpr/src/base/vpr_context.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "clock_connection_builders.h"
2121
#include "route_traceback.h"
2222
#include "place_macro.h"
23+
#include "connection_box.h"
2324

2425
//A Context is collection of state relating to a particular part of VPR
2526
//
@@ -194,6 +195,8 @@ struct DeviceContext : public Context {
194195
* Clock Network
195196
********************************************************************/
196197
t_clock_arch* clock_arch;
198+
199+
ConnectionBoxes connection_boxes;
197200
};
198201

199202
//State relating to power analysis

vpr/src/base/vpr_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ constexpr const char* EMPTY_BLOCK_NAME = "EMPTY";
103103
enum class e_router_lookahead {
104104
CLASSIC, //VPR's classic lookahead (assumes uniform wire types)
105105
MAP, //Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
106-
NO_OP //A no-operation lookahead which always returns zero
106+
NO_OP, //A no-operation lookahead which always returns zero
107+
CONNECTION_BOX_MAP,
108+
// Lookahead considering different wire types and IPIN
109+
// connection box.
107110
};
108111

109112
enum class e_route_bb_update {
@@ -947,6 +950,7 @@ struct t_router_opts {
947950
float reconvergence_cpd_threshold;
948951
std::string first_iteration_timing_report_file;
949952
bool strict_checks;
953+
bool disable_check_route;
950954
};
951955

952956
struct t_analysis_opts {

vpr/src/place/timing_place_lookup.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,11 @@ static float route_connection_delay(int source_x, int source_y, int sink_x, int
264264

265265
VTR_ASSERT(sink_rr_node != OPEN);
266266

267-
successfully_routed = calculate_delay(source_rr_node, sink_rr_node,
268-
router_opts,
269-
&net_delay_value);
267+
{
268+
successfully_routed = calculate_delay(source_rr_node, sink_rr_node,
269+
router_opts,
270+
&net_delay_value);
271+
}
270272

271273
if (successfully_routed) break;
272274
}

vpr/src/route/connection_box.cpp

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#include "connection_box.h"
2+
#include "vtr_assert.h"
3+
#include "globals.h"
4+
5+
ConnectionBoxes::ConnectionBoxes()
6+
: size_(std::make_pair(0, 0)) {
7+
}
8+
9+
size_t ConnectionBoxes::num_connection_box_types() const {
10+
return boxes_.size();
11+
}
12+
13+
std::pair<size_t, size_t> ConnectionBoxes::connection_box_grid_size() const {
14+
return size_;
15+
}
16+
17+
const ConnectionBox* ConnectionBoxes::get_connection_box(ConnectionBoxId box) const {
18+
if (bool(box)) {
19+
return nullptr;
20+
}
21+
22+
size_t index = size_t(box);
23+
if (index >= boxes_.size()) {
24+
return nullptr;
25+
}
26+
27+
return &boxes_.at(index);
28+
}
29+
30+
bool ConnectionBoxes::find_connection_box(int inode,
31+
ConnectionBoxId* box_id,
32+
std::pair<size_t, size_t>* box_location) const {
33+
VTR_ASSERT(box_id != nullptr);
34+
VTR_ASSERT(box_location != nullptr);
35+
36+
const auto& conn_box_loc = ipin_map_[inode];
37+
if (conn_box_loc.box_id == ConnectionBoxId::INVALID()) {
38+
return false;
39+
}
40+
41+
*box_id = conn_box_loc.box_id;
42+
*box_location = conn_box_loc.box_location;
43+
return true;
44+
}
45+
46+
// Clear IPIN map and set connection box grid size and box ids.
47+
void ConnectionBoxes::reset_boxes(std::pair<size_t, size_t> size,
48+
const std::vector<ConnectionBox> boxes) {
49+
clear();
50+
51+
size_ = size;
52+
boxes_ = boxes;
53+
}
54+
55+
void ConnectionBoxes::resize_nodes(size_t rr_node_size) {
56+
ipin_map_.resize(rr_node_size);
57+
canonical_loc_map_.resize(rr_node_size,
58+
std::make_pair(-1, -1));
59+
}
60+
61+
void ConnectionBoxes::clear() {
62+
ipin_map_.clear();
63+
size_ = std::make_pair(0, 0);
64+
boxes_.clear();
65+
canonical_loc_map_.clear();
66+
sink_to_ipin_.clear();
67+
}
68+
69+
void ConnectionBoxes::add_connection_box(int inode, ConnectionBoxId box_id, std::pair<size_t, size_t> box_location) {
70+
// Ensure that box location is in bounds
71+
VTR_ASSERT(box_location.first < size_.first);
72+
VTR_ASSERT(box_location.second < size_.second);
73+
74+
// Bounds check box_id
75+
VTR_ASSERT(bool(box_id));
76+
VTR_ASSERT(size_t(box_id) < boxes_.size());
77+
78+
// Make sure sink map will not be invalidated upon insertion.
79+
VTR_ASSERT(sink_to_ipin_.size() == 0);
80+
81+
ipin_map_[inode] = ConnBoxLoc(box_location, box_id);
82+
}
83+
84+
void ConnectionBoxes::add_canonical_loc(int inode, std::pair<size_t, size_t> loc) {
85+
VTR_ASSERT(loc.first < size_.first);
86+
VTR_ASSERT(loc.second < size_.second);
87+
canonical_loc_map_[inode] = loc;
88+
}
89+
90+
const std::pair<size_t, size_t>* ConnectionBoxes::find_canonical_loc(int inode) const {
91+
const auto& canon_loc = canonical_loc_map_[inode];
92+
if (canon_loc.first == size_t(-1)) {
93+
return nullptr;
94+
}
95+
96+
return &canon_loc;
97+
}
98+
99+
void ConnectionBoxes::create_sink_back_ref() {
100+
const auto& device_ctx = g_vpr_ctx.device();
101+
102+
sink_to_ipin_.resize(device_ctx.rr_nodes.size(), {{0, 0, 0, 0}, 0});
103+
104+
for (size_t i = 0; i < device_ctx.rr_nodes.size(); ++i) {
105+
const auto& ipin_node = device_ctx.rr_nodes[i];
106+
if (ipin_node.type() != IPIN) {
107+
continue;
108+
}
109+
110+
if (ipin_map_[i].box_id == ConnectionBoxId::INVALID()) {
111+
continue;
112+
}
113+
114+
for (auto edge : ipin_node.edges()) {
115+
int sink_inode = ipin_node.edge_sink_node(edge);
116+
VTR_ASSERT(device_ctx.rr_nodes[sink_inode].type() == SINK);
117+
VTR_ASSERT(sink_to_ipin_[sink_inode].ipin_count < 4);
118+
auto& sink_to_ipin = sink_to_ipin_[sink_inode];
119+
sink_to_ipin.ipin_nodes[sink_to_ipin.ipin_count++] = i;
120+
}
121+
}
122+
}
123+
124+
const SinkToIpin& ConnectionBoxes::find_sink_connection_boxes(
125+
int inode) const {
126+
return sink_to_ipin_[inode];
127+
}

0 commit comments

Comments
 (0)