Skip to content

Commit 1a8e7f3

Browse files
committed
Added missing information in clock rr nodes
- fixes previous valgrid errors in clock code and segfaults
1 parent b69453a commit 1a8e7f3

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

vpr/src/route/clock_network_types.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ClockType ClockRib::get_network_type() const {
5555
* ClockRib (setters)
5656
*/
5757

58-
void ClockRib::set_metal_layer(int r_metal, int c_metal) {
58+
void ClockRib::set_metal_layer(float r_metal, float c_metal) {
5959
x_chan_wire.layer.r_metal = r_metal;
6060
x_chan_wire.layer.c_metal = c_metal;
6161
}
@@ -149,6 +149,10 @@ int ClockRib::create_chanx_wire(
149149
rr_nodes[node_index].set_type(CHANX);
150150
rr_nodes[node_index].set_capacity(1);
151151
rr_nodes[node_index].set_ptc_num(ptc_num);
152+
rr_nodes[node_index].set_cost_index(CHANX_COST_INDEX_START);
153+
auto rc_index = find_create_rr_rc_data(x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal);
154+
rr_nodes[node_index].set_rc_index(rc_index);
155+
// rr_nodes[node_index].set_direction(); // TODO: set direction, can look into how alloc_alloc_and_load_seg_details() does it in rr_graph2.cpp
152156

153157
return node_index;
154158
}
@@ -185,7 +189,7 @@ ClockType ClockSpine::get_network_type() const {
185189
* ClockSpine (setters)
186190
*/
187191

188-
void ClockSpine::set_metal_layer(int r_metal, int c_metal) {
192+
void ClockSpine::set_metal_layer(float r_metal, float c_metal) {
189193
y_chan_wire.layer.r_metal = r_metal;
190194
y_chan_wire.layer.c_metal = c_metal;
191195
}
@@ -279,6 +283,10 @@ int ClockSpine::create_chany_wire(
279283
rr_nodes[node_index].set_type(CHANY);
280284
rr_nodes[node_index].set_capacity(1);
281285
rr_nodes[node_index].set_ptc_num(ptc_num);
286+
auto rc_index = find_create_rr_rc_data(y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal);
287+
rr_nodes[node_index].set_rc_index(rc_index);
288+
rr_nodes[node_index].set_cost_index(CHANX_COST_INDEX_START); //TODO: Why not chany
289+
// rr_nodes[node_index].set_direction(); // TODO: set direction, can look into how alloc_alloc_and_load_seg_details() does it in rr_graph2.cpp
282290

283291
return node_index;
284292
}

vpr/src/route/clock_network_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ClockRib : public ClockNetwork {
128128
/*
129129
* Setters
130130
*/
131-
void set_metal_layer(int r_metal, int c_metal);
131+
void set_metal_layer(float r_metal, float c_metal);
132132
void set_initial_wire_location(int start_x, int end_x, int y);
133133
void set_wire_repeat(int repeat_x, int repeat_y);
134134
void set_drive_location(int offset_x);
@@ -178,7 +178,7 @@ class ClockSpine : public ClockNetwork {
178178
/*
179179
* Setters
180180
*/
181-
void set_metal_layer(int r_metal, int c_metal);
181+
void set_metal_layer(float r_metal, float c_metal);
182182
void set_initial_wire_location(int start_y, int end_y, int x);
183183
void set_wire_repeat(int repeat_x, int repeat_y);
184184
void set_drive_location(int offset_y);

vpr/src/route/rr_graph_clock.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void ClockRRGraph::create_and_append_clock_rr_graph() {
2222

2323
rib->set_num_instance(3);
2424
rib->set_clock_name("rib1");
25-
rib->set_metal_layer(0, 0);
25+
rib->set_metal_layer(405, 0.00000116);
2626
rib->set_initial_wire_location(0, 19, 0);
2727
rib->set_wire_repeat(17, 1);
2828
rib->set_drive_location(10);
@@ -37,7 +37,7 @@ void ClockRRGraph::create_and_append_clock_rr_graph() {
3737

3838
spine->set_num_instance(3);
3939
spine->set_clock_name("spine1");
40-
spine->set_metal_layer(0,0);
40+
spine->set_metal_layer(405,0.00000116);
4141
spine->set_initial_wire_location(0, 19, 10);
4242
spine->set_wire_repeat(19,19);
4343
spine->set_drive_location(10);
@@ -227,6 +227,8 @@ std::set<std::pair<int, int>> SwitchPoint::get_switch_locations() const {
227227

228228
return locations;
229229
}
230+
231+
230232
//void ClockRRGraph::create_star_model_network() {
231233
//
232234
// vtr::printf_info("Creating a clock network in the form of a star model\n");

0 commit comments

Comments
 (0)