Forum Discussion
Altera_Forum
Honored Contributor
13 years agoMathWorks provides the product Stateflow to build state machines and flow charts. The 3 phases of execution that you are referring to can be represented using 3 states. There is a short video on the Stateflow webpage titled "Getting Started with Stateflow" that solves a similar problem.
The decision tree logic (if-else) in your design can either be written programmatically (using MATLAB language in the MATLAB function block) ,or drawn in a flow chart. Look in the Stateflow documentation for "What is a flow graph" and "Reusable functions in state charts". A more detailed (and slightly longer) video of how to use Stateflow for building such logic is available in "Control Logic Made Easy with Stateflow". You can then generate HDL code from this model using the MathWorks HDL coder product. Find more information about that on the HDL Coder product.