Sie sind auf Seite 1von 70

De La Salle Lipa

College of Information Technology and Engineering

Electronics Engineering Department

LOGSWIT FINAL TERM PROJECT

Tap Until You Drop

Group 3

Leader:

Panganiban, Rico Jr.

Members:

Atienza, Marvin James

Cena, Crisse Micaela

De Guzman, Fritz Kenneth

Samonte, Maicah Feliz

BS ECE | 4TH YEAR | T4B

Engr. Aileen F. Villamonte, ECE

Instructor
TABLE OF CONTENTS

Page

List of Tables ii

List of Figures iii

Abstract iv

I. Introduction 1

II. Objectives 3

III. Discussion of Project’s Function and Operation 3

IV. Design Specifications 7

V. List of Materials 10

VI. Prototype 12

VII. Project Development 13

VIII. VHDL Programming 15

IX. Testing and Simulation 46

X. Conclusions 57

XI. Recommendations 59

Appendices 60

i
References 65

LIST OF TABLES

Table No. Title Page

Table 1 Design Specifications 7

Table 2 List of Materials 10

Table 3 Actual Simulation 51

ii
LIST OF FIGURES
Figure No. Title Page
Figure 1 Top View of the Prototype 2
Figure 2 Front View of the Prototype 2
Figure 3 Left-Side View 2
Figure 4 Right-Side View 2
Figure 5 Block Diagram of Tap Until You Drop 3
Figure 6 Flowchart of the Game 6
Figure 7 Project Prototype showing Essential Parts 12
Figure 8 VHDL Codes for Sequence 1 15
Figure 9 VHDL Codes for Sequence 2 23
Figure 10 VHDL Codes for Sequence 3 30
Figure 11 VHDL Codes for Sequence 4 38
Figure 12 Pin Assignments of Sequence 1-4 45
Figure 13 RTL View of Sequence 1-4 46
Figure 14 Summary Report for Sequence 1 46
Figure 15 Functional Simulation of Sequence 1 47
Figure 16 Timing Simulation of Sequence 1 47
Figure 17 Summary Report for Sequence 2 48
Figure 18 Functional Simulation of Sequence 2 48
Figure 19 Timing Simulation of Sequence 2 48
Figure 20 Summary Report for Sequence 3 49
Figure 21 Functional Simulation of Sequence 3 49
Figure 22 Timing Simulation of Sequence 3 49
Figure 23 Summary Report for Sequence 4 50
Figure 24 Functional Simulation of Sequence 4 50

iii
Figure 25 Timing Simulation of Sequence 4 50

Abstract

Games especially those involved on gadgets have been one of the endeavors nowadays. One of

the recent android games that have been popular is the so - called Piano Tiles – a rhythm game

where its keys are moving in a fast-paced manner displayed on the screen of a device such as an

Android phone. The player should press the key/s at the right moment before it disappears from

the screen to keep playing, or else it will be a game over. This project entitled, “Tap Until You

Drop” is based from the said android game; however, with the group’s modifications, the project

was designed. Instead of an android phone, it was completely modified to a prototype that

consists of 6 push buttons as input and a 6x6 LED matrix as output which are programmed

through Quartus II VHDL codes and DE2 Altera Field Programmable Gate Array (FPGA) board.

Moreover, instead of black and white, the LEDs consist of red, blue and green colors. The

game’s goal is that the player should tap an LED, before it turns off, through a push button

located at each end of each column of the matrix.

iv
I. Introduction

The advancement of new technology has been taking place since the beginning of human

history. It is usually represented by electronic devices nowadays such as computer, mobile phones

and etc. Behind this electronic device is a circuit that executes process and even controls a function

in a computer namely, logic circuits. This circuit execute logical operation on information to

process it.

In order to function a particular sequence of operations in a given system, programmers

need to comprise a circuit that provides both input and output relationship that is relative to the

Boolean algebra. This is known as the logic circuits. Furthermore, since logic gates are the building

blocks of digital electronics, they have been castoff on different digital products including personal

computers, tablets, mobile phones, and etc. For this project, a combination of logic circuits will be

used for the development and implementation of a game.

The project is entitled “Tap Until You Drop”, and it is composed of a 6 x 6 led matrix with

6 push buttons. The concept of this game is adapted from the IOS and android application “Piano

Tiles” that consists of many classical songs that is being played as the game began, and the gamer

must aim to tap all the black tiles without making any mistakes. In this project, each level has a

corresponding led color and pattern and as the level increases the speed also increases. A field

programmable gate array (FPGA) and the combination of logic circuits will be used for the

enlargement and achievement of the game.

In order to accomplish the prototype of the “Tap Until You Drop” game the proponents

used the following:

1. RGB LED lights

1|Page
2. Push Buttons

3. Cardboard

4. Cover Layout/Construction Paper

The dimensions of the casing are 8.5 inch in height x 7 inch in length x 7 inch in width.

Looking like an arcade machine, the whole casing is made up of cardboard which is covered with

a printed layout evidently seen on the side view figures shown below and with a light blue

construction paper seen on the top and front views. Presented also on Figure 1, the screen of the

so – called arcade machine is a 6x6 led matrix where different led patterns will appear. Below the

led matrix are the 6 push buttons to be pressed during the game.

Figure 1. Top view of the Prototype Figure 2. Front View of the Prototype

Figure 3. Left-Side View Figure 4. Right-Side View

2|Page
II. Objectives

The project aims to design a game entitled “Tap Until You Drop” with the use of Quartus

software, Altera FPGA board and other external devices such as push buttons and LEDs. To

achieve this, the following are the project’s specific objectives:

1. To create a prototype that consists of a 6x6 RGB LED matrix with other external

components such as push buttons that are compatible to the Altera board for

programming.

2. To implement through Quartus II VHDL codes the different game modules needed then

to be able to program them to the prototype created.

3. To test and evaluate the functionality of the implemented project via game play.

III. Discussion of Project's Function and Operation

Block Diagram
PROCESS:
FPGA
INPUT

OUTPUT

6 Push 6 x 6 LED
Buttons Four Sequence Matrix,
Generators with Buzzer
Clock and
Buzzer Codes

Figure 5. Block Diagram of Tap Until You Drop

3|Page
Operation of Project
On the perspective of the player, the inputs of the game are the 6 push buttons located at

the bottom of each column of the 6x6 LED matrix. Through these, the player can control the game

whereas when a button is pushed or tapped, goal of the game is achieved which is to turn off an

LED before it disappears on a situated column. The output of the game is designated or can be

seen on the 6x6 LED matrix where lights are running in a specific pattern. The process of the

whole game is made possible by the different modules implemented on the Quartus II VHDL

Codes and on the Altera FPGA Board. Sequence 1 – 4 modules are the main interface of the project

since it is where the pattern and speed of the running LEDs and the time duration of the game were

developed. Additional sound output feature was added which can be heard through a buzzer

whenever the player taps a button – made possible by the buzzer code part in each Sequence

Module through VHDL codes.

Mechanics of the Game Implemented

Operated by Altera FPGA board, the game “Tap Until You Drop” is associated with a

prototype that is composed of 6x6 RGB LED matrix that displays colors red, green and blue. The

player can play the game via the 6 push buttons located at the bottom of each column of the matrix.

Tap Until You Drop’s main objective is to turn off the randomly running LEDs before it disappears

at a situated column by tapping the specific push button at the end of the matrix. Also, the LEDs

will randomly lit then run which goes from slow to fast speed conveying some complexity in the

game. Hence, the running LEDs are going faster as the game proceeds. In addition, a sound is

generated through a buzzer whenever the player is able to tap an LED.

4|Page
Discussion of Each Module Utilized

The following are the four sequence modules that were utilized in the program that made the

patterns displayed on the running 6x6 LED matrix possible.

Sequence 1 – In this module, the LED lights running are in its lowest speed with a clock

whereas the time duration of the whole game is estimated at 15 seconds

Sequence 2 – Here, the speed of the running LEDs is quite faster compared to Sequence

1 module. It has an estimated time duration of 11 seconds.

Sequence 3 – From here, it can be observed that higher number of sequence module

indicates a faster speed of the running LEDs; hence, this module would indicate a higher

level of difficulty compared from the first two mentioned. It has an estimated time duration

of 9 seconds.

Sequence 4 – This module consists of the most difficult level of the game since the LEDs

are running at its highest speed. with an estimated duration of 7 seconds.

Buzzer – This portion is part of each sequence module generated; here, the sounds

generated every time the player taps a push button is made possible.

5|Page
Project Flowchart and Algorithm

6x6 LED Lights


running in pattern
through modules

No

Yes

Figure 6. Flowchart of the Game

1. Start of Game.

2. Sequence module will generate the patterns for the running 6x6 LED Lights.

3. When LED reached the bottom and then a button is tapped, a sound will generate.

4. If button is not tapped, game will just continue.

5. End of Game.

6|Page
IV. Design Specifications

The table below shows the pins assigned to the terminals used in the DE2 Altera FPGA Board; it

also indicates the General Purpose Input/ Output (GPIO) and the design specifications of the whole

project. Pin assignments below are true for all sequence generator modules implemented.

Input/ Output - Node Pin Location Row Column


Component Name

Input – Push Button Button1 PIN_K25 x 1

Input – Push Button Button2 PIN_K26 x 2

Input – Push Button Button3 PIN_M22 x 3

Input – Push Button Button4 PIN_M23 x 4

Input – Push Button Button5 PIN_M19 x 5

Input – Push Button Button6 PIN_M20 x 6

Output - LED LED1[0] PIN_D25 1 1

Output - LED LED1[1] PIN_J22 1 2

Output - LED LED1[2] PIN_E26 1 3

Output - LED LED1[3] PIN_E25 1 4

Output - LED LED1[4] PIN_F24 1 5

Output - LED LED1[5] PIN_N24 1 6

Output - LED LED2[0] PIN_F23 2 1

Output - LED LED2[1] PIN_J21 2 2

7|Page
Output - LED LED2[2] PIN_J20 2 3

Output - LED LED2[3] PIN_F25 2 4

Output - LED LED2[4] PIN_F26 2 5

Output - LED LED2[5] PIN_P24 2 6

Output - LED LED3[0] PIN_N18 3 1

Output - LED LED3[1] PIN_P18 3 2

Output - LED LED3[2] PIN_G23 3 3

Output - LED LED3[3] PIN_G24 3 4

Output - LED LED3[4] PIN_K22 3 5

Output - LED LED3[5] PIN_R25 3 6

Output - LED LED4[0] PIN_G25 4 1

Output - LED LED4[1] PIN_H23 4 2

Output - LED LED4[2] PIN_H24 4 3

Output - LED LED4[3] PIN_J23 4 4

Output - LED LED4[4] PIN_J24 4 5

Output - LED LED4[5] PIN_R24 4 6

Output - LED LED5[0] PIN_H25 5 1

Output - LED LED5[1] PIN_H26 5 2

Output - LED LED5[2] PIN_H19 5 3

Output - LED LED5[3] PIN_K18 5 4

8|Page
Output - LED LED5[4] PIN_K19 5 5

Output - LED LED5[5] PIN_R20 5 6

Output - LED LED6[0] PIN_K21 6 1

Output - LED LED6[1] PIN_K23 6 2

Output - LED LED6[2] PIN_K24 6 3

Output - LED LED6[3] PIN_L21 6 4

Output - LED LED6[4] PIN_L20 6 5

Output - LED LED6[5] PIN_T22 6 6

Output - Buzzer buzz PIN_W23

Output - Buzzer buzz2 PIN_W25

Output - Buzzer buzz3 PIN_V23

Output - Buzzer buzz4 PIN_V24

Output - Buzzer buzz5 PIN_V25

Output - Buzzer buzz6 PIN_V26

Table 1. Design Specifications

9|Page
V. List of Materials

Name Picture Specification

Power Input: External:8V-12V USB:5V

DC Power Output: 3.3V

Altera DE2 FPGA Microcontroller: ATmega328

Board
On-board Crystal: 16 & 12MHz

User Interface: USB Port, DC Jack, Reset

Button

4 pin, common anode

DC forward voltage:

Green & Blue: 3.2V-3.4V Typ, 3.8V Max

Red: 1.9-2.1V Typ, 2.4V Max


RGB LEDs
Wavelength:

Red: 625nm
Green: 525nm
Blue: 470nm

Lead Polarity:
Lead 1: Negative
Lead 2: Positive
Lead 3: Negative
Lead 4: Negative

10 | P a g e
220 Ohms
Resistor
½ Watt

4 Pin push button switch

Material: Plastic
Compatible swath size:12x12x7.3mm

Push Button Total Size:10 x 10 x 4.5mm/0.39 x 0.39 x


0.18″(L x W x H)
Hole Size:3.8 x 3.5mm/0.15 x 0.14″(L x W)

Dimension:
Male to Female
7.87 in x 2.2 in x 0.12 in (20 cm x 5.6 cm x
Connector
0.3 cm)

Buzzer Applied vibration of amplitude of 1.5 mm

10 to 55 Hz band of vibration frequency

Laptop with

Quartus II 13.0sp1

(64-bit)

Table 2. List of Materials

11 | P a g e
VI. Prototype

Shown in the picture is the prototype associated to the project where the game is

implemented through Altera FPGA and Quartus II VHDL codes. The essential parts evident in the

prototype are the 6 push buttons and 6x6 LED matrix. The 6 red push buttons located at the bottom

part of the LEDs, serve as the controller of the user/player to be able to play Tap until You Drop.

Each button controls a corresponding column of the LED matrix which LEDS are connected in

parallel to each other. The game proper is displayed through the LED matrix where the lights are

running in a pace of increasing manner. These LEDs also show the pattern or sequence made by

the sequence generator. Via the push buttons, the specific LED needed to be turned off during the

game is tapped.

Figure 7. Project Prototype showing Essential Parts

12 | P a g e
VII. Project Development

At the time of the proposal we researched for the games that we could implement in the

Quartus II. We came up with the game entitled “Tap Until You Drop” which is a modified

game of an existing game called “Piano Tiles”.

 The group bought all the materials needed for the prototype which are rgb led, push

buttons, connecting wires, electrical tape for the insulation of the soldered wires,

and cardboards. We decided to make the prototype to look like a mini arcade. In

making the prototype, the group must consider the connections of the led lights

since there are many of it involved there is a tendency that it might get shorted

that’s why the group must properly solder the wire and insulate it. Our prototype is

also grounded whenever we touch the laptop the sound of the buzzer changes. In

line with the codes, the group must do more research in order to better implement

the project.

 The group used an available reference for our project which we modified to meet

the main and specific objectives of the game but it took days before it work though

there are no errors but we cannot implement it properly in the prototype as desired.

 The codes of the LED patterns each have the clock where the speed of the pattern

is set and the time duration of the game. The group implemented for sequence

modules with different clock for each one in Quartus II VHDL codes. The patterns

for each sequence are all the same the only difference is the speed for each one. For

13 | P a g e
the first sequence is 11 seconds. The second is 9 seconds. The third one is 7 seconds.

The fourth one is 5 seconds.

 From Piano Tiles which is the basis of the game, the group pursued to generate a

sound whenever the push button is tapped. At first only one buzzer was tried; after

further research and troubleshooting, each column of the matrix was connected to

a buzzer. A total of 6 buzzers were utilized which is the same number of push

buttons used. The codes in order to generate a sound through the buzzer is

incorporated in the sequence module. As can be seen in the codes, push buttons will

work when it is high or 1 while the buzz will sound when it is low or 0.

 The group had a very hard time to compile the modules altogether; hence, playing each

module or each level requires a manual operation of the Quartus software and of the

Altera FPGA Board. After several troubleshooting of both the program and the

prototype, the final function of Tap Until You Drop was developed. As it started on the

Quartus software, the 6x6 RGB LED light will run down the matrix while some whistle

sound can be heard from the buzzer. To play the game, the player should hold the push

button tight rather than just simply pressing it; moreover, as the button is pressed, the

LED light upon reaching the last row will just stop rather than being turn off. Finally,

as the LED is tapped through the push buttons, a clearer and louder sound can be heard

through the buzzers. The game stops when all the LED lights are already tapped by the

player or the game can go on (like a loop) if desired by the player.

14 | P a g e
VIII. VHDL Programming

The following show the VHDL codes of each sequence module utilized and implemented

in the project which made the game’s features and functions possible. Codes that make sound

possible is also associated with each sequence module. The pin assignments and the Register

Transfer Level (RTL) View of each module are also presented.

SEQUENCE 1
VHDL Codes

15 | P a g e
16 | P a g e
17 | P a g e
18 | P a g e
19 | P a g e
20 | P a g e
21 | P a g e
Figure 8. VHDL Codes for Sequence 1

22 | P a g e
SEQUENCE 2
VHDL Codes

23 | P a g e
24 | P a g e
25 | P a g e
26 | P a g e
27 | P a g e
28 | P a g e
29 | P a g e
Figure 9. VHDL Codes for Sequence 2

SEQUENCE 3
VHDL Codes

30 | P a g e
31 | P a g e
32 | P a g e
33 | P a g e
34 | P a g e
35 | P a g e
36 | P a g e
Figure 10. VHDL Codes for Sequence 3

37 | P a g e
SEQUENCE 4
VHDL Codes

38 | P a g e
39 | P a g e
40 | P a g e
41 | P a g e
42 | P a g e
43 | P a g e
44 | P a g e
Figure 11. VHDL Codes for Sequence 4

Pin Assignments of Sequence 1-4 Modules

Figure 12. Pin Assignments of Sequence 1-4


45 | P a g e
RTL View of Sequence 1-4 Modules

Figure 13. RTL View of Sequence 1-4

IX. Testing and Simulation

Upon assigning pins, compilation or summary report, functional simulation and timing

simulation of each of the four Sequence Generators are presented below which are simulated

through Quartus II VHDL Codes as well.

SEQUENCE 1
Compilation Report/ Summary Report

Figure 14. Summary Report for Sequence 1

46 | P a g e
Functional Simulation

Figure 15. Functional Simulation of Sequence 1

Timing Simulation

Figure 16. Timing Simulation of Sequence 1

47 | P a g e
SEQUENCE 2

Compilation Report/ Summary Report

Figure 17. Summary Report for Sequence 2

Functional Simulation

Figure 18. Functional Simulation of Sequence 2

Timing Simulation

Figure 19. Timing Simulation of Sequence 2

48 | P a g e
SEQUENCE 3

Compilation Report/ Summary Report

Figure 20. Summary Report for Sequence 3

Functional Simulation

Figure 21. Functional Simulation of Sequence 3

Timing Simulation

Figure 22. Timing Simulation of Sequence 3

49 | P a g e
SEQUENCE 4

Compilation Report/ Summary Report

Figure 23. Summary Report for Sequence 4

Functional Simulation

Figure 24. Functional Simulation of Sequence 4

Timing Simulation

Figure 25. Timing Simulation of Sequence 4


50 | P a g e
On the other hand, the table below shows the results of the actual hardware simulation of

the game Tap Until You Drop. Actual images shown are the patterns generated which is the

same for all four sequence modules implemented.

Pattern Actual Image Pattern Actual Image

No. No.

1 31

2 32

3 33

51 | P a g e
4 34

5 35

6 36

7 37

8 38

52 | P a g e
9 39

10 40

11 41

12 42

13 43

53 | P a g e
14 44

15 45

16 46

17 47

18 48

54 | P a g e
19 49

20 50

21 51

22 52

23 53

55 | P a g e
24 54

25 55

26 56

27 57

28 58

56 | P a g e
29 59

30

Table 3. Actual Simulation

X. Conclusions

Tap Until You Drop is designed by developing program codes with the use of Quartus II

software implemented on a DE2 Altera Field Programmable Array (FPGA) board to a prototype

that consists of 6 push buttons as input and 6x6 LED matrix as output. In addition, based from

the provided objectives, the following can be concluded:

1. Through the use of soldering iron and leads, connecting wires, push buttons, and RGB

LEDs the prototype for the project was created. Its casing was made of illustration boards,

folders, paste materials, and papers with some design that added to the attractivity of the

prototype as a whole. The prototype looks like a mini arcade machine where the 6x6 LED

matrix connected in parallel, serves as the screen display while the 6 push buttons serve as

the controls of the user. The functionality of the codes programed on the Altera Board

through Quartus VHDL codes is reflected on this prototype. Adjustments on the codes

where made whenever its desired function is not seen on the prototype.

57 | P a g e
2. The game modules that were programed to the prototype through Quartus II VHDL codes

are the four sequence modules. The four sequence generator modules serve as the main

interface of the game. Through these, patterns are shown on the running lights of the 6x6

LED matrix along with the speed of the LEDs and the time duration of the whole game;

also, codes that generate sounds through the buzzer are manifested in these modules.

Sequence 1 to 4 indicate a level of difficulty where the speed of the LEDs run faster as the

game proceeds. In addition, software simulation results of each module utilized were

obtained such as the RTL view, compilation report, functional simulation and timing

simulation.

3. Upon executing a hardware simulation of the created prototype programmed with the

different modules needed through Quartus II VHDL codes that are implemented on an

Altera FPGA Board, the following realizations were attained. Firstly, when a push button

is tapped before an LED disappears in a situated column, the LED does not turn off literally

but only stops. However, pattern for the 6x6 LED matrix was generated that involve

varying speed which can be observed in an increasing manner. With this, the main interface

of the game is accomplished. Finally, a sound can be heard through a buzzer whenever a

button is tapped which feature is similar to the basis of the game, Piano Tiles.

58 | P a g e
XI. Recommendations

After implementing the project prototype and software, the following are the group’s
recommendations for future references:

 To increase the complexity of the game, developers could add more LEDs

and push buttons such as making an 8x8 matrix instead of a 6x6.

 To add also to the difficulty of the game, it can be programmed that

instead of tapping any color of LED going down, the player should tap

only a specific color of LED for each round, for instance, color red only

for the first round and so on.

 A storage module can be added to the system to save a record of the scores

obtained on each level then be able to recall whenever desired by the player.

 An external LCD Display can be added where the score is conveyed and

where the player can choose a level of difficulty before starting the game.

59 | P a g e
APPENDICES

220 Ohm Carbon Film Resistor

60 | P a g e
61 | P a g e
RGB LED

62 | P a g e
63 | P a g e
Push Button

64 | P a g e
REFERENCES

https://docs-apac.rs-online.com/webdocs/1698/0900766b81698ecf.pdf

https://www.kitronik.co.uk/pdf/5mm_RGB_led.pdf

https://www.digchip.com/datasheets/parts/datasheet/1838/CFR-25JB-220R-pdf.php

65 | P a g e

Das könnte Ihnen auch gefallen