Home

Report

image

Contents

1. operate the transform function Each diamond has a fixed generating function such as creat_TQ create_L and etc In these functions we have defined all shapes of one certain diamond and put them in a chain list When we want to transform one diamond the function show_next will be called In the show_next function the information of the diamond to be transformed will be got in the create function and the usual judging methods will be applied again to check if current diamond can be transformed c Deleting As mentioned before show_down function can not only accelerate the falling speed of certain diamond but also can delete the rows full of diamonds Each time the system will detect these rows from bottom row 19 to see if the value of the blocks in this row are all equal to 1 if it is true the information of the line above will be written in this line color and value which seems that one line has been deleted 2 6 4 3 Interrupt For the timer counter in the software level we start the timer at the beginning of booting the system After a fixed period which is set by us to decide the falling speed of the Tetris blocks the timer counter will send an interrupt signal and the processor will respond to it by calling showdown function so that the Tetris blocks will automatically fall down at fixed distance per fixed time slot 2 6 4 4 VGA displaying In the software part since we have already implemented the VGA con
2. cece cece ccc eeeeeee eee e eee neeaaas 12 2 0 Brief Installations and User Mana siiiscicissecndionssncsaadoiescareasdeanieauedses wwadebes tebiesenstaweves 13 SCC SOS oop osc ane sense E E E ese E E 14 3 a Problems Encountered and Solved 0 cece ccc ccc cece cece cece e eee e eee e eee eeeeeee eee eeetenenes 14 3 b Lessons Learnt and Future Work 0 cc cece cece cece eee ee ee een eee e eee cece teen ene e eee ener 14 A ca 0 11 a1 0101 610 E eee ee ee E en Nn E S E ree ee ee 15 FEE eee ee ee ee eee ee 15 4 Acknowledgment 0oooneeeeeoeessossssrrreserersrrreereseereeressssessssssrersrerseeererreeeessssosssssssosssssrseseeeerereeeee 15 mA E E EE EEEE EE A E T EEA EE E E A 15 Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 1 Introduction The Tetris is a typical game and in this project we will use the Nexys 2 standard developments board to realize the functions of it All the developments will be based on the Xilinx ISE 10 1 Design Suite The hardware architecture contains timer processor VGA controller PS 2 controller and off chip RAM As to the software architecture interrupt will be added and many other specified functions will be used to realize the game s behaviors or drive the hardware Timer has been added to hardware since we want to realize the response of t
3. of this operation the shift register will be filled with the scan code And then the ps2 controller will sent the scan code which is stored in the shift register to the PLB bus So finally the Microblaze processor will take the scan code from the PLB bus VGA red VGA_ green VGA blue heyneb weynob As to the PS 2 controller design base on the one provided on the website we made some little modification one is change the bus type to PLB bus so it can fits the new hardware platform The second is we have to change the counter number in the original ps2 controller to synchronize the clock of keyboard with the clock of the system By doing this the PS 2 controller can return the right scan codes to the system in our case because our processor s clock frequency is SOMHZ so we only need to decrease the number of the counter in the state machine to the value 1250 to meet the time requirement Timer Counter Finally considering the timer counter it is used to generate an interrupt and then the processor will respond to that interrupt and call the interrupt service function and finally by executing the interrupt service program we can control the falling of each Tetris block And the timer counter is also used to control the falling speed of each Tetris blocks Its functions can be configured to be added to the hardware when initiating XPS Then it s the work of the software to set and activate it since the timer counter is the onl
4. Department of Electrical and Information Technology x UNIVERSITY Embedded System Design Advanced Course EDA385 Spartan 3E 1200 based Tetris game box Jia Li sx07jI7 student lth se Qingyuan Zhang sx07qz4 student th se Yiming Huo sx07yh4 student Ith se Supervisors Flavius Gruian Per Andersson Oct 19 2008 wv Tere p Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 Abstract As in our design we have developed Spartan 3E 1200 based Tetris game box on the Nexys 2 standard developments board under the Xilinx ISE 10 1 Design Suite The user player can operate the games on the standard keyboard by changing the direction and speeds of the tetris shapes The highlights of this design are we have saved 99 5 of BRAMS than the normal design and the IP core has been designed to be more flexible and compatible to integrate more other software based games The project is initiated by Department of Computer Science Lund University Contents t GOCE eE cn es faceioan secon E EEE 3 2 Project Doslo ee eee ee eee 4 2 a Hardware TniplementatiOm 24 20 lt 5 4asenene denne anceeeenentpewnsa sedate EEE En 2 b Software Implementation c cece cece cece eee ee ee eee enn n nn REESE EEE EE EEE EEE EEE EEE EE EEE 7 2 c Debugging and Optimizations in System Level 0
5. LB Apart the problem above another tricky problem appeared in the testing stage that is the problem of the boundaries which have been mentioned in the debugging part They have been resolved by modifying the corresponding functions in the software 3 b Lessons Learnt and Future Work First of all the technology flies so fast beyond people s imaginations Embedded System do have changed human being s lives in many ways Obviously it has quite a bright future Secondly through this lecture we gradually have a deeper understanding of this field and what to do and how to do As to a feasible project practical title schedule allocation of assignments team spirit have to be planned and strictly stick to every member should play their most capable and appropriate roles in a project then the project can be finished successfully in time To sum up affairs that are done by due degrees are soon ended On the aspects of academic learning we gradually have a deeper understanding about the top down design methodology Particularly in our process when problems happened or the results were not what we have imagined we need to quickly go back to the topology analyze to locate where the errors were produced from whether they were caused in SW level or HW level and how One more point the comprehensive thinking of whole system 1s critical in designing a robust system since many factors and elements have to be taken into considerat
6. any times accidently but luckily we encountered the problems as following Figure 2 4 Problems of Boundaries As shown in the figure 2 4 the Testris blocks sometimes could be moved out of the boundaries of the game area it happened when we moved the Tetris blocks to left or right boundaries of grids while they were falling So we go back to the design topology again check our most suspectable part which has caused this problem the special functions in the software at last the causes were found lying on using the functions show_left and show_right without programming the commands of limiting them insides the grids Then after debugging the errors we finally got the right result as below Figure2 5 The Right Displaying of Tetris Game 12 Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 2 d Brief Installations and User Manual of the Video Game Installations 1 Open your host connect the JTAG to the Nexys 2 standard developments board connect the USB wire to the host from the board 2 Connect CRT displayer with VGA port and PS 2 based keyboard to the board 3 Download the packed files of the project from the website 4 Start Xilinx EDK 10 1 on your host open the project file and download it to the FPGA 5 Open the debug of the Xilinx EDK10 1 in the debug window type
7. diamond These three states are represented by three values 0 1 and 2 respectively The method to set the boundary is based on this very assumption The array of the main display window is 12 20 The value of the blocks in row 0 row19 volume O and volume 11 are set to 1 which means that we assume that there are already diamonds in these positions and these blocks cannot be replaced by other diamonds Meanwhile other blocks are set to zero to be ready to accept new diamonds 2 6 4 2 Moving transforming and deleting the diamonds a Moving As we mentioned above the player can control the movement by using the direction arrows on the keyboard For example if the expected moving direction is left and assume that the current positions of the four blocks consist of the diamond are x1 yl x2 y2 x3 y3 x4 y4 the moving steps are as follows Firstly judge the four values of the blocks of the next position the diamond is about to move to They are xl yl 1 x2 y2 1 x3 y3 1 x4 y4 1 A counter is needed to be used here If all the values of these four blocks are not 1 then we draw the diamond color change the values to 2 in the next position and draw the background color change the values to O in the current position Otherwise the diamond will stay at the current position and the values of the four diamond blocks are changed from 2 to 1 b Transforming If the response to the keyboard is up the diamond will
8. he interrupt Block_ram Micro_blaze VGA_Controller PS2_ Controller xps_timer Figure 1 1 Architecture of Hardware As shown above in particular we add the timer to the hardware however it needs no modifications Actually we only use the default functions to control the interrupts in software As to the software implementation we integrate the Tetris programs into the whole system which contains many special functions recalled by interrupts and these functions would actually drive the hardware 2 Project Design 2 a Hardware Implementation In the hardware implementation the most critical design of VGA controller is to allocate the resource of BRAM since the size of BRAM is limited As to this case in the Tetris game all the shapes of Tetris diamonds are orthogonal and actually consist of many same little regular squares SO we can just divide the 640 480 resolution by small 16 16 displaying blocks in which the same color will be drawn We don t need to specially define and store each pixel s color information into the BRAM we just need to define every 16 16 matrix based square which saves 99 5 of BRAM than the original solution 640 480 Figure 2 1 BRAM Using Strategy VGA controller In the VGA controller part as shown in fig2 1 we divide the whole screen into 40 30 units and each unit consists of 16 16 pixels So in the memory part each memory unit will store the color informat
9. interrupt Stay at current dispaying Figure 2 3 Topology of Software Design Y Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 a When the game starts the initialization of the whole system such as setting the boundaries resetting the initial parameters of each Tetris block will be done in this step b Anew diamond will be obtained by calling the function get_diamond c Enabling the interrupt and waiting for the response to the keyboard d Response to the keyboard and doing the corresponding action such as moving the diamond to left or right transforming the shape of the moving diamond accelerating the falling speed and deleting the lines full of diamonds If the action is done and the game is not over then continue to get a new diamond e When the new diamond meets the up boundary of the display window the game is Over f Interrupt has to be stopped as soon as the game is over and another judgment comes out If F1 button of the keyboard is pressed the game will start again otherwise the game will stay at the current displaying 2 b 4 Some detailed descriptions of the critical parts in software Initialization Boundary setting in our design we have three states for each block of the display window They are no diamond having movable diamond having static
10. ion for each unit And then by controlling the reading address we can extend this to the 640 480 resolution by repeatedly read the same unit for 16 16 times Through using this method we don t need to store each pixel into the memory unit Which will save the memory size to a large extent finally we only use 40 30 memory units to store the whole 640 480 pixels color information So later in the software design what we need to do is to change the relative units information so as to change the whole screen s displaying And for the grid part it is a spec ial case we solve this problem by using a MUX in the VGA controller which means when we arrive at the address where we need to draw a grid we just choose another memory block which stores only the grid color information instead of reading the data from the main memory block which is used to store the Tetris blocks color data Bus2lP_Reset pam pozat Bus2iP Cik Pa BustIP_CIk Bus2IP_R NYY Bus2lP Addr BuszlP Data amp Pixel _elk_ gen read addr gen Bus21P_ Clk reset Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 Further more for the color information stored in the memory we allocate 3 bits for using which means it can stand for 8 main different colors on the screen Considering the SRAM since in our case we use the off ch
11. ions synchronously in the HW SW co design And besides the above it always works like no pains no gains It s extremely hard when the problems appeared and got people stuck for hours or even days man can become quite upset to lose the patience however what we need to do is just hold on never give up It s better for one to review the design methodologies and then ask for some clues or suggestions from experienced people It normally can save much time and resolve problems quickly Then the turning point is close to you Finally due to the lack of project experience we didn t find enough time for the optimizations of the project for example we thought we could add the scores board and some beautiful picture as the background We also expect to generate some music by integrating the audio functions 14 Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 3 c Contributions Jobs Assigned Hardware design namely VGA controller PS 2 Controller modifications Guidance on software design especially in Interrupt Technical manager Qingyuan Zhang Software design Hardware assistant design in Timer Coordinator and secretary Yiming Huo Software assistant design in Tetris game C programming Debugging and testing Proposal Presentation and Report Documents organization
12. ip memory to store the software program so we need to add a SRAM controller into IP core which will establish the connection between processor and off chip memory Block ram Color_data_selec Color spill grid_color_gen smc gen Bus IP_Chk vomit gen BusziP_Cik F BystiP_Cik Fuert pixel_elk pixel_elk woa_wsyne Figure 2 2 RTL Schematic of VGA Controller As we can see from the figure 2 2 the block hsync_gen and the vsync_gen are used to generate the correct synchronized signal to CRT displayer And the Block_ram is used to store the color information of each tetris block The grid_color_gen stores the grid color information and through the color_data_select block which is controlled by the hcnt and vent it can select whether read the color information from the block ram or from the grid_color_gen block After this selection The output 8 bits data will further be splitted into 3 parts which contend different color information And then forward them to the output ports VGA_red VGA_ green VGA_ blue PS 2 controller The basic operation principle of PS 2 controller is when a key is pressed the keyboard will sent the scan code to the ps 2 controller due to the series communication between Keyboard and PS 2 controller So the ps 2 controller won t take all of those scan code at one time Actually every 25ms the ps 2 controller will take one bit of the scan code and push it into the shift register From repeating
13. mond The player can control moving diamonds by using the four direction arrow keys namely left right down up to go left right fall down and transform respectively Each time when the diamond falls down the program will judge if any horizontal row can be deleted The diamond will fall down automatically and the player cannot stop it during the process 2 b 2 Highlights of our Tetris game a Using off chip RAM on the board to save the data for the game b Each diamond consists of four 16 16 displaying blocks as mentioned in 2 a c Setting boundaries of four edges of the play window so that the diamond will not move out of it d Using a structure to record the position and color information of each diamond e Drawing different colors and shapes for the diamonds red yellow green and blue f The diamond falls down spontaneously The default moving speed can be controlled by the timer interrupt and the player can accelerate the speed by pressing the direction arrow down e The game will be over when the new diamond reaches the upper boundary of the game area 2 b 3 The flow chart of the software is shown in Figure Start Get a new diamond Response to the keyboard Show_ next how_down accelerating transformation alling and deleting lines Show left Show_right Move the diamonds Enable the interrupt Delete the lines which are full of diamonds stop the
14. s and editing Of which in the report part Jia Li is in charge of hardware part Qingyuan Zhang works on summarizing the main ideas of the software part Yiming Huo takes responsibilities for the debugging part user manual part and overall report organization arranging editing and rectifications 3 d Extras From our on line resources the relative screen shots diagrams schematics address the project can be downloaded from the link as below http www edacn net bbs viewthread php tid 133153 amp page 1 amp extra pase 3D1 pid11635 20 4 Acknowledgement We should firstly give our great thanks to Flavius Gruian Per Andersson who have given us careful guidance and helps during the project and also the previous laboratories of the Embedded System courses And we also remember our best regards to our classmates who work with and help us together during this period Tack sa mycket 5 Reference 1 Digilent inc Nexys2 board Reference Manual 2008 2 Xilinx Inc Xilinx ISE 10 1 Design Suite Software Manuals and Helps PDF collection 2008 3 W Wolf Computers as Components Principles of Embedded Computing Systems Design Morgan Kaufman Publisher 2001 4 http www cs lth se EDA385
15. the commands below dow executable elf run After installing the game properly following the operations below User manual a a Press the ENTER key to start the game Move the Tetris blocks left and right by pressing A or D on the keyboard Move the diamonds faster by pressing S if you want Transform the diamonds by pressing W on the keyboard Try to delete the rows of diamonds by putting them full in a row or more rows Press F1 to restart the game if your game is over Transform Zoom ii Power Enhance ments Findera Speech _ Readers Sunt Oni Tooth Color Pointer Cursor Desktop Web Teri gupi appre Dockdr aisquared com A E A H Fo F F Fo FO Mi FE PS SL PEB hue tape fered Lech Lesi Lich ee gso Ta go a H Cm nw wb QOQWERTYUIOPT q m pu 7 w ASDEGHU Shit ZXCVBNM 7 Shift 1 Gri amp A 0 k 9 6 3 Del I 8 KLU Ener te pp 4 5 2 Ins Speed falling Move right Figure 2 6 Control keys of Tetris Game 3 Conclusions 3 a Problems Encountered and Solved As to the Xilinx EDK 10 1 it will not support the OPB any more So principles and protocols of the PLB specification have to be researched and utilized since most examples of the VGA controller on the website are based on OPB And what s more a lot of reference about how to interface the PLB with the other peripherals has been researched particularly the using of the control signals of P
16. troller as an IP core into our hardware system so then what to do next is only to send the correct address and corresponding data into the VGA controller Thereby the VGA controller could be imagined as a painter who will finish the rest of work In the software design this process is realized by using the function called gridpainter 2 6 4 5 PS 2 controller For the PS 2 control part the software will receive the scan codes which are sent by PS 2 controller and then it will call the corresponding code sections to perform the movements of the Tetris blocks The following table lists some import functions we use during the software development 10 Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 Important special functions Function name Functions InitializeQ set the boundary of the grid initialize the values and colors for each grid random Return a random integer value eridpainter Get the values and colors for the current grids and next grids of the moving diamond Seandeld Show nex Show down Show eft Show sight Software size Text bits Data bits Bss bits Dec bits Hex bits 21390 1928 11818 35136 8940 2 c Debugging and Optimizations in System Level Finally we enter the stage of testing debugging and verifications After booting the system By testing m
17. y interrupt source Then it isn t necessary to implement an interrupt controller And hereby in our design what we do is to directly connect the interrupt output of the timer counter to the interrupt input of the processor Interrupt Control In the overall system design since the Microblaze only needs to handle one interrupt source which is generated by the timer so there is no reason to implement any other interrupt controller module in to our hardware design If we need to handle more than one interrupt we have to implement interrupt controller to response different interrupts and then send the highest priority interrupt to the Microblaze Finally we can get the Device Utilization as following Selected Device 3s1200efg320 5 Name Number Used out of Total Percentage Occupied Jia Li sx07j17 Embedded System Design Advanced Course EDA385 Qingyuan Zhang sx07qz4 Department of Electrical and Information Technology LUND UNIVERSITY Yiming Huo sx07yh4 Oct 19 2008 As shown above the only 35 of BRAMs have been used which means the optimization of memory resource works and more extensive functions can be integrated 2 b Software Implementation 2 b 1 Introduction of the game As the traditional Tetris game two windows are displayed on the screen The larger one is the main window including one moving diamond Tetris block and several static diamonds and the smaller window is just used to display the next random dia

Download Pdf Manuals

image

Related Search

Report reports report card report builder report passport lost report fraud reportsnow report synonym report template report phishing outlook report child abuse reportedly report identity theft report of contact report abandoned vehicle report a problem apple report animal cruelty report sheet reportbeam report fraud ftc government report builder download reporting central reporter nih reported speech reporte de puentes reporting from ukraine

Related Contents

SOYO SY-7VCA User's Manual  Edimax PS-1206UWG Wireless Print Server  Manuel d`utilisation Instruction Manual MPF140  Psiber ReportXpert User`s Manual  Manuale Utente parte I  TRANSMISSION AND TRANSFER CASE  Bedienungsanleitung herunterladen  Oster TOASTERS User's Manual  USER GUIDE — Indirect Treatment Comparison    

Copyright © All rights reserved.
Failed to retrieve file