This repository contains the implementation in VHDL of the microprocessor MIPS (Single-Cycle) for the course of Design of Digital Systems in University of West Attika. Both the MIPS implementation and testbench are available along with graphs of the microprocessor and ALU controller.
The VHDL code can be compiled using the Modelsim environment or Visual Studio Code.
This section will guide you on how to setup Visual Studio Code for VHDL. For compiling VHDL the GHDL
compiler is been used along with the GTKWave
wave image program.
- Download the
GHDL
compiler for windows here (Find the MINGW32.zip). Extract the root folder of the .zip file to your preferred location. Add theGHDL/bin
in thePATH
variable to access the compiler from the Windows Terminal. - In this tutorial the
GTKWave
program is used. DownloadGTKWave
for Windows here. After download is completed unzip the file and place it at your preferred location. Add thegtkwave64/bin
in thePATH
variable to accessGTKWave
from the Windows Terminal. - Compile the .vhd files using:
After the compilation two files should have been created a .cf file and a
ghdl -a .\02_MIPS.vhd ghdl -a .\03_Testbench.vhd ghdl -r -fsynopsys testbench --wave="wave.ghw"
wave.ghw
file. The .cf is used during theghdl -r
and it can be removed if you want. Thewave.ghw
holds the wave of the testbench. You can open it usingGTKWave
like so:gtkwave wave.ghw
.
- In debian based distributions use:
On other distros use the appropriate package manager.
#Update package manager sudo apt update #Install dependencies sudo apt install build-essential gnat zlib1g-dev #Download the ghdl package sudo apt install ghdl #Download the gtkwave package sudo apt install gtkwave
- Compile the .vhd files using the following commands:
After the compilation a
ghdl -a 02_MIPS.vhd ghdl -a 03_Testbench.vhd ghdl -r testbench --wave="wave.ghw"
.cf
and awave.ghw
should appear. The .cf file can be removed. You can open the waves of the testbench in theGTKWave
usinggtkwave wave.ghw
After you are done with the installations, open VS code on the directory that the .vhd files are located and compile from the integrated terminal. Dont forget to add a VHDL extension to VS Code to help with the VHDL coding.
This section will show you basic operations in the GTKWave program.
- You can add signals to the view by navigating in the SST tree view and selecting the object that contains the signal. Then in the panel below the tree view, select the target signal and "drag and drop" in the signals panel on the left.
- The signals inside the mips entity are located in the mipsmain object end.
- You can insert seperators, change the color of signals or the way that are presented by left clicking in the Signals section
- You can save as a
.gtkw
file inFile->Write Save File As
. This new file will hold any signals that you have added as well as seperators, colors or any other modifications and every time that the wave.ghw is updated, the .gtkw file will be updated as well.