diff --git a/src/Algorithm.cpp b/src/Algorithm.cpp index df318996..9180dde5 100644 --- a/src/Algorithm.cpp +++ b/src/Algorithm.cpp @@ -51,6 +51,8 @@ LuaPreProcessor *Algorithm::s_LuaPreProcessor = nullptr; /// These controls are provided as a convenience to illustrate the impact of CL0004 and CL0005 bool g_Disable_CL0004 = false; bool g_Disable_CL0005 = false; +/// Forces the use of reset on register with initialized value +bool g_ForceResetInit = false; // ------------------------------------------------- @@ -6609,6 +6611,14 @@ void Algorithm::optimize(const t_instantiation_context& ictx) m_Optimized = true; // generate states generateStates(&m_RootFSM); + // forces reset init on all vars + if (g_ForceResetInit) { + for (auto& _v : m_Vars) { + if (_v.init_at_startup) { + _v.init_at_startup = false; + } + } + } // report if (hasNoFSM()) { std::cerr << " (no FSM)"; diff --git a/src/silice.cpp b/src/silice.cpp index f14a743a..859ce4cb 100644 --- a/src/silice.cpp +++ b/src/silice.cpp @@ -46,6 +46,7 @@ using namespace Silice; // global switches extern bool g_Disable_CL0006; +extern bool g_ForceResetInit; // ------------------------------------------------- @@ -82,12 +83,15 @@ int main(int argc, char **argv) cmd.add(toExport); TCLAP::MultiArg exportParam("P", "export_param", "specifies an export parameter for algorithm instantiation, e.g. -P name=value", false, "string"); cmd.add(exportParam); - TCLAP::SwitchArg disableCL0006("", "no-pin-check", "disable check for pin declaration in frameworks (see CL0006)", true); /// ///////////////////////////////////////////// TODO set to false once no longer wip + TCLAP::SwitchArg forceResetInit("", "force-reset-init", "forces initialization at reset of initialized registers", false); + cmd.add(forceResetInit); + TCLAP::SwitchArg disableCL0006("", "no-pin-check", "disable check for pin declaration in frameworks (see CL0006)", true); /// ///////////////////////////////////////////// TODO set to false once no longer wip cmd.add(disableCL0006); cmd.parse(argc, argv); g_Disable_CL0006 = disableCL0006.getValue(); + g_ForceResetInit = forceResetInit.getValue(); SiliceCompiler compiler; compiler.run(