102
102
# include < tbb/global_control.h>
103
103
#endif
104
104
105
+ #ifndef NO_SERVER
106
+ #include " gateio.h"
107
+ #include " serverupdate.h"
108
+ #endif /* NO_SERVER */
109
+
105
110
/* Local subroutines */
106
111
static void free_complex_block_types ();
107
112
@@ -291,6 +296,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
291
296
&vpr_setup->RouterOpts ,
292
297
&vpr_setup->AnalysisOpts ,
293
298
&vpr_setup->NocOpts ,
299
+ &vpr_setup->ServerOpts ,
294
300
&vpr_setup->RoutingArch ,
295
301
&vpr_setup->PackerRRGraph ,
296
302
vpr_setup->Segments ,
@@ -309,6 +315,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
309
315
CheckSetup (vpr_setup->PackerOpts ,
310
316
vpr_setup->PlacerOpts ,
311
317
vpr_setup->RouterOpts ,
318
+ vpr_setup->ServerOpts ,
312
319
vpr_setup->RoutingArch , vpr_setup->Segments , vpr_setup->Timing , arch->Chans );
313
320
314
321
/* flush any messages to user still in stdout that hasn't gotten displayed */
@@ -387,6 +394,9 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
387
394
388
395
// TODO: Placer still assumes that cluster net list is used - graphics can not work with flat routing yet
389
396
vpr_init_graphics (vpr_setup, arch, false );
397
+
398
+ vpr_init_server (vpr_setup);
399
+
390
400
{ // Place
391
401
const auto & placement_net_list = (const Netlist<>&)g_vpr_ctx.clustering ().clb_nlist ;
392
402
bool place_success = vpr_place_flow (placement_net_list, vpr_setup, arch);
@@ -806,6 +816,12 @@ RouteStatus vpr_route_flow(const Netlist<>& net_list,
806
816
auto & atom_ctx = g_vpr_ctx.atom ();
807
817
routing_delay_calc = std::make_shared<RoutingDelayCalculator>(atom_ctx.nlist , atom_ctx.lookup , net_delay, is_flat);
808
818
timing_info = make_setup_hold_timing_info (routing_delay_calc, router_opts.timing_update_type );
819
+ #ifndef NO_SERVER
820
+ if (g_vpr_ctx.server ().gateIO ().is_running ()) {
821
+ g_vpr_ctx.mutable_server ().set_timing_info (timing_info);
822
+ g_vpr_ctx.mutable_server ().set_routing_delay_calc (routing_delay_calc);
823
+ }
824
+ #endif /* NO_SERVER */
809
825
} else {
810
826
/* No delay calculator (segfault if the code calls into it) and wirelength driven routing */
811
827
timing_info = make_constant_timing_info (0 );
@@ -1049,6 +1065,21 @@ void vpr_init_graphics(const t_vpr_setup& vpr_setup, const t_arch& arch, bool is
1049
1065
alloc_draw_structs (&arch);
1050
1066
}
1051
1067
1068
+ void vpr_init_server (const t_vpr_setup& vpr_setup) {
1069
+ #ifndef NO_SERVER
1070
+ if (vpr_setup.ServerOpts .is_server_mode_enabled ) {
1071
+ /* Set up a server and its callback to be triggered at 100ms intervals by the timer's timeout event. */
1072
+ server::GateIO& gate_io = g_vpr_ctx.mutable_server ().mutable_gateIO ();
1073
+ if (!gate_io.is_running ()) {
1074
+ gate_io.start (vpr_setup.ServerOpts .port_num );
1075
+ g_timeout_add (/* interval_ms*/ 100 , server::update, &application);
1076
+ }
1077
+ }
1078
+ #else
1079
+ (void )(vpr_setup);
1080
+ #endif /* NO_SERVER */
1081
+ }
1082
+
1052
1083
void vpr_close_graphics (const t_vpr_setup& /* vpr_setup*/ ) {
1053
1084
/* Close down X Display */
1054
1085
free_draw_structs ();
@@ -1256,6 +1287,7 @@ void vpr_setup_vpr(t_options* Options,
1256
1287
t_router_opts* RouterOpts,
1257
1288
t_analysis_opts* AnalysisOpts,
1258
1289
t_noc_opts* NocOpts,
1290
+ t_server_opts* ServerOpts,
1259
1291
t_det_routing_arch* RoutingArch,
1260
1292
std::vector<t_lb_type_rr_node>** PackerRRGraph,
1261
1293
std::vector<t_segment_inf>& Segments,
@@ -1280,6 +1312,7 @@ void vpr_setup_vpr(t_options* Options,
1280
1312
RouterOpts,
1281
1313
AnalysisOpts,
1282
1314
NocOpts,
1315
+ ServerOpts,
1283
1316
RoutingArch,
1284
1317
PackerRRGraph,
1285
1318
Segments,
@@ -1300,11 +1333,12 @@ void vpr_check_arch(const t_arch& Arch) {
1300
1333
void vpr_check_setup (const t_packer_opts& PackerOpts,
1301
1334
const t_placer_opts& PlacerOpts,
1302
1335
const t_router_opts& RouterOpts,
1336
+ const t_server_opts& ServerOpts,
1303
1337
const t_det_routing_arch& RoutingArch,
1304
1338
const std::vector<t_segment_inf>& Segments,
1305
1339
const t_timing_inf& Timing,
1306
1340
const t_chan_width_dist& Chans) {
1307
- CheckSetup (PackerOpts, PlacerOpts, RouterOpts, RoutingArch,
1341
+ CheckSetup (PackerOpts, PlacerOpts, RouterOpts, ServerOpts, RoutingArch,
1308
1342
Segments, Timing, Chans);
1309
1343
}
1310
1344
0 commit comments