Basic Finite State Machine with Datapath (FSMD) example to calculate the Greatest Common Divisor (GCD) of two 8-bit numbers.
These examples use ModelSim® and Quartus® Prime from Intel FPGA, GIT, Visual Studio Code, make sure they are installed locally on your computer before proceeding.
-
Grab a copy of this repository to your computer's local folder (i.e. C:\projects):
$ cd projects $ git clone https://github.com/ihabadly/fsmd-gcd.git
-
Use Visual Studio Code (VSC) to edit and view the design files:
$ cd fsmd-gcd $ code .
Click on the gcd_toplevel.vhd file in the left pane to view its contents.
-
From the VSC View menu, choose Terminal, in the VCS Terminal, create a "work" library:
$ vlib work
-
Compile all the design units:
$ vcom *.vhd
-
Simulate your design. For example, if x_i = 12, y_i = 8 then d_o = 4:
$ vsim work.gcd_toplevel_tb