Beruflich Dokumente
Kultur Dokumente
)
0,0
Figure 3. Graphic display method
In the virtual coordinate system, each square is a 16 * 16 set
of pixels. Each of the 16 * 16 pixel set is regarded as a graphic
display unit. In a graphic display unit, the outermost layer (white
square area) pixel is set to:
pix (2 downto 0) <= 000;
The outer layer (light gray area) pixels set to:
pix(2) <= mclk when rect(0)= '1' else '0';
pix(1) <= mclk when rect(0)= '1' else '0';
pix(0) <= mclk when rect(0)= '1' else '0';
The inner layer (dark gray area) pixels set to:
pix (2 downto 0) <= rect(2 downto 0);
2) Method of displaying text character
We design a text display area, in which players can see key
tips and scores information. The display principle of the text
characters display area is similar to graphic displaying. Regard a
collection of 8*8 pixels as a characters display unit. Pixel display
effect appears as shown in Figure 4.
Figure 4. Character display method
Set the pixel white squares area to:
pix (2 downto 0) <= 000;
Set the pixel gray squares area to:
pix (2 downto 0) <= 111;
By fast read/write to the storage unit, graphic display module
and text display module, constantly transmits new display signal
to VGA mode to complete the refreshment of the screen, giving
game operator the right visual feedback.
D. VGA module
The function of VGA module in the game is to translate
coordinate and pixel settings information received from the
graphic display module and the text display module into VGA
control signal, and then correctly display the image information
by a monitor.
This module also helps divide game and feature area on the
screen, as shown in Figure 4.
HC and VC, is respectively the VGA Line synchronizing
signal Field synchronizing signal.When HC and VC scanned are
into two specific areas, return '1' as vid and text values, which
means this two range is a legal area. Graphic display module
operates the area vid='1', and text display module operates the
area text='1'.
0uh`
d`:'u) uu
v`d !`
txt d`:'u)
uu
txt !`
0,0 800,0
h
v
0,?! 800,?!
!99,99 3b0,99
399,99 bb,99
399,??8 bb,??8
!99,+?0 3b0,+?0
Figure 5. Overall layout of game screen
IV. VERIFIED IMPLEMENTATION OF GAME DESIGN AND
RESULT ANALYSIS
The game program is done in ISE12.3 environments using
VHDL language. In the validation experiment we used the
Xilinx's spartan-3AN FPGA starter boards, a PS/2 interface
keyboard, and a CRT monitor.
During the initial validation experiments, blocks appear
garbled. Each sub-block does not display in predefined
coordinate. Dropping and moving action can work, but rotating
action cannot be completed. The reason is that the signal
random is not synchronized with game control program clocks,
and when generating new blocks, assignment delay leads to
temporal disorder and being unable to initialize the shapes of
blocks as preset. The solution is to unify the clock of the change
of the random value and the game control.
Eventually, the game runs perfectly, with keyboard
controlling without delay, image displaying accurately, and
achieving all the program settings.
REFERENCES
[1] Xu Xin, Hongqi Yu, Yi Fan, Lu Qizhong. based on FPGA in embedded
system design. Beijing: China machine press, 2004. 9.
[2] Du Yong. FPGA/VHDL Design entry and advanced. Beijing: China
machine press, 2011
[3] Liu Tao, Xinghua Lou. FGPA digital electronic systems design and
development. Beijing: people's Publishing House of posts and
telecommunications, 2005.6.
[4] Xilinx. Spartan-3 Generation FPGA User Guide.
[5] Wayne Wolf. FPGA-based system design. Beijing:Chnia Machine
Press,2005.
2927
[6] Fuqi Liu. FPGA embedded project development practice. Beijing: Publishing House of electronics industry, 2009.
2928