Skip to content

Commit 3fac425

Browse files
committed
Added skelton of clock edge creation
1 parent 063a429 commit 3fac425

File tree

7 files changed

+428
-85
lines changed

7 files changed

+428
-85
lines changed
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#include "clock_connection_types.h"
2+
3+
#include "globals.h"
4+
5+
#include "vtr_assert.h"
6+
#include "vtr_log.h"
7+
#include "vtr_error.h"
8+
9+
/*
10+
* RoutingToClockConnection (getters)
11+
*/
12+
13+
ClockConnectionType RoutingToClockConnection::get_connection_type() const {
14+
return ClockConnectionType::ROUTING_TO_CLOCK;
15+
}
16+
17+
/*
18+
* RoutingToClockConnection (setters)
19+
*/
20+
21+
void RoutingToClockConnection::set_clock_name_to_connect_to(std::string clock_name) {
22+
clock_to_connect_to = clock_name;
23+
}
24+
25+
void RoutingToClockConnection::set_clock_switch_name(std::string clock_switch_name) {
26+
switch_name = clock_switch_name;
27+
}
28+
29+
void RoutingToClockConnection::set_switch_location(int x, int y) {
30+
switch_location.x = x;
31+
switch_location.y = y;
32+
}
33+
34+
void RoutingToClockConnection::set_switch(int switch_index) {
35+
switch_idx = switch_index;
36+
}
37+
38+
void RoutingToClockConnection::set_fc_val(int fc_val) {
39+
fc = fc_val;
40+
}
41+
42+
/*
43+
* RoutingToClockConnection (member functions)
44+
*/
45+
46+
void RoutingToClockConnection::create_switches(const ClockRRGraph& clock_graph) {
47+
48+
}
49+
50+
51+
52+
53+
/*
54+
* ClockToClockConneciton (getters)
55+
*/
56+
57+
ClockConnectionType ClockToClockConneciton::get_connection_type() const {
58+
return ClockConnectionType::CLOCK_TO_CLOCK;
59+
}
60+
61+
/*
62+
* ClockToClockConneciton (setters)
63+
*/
64+
65+
void ClockToClockConneciton::set_from_clock_name(std::string clock_name) {
66+
from_clock = clock_name;
67+
}
68+
69+
void ClockToClockConneciton::set_from_clock_switch_name(std::string switch_name) {
70+
from_switch = switch_name;
71+
}
72+
73+
void ClockToClockConneciton::set_to_clock_name(std::string clock_name) {
74+
to_clock = clock_name;
75+
}
76+
77+
void ClockToClockConneciton::set_to_clock_switch_name(std::string switch_name) {
78+
to_switch = switch_name;
79+
}
80+
81+
void ClockToClockConneciton::set_switch(int switch_index) {
82+
switch_idx = switch_index;
83+
}
84+
85+
void ClockToClockConneciton::set_fc_val(int fc_val) {
86+
fc = fc_val;
87+
}
88+
89+
/*
90+
* ClockToClockConneciton (member functions)
91+
*/
92+
93+
void ClockToClockConneciton::create_switches(const ClockRRGraph& clock_graph) {
94+
95+
}
96+
97+
98+
99+
100+
/*
101+
* ClockToPinsConnection (getters)
102+
*/
103+
104+
ClockConnectionType ClockToPinsConnection::get_connection_type() const {
105+
return ClockConnectionType::CLOCK_TO_PINS;
106+
}
107+
108+
/*
109+
* ClockToPinsConnection (setters)
110+
*/
111+
112+
void ClockToPinsConnection::set_clock_name_to_connect_from(std::string clock_name) {
113+
clock_to_connect_from = clock_name;
114+
}
115+
116+
void ClockToPinsConnection::set_clock_switch_name(std::string connection_switch_name) {
117+
switch_name = connection_switch_name;
118+
}
119+
120+
void ClockToPinsConnection::set_switch(int switch_index) {
121+
switch_idx = switch_index;
122+
}
123+
124+
void ClockToPinsConnection::set_fc_val(int fc_val) {
125+
fc = fc_val;
126+
}
127+
128+
/*
129+
* ClockToPinsConnection (member functions)
130+
*/
131+
132+
void ClockToPinsConnection::create_switches(const ClockRRGraph& clock_graph) {
133+
134+
}
135+
136+
137+
138+
139+
/*
140+
* RoutingToPins (getters)
141+
*/
142+
143+
ClockConnectionType RoutingToPins::get_connection_type() const {
144+
return ClockConnectionType::ROUTING_TO_PINS;
145+
}
146+
147+
/*
148+
* RoutingToPins (setters)
149+
*/
150+
151+
void RoutingToPins::set_fc_val(int fc_val) {
152+
fc = fc_val;
153+
}
154+
155+
/*
156+
* RoutingToPins (member functions)
157+
*/
158+
159+
void RoutingToPins::create_switches(const ClockRRGraph& clock_graph) {
160+
(void)clock_graph; // parameter not needed in this case
161+
}
162+
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#ifndef CLOCK_CONNECTION_TYPES
2+
#define CLOCK_CONNECTION_TYPES
3+
4+
#include <string>
5+
6+
#include "clock_fwd.h"
7+
8+
#include "rr_graph_clock.h"
9+
10+
class ClockRRGraph;
11+
12+
enum class ClockConnectionType {
13+
ROUTING_TO_CLOCK,
14+
CLOCK_TO_CLOCK,
15+
CLOCK_TO_PINS,
16+
ROUTING_TO_PINS
17+
};
18+
19+
20+
class ClockConnection {
21+
public:
22+
/*
23+
* Destructor
24+
*/
25+
virtual ~ClockConnection() {};
26+
27+
/*
28+
* Getters
29+
*/
30+
virtual ClockConnectionType get_connection_type() const = 0;
31+
32+
/*
33+
* Member functions
34+
*/
35+
virtual void create_switches(const ClockRRGraph& clock_graph) = 0;
36+
};
37+
38+
39+
class RoutingToClockConnection : public ClockConnection {
40+
private:
41+
std::string clock_to_connect_to;
42+
std::string switch_name;
43+
Coordinates switch_location;
44+
int switch_idx;
45+
int fc;
46+
47+
public:
48+
/*
49+
* Getters
50+
*/
51+
ClockConnectionType get_connection_type() const;
52+
53+
/*
54+
* Setters
55+
*/
56+
void set_clock_name_to_connect_to(std::string clock_name);
57+
void set_clock_switch_name(std::string clock_switch_name);
58+
void set_switch_location(int x, int y);
59+
void set_switch(int switch_index);
60+
void set_fc_val(int fc_val);
61+
62+
/*
63+
* Member functions
64+
*/
65+
/* Connects the inter-block routing to the clock source at the specified coordinates */
66+
void create_switches(const ClockRRGraph& clock_graph);
67+
};
68+
69+
70+
class ClockToClockConneciton : public ClockConnection {
71+
private:
72+
std::string from_clock;
73+
std::string from_switch;
74+
std::string to_clock;
75+
std::string to_switch;
76+
int switch_idx;
77+
int fc;
78+
79+
public:
80+
/*
81+
* Getters
82+
*/
83+
ClockConnectionType get_connection_type() const;
84+
85+
/*
86+
* Setters
87+
*/
88+
void set_from_clock_name(std::string clock_name);
89+
void set_from_clock_switch_name(std::string switch_name);
90+
void set_to_clock_name(std::string clock_name);
91+
void set_to_clock_switch_name(std::string switch_name);
92+
void set_switch(int switch_index);
93+
void set_fc_val(int fc_val);
94+
95+
/*
96+
* Member functions
97+
*/
98+
/* Connects a clock tap to a clock source */
99+
void create_switches(const ClockRRGraph& clock_graph);
100+
};
101+
102+
103+
class ClockToPinsConnection : public ClockConnection {
104+
private:
105+
std::string clock_to_connect_from;
106+
std::string switch_name;
107+
// pin_type; //To
108+
int switch_idx;
109+
int fc;
110+
111+
public:
112+
/*
113+
* Getters
114+
*/
115+
ClockConnectionType get_connection_type() const;
116+
117+
/*
118+
* Setters
119+
*/
120+
void set_clock_name_to_connect_from(std::string clock_name);
121+
void set_clock_switch_name(std::string connection_switch_name);
122+
void set_switch(int switch_index);
123+
void set_fc_val(int fc_val);
124+
125+
/*
126+
* Member functions
127+
*/
128+
/* Connects the clock tap to block pins */
129+
void create_switches(const ClockRRGraph& clock_graph);
130+
};
131+
132+
class RoutingToPins : public ClockConnection {
133+
private:
134+
// pin_type;
135+
int fc;
136+
137+
public:
138+
/*
139+
* Getters
140+
*/
141+
ClockConnectionType get_connection_type() const;
142+
143+
/*
144+
* Setters
145+
*/
146+
void set_fc_val(int fc_val);
147+
148+
/*
149+
* Member functions
150+
*/
151+
152+
void create_switches(const ClockRRGraph& clock_graph);
153+
};
154+
155+
#endif
156+

vpr/src/route/clock_fwd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef CLOCK_FWD
2+
#define CLOCK_FWD
3+
4+
struct Coordinates {
5+
int x;
6+
int y;
7+
};
8+
9+
#endif

vpr/src/route/clock_network_types.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#include "clock_network_types.h"
22

3+
#include "globals.h"
4+
5+
#include "vtr_assert.h"
6+
#include "vtr_log.h"
7+
#include "vtr_error.h"
8+
39
/*
410
* ClockNetwork (getters)
511
*/
@@ -96,7 +102,7 @@ void ClockRib::create_rr_nodes_for_one_instance(int inst_num, ClockRRGraph& cloc
96102
auto& rr_nodes = device_ctx.rr_nodes;
97103
auto& grid = device_ctx.grid;
98104

99-
int ptc_num = inst_num + 50; // used for drawing
105+
int ptc_num = inst_num + 55; // used for drawing
100106

101107
for(unsigned x_start = x_chan_wire.start + 1, x_end = x_chan_wire.end;
102108
x_end < grid.width() - 1;
@@ -218,7 +224,7 @@ void ClockSpine::create_rr_nodes_for_one_instance(int inst_num, ClockRRGraph& cl
218224
auto& rr_nodes = device_ctx.rr_nodes;
219225
auto& grid = device_ctx.grid;
220226

221-
int ptc_num = inst_num + 50;
227+
int ptc_num = inst_num + 55;
222228

223229
for(unsigned y_start = y_chan_wire.start + 1, y_end = y_chan_wire.end;
224230
y_end < grid.height() - 1;

vpr/src/route/clock_network_types.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#ifndef CLOCK_NETWORK_TYPES_H
22
#define CLOCK_NETWORK_TYPES_H
33

4+
#include <string>
5+
#include <vector>
6+
7+
#include "clock_fwd.h"
8+
9+
#include "globals.h"
410
#include "rr_graph_clock.h"
511

612
class ClockRRGraph;
713

8-
struct Point {
9-
int x;
10-
int y;
11-
};
12-
1314
enum class ClockType {
1415
SPINE,
1516
RIB,
@@ -59,14 +60,14 @@ struct SpineTaps {
5960

6061
struct HtreeDrive {
6162
std::string name;
62-
Point offset;
63+
Coordinates offset;
6364
int switch_idx;
6465
};
6566

6667
struct HtreeTaps {
6768
std::string name;
68-
Point offset;
69-
Point increment;
69+
Coordinates offset;
70+
Coordinates increment;
7071
};
7172

7273
class ClockNetwork {

0 commit comments

Comments
 (0)