Skip to content

Commit

Permalink
Debug windows failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshanlon committed Sep 25, 2024
1 parent 786bb2a commit d8f5c1b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 57 deletions.
1 change: 1 addition & 0 deletions tools/netlist/tests/NetlistTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using namespace netlist;
inline Netlist createNetlist(ast::Compilation& compilation) {
Netlist netlist;
NetlistVisitorOptions options;
options.unrollForLoops = true;
NetlistVisitor visitor(compilation, netlist, options);
compilation.getRoot().visit(visitor);
netlist.split();
Expand Down
114 changes: 57 additions & 57 deletions tools/netlist/tests/PathTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,63 +307,63 @@ endmodule
CHECK(*path.findVariable("nested_passthrough.foo_b.o_value") == 6);
}

////===---------------------------------------------------------------------===//
//// Tests for conditional variables in procedural blocks (Not supported!)
////===---------------------------------------------------------------------===//
//
// TEST_CASE("Mux") {
// // Test that the variable in a conditional block is correctly added as a
// // dependency on the output variable controlled by that block.
// auto tree = SyntaxTree::fromText(R"(
// module mux(input a, input b, input sel, output reg f);
// always @(*) begin
// if (sel == 1'b0) begin
// f = a;
// end else begin
// f = b;
// end
// end
// endmodule
//)");
// Compilation compilation;
// compilation.addSyntaxTree(tree);
// NO_COMPILATION_ERRORS;
// auto netlist = createNetlist(compilation);
// PathFinder pathFinder(netlist);
// // Path does not exist!
// CHECK(pathFinder.find(*netlist.lookupPort("mux.sel"), *netlist.lookupPort("mux.f")).empty());
//}
//
// TEST_CASE("Nested muxing") {
// // Test that the variables in multiple nested levels of conditions are
// // correctly added as dependencies of the output variable.
// auto tree = SyntaxTree::fromText(R"(
// module mux(input a, input b, input c,
// input sel_a, input sel_b,
// output reg f);
// always @(*) begin
// if (sel_a == 1'b0) begin
// if (sel_b == 1'b0)
// f = a;
// else
// f = b;
// end else begin
// f = c;
// end
// end
// endmodule
//)");
// Compilation compilation;
// compilation.addSyntaxTree(tree);
// NO_COMPILATION_ERRORS;
// auto netlist = createNetlist(compilation);
// PathFinder pathFinder(netlist);
// // Paths do not exist!
// CHECK(pathFinder.find(*netlist.lookupPort("mux.sel_a"),
// *netlist.lookupPort("mux.f")).empty());
// CHECK(pathFinder.find(*netlist.lookupPort("mux.sel_b"),
// *netlist.lookupPort("mux.f")).empty());
//}
//===---------------------------------------------------------------------===//
// Tests for conditional variables in procedural blocks (Not supported!)
//===---------------------------------------------------------------------===//

TEST_CASE("Mux") {
// Test that the variable in a conditional block is correctly added as a
// dependency on the output variable controlled by that block.
auto tree = SyntaxTree::fromText(R"(
module mux(input a, input b, input sel, output reg f);
always @(*) begin
if (sel == 1'b0) begin
f = a;
end else begin
f = b;
end
end
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
auto netlist = createNetlist(compilation);
PathFinder pathFinder(netlist);
// Path does not exist!
CHECK(pathFinder.find(*netlist.lookupPort("mux.sel"), *netlist.lookupPort("mux.f")).empty());
}

TEST_CASE("Nested muxing") {
// Test that the variables in multiple nested levels of conditions are
// correctly added as dependencies of the output variable.
auto tree = SyntaxTree::fromText(R"(
module mux(input a, input b, input c,
input sel_a, input sel_b,
output reg f);
always @(*) begin
if (sel_a == 1'b0) begin
if (sel_b == 1'b0)
f = a;
else
f = b;
end else begin
f = c;
end
end
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
auto netlist = createNetlist(compilation);
PathFinder pathFinder(netlist);
// Paths do not exist!
CHECK(pathFinder.find(*netlist.lookupPort("mux.sel_a"),
*netlist.lookupPort("mux.f")).empty());
CHECK(pathFinder.find(*netlist.lookupPort("mux.sel_b"),
*netlist.lookupPort("mux.f")).empty());
}

//===---------------------------------------------------------------------===//
// Tests for loop unrolling
Expand Down

0 comments on commit d8f5c1b

Please sign in to comment.