6.111 1 of 9 Lab #4 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.111 Lab #4 Checkoff List Please be ready with the following when checking off Lab #4: 1. A printout of your Verilog code (put your name at the top!) that will be collected by the staff and evaluated. 2. Set the labkit’s switches to 0 (i.e., zero puck velocity) and demonstrate your game in its reset state. 3. Demonstrate the paddle moving along the left edge of the screen in response to pushing the UP and DOWN buttons. 4. Enter a small velocity in switch[7:4] and demonstrate the puck moving and bouncing off the top, right and bottom of the screen. 5. Demonstrate the puck bouncing off the paddle, and how your game halts when the puck reaches the left edge of the screen. 6. Demonstrate that your game can be restarted after halting by pressing the ENTER button. During checkoff you may be asked to discuss one or more of the following questions: 1. What would have to change in your Verilog code if the size of playing screen was reduced to 800x600? [Hint: it’s always a good idea to use the parameter statement to give a symbolic name to important constants rather than scattering numbers all through your code.] 2. If the display were being driven from a frame buffer memory that supplies 8-bits for each of red, green and blue for each pixel, how much memory would be needed? If we used the labkit’s ZBT rams for the frame buffer, what fraction of the memory bandwidth would be used by refreshing the screen? (Look at the labkit’s documentation for the ZBT memories to get the throughput information you need to answer this question.)6.111 2 of 9 Lab #4 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.111 Lab #4 Goal: Implement a simple Pong game on a video monitor. Video display technologies Most video displays accept the image to be displayed in a serial fashion, usually a sequence of horizontal scan lines to be displayed one under another with a small vertical offset to create a raster image. Typically the raster is transmitted in left-to-right, top-to-bottom order. A complete raster image is called a frame and one can create the appearance of motion by displaying frames in rapid succession (24 frames/sec in movies, 30 frames/sec in broadcast TV, 60+ frames/sec in computer monitors). To transmit a raster image, one must encode the color image information and provide some control signals that indicate the end of each horizontal scan line (horizontal sync) and frame (vertical sync). The display device creates the image using red, green and blue emitters, so an obvious way to encode the color information is to send separate signals that encode the appropriate intensity of red, green and blue. This is indeed how most analog computer monitors work – they accept 5 analog signals (red, green, blue, hsync, and vsync) over a standardized HD15 connector. The signals are transmitted as 0.7V peak-to-peak (1V peak-to-peak if the signal also encodes sync). The monitor supplies a 75Ω termination for each signal, which if matched with a driver and cable with a characteristic impedance of 75Ω minimizes the interference due to signal reflections. The labkit incorporates an integrated circuit – the ADV7125 Triple 8-bit high-speed video DAC – which produces the correct analog signals given the proper digital inputs: three 8-bit values for R, G and B intensity, hsync, vsync, and blanking. [Small digression on other video encodings; feel free to skip to the end of the digression.] When encoding a color video image for broadcast or storage, it’s important to use the bandwidth/bits as efficiently as possible. And, in the case of broadcast, there was the issue of backwards compatibility with black-and-white transmissions. Since the human eye has less resolution for color than intensity, the color image signal is separated into luminance (Y, essentially the old black-and-white signal) and chrominance (U/Cr/Pr, V/Cb/Pb). YUV are related to RGB as follows: ⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−−−−=⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡BGRVUY100.0515.0615.0436.0289.0147.0114.0587.0229.06.111 3 of 9 Lab #4 Luminance and chrominance are encoded separately and transmitted/stored at different bandwidths. In most systems the chrominance bandwidth is a half (4:2:2 format) or a quarter (4:2:0 format) of the luminance bandwidth. There are several common ways of transmitting Y, U and V: • Composite video where Y and the composite sync are combined to form a 1V peak-to-peak signal. U+V and U-V are used to modulate orthogonal phases of a color subcarrier (3.58MHz in NTSC broadcasts) and then mixed with a low-pass-filtered version of Y/sync signal. • S-Video where Y and the modulated color subcarrier are transmitted on separate signal/ground pairs. This avoids the low-pass filtering of Y used in composite video, resulting in a higher-resolution video image. • Component video where Y, Cr/Pr, and Cb/Pb are transmitted on separate signal ground pairs (Cr and Cb are just scaled versions of U and V). Some transmission schemes break a frame into an even field (containing the even numbered scan lines) and an odd field (containing the odd numbered scan lines) and then transmit the fields in alternation. This technique is called interlacing and permits slower frame rates (and hence lower bandwidths) while still avoiding the problem of image flicker. When higher bandwidths are available, non-interlaced transmissions are preferred (often called progressive scan). The labkit contains interface chips for encoding (ADV7194) and decoding (ADV7185) composite and S-Video signals. The decoder chip is particularly useful if you want to use a video camera signal as part of your project. [End of digression.] To create a video image for our Pong game, it’s helpful to think of the image as a rectangular array of picture elements or pixels. There are several common choices for the dimensions (HxV) of the rectangle: 640x480 (VGA), requires 25MHz (40ns) pixel clock for 60Hz refresh 800x600 (SVGA), requires 40MHz (25ns) pixel clock for 60Hz refresh 1024x768 (XVGA), requires 65MHz (15ns) pixel clock for 60Hz refresh The computer monitors in the lab support resolutions up to 1280x1024 but the required
View Full Document