| Customizing the Machine | ||||||||||||||||
| Links Mentioned Links Tip |
Now you can customize your machine. Double click on each state and rename them to: Off, OnState, RECState, and PLAYState:
Now you need to add transitions from RECState to OnState and Off. You also
need to add the same backwards transitions from PlayState. Pick the
transition tool (
Move to the other state and click. If you want your lines to curve, you can click outside a state to pick a curve point. If you don't do this, your lines will be straight. Your final diagram should look like this:
The next step is to put conditions on the transitions. Double click the arrow going from Off to OnState.
Put in pwrswitch='1' as shown and click OK. Repeat for the other conditions. The transitions are:
Can you find the state I omitted? You'll add this state later. You can assign outputs during transitions, but in this case I put all of them in the states. Double click each state and assign variable outputs. Your final drawing should look more or less like this:
Just as a trial, click on
Since all of these are outputs, click on the X next to the names to clear the selection. Then press Optimize. Actually, you can probably click Cancel here since there is nothing for this dialog to do. You'll get a few warnings:
Click the arrows next to the ID number to see the next warning:
What this is trying to tell you is that you have states where pwrswitch and stopswitch could conflict. In other words, in the play state (for example), you didn't say what should happen if the pwrswitch goes off and the user presses the stop button at exactly the same time. You could fix this by making the conditions more specific. However, for this example, we'll leave it as is. Finally, the source browser shows up with the Verilog code for the state machine in VCRFSM.v. For now, we are finished with StateCAD. Go to the next frame to see how you can use the new state machine.
© 2002 by AWC. All Rights Reserved. |