|
|
|
4.5.3 LPM_FSM |
|
Copyright © 1998 University of Manchester |
Finite State Machine

Ports:
| Description | Comments | |||
| Data input | Vector, LPM_WidthIn wide | |||
| Clock for State transitions | Positive edge triggered | |||
| Current State Vector | Vector, LPM_WidthS wide. Note 1 | |||
| Result of Logic Function | Vector, LPM_WidthOut wide. Note 2 | |||
| Asynchronous set control | Note 3 | |||
| Test clock enable input | ||||
| Serial test data input | ||||
| Serial test data output | TestOut = StateLPM_WidthS-1 |
Note 1: The state vector is always present inside the FSM. It may be brought out if needed elsewhere in the design by using the State port.
Note 2: The Result vectors are asynchronous. The outputs may be purely a function of the internal state vector (a Moore machine) or may be a function of both the internal state vector and the Data inputs (a Mealy machine).
Note 3: Aset will set the count to the value of LPM_Avalue, if that value is present. If no LPM_Avalue is specified, then Aset will set the count to all ones. Aset affects the outputs (Result and State ) values before the application of polarity to the ports.
Note 4: Either all of the Test ports must be connected or none of them.
Properties:
| Value | Comments | ||
| LPM Value > 0 | Width of input vector | ||
| LPM Value > 0 | Width of output vector | ||
| LPM Value > 0 | Width of the State vector | ||
| String File Name | Name of file containing Truth Table file. | ||
| LPM Value | Power-up value of State Vector | ||
| LPM Value | Value of State Vector when Aset is asserted. | ||
| F | FD | FR | FDR | Default is FD |
Functions:
| Moore machine | |
| Mealy machine | |
Example:

The file FSM1.txt contains:
| .start | Kiss | ||
| .I 4 | |||
| .o 3 | |||
| .p 5 | |||
| 1 | dc | idle | 1 1 |
| 0 1 | idle | reading | 1 0 |
| 0 0 1 | idle | writing | 0 1 |
| 0 1 | reading | idle | 1 1 |
| 0 1 | writing | idle | 1 1 |
| .code | dc | | |
| .code | idle | 0 0 | |
| .code | reading | 0 1 | |
| .code | writing | 1 0 |
This can be better understood by considering the ninth line form the FSM1.txt file:
| 0 1 | reading | idle | 1 1 |
| Data (input) | From state | To state | Result (Output) |
Although all LPM_FSMs have a valid state encoding, the fitter is free to re-encode the states. Care must be taken in re-encoding if the state is brought outside the LPM_FSM.