ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA...

29
ECE 448: Lab 4 VGA Display Mini-Pacman

Transcript of ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA...

Page 1: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

ECE 448: Lab 4

VGA Display Mini-Pacman

Page 2: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Flexibility in the Second Part of the Semester

Lab 4: VGA display (2 weeks) – 8 points

Lab 5: Computer Graphics (2 weeks) – 8 points

Lab 6: PicoBlaze System (2 weeks) – 8 points

Lab 7: Logic Analyzer (in class) – 2 bonus points

Lab 4: VGA display (3 weeks) – 8 points

Lab 5: Computer Graphics or Lab 6: PicoBlaze System

(3 weeks) – 8 points

Lab 7: Logic Analyzer (in class) – 2 bonus points

Schedule A:

Schedule B:

Total: 24+2 points

Total: 16+2 points

Page 3: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Flexibility in the Second Part of the Semester

• Intended for students who do exceptionally well in the first part

of the semester ( ≥ 90% of points for Labs 1-3)

• An open-ended project proposed by students, the TAs, or the

instructor

• Can be done individually or in groups of two students

• Schedule: Detailed Specification (1 week)

Milestone 1 (2 weeks)

Milestone 2 (2 weeks)

Final Report & Deliverable (1 week)

Schedule A+:

Total: 25 points

Page 4: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Expected Project TasksSchedule A+: 1. Use of at least one complex input/output device

• VGA display• Keyboard or Mouse (USB-HID)• Ethernet, etc.

2. Use of on-chip embedded resources: BRAMs, DSP units or External on-board memory or Soft microcontroller core (e.g. Picoblaze)3. (bonus) Use of PMOD Accessory Boards implementing additional functions, e.g., A/D, D/A, motor drivers, sensors, cameras.

Page 5: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Lab 4 Exercises

Page 6: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

6ECE 448 – FPGA and ASIC Design with VHDL

Reading

• P. Chu, FPGA Prototyping by VHDL Examples

Chapter 12, VGA Controller I: Graphic

Chapter 12, VGA Controller II: Text

•Nexys3 Reference Manual

VGA Port, pages 15-17

Page 7: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

7

Lab4 Exercise 1

Displaying synchronization signals on the oscilloscope

• Develop a testbench for the circuit, described in the figure above.• Perform functional simulation, displaying ALL ports of vga_sync component.• Synthesize and implement the top-level circuit using provided UCF file • Perform timing simulation, displaying ALL ports of vga_sync component.• Perform experimental testing using oscilloscope, displaying clk, hsync, vsync.

clk

reset

hsync

vsync

Observe these signals on

oscilloscope

vga_sync

Lab4_exercise1

hsync

vsync

pixel_x

pixel_y

video_on

p_tick

10

10

Page 8: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Lab Exercise 2• Resolution: 640x480• Display: 8 colors (3 bits), 16 colors (4 bits),

64 colors (6 bits), 256 colors (8 bits)• Refresh Rate: 25Hz, 30Hz, 60Hz (frames / second)

Page 9: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Lab4_exercise1

clk

resethsync

rgbsw

vsync

35

Interface

Page 10: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Use of switches

Page 11: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Specification of coordinates of three objects assuming sw(4)=0

Page 12: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Specification of colors of three objects

Page 13: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Specification of dimensions of the ball

Page 14: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 1

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 32, x_right = 35)

Bar coordinates = (x_left = 600, x_right = 603, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 480, x_right = 487, y_top = 38, y_bottom = 45)

Wall

Paddle bar

Ball

Configuration-1 ( sw(4) = ‘0’, sw(3..2) = “00”, sw(1..0) = “00” )

Page 15: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 2

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 32, x_right = 35)

Bar coordinates = (x_left = 600, x_right = 603, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 480, x_right = 487, y_top = 38, y_bottom = 45)

Wall

Paddle bar

Ball

Configuration-2 ( sw(4) = ‘0’, sw(3..2) = “01”, sw(1..0) = “00” )

Page 16: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 3

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 32, x_right = 35)

Bar coordinates = (x_left = 600, x_right = 603, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 480, x_right = 487, y_top = 38, y_bottom = 45)

Wall

Paddle bar

Ball

Configuration-3 ( sw(4) = ‘0’, sw(3..2) = “10”, sw(1..0) = “00” )

Page 17: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 4

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 32, x_right = 35)

Bar coordinates = (x_left = 600, x_right = 603, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 480, x_right = 487, y_top = 38, y_bottom = 45)

Wall

Paddle bar

Ball

Configuration-4 ( sw(4) = ‘0’, sw(3..2) = “11”, sw(1..0) = “00” )

Page 18: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 5

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 605, x_right = 608)

Bar coordinates = (x_left = 500, x_right = 503, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 380, x_right = 387, y_top = 138, y_bottom = 145)

Wall

Paddle bar

Ball

Configuration-5 ( sw(4) = ‘0’, sw(3..2) = “00”, sw(1..0) = “01” )

Page 19: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 6

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (y_top = 32, y_bottom = 35)

Bar coordinates = (x_left = 400, x_right = 403, y_top = 204, y_bottom = 275)

Ball coordinates = (x_left = 280, x_right = 287, y_top = 238, y_bottom = 245)

Wall

Paddle bar

Ball

Configuration-6 ( sw(4) = ‘0’, sw(3..2) = “00”, sw(1..0) = “10” )

Page 20: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 7

(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (y_top = 445, y_bottom = 448)

Bar coordinates = (x_left = 300, x_right = 303, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 180, x_right = 187, y_top = 338, y_bottom = 345)

Wall Paddle bar

Ball

Configuration-7 ( sw(4) = ‘0’, sw(3..2) = “00”, sw(1..0) = “11” )

Page 21: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Configuration : 8(0,0) (639,0)

(639,479)(0,479)

Wall coordinates = (x_left = 32, x_right = 35)

Bar coordinates = (x_left = 600, x_right = 603, y_top = 204, y_bottom = 276)

Ball coordinates = (x_left = 472, x_right = 495, y_top = 30, y_bottom = 53)

Wall Paddle bar

Ball

Configuration-8 ( sw(4) = ‘1’, sw(3..2) = “00”, sw(1..0) = “00” )

Page 22: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Introduction to Lab 4

Page 23: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Game Characters and Maze

Shadow InkyPacman Diamond

Page 24: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 1: Displaying the maze (Points: 25%)

• Maze Color: Blue• Color Generator: Selects colors for the background and

maze• VGA Controller: Sync generator

Page 25: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 2: Displaying Diamonds in four corners (Points:10%)

• Diamond Color: Magenta• The diamonds should be stationary objects placed in four corners

shown above.

Page 26: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 3: Display and create movement of character “Inky” (Points: 15%)

• Inky should move in the direction shown above

Page 27: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 4: Display and create movement of character “Shadow” (Points:15%)

• Shadow should move in the direction shown above• Shadow and Inky should not collide with each other.

Page 28: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 5: Introduce “Pacman”(Points:25%)

• Use four push buttons (BTNU for Up, BTND for Down, BTNL for Left and BTNR for Right movement) to control Pacman’s movement.

• Pacman should keep moving in one direction until any other button is pressed.

• The goal of the Pacman is to get all four Diamonds without collision with any of the Ghost characters.

Page 29: ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.

Task 5 : Displaying score and number of lives left on VGA display (Points: 10%)

•Display the score and number of lives on VGA display.

•Each Diamond carries 200 points.

•Whenever Pacman eats any of the Diamonds, the count on the VGA display should increment and display the total score.

•Pacman should have three lives initially. Every collision with Shadow or Inky should result in loss of one life. The count of remaining lives should also be updated on the VGA display . After three such collisions, the game will be over.

•When Pacman eats all four diamonds, this event should pause the game, and YOU WON should be displayed on the VGA display.