UPC EETAC Bachelor's Degree in Telecommunications Systems and in Network Engineering EEL



PLA6: Designing finite state machines (FSM)



NOTE: This post lab assignment must be solved only after having completed successfully lab session Lab6 because you will copy and adapt materials from it.

Specifications: pattern detector (FSM)

Our aim is to implement a circuit to detect the binary pattern "0110" received from a radio transmitter bit stream at input T. Fig. 1 shows the symbol of this pattern_detector circuit. This PLA is adapted from problem D2.4 where you will find questions and ideas.

When the sequence "0110" is detected output Z goes high for one CLK period. Two or more adjacent patterns can also be detected as in this bit stream sequence: "01101101101..."

To make it simpler that the next version propsed in problem D2.5, we will assume:

- The bitstream incoming frequency is the same of the pattern_detector CLK.

- The bit stream signal is delayed half period with respect the CLK, to be able to sample stable data every CLK rising edge.

-- Transmission is continuous.


Fig. 1. Symbol.

The best way to start, is to try imagining how the output will be for a given bitstream, as represented in Fig. 2.

timing diagram

Fig. 2. Example of timing diagram.

To translate such waveforms into a testbench process for driving T, it is necessary to rely on the constant CLK_Period for both, generating the initial delay and implementing the bit sequence.

Example T testbench

Fig. 3. Example of the T process generation.

Project location:



Specifications: water tank controller

We want to design a water tank controller (Water_tank_controller) as an FSM that can drive two pumps independently, as represented in Fig. 1. The tank has level sensors D1, D2, and D3 attached to the wall, so that a '1' is generated when the sensor is sunk into water. This PLA is adapted from problem D2.9 where you will find questions and ideas.

The controller works as follows: when the tank is empty, below D1, both pumps work simultaneously; when the water level is above D2 pump P1 stops; when the water is above D3, meaning that the tank is full, pump P2 stops; and finally, the pumps do not switch on until the water level is again below D1.

Water tank

Fig. 1. Diagram of the water tank installation.

In addition to controlling the water level, we also want to indicate in a LED column the current level of the water in the tank.

Project location:



Specifications: stepper motor controller

Our aim is to design the digital control unit (stepper_controller) for the "9904 112 31004" stepping motor from Premotec shown in Fig. 1 following our FSM strategies. Nowadays stepper motors can be found in computer peripherals, machine tools, medical equipment, automotive devices, or small business machines, to name a few applications. This PLA is adapted from problem D2.2 where you will find questions and ideas.

Clockwise (CW) and counter-clockwise (CCW) rotation can be achieved by reversing the step sequence. Inhibit (INH) is like a count disable, do not letting the motor rotate. Step or stride angle is 7.5 degree, thus 48 CLK periods are required for a full revolution. xternal CLK frequency is 96 Hz, and so when running it rotates at 2 revolutions per second.

The idea is to connect four outputs to the motor coils and drive them with the right sequence so that the motor inhibits or rotates clockwise or counter-clockwise accordingly to the input signals INH and CW. Four additional outputs are used connected to LED to visualise the coils binary sequence.

Steeper motor details

Fig. 1. Example of two-phase stepper motor: characteristics, connections, full wave steeping sequence and unipolar winding circuit using a power driver to energise coils.

 Project location:



Specifications: LED rotator

Our aim is to implement a LED rotator like the one represented in Fig. 1, which is basically a FSM acting as an 8-bit one-hot shift register that runs continuously. This PLA is adapted from problem D2.3 where you will find questions and ideas.

The system operates by means of two control signals:

CE_ L = 1 (do nothing), CE_ L = 0 (run rotating)

SR_L = 0 (shift and rotate right), SR_L = 1 (shift and rotate left)

Rototor circuit

Fig. 1. LED rotator.

 Project location:



Example of individual assignments
  Circuit FSM encoding PLD target chip
Est. 1 Pattern detector onehot Cyclone IV
Est. 2 LED sequencer binary sequential MAX II
Est. 3 Stepper motor Gray MAX II
Est. 4 Water tank controller onehot Cyclone IV
Est. 5 ··· ··· ···
··· ··· ··· ···