Lab 4 VGA Display. Bouncing Ball

Lab 4 VGA Display. Bouncing Ball. Design and implement a digital circuit capable of displaying predefined patterns on the screen of a VGA monitor, and...
Author: Lilian Marshall
30 downloads 0 Views 126KB Size
Lab 4 VGA Display. Bouncing Ball. Design and implement a digital circuit capable of displaying predefined patterns on the screen of a VGA monitor, and provide the basic components for a bouncing ball display. Your circuit must generate all control and data signals driving the VGA output of the BASYS2 board. Please refer to the introductory lab slides for information about the meaning and timing of VGA control signals. Use the clock frequency of 25 MHz generated by a DCM, and the resolution as close as possible to 640x480 pixels. This Lab can be done in teams or individually, but teams are required to finish more tasks. Task 1 (for individuals: required, 2 points; for teams: required, 1.5 points) Design a circuit to display a white circle in the center of the screen. The background of the screen is black. The circle, or ball, is 40 pixels in diameter.

Task 2 (for individuals: required, 2 points; for teams: required, 1.5 points) Extend Task 1 by adding the capability to move the ball to any point in the screen. Switches 0-1 select the step size the balls moves in the horizontal direction. One step is equal to 4 pixels, which allows the user to change the step size between 4 and 16 pixels. Switches 2-3 select the step size the ball moves in the vertical direction. One step is equal to 4 pixels, which allows the user to change the step size between 4 and 16 pixels. Pressing button 0 moves the ball up. Pressing button 1 moves the ball down. Pressing button 2 moves the ball left. Pressing button 3 moves the ball right. The ball must not exit the screen.

The heavy arrows depict movement of the ball; they do not need to be drawn on the screen.

Task 3 (for individuals: required, 2 points; for teams: required, 1.5 points) Extend Task 2 to allow the ball to move and bounce off of the screen walls. Switch 7 changes the mode from “Manual” when the switch is 0, to “Bounce” or “Automatic” when the switch is 1. In Manual mode, the ball can be moved using the buttons (as in Task2). In Bounce mode (this task), the ball position automatically moves periodically so that it appears to be in fluent motion. The starting location of the motion is the last position from Manual mode. The same step size that is used for Task 2 is also used for Task 3. Switches 0-1 select the step size the ball moves at each interval in the horizontal direction. One step is equal to 1 pixel, which allows the user to change the step size between 0 and 3 pixels. Switches 2-3 select the step size the ball moves at each interval in the vertical direction. One step is equal to 1 pixel, which allows the user to change the step size between 0 and 3 pixels. The period at which the updates occur is determined by a clock divider and a step size for the period. Switches 4-5 determine the step size of the period. One step is equal to 5 ms (125,000 clocks at 25 MHz.), which allows the user to change the interval between 0 ms and 15 ms in 5 ms increments. The ball bounces off of the wall. The point at which the ball bounces is called the boundary (see the following diagram.) The ball changes direction when its center position reaches the boundary. At this point, the step of an appropriate (horizontal or vertical) movement changes sign.

The boundary is half the diameter of the ball (20 pixels) from the edge of the screen. The dashed rectangle is a virtual boundary; it does not need to be drawn on the screen. When the center of the ball is beyond the boundary, the ball bounces.

Task 4 (for individuals: bonus, 2 points; for teams: required, 1.5 point) Extend Task 3 so there are two balls on the screen. The first ball starts in the center of the screen. The second ball does not. The color of the second ball is not the same color of the first ball. But the step sizes for motion is the same for both balls. When in Manual mode, Switch 6 switches between the balls. In Bounce mode, both balls are in motion and bounce off of the walls, as described in Task 3.

Task 5 (for individuals: bonus, 1.5 point; for teams: bonus, 1 point) Extend Task 3 to change the color of the ball and the background when the ball bounces off of a wall. Cycle through all 16 colors. The color of the background must not be the same color of the ball.

Task 6 (for teams only: bonus, 1 point) Extend Task 3 to change the shape of the ball when it bounces, alternating between a circle and a square. The length of one wall of the square is twice the radius of the circle.

For the all tasks, determine the following properties: 1. Number of CLB slices 2. Minimum clock period after synthesis [ns] 3. Maximum clock frequency after synthesis [MHz] 4. Minimum clock period after implementation [ns] 5. Maximum clock frequency after implementation [MHz]

As a part of the design process: 1. Draw an optimized block diagram of your color, sync generator, circle fill, and counter circuits. 2. Translate your block diagram (and the rest of the circuits) into RTL VHDL. 3. Write a separate testbench capable of verifying the functionality of the circuits. 4. Synthesize, implement, and load your design on the Basys board to verify functionality. In the lab report include: 1. Optimized block diagrams (hand-drawn hardcopy submitted in class and used during an exit quiz, and an electronic copy submitted using Blackboard in the pdf or MS Word format (preferably, the scanned version of the hand-drawn hardcopy.) 2. VHDL source codes for: a. Clock management unit b. VGA Sync generator c. Manual Count d. Automatic Count e. Circle Fill f. Clock Divider g. Color Generator h. Top Level Unit 3. User Constraint File (UCF) 4. Testbench and waveforms from the functional simulation (electronic versions submitted using Blackboard) for both filters. Important Dates Monday Section Hands-on Session and Introduction to the Experiment Demonstration and Deliverables Due (Schedule A) Demonstration and Deliverables Due (Schedule B)**

Tuesday Section

Wednesday Section

Thursday Section

03/21/2011 03/22/2011

03/23/2011

03/24/2011

04/04/2011 04/05/2011

04/06/2011

04/07/2011

04/11/2011 04/12/2011

04/13/2011

04/14/2011

**Students following Schedule B forfeit their right to all points for Lab 6: PicoBlaze & Serial Communication (a total of 6 points).