7
7
#include " vtr_assert.h"
8
8
#include " vpr_error.h"
9
9
#include " vtr_math.h"
10
+ #include " echo_files.h"
10
11
11
12
static void identify_and_store_noc_router_tile_positions (const DeviceGrid& device_grid, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles, std::string noc_router_tile_name);
12
13
@@ -16,6 +17,8 @@ static void create_noc_routers(const t_noc_inf& noc_info, NocStorage* noc_model,
16
17
17
18
static void create_noc_links (const t_noc_inf* noc_info, NocStorage* noc_model);
18
19
20
+ static void echo_noc (char * file_name);
21
+
19
22
20
23
void setup_noc (const t_arch& arch)
21
24
{
@@ -53,6 +56,14 @@ void setup_noc(const t_arch& arch)
53
56
noc_ctx.noc_link_latency = arch.noc ->link_latency ;
54
57
noc_ctx.noc_router_latency = arch.noc ->router_latency ;
55
58
59
+ // echo the noc info
60
+ if (getEchoEnabled () && isEchoFileEnabled (E_ECHO_NOC_MODEL))
61
+ {
62
+ echo_noc (getEchoFileName (E_ECHO_NOC_MODEL));
63
+ }
64
+
65
+ exit (1 );
66
+
56
67
return ;
57
68
58
69
}
@@ -283,4 +294,59 @@ static void create_noc_links(const t_noc_inf* noc_info, NocStorage* noc_model){
283
294
284
295
}
285
296
297
+ static void echo_noc (char * file_name)
298
+ {
299
+ FILE* fp;
300
+ fp = vtr::fopen (file_name, " w" );
301
+
302
+ fprintf (fp, " --------------------------------------------------------------\n " );
303
+ fprintf (fp, " NoC\n " );
304
+ fprintf (fp, " --------------------------------------------------------------\n " );
305
+ fprintf (fp, " \n " );
306
+
307
+ auto & noc_ctx = g_vpr_ctx.noc ();
308
+
309
+ // print the overall constraints of the NoC
310
+ fprintf (fp, " NoC Constraints:\n " );
311
+ fprintf (fp, " --------------------------------------------------------------\n " );
312
+ fprintf (fp, " \n " );
313
+ fprintf (fp, " Maximum NoC Link Bandwidth: %d\n " , noc_ctx.noc_link_bandwidth );
314
+ fprintf (fp, " \n " );
315
+ fprintf (fp, " NoC Link Latency: %d\n " , noc_ctx.noc_link_latency );
316
+ fprintf (fp, " \n " );
317
+ fprintf (fp, " NoC Router Latency: %d\n " , noc_ctx.noc_router_latency );
318
+ fprintf (fp, " \n " );
319
+
320
+ // print all the routers and their properties
321
+ fprintf (fp, " NoC Router List:\n " );
322
+ fprintf (fp, " --------------------------------------------------------------\n " );
323
+ fprintf (fp, " \n " );
324
+
325
+ auto & noc_routers = noc_ctx.noc_model .get_noc_routers ();
326
+
327
+ // go through each router and print its information
328
+ for (auto router = noc_routers.begin (); router != noc_routers.end (); router++)
329
+ {
330
+ fprintf (fp," Router %d:\n " , router->get_router_id ());
331
+ // if the router tile is larger than a single grid, the position represents the bottom left corner of the tile
332
+ fprintf (fp," Equivalent Physical Tile Grid Position -> (%d,%d)\n " , router->get_router_grid_position_x (), router->get_router_grid_position_y ());
333
+ fprintf (fp, " Router Connections ->" );
334
+
335
+ auto & router_connections = noc_ctx.noc_model .get_noc_router_connections (noc_ctx.noc_model .convert_router_id (router->get_router_id ()));
336
+
337
+ // go through the links of the current router and add the connecting router to the list
338
+ for (auto router_link = router_connections.begin (); router_link != router_connections.end (); router_link++)
339
+ {
340
+ fprintf (fp, " %d" , noc_ctx.noc_model .get_noc_router_id (noc_ctx.noc_model .get_noc_link_sink_router (*router_link)));
341
+ }
342
+
343
+ fprintf (fp, " \n\n " );
344
+ }
345
+
346
+ fclose (fp);
347
+
348
+ return ;
349
+
350
+ }
351
+
286
352
0 commit comments