Creating HDL Text Modules, страница 7

You can change a state name by right-clicking on the state, selecting Properties and typing a new name in the General tab of the State Properties window. If you are zoomed close enough, you can double click the old name and type the new name directly in the diagram.

•  Change the first state name to Idle

•  Change the second state name to Exec, also check the Hierarchical checkbox.

                                     2.16   Creating Fub Contents

You can draw transitions between states by selecting
FSM | Transition from the menu or Transition button      in the toolbar and clicking the starting state, then clicking the target state.

•  Draw transitions as shown in this picture

•  To draw a loop transition, click inside the same state twice

•  To change the shape of any transition, click on it and drag the handles

                                     2.17   Creating Fub Contents

You can define a reset state in your FSM by selecting FSM | RESET from the menu or Reset button       in the toolbar, clicking close to the reset state to place the reset symbol, then clicking inside the state to draw the reset transition.

•  Draw the reset symbol and transition as shown in this picture

•  To set the parameters of the reset signal, you must invoke the Machine Properties window by right-clicking on the rectangular frame surrounding the machine and selecting Properties                                                                    

                                                                                         Right-click in this area

                               

2.18   Creating Fub Contents

•  Click the Reset tab in the Machine Properties window and select:
- Reset signal in the Name box
- Asynchronous in the Type box
- High in the Active Level box

            You can specify more elaborate
reset conditions by clicking
Advanced & typing an expression

            describing the reset condition

•  Click OK

•  To change the machine name, switch to the General tab and type the name of the machine in the Name field.

•  To set a trap or default state, you can switch to the Defaults tab. These states are used in cases when illegal conditions are met.

2.19   Creating Fub Contents

You can add conditions to the transitions by selecting FSM | Condition from the menu or Condition button       in the toolbar, clicking the transition and typing the condition expression.

•  Please add the following conditions:

–  Start=‘0’ to the loop transition in the Idle state and to the transition from the Exec to the Idle state;

–  Start=‘1’ to the transition to the Exec state

2.20   Creating Fub Contents

Three kinds of actions can be specified for a state – entry, state and exit actions. Use FSM | Action | State from the menu, clicking inside the state and typing the expression(s) that should be executed in the state.

•         Add the following action:
       RST<=‘1’
to the Idle state

•  Actions and transitions executed in a hierarchical state are defined on a separate state machine diagram

                                               2.21   Creating Fub Contents

You can define the action of a hierarchical state by selecting hierarchical state and clicking on the Push Hierarchy button      

The new state diagram will be created. It starts with Entry and ends with Exit points.

There can be defined action between these two points.

First, add a second state and create transitions as shown on right.

2.22   Creating Fub Contents

•  Change the first state name to Run

•  Change the second state name to Count

•   Please add the following condition:

–  Start=‘1’ to the loop transition in the Count state;

•  Add the following action:

–  RST<=‘0’
  to the Run state

–  Clock <= CLK;
                                to the Count state

•  The final state machine for hierarchical Execstate is shown in the picture