Verilog Project Discussion Solutions
design and implement a simple game on NEXYS 4 DDR FPGA boards. The Boards include eight 7-segments, 16 Switches, 16 Leds, and (5+2) push buttons as below. (CPU RESET and PROG are also push buttons)
Description: In this game you play the role of a police to arrest a thief. Police’s and the thief’s locations are shown with (XP,YP) and (Xt,Yt) coordinates, where all indexes are in range of [0,15] (inclusive).
First you need to initialize the coordinate of police and thief. The thief’s location should be entered via the 8 switches (SW[15:8]) and police’s location is entered by other 8 switches (SW[7:0]).
SW[15:12] ==> Xt
SW[11:8]
SW[7:4]
SW[3:0]
==> Yt==> XP==> YP
After you set the switches to the desired locations, the locations of police and thief should be shown in the 7-segments as below. The seven segment #7 shows the X index of the thief’s location and 7-segments #6 shows his Y location. The 7-segments #5 and #4 show the police location (Xp,Yp), respectively. All these four 7-segments should show the location in hexadecimal format. For example, if the location of thief and police are (14,9), and (3,10), respectively the number that each 7-segment should show are:
1
7-segnent #7 ==> E
7-segnent #6 ==> 9
7-segnent #5 ==> 3
7-segnent #4 ==> A
The game starts by pushing reset button (BTNC). The locations should be loaded in appropriate registers in your design after BTNC is pushed. Now you can move the police by pushing BTNU (move up), BTND (move down), BTNR (move right), and BTNL (move left). Each push moves the police one location in the related direction.
The number of steps (moves) the police takes should be counted. To do so, there should be a counter in your design that whenever you push one of the BTNU, BTND, BTNR, and BTNL it counts up by 1. This value of this counter should be shown in 7-segment #1 and #0 (in Fig. 2) in decimal format. For example, if the move buttons have been hit for 15 times totally, the 7-segments should be turned on like this:
o 7-segnent #1 ==> 1o 7-segnent #0 ==> 5
Not that the thief’s location is constant, but the police’s location should be updated whenever each move happens, and so the related seven-segments needs to be updated accordingly. In fact, the thief location doesn’t change but the police location and the number of moves (number of pushed buttons counter) should be updated dynamically and their 7- segment should show the current status.
In each move, the police can go 1 location to left, right, bottom or up using the push buttons. If Police reaches to the thief location, then game is over. However, you need to follow the following rules:
2
o The aim is that the police arrest the thief using shortest path or near shortest paths, i..e, if shortest path needs N moves (N times pressing push buttons) for police, then if police reaches to the thief location with at most N+5 push, the police wins and all the LES are blinking with 1Hz frequency.
o If the police reaches to the thief’s location with more than N+5 pushes (where N is the shortest path between them), the game is over but with a fail so all LEDs should show turn off.
o If police has not reached to the thief’s location yet but the path so far he moved is more than N+5 then again he fails and all LEDs should turn off.
Note that it is assumed that after starting the moves, the center button and switches are not pushed (you do not need to consider the case that center button is pushed after the first move started).
If the police is on the borders ,i.e.,Xp=15,Xp=0,Yp=0, orYp=15 and the new movement is towards out of the shown grid, the police will stuck in his current position. However, the pushed buttons counter should be increased by 1 by any push (even if not move because of reaching to the boarder). To make it more obvious, suppose that the police is on (15,6), and you push the PTNR, so he cannot go further than 15 and will still in (15,6)
Requirements: 1200
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more