From 08c80a6a36317562c1cd75a8bb9db1827278ea93 Mon Sep 17 00:00:00 2001 From: Sylvain Lefebvre Date: Tue, 5 Dec 2023 20:58:49 +0100 Subject: [PATCH] nested pipelines, fixing start condition --- src/Algorithm.cpp | 8 ++++---- tests/pipeline29.si | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Algorithm.cpp b/src/Algorithm.cpp index e28995cf..fa033212 100644 --- a/src/Algorithm.cpp +++ b/src/Algorithm.cpp @@ -4270,15 +4270,15 @@ std::string Algorithm::fsmPipelineFirstStageDisable(const t_fsm_nfo *fsm) const // ------------------------------------------------- -std::string Algorithm::fsmNextState(std::string prefix,const t_fsm_nfo *) const +std::string Algorithm::fsmNextState(std::string prefix,const t_fsm_nfo *fsm) const { std::string next; if (m_AutoRun) { // NOTE: same as isNotCallable() since hasNoFSM() is false - next = std::string("( ~") + prefix + ALG_AUTORUN + " ? " + std::to_string(toFSMState(&m_RootFSM, entryState(&m_RootFSM))); + next = std::string("( ~") + prefix + ALG_AUTORUN + " ? " + std::to_string(toFSMState(fsm, entryState(fsm))); } else { - next = std::string("( ~") + ALG_INPUT + "_" + ALG_RUN + " ? " + std::to_string(toFSMState(&m_RootFSM, entryState(&m_RootFSM))); + next = std::string("( ~") + ALG_INPUT + "_" + ALG_RUN + " ? " + std::to_string(toFSMState(fsm, entryState(fsm))); } - next += std::string(" : ") + FF_D + prefix + fsmIndex(&m_RootFSM) + ")"; + next += std::string(" : ") + FF_D + prefix + fsmIndex(fsm) + ")"; return next; } diff --git a/tests/pipeline29.si b/tests/pipeline29.si index 70e7c700..04a514ec 100644 --- a/tests/pipeline29.si +++ b/tests/pipeline29.si @@ -17,15 +17,21 @@ algorithm main(output uint8 leds) __display("[B] before (%d)",n); // stage 1 - uint5 j = 0; - while (j!=4) { + uint5 j = 0; + uint1 done = 0; + while (~done) { // nested pipeline __display("[B,A] %d,%d",n,j); - j = j + 1; + uint8 q = j + 10; + j = j + 1; -> - __display("[B,B] %d,%d",n,j); + __display("[B,B] %d,%d",n,q); + q = q + 100; + -> + __display("[B,C] %d,%d",n,q); + if (j == 3) { done = 1; } } - ++: ////////////////////////////// breaks without, why? + ++: ////////////////////////////// breaks without, why? __display("[B] after (%d)",n); ->