Skip to content

Commit

Permalink
adding the possibility to force initial values to be set at reset tim…
Browse files Browse the repository at this point in the history
…e (--force-reset-init)
  • Loading branch information
sylefeb committed May 22, 2024
1 parent b4e3994 commit 507a93d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

// -------------------------------------------------

Expand Down Expand Up @@ -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)";
Expand Down
6 changes: 5 additions & 1 deletion src/silice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ using namespace Silice;
// global switches

extern bool g_Disable_CL0006;
extern bool g_ForceResetInit;

// -------------------------------------------------

Expand Down Expand Up @@ -82,12 +83,15 @@ int main(int argc, char **argv)
cmd.add(toExport);
TCLAP::MultiArg<std::string> 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(
Expand Down

0 comments on commit 507a93d

Please sign in to comment.