How to set Unconditional Transition State for Else Statement in HDL Coder with a Counter?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
in the HDL Coder Guideline, it is recommended to insert an unconditional Else transition: "Insert Unconditional Transition State for Else Statement in HDL Code"
How to do this, if the after(..., tick) transition is used?
Consider the following modification to the example: the transition between the 2 states shall happen every 2 clock cycles.
With the unconditional "else" transition, the transition will never happen, because the timer (which evaluates the "after(2,tick)" event) is always reset to 0 by the unconditional "else" transition → counter value of 2 is never reached. So the unconditional transition breaks the whole functionality.
I do not see any solution how to follow the guideline with after(n,E) events used: https://de.mathworks.com/help/stateflow/ref/after.html.
The only workaround would be to re-invent the wheel and implement a custom counter in the stateflow, and use "if(counter == 2)" instead of the after(n,E) event - which is obviously a bad workaround.
In my opinion, an transition type that does not reset the counters for the after(n,E) events is missing for stateflow.
What do you think about this, or am I missing something?
0 件のコメント
採用された回答
Tom Richter
2024 年 4 月 3 日
Hello Michael,
This is a good catch. Have you tried to use the “after” temporal logic operator on a smaller design? Did the Synthesis tool do some strange things or added latches? The guideline says you should have an unconditional transition to prevent having latches later. If this is not the case, I would just say the after operator is fine and can be justified. If you see latches then yes, the workaround you mentioned is a possible solution. Instead of a conditional transition you would switch to an “about to switch” state where you count up to N-1 (in your case it would just be an empty state).
If you think MathWorks should offer a better solution I suggest contacting Technical Support to help you with this issue/question. If you go to
, you can submit a support request and add example or reproduction files. The page also displays phone contact information based on your location.
Best regards,
Tom
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Model Compatibility Checks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!