Embedded Systems Spring 2024
HW 2
Data types, operators, combinational logic
Name: Mason Brady
Email: mrbrady1@fortlewis.edu

HW 2

Introduction: This homework is an introduction to FPGAs and Data types.

Materials: gvim, vivado, basys 3

Methods: gVim was installed and added to the path directory so it could be opened through command line. The video below is a demonstration of the basic commands in gvim.

Part 1

The calculations from decimal to binary were done with two different methods as per the instructions and can be seen below in Figure 1.

Figure 1.
Part 1 Calculations.

Part 2

The textbook demonstration was re-written using GVIM and imported into vivado along with the respective test bench. This code was designed to show the difference in data types and using the vectors to access MSB and LSBs.

Figure 2.
Demonstration Code from Textbook.

I then simulated this code and verified the output from the given example.

Figure 3.
Simulated code from Figure 2.

Part 3

For this part of the homework, I wrote all three scripts into the same file as seen below in Figure 4.

Figure 4.
Modules for combinational logic examples.

The corresponding test bench was written shifting the switches and leds starting from the next switch/leds of the previous module. This way I only had to wait for the implementation and upload once instead of three times since it is a timeconsuming process.

Figure 5.
Test bench for all three modules at once.

I then uploaded the code to the FPGA board and demonstrated all three functions at the same time as seen below in Figure 6.

Figure 6.
Demonstration video for all three scripts in part 7.

Part 4

The Konami Code is a famous code used for accessing cheats in old Konami video games. Since I didn't want to deal with debounce or learning how to use the buttons yet I converted the konami code to ON/OFF switches as seen below

Figure 7. Konami code module.

I then setup a test bench and uploaded the code to the FPGA

Figure 8. Konami code test bench.

The demonstration can be seen below

Figure 9. Konami Code Switch Demonstration.

Like the second lab, I decided to put all of the modules into the same testbench so I could test them all simultaneously. This made it more interesting in my opinnion and helped further my understanding. I kept getting errors for the order of my list definitions [3:4] vs [4:3] between the test bench and module which made sense due to reversing the MSB and LSB but is different from typical programming languages.