Skip to content

Commit ebf88f0

Browse files
verify overridden edge attribute in the unit test
1 parent fb5ad75 commit ebf88f0

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

vpr/test/test_vpr.cpp

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ TEST_CASE("read_rr_graph_metadata", "[vpr]") {
232232
vpr_free_all(arch, vpr_setup);
233233
}
234234

235-
TEST_CASE("read_rr_edge_override", "[vpr33]") {
235+
TEST_CASE("read_rr_edge_override", "[vpr]") {
236236

237237
const std::string RR_GRAPH_NAME = "test_read_rr_edge_override";
238238
const std::string RR_EDGE_OVERRIDE_FILENAME = "test_read_rr_edge_override.txt";
@@ -264,7 +264,6 @@ TEST_CASE("read_rr_edge_override", "[vpr33]") {
264264
const auto& device_ctx = g_vpr_ctx.device();
265265
auto& mutable_device_ctx = g_vpr_ctx.mutable_device();
266266
const auto& rr_graph = device_ctx.rr_graph;
267-
// auto& rr_graph_builder = mutable_device_ctx.rr_graph_builder;
268267
bool echo_enabled = getEchoEnabled() && isEchoFileEnabled(E_ECHO_RR_GRAPH_INDEXED_DATA);
269268
const char* echo_file_name = getEchoFileName(E_ECHO_RR_GRAPH_INDEXED_DATA);
270269

@@ -320,8 +319,6 @@ TEST_CASE("read_rr_edge_override", "[vpr33]") {
320319

321320
const auto& device_ctx = g_vpr_ctx.device();
322321
auto& mutable_device_ctx = g_vpr_ctx.mutable_device();
323-
// const auto& rr_graph = device_ctx.rr_graph;
324-
// auto& rr_graph_builder = mutable_device_ctx.rr_graph_builder;
325322
bool echo_enabled = getEchoEnabled() && isEchoFileEnabled(E_ECHO_RR_GRAPH_INDEXED_DATA);
326323
const char* echo_file_name = getEchoFileName(E_ECHO_RR_GRAPH_INDEXED_DATA);
327324

@@ -341,6 +338,57 @@ TEST_CASE("read_rr_edge_override", "[vpr33]") {
341338

342339
vpr_free_all(arch, vpr_setup);
343340
}
341+
342+
{ // Verify overridden values
343+
t_vpr_setup vpr_setup;
344+
t_arch arch;
345+
t_options options;
346+
const char* argv[] = {
347+
"test_vpr",
348+
kArchFile,
349+
"wire.eblif",
350+
"--route_chan_width",
351+
"100",
352+
"--read_rr_graph",
353+
overridden_rr_graph_filename.c_str()};
354+
355+
vpr_init(sizeof(argv) / sizeof(argv[0]), argv, &options, &vpr_setup, &arch);
356+
vpr_create_device(vpr_setup, arch);
357+
358+
const auto& device_ctx = g_vpr_ctx.device();
359+
const auto& rr_graph = device_ctx.rr_graph;
360+
361+
switch_id = rr_graph.edge_switch((RREdgeId)12);
362+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 5.9e-11f);
363+
364+
switch_id = rr_graph.edge_switch((RREdgeId)1586);
365+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 4.2e-11f);
366+
367+
switch_id = rr_graph.edge_switch((RREdgeId)1111);
368+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 7.1e-11f);
369+
370+
switch_id = rr_graph.edge_switch((RREdgeId)1324);
371+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 9.4e-11f);
372+
373+
RREdgeId edge_id;
374+
edge_id = rr_graph.rr_nodes().edge_id((RRNodeId)645, (RRNodeId)127);
375+
switch_id = rr_graph.edge_switch(edge_id);
376+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 7.3e-11f);
377+
378+
edge_id = rr_graph.rr_nodes().edge_id((RRNodeId)591, (RRNodeId)347);
379+
switch_id = rr_graph.edge_switch(edge_id);
380+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 7.9e-11f);
381+
382+
edge_id = rr_graph.rr_nodes().edge_id((RRNodeId)544, (RRNodeId)45);
383+
switch_id = rr_graph.edge_switch(edge_id);
384+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 8.3e-11f);
385+
386+
edge_id = rr_graph.rr_nodes().edge_id((RRNodeId)37, (RRNodeId)511);
387+
switch_id = rr_graph.edge_switch(edge_id);
388+
REQUIRE(rr_graph.rr_switch_inf((RRSwitchId)switch_id).Tdel == 9.5e-11f);
389+
390+
vpr_free_all(arch, vpr_setup);
391+
}
344392
}
345393
}
346394

0 commit comments

Comments
 (0)