Customizing the Machine
Links Mentioned
 

Links

 

Tip
You can run the optimization wizard separately if you want to optimize a manually entered state machine.

Home
Using StateCad
Create a State Machine
Optimizing the Machine
Customizing the Machine
Using the Machine

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 () and click on the starting state. You should see a red outline indicating the state is selected. Now click on the edge of the state. You'll see a small red box appear where you clicked:

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:

bullet

Off to OnState - pwrswitch='1'

bullet

Onstate to RecState - RECSwitch='1'

bullet

Onstate to PlayState - PlaySwitch='1'

bullet

RecState to OnState - StopSwitch='1'

bullet

PlayState to OnState - StopSwitch='1'

bullet

PlayState to OffState - pwrswitch='0'

bullet

RecState to OffState - pwrswitch='0'

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 . If you didn't get rid of A, B, UP, and DOWN in the previous step, you'll be prompted to remove them now. These are just variables the wizard included that we didn't use. Then you'll see this dialog:

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.

 

 

Back Home Next

© 2002 by AWC. All Rights Reserved.