1
- #include " vtr_log.h"
2
1
2
+ #include " CheckSetup.h"
3
+
4
+ #include " vtr_log.h"
3
5
#include " vpr_types.h"
4
6
#include " vpr_error.h"
5
7
#include " globals.h"
6
- #include " echo_files.h"
7
8
#include " read_xml_arch_file.h"
8
- # include " CheckSetup.h "
9
+
9
10
10
11
static constexpr int DYMANIC_PORT_RANGE_MIN = 49152 ;
11
12
static constexpr int DYNAMIC_PORT_RANGE_MAX = 65535 ;
12
13
13
- void CheckSetup (const t_packer_opts& PackerOpts ,
14
- const t_placer_opts& PlacerOpts ,
15
- const t_ap_opts& APOpts ,
16
- const t_router_opts& RouterOpts ,
17
- const t_server_opts& ServerOpts ,
18
- const t_det_routing_arch& RoutingArch ,
19
- const std::vector<t_segment_inf>& Segments ,
20
- const t_timing_inf& Timing ,
21
- const t_chan_width_dist& Chans ) {
22
- if (!Timing .timing_analysis_enabled && PackerOpts .timing_driven ) {
14
+ void CheckSetup (const t_packer_opts& packer_opts ,
15
+ const t_placer_opts& placer_opts ,
16
+ const t_ap_opts& ap_opts ,
17
+ const t_router_opts& router_opts ,
18
+ const t_server_opts& server_opts ,
19
+ const t_det_routing_arch& routing_arch ,
20
+ const std::vector<t_segment_inf>& segments ,
21
+ const t_timing_inf& timing ,
22
+ const t_chan_width_dist& chans ) {
23
+ if (!timing .timing_analysis_enabled && packer_opts .timing_driven ) {
23
24
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
24
25
" Packing cannot be timing driven without timing analysis enabled\n " );
25
26
}
26
27
27
- if (PackerOpts .load_flat_placement ) {
28
- if (PackerOpts .device_layout == " auto" ) {
28
+ if (packer_opts .load_flat_placement ) {
29
+ if (packer_opts .device_layout == " auto" ) {
29
30
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
30
31
" Legalization requires a fixed device layout.\n " );
31
32
}
32
- if (!PlacerOpts .constraints_file .empty ()) {
33
+ if (!placer_opts .constraints_file .empty ()) {
33
34
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
34
35
" Cannot specify a fixed clusters file when running legalization.\n " );
35
36
}
36
37
}
37
38
38
39
39
- if ((GLOBAL == RouterOpts .route_type )
40
- && (PlacerOpts .place_algorithm .is_timing_driven ())) {
40
+ if ((GLOBAL == router_opts .route_type )
41
+ && (placer_opts .place_algorithm .is_timing_driven ())) {
41
42
/* Works, but very weird. Can't optimize timing well, since you're
42
43
* not doing proper architecture delay modelling. */
43
44
VTR_LOG_WARN (
44
45
" Using global routing with timing-driven placement. "
45
46
" This is allowed, but strange, and circuit speed will suffer.\n " );
46
47
}
47
48
48
- if (!Timing .timing_analysis_enabled
49
- && (PlacerOpts .place_algorithm .is_timing_driven ())) {
49
+ if (!timing .timing_analysis_enabled
50
+ && (placer_opts .place_algorithm .is_timing_driven ())) {
50
51
/* May work, not tested */
51
52
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
52
53
" Timing analysis must be enabled for timing-driven placement.\n " );
53
54
}
54
55
55
- if (!PlacerOpts .doPlacement && (!PlacerOpts .constraints_file .empty ())) {
56
+ if (!placer_opts .doPlacement && (!placer_opts .constraints_file .empty ())) {
56
57
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
57
58
" A block location file requires that placement is enabled.\n " );
58
59
}
59
60
60
- if (PlacerOpts .place_algorithm .is_timing_driven () &&
61
- PlacerOpts .place_static_move_prob .size () > NUM_PL_MOVE_TYPES) {
61
+ if (placer_opts .place_algorithm .is_timing_driven () &&
62
+ placer_opts .place_static_move_prob .size () > NUM_PL_MOVE_TYPES) {
62
63
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
63
64
" The number of provided placer move probabilities (%d) should equal or less than the total number of supported moves (%d).\n " ,
64
- PlacerOpts .place_static_move_prob .size (),
65
+ placer_opts .place_static_move_prob .size (),
65
66
NUM_PL_MOVE_TYPES);
66
67
}
67
68
68
- if (!PlacerOpts .place_algorithm .is_timing_driven () &&
69
- PlacerOpts .place_static_move_prob .size () > NUM_PL_NONTIMING_MOVE_TYPES) {
69
+ if (!placer_opts .place_algorithm .is_timing_driven () &&
70
+ placer_opts .place_static_move_prob .size () > NUM_PL_NONTIMING_MOVE_TYPES) {
70
71
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
71
72
" The number of placer non timing move probabilities (%d) should equal to or less than the total number of supported moves (%d).\n " ,
72
- PlacerOpts .place_static_move_prob .size (),
73
+ placer_opts .place_static_move_prob .size (),
73
74
NUM_PL_MOVE_TYPES);
74
75
}
75
76
76
77
// Rules for doing Analytical Placement
77
- if (APOpts .doAP ) {
78
+ if (ap_opts .doAP ) {
78
79
// Make sure that the --place option was not set.
79
- if (PlacerOpts .doPlacement ) {
80
+ if (placer_opts .doPlacement ) {
80
81
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
81
82
" Cannot perform both analytical and non-analytical placement.\n " );
82
83
}
83
84
// Make sure that the --pack option was not set.
84
- if (PackerOpts .doPacking ) {
85
+ if (packer_opts .doPacking ) {
85
86
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
86
87
" Analytical placement should skip packing.\n " );
87
88
}
@@ -95,58 +96,58 @@ void CheckSetup(const t_packer_opts& PackerOpts,
95
96
// goes with ensuring that some blocks are fixed.
96
97
}
97
98
98
- if (RouterOpts .doRouting ) {
99
- if (!Timing .timing_analysis_enabled
100
- && (DEMAND_ONLY != RouterOpts .base_cost_type && DEMAND_ONLY_NORMALIZED_LENGTH != RouterOpts .base_cost_type )) {
99
+ if (router_opts .doRouting ) {
100
+ if (!timing .timing_analysis_enabled
101
+ && (DEMAND_ONLY != router_opts .base_cost_type && DEMAND_ONLY_NORMALIZED_LENGTH != router_opts .base_cost_type )) {
101
102
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
102
103
" base_cost_type must be demand_only or demand_only_normalized_length when timing analysis is disabled.\n " );
103
104
}
104
105
}
105
106
106
- if (DETAILED == RouterOpts .route_type ) {
107
- if ((Chans .chan_x_dist .type != UNIFORM)
108
- || (Chans .chan_y_dist .type != UNIFORM)) {
107
+ if (DETAILED == router_opts .route_type ) {
108
+ if ((chans .chan_x_dist .type != UNIFORM)
109
+ || (chans .chan_y_dist .type != UNIFORM)) {
109
110
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
110
111
" Detailed routing currently only supported on FPGAs with uniform channel distributions.\n " );
111
112
}
112
113
}
113
114
114
- for (int i = 0 ; i < (int )Segments .size (); ++i) {
115
- int Tmp = Segments [i].arch_opin_switch ;
115
+ for (int i = 0 ; i < (int )segments .size (); ++i) {
116
+ int opin_switch_idx = segments [i].arch_opin_switch ;
116
117
auto & device_ctx = g_vpr_ctx.device ();
117
- if (!device_ctx.arch_switch_inf [Tmp ].buffered ()) {
118
+ if (!device_ctx.arch_switch_inf [opin_switch_idx ].buffered ()) {
118
119
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
119
- " arch_opin_switch (#%d) of segment type #%d is not buffered.\n " , Tmp , i);
120
+ " arch_opin_switch (#%d) of segment type #%d is not buffered.\n " , opin_switch_idx , i);
120
121
}
121
122
}
122
123
123
- if ((PlacerOpts .place_chan_width != NO_FIXED_CHANNEL_WIDTH) && PlacerOpts .place_chan_width < 0 ) {
124
+ if ((placer_opts .place_chan_width != NO_FIXED_CHANNEL_WIDTH) && placer_opts .place_chan_width < 0 ) {
124
125
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
125
126
" Place channel width must be positive.\n " );
126
127
}
127
- if ((RouterOpts .fixed_channel_width != NO_FIXED_CHANNEL_WIDTH) && RouterOpts .fixed_channel_width < 0 ) {
128
+ if ((router_opts .fixed_channel_width != NO_FIXED_CHANNEL_WIDTH) && router_opts .fixed_channel_width < 0 ) {
128
129
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
129
130
" Routing channel width must be positive.\n " );
130
131
}
131
132
132
- if (UNI_DIRECTIONAL == RoutingArch .directionality ) {
133
- if ((RouterOpts .fixed_channel_width != NO_FIXED_CHANNEL_WIDTH)
134
- && (RouterOpts .fixed_channel_width % 2 > 0 )) {
133
+ if (UNI_DIRECTIONAL == routing_arch .directionality ) {
134
+ if ((router_opts .fixed_channel_width != NO_FIXED_CHANNEL_WIDTH)
135
+ && (router_opts .fixed_channel_width % 2 > 0 )) {
135
136
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
136
137
" Routing channel width must be even for unidirectional.\n " );
137
138
}
138
- if ((PlacerOpts .place_chan_width != NO_FIXED_CHANNEL_WIDTH)
139
- && (PlacerOpts .place_chan_width % 2 > 0 )) {
139
+ if ((placer_opts .place_chan_width != NO_FIXED_CHANNEL_WIDTH)
140
+ && (placer_opts .place_chan_width % 2 > 0 )) {
140
141
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
141
142
" Place channel width must be even for unidirectional.\n " );
142
143
}
143
144
}
144
145
145
- if (ServerOpts .is_server_mode_enabled ) {
146
- if (ServerOpts .port_num < DYMANIC_PORT_RANGE_MIN || ServerOpts .port_num > DYNAMIC_PORT_RANGE_MAX) {
146
+ if (server_opts .is_server_mode_enabled ) {
147
+ if (server_opts .port_num < DYMANIC_PORT_RANGE_MIN || server_opts .port_num > DYNAMIC_PORT_RANGE_MAX) {
147
148
VPR_FATAL_ERROR (VPR_ERROR_OTHER,
148
149
" Specified server port number `--port %d` is out of range [%d-%d]. Please specify a port number within that range.\n " ,
149
- ServerOpts .port_num , DYMANIC_PORT_RANGE_MIN, DYNAMIC_PORT_RANGE_MAX);
150
+ server_opts .port_num , DYMANIC_PORT_RANGE_MIN, DYNAMIC_PORT_RANGE_MAX);
150
151
}
151
152
}
152
153
}
0 commit comments