Using StateCad
Links Mentioned
 

Links
AWC PLD Page
 

Tip
Discuss PLDs with others at our discussion group.

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

 

 



 

Building schematics and even Verilog or VHDL circuits is a great way to program a PLD. However, there is at least one class of circuit where you might want to avoid the details and use a higher level abstraction. This common construct is a state machine.

You use state machines all the time without realizing it. For example, consider a simple VCR. It has several possible states: Off, On, Play, Record, Fast Forward, and Rewind. There are well-defined ways to move from one state to another. For example, to enter the On state from the Off state, you press the power button. From the On state you can enter the Play or Record state with the appropriate button. You can't get to Fast Forward or Rewind unless you are in the Play state.

Defining a state machine, then, requires several pieces of information:

1) The states

2) The transitions (that is, the methods used to get from state to state)

3) The outputs (for example, the record state has to start the tape motor, turn on the record light, and engage the record head.

Can you program this logic using Verilog, VHDL, or a schematic? Of course! People have built state machines with relays and motors, so you can certainly build a state machine with logic gates and constructs. However, the StateCad editor provides a much easier way.

You'll find finite state machines (FSMs) everywhere you look. Inside PLDs they are often used to sequence CPUs, control UART operations, and perform anywhere you need to control other logic.

As an example, let's strip the VCR example to a bare minimum. Here's a textual description of the FSM:

Off state: All LEDs off. If power switch=1 then go to On state

On state: PWRLED on. All other LEDs off. If REC switch=1 then go to REC state. If PLAY switch=1 then go to PLAY state. If power switch=0 then go to Off state.

REC state: REC LED=1. If stop switch=1 then go to On state. If power switch=0 go to Off state.

Play state: PLAY LED=1. If stop switch=1 then go to On state. If power switch=0 go to Off state.

Try sketching the machine on a piece of paper. Use a box for each state and draw arrows to indicate the transitions. The next frame will show you how to build this logic with StateCad.

 

Home Next

© 2002 by AWC. All Rights Reserved.