UCR EE/CS120B: Digital Systems
I. Introduction
The purpose of this lab is to implement a finite state machine in VHDL to calculate the Greatest Common Divisor(GCD) of 2 numbers.
The design of the GCD calculator should be divided into 2 parts - a controller and a datapath. The controller is an FSM which issues commands to the datapath based on the current state and the external inputs. This can be a behavioral description. The datapath contains a netlist of functional units like multiplexors, registers, subtractors and a comparator, and hence this design is structural. The controller basically steps through different states based on the comparison of the 2 numbers x and y. If x = y, we have finished computing the GCD, and we go to the final state and assert the data output line, and reset the FSM back to state 0. The Datapath does the actual GCD computation. It has the following components:
II. Implementation
Please refer to the figure given below for an example of how the design might be captured. However, your state machine can have a different number of states and different arcs, including loops. Write a testbench and verify your results.
III. Downloading
Once you have verified your results using Aldec HDL, check out an XS40 board from the T.A. Download your code and verify your results.