Skip to content

Commit

Permalink
Add no-op test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajsekhar Setaluri committed Jul 15, 2020
1 parent a8761e5 commit 5fd9f8d
Showing 1 changed file with 17 additions and 111 deletions.
128 changes: 17 additions & 111 deletions tests/zext_coalescer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,117 +94,23 @@ TEST(ZextCoalescerTests, TestElide) {
runTest({1, 2}, pre, post, true /* elide */);
}

// TEST(ZextCoalescerTests, TestMultipleRuns) {
// auto pre =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[7],I[6],I[5],I[2],I[1],I[0],I[4],I[3]};\n"
// "endmodule\n";
// auto post =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[7:5],I[2:0],I[4:3]};\n"
// "endmodule\n";
// runTest({3, 4, 0, 1, 2, 5, 6, 7}, pre, post);
// }

// TEST(ZextCoalescerTests, TestNoRuns) {
// auto pre =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[7],I[5],I[3],I[1],I[6],I[4],I[2],I[0]};\n"
// "endmodule\n";
// auto post =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[7],I[5],I[3],I[1],I[6],I[4],I[2],I[0]};\n"
// "endmodule\n";
// // Sequence has no contiguous runs.
// runTest({0, 2, 4, 6, 1, 3, 5, 7}, pre, post);
// }

// TEST(ZextCoalescerTests, ReverseRun) {
// auto pre =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[4],I[5],I[6],I[7],I[3],I[2],I[1],I[0]};\n"
// "endmodule\n";
// // ZextCoalescer doesn't coalese reverse runs right now.
// auto post =
// "module test_module (\n"
// " input [7:0] I,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I[4],I[5],I[6],I[7],I[3:0]};\n"
// "endmodule\n";
// runTest({0, 1, 2, 3, 7, 6, 5, 4}, pre, post);
// }

// TEST(ZextCoalescerTests, MultipleNames) {
// auto pre =
// "module test_module (\n"
// " input [7:0] I0,\n"
// " input [7:0] I1,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I0[7],I0[6],I0[5],I0[4],I1[3],I1[2],I1[1],I1[0]};\n"
// "endmodule\n";
// auto post =
// "module test_module (\n"
// " input [7:0] I0,\n"
// " input [7:0] I1,\n"
// " output [7:0] O\n"
// ");\n"
// "assign O = {I0[7:4],I1[3:0]};\n"
// "endmodule\n";
// std::vector<std::unique_ptr<vAST::AbstractPort>> ports;
// ports.push_back(std::make_unique<vAST::Port>(makeVector("I0", 7, 0),
// vAST::INPUT,
// vAST::WIRE));
// ports.push_back(std::make_unique<vAST::Port>(makeVector("I1", 7, 0),
// vAST::INPUT,
// vAST::WIRE));
// ports.push_back(std::make_unique<vAST::Port>(makeVector("O", 7, 0),
// vAST::OUTPUT,
// vAST::WIRE));
// std::vector<BodyElement> body;

// std::vector<std::unique_ptr<vAST::Expression>> args = {};
// for (int i = 7; i >= 0; i--) {
// auto id = i > 3 ? "I0" : "I1";
// args.emplace_back(
// new vAST::Index(
// vAST::make_id(id),
// vAST::make_num(std::to_string(i))));
// }
// std::unique_ptr<vAST::Expression> rhs(new vAST::Concat(std::move(args)));

// body.push_back(std::make_unique<vAST::ContinuousAssign>(
// std::make_unique<vAST::Identifier>("O"), std::move(rhs)));

// std::unique_ptr<vAST::AbstractModule> module = std::make_unique<vAST::Module>(
// "test_module",
// std::move(ports),
// std::move(body));

// EXPECT_EQ(module->toString(), pre);

// // Run ZextCoalescer transformer.
// vAST::ZextCoalescer transformer;
// module = transformer.visit(std::move(module));

// EXPECT_EQ(module->toString(), post);
// }
TEST(ZextCoalescerTests, TestNoop) {
auto pre =
"module test_module (\n"
" input [7:0] I,\n"
" output [7:0] O\n"
");\n"
"assign O = {I[7:0]};\n"
"endmodule\n";
auto post =
"module test_module (\n"
" input [7:0] I,\n"
" output [7:0] O\n"
");\n"
"assign O = {I[7:0]};\n"
"endmodule\n";
runTest({}, pre, post);
}

} // namespace

Expand Down

0 comments on commit 5fd9f8d

Please sign in to comment.