diff --git a/tools/netlist/include/NetlistVisitorOptions.hpp b/tools/netlist/include/NetlistVisitorOptions.hpp index e82277d0e..f9036d6d1 100644 --- a/tools/netlist/include/NetlistVisitorOptions.hpp +++ b/tools/netlist/include/NetlistVisitorOptions.hpp @@ -13,5 +13,5 @@ struct NetlistVisitorOptions { /// If enabled, unroll loops in procedural blocks. - std::optional unrollForLoops; + bool unrollForLoops{false}; }; diff --git a/tools/netlist/include/visitors/ProceduralBlockVisitor.hpp b/tools/netlist/include/visitors/ProceduralBlockVisitor.hpp index 8ce62204a..3bc485c87 100644 --- a/tools/netlist/include/visitors/ProceduralBlockVisitor.hpp +++ b/tools/netlist/include/visitors/ProceduralBlockVisitor.hpp @@ -85,7 +85,7 @@ class ProceduralBlockVisitor : public ast::ASTVisitor showHelp; std::optional showVersion; std::optional quiet; std::optional debug; std::optional combLoops; + std::optional unrollForLoops; driver.cmdLine.add("-h,--help", showHelp, "Display available options"); driver.cmdLine.add("--version", showVersion, "Display version information and exit"); driver.cmdLine.add("-q,--quiet", quiet, "Suppress non-essential output"); driver.cmdLine.add("-d,--debug", debug, "Output debugging information"); driver.cmdLine.add("-c,--comb-loops", combLoops, "Detect combinatorial loops"); - driver.cmdLine.add("--unroll-for-loops", options.unrollForLoops, "Unroll procedural for loops"); + driver.cmdLine.add("--unroll-for-loops", unrollForLoops, "Unroll procedural for loops"); std::optional astJsonFile; driver.cmdLine.add( @@ -286,6 +286,8 @@ int main(int argc, char** argv) { // Create the netlist by traversing the AST. Netlist netlist; + NetlistVisitorOptions options; + options.unrollForLoops = unrollForLoops.value_or(false); NetlistVisitor visitor(*compilation, netlist, options); compilation->getRoot().visit(visitor); netlist.split(); diff --git a/tools/netlist/tests/NetlistTest.h b/tools/netlist/tests/NetlistTest.h index 0dde80831..7f85bee81 100644 --- a/tools/netlist/tests/NetlistTest.h +++ b/tools/netlist/tests/NetlistTest.h @@ -13,7 +13,6 @@ 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();