Digital Signal Processing Reference
In-Depth Information
can detect color intensity flicker in large regions unless the alternating
checkerboard pattern is used.
10.14 VHDL Graphics Display Design Example
This simple graphics example will generate a ball that bounces up and down on
the screen. As seen in Figure 10.10, in the VGA_BALL project the ball is red
and the background is white. This example requires the VGA_SYNC design
from Section 10.4 to generate the video sync and the pixel address signals. The
pixel_row signal is used to determine the current row and the pixel_column
signal determines the current column. Using the current row and column
addresses, the process Display_Ball generates the red ball on the white
background and produces the ball_on signal which displays the red ball using
the logic in the red, green, and blue equations.
Figure 10.10
Bouncing Ball Video Output.
Ball_X_pos and Ball_y_pos are the current address of the center of the ball.
Size is the size of the square ball.
The process Move_Ball moves the ball a few pixels every vertical sync and
checks for bounces off of the walls. Ball_motion is the number of pixels to
move the ball at each vertical sync clock. The VGA_SYNC core is also used to
generate sync signals and pixel addresses, but is not shown in the code below.
ENTITY
ball
IS
PORT(
I G
L
Red, Green, Blue
:
OUT
STD_LOGIC
;
I G
L
vert_sync_out
:
IN
STD_LOGIC
;
I G
L
pixel_row, pixel_column :
IN
STD_LOGIC_VECTOR(
9
DOWNTO
0
));
END
ball;
ARCHITECTURE
behavior
OF
ball
IS
-- Video Display Signals
I G
L
reset, Ball_on, Direction
:
STD_LOGIC
;
I G
L
Size
:
STD_LOGIC_VECTOR
( 9
DOWNTO
0 );
I G
L
Ball_Y_motion
:
STD_LOGIC_VECTOR
( 9
DOWNTO
0 );
I G
L
Ball_Y_pos, Ball_X_pos
:
STD_LOGIC_VECTOR
( 9
DOWNTO
0 );