Presentation is loading. Please wait.

Presentation is loading. Please wait.

Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How.

Similar presentations


Presentation on theme: "Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How."— Presentation transcript:

1

2

3 Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How to Play To begin play press Button 4. The clock will begin and a value will be displayed. Enter the displayed value on the switches. Zero is towards the top of the game board and one is towards the bottom of the game board. The player has 30 seconds to convert as many numbers as possible. At the end of the 30 seconds, the player’s score will be displayed. If it is the new High Score “HI” will appear next to the player’s score. If it is not the new High Score then “00” will appear next to the player’s score. To display the High Score press Button 3. To clear the High Score Memory, press Button 2.

4 Continually cycles through 00-FF at each rising edge of the clock. When the game is started or a value gets checked, the random number output at that instant is displayed on the 7-segment display as the new hex value. Randomhex Module

5 This module sends W8Y_control the BTN2 signal, taking into account OutOfTime. This changes the button operations in different states. BTNcontrol Module

6 Checks the random hex value against the switch value Only checks when BTN1 is pressed during the game -Controlled by chkload, which is controlled by W8Y_control If the values are equal, then the score is incremented. If they are not equal, the score remains unchanged. Check Module

7 Score = 1 Score = 0Score = 1 (unchanged)

8 The 30-second game timer. When time runs out, OurtOfTime goes high. The game timer is displayed in decimal. -This was accomplished by a case statement. Timer Module case time30 is when "00011110" => time <= "00110000"; --30 when "00011101" => time <= "00101001"; --29 … when others => time <= time30; --09to00 end case;

9 Timer Module elsif (clk = '1' and clk'event) then … elsif decenable = '1' then-- during game time490 <= time490 + 1; if time490 = "1011011111" then-- 735 decimal time30 <= time30 - 1; time490 <= "0000000000"; end if; … Timer construction in VHDL.

10 Timer Module Actual hex values “Forced” decimal values OutOfTime goes low when timer is initialized and goes back to high when time runs out.

11 The running score is displayed as you play. For each correct answer, one LED lights up. Beginning with the 9 th correct answer, the LEDs turn off for each additional correct answer. ScoreLED Module

12 Three states for HexBinIQ: Main, Game, ShowHigh Main waits for BTN1 to start a new game, or you can press BTN3 to view the high score (ShowHigh). ShowHigh cannot be executed during the game. State Diagram: The ROM Main Game Show- High BTN3 = 0 BTN3 = 1 OutOfTime = 1 BTN4 = 1

13 There were seven new opcodes added to the set from Lab 9. New OpCodes -- New Data Stack Instructions constant swapNs: opcode := X"0B";-- Swap N, N2 -- New Return Stack, Conditional, and I/O instructions constant e1fetch: opcode := X"38";-- E1@ constant e2fetch: opcode := X"39";-- E2@ constant Tstore: opcode := X"3A";-- Tstore constant Nstore: opcode := X"3B";-- Nstore constant reset:opcode := X"3C";-- reset constant check:opcode := X"3D";-- Check

14 New OpCodes when E1fetch =>tsel <= "01"; tload <= '1'; dssel <= "11"; esel <= '0'; when E2fetch =>tsel <= "01"; tload <= '1'; dssel <= "11"; esel <= '1'; when swapNs =>nsel <= '1'; nload <= '1'; dpush <= '1'; dpop <= '1'; when Tstore =>tdload <= '1'; when Nstore =>ndload <= '1'; when Reset =>ResetSig <= '1'; when Check =>chkload <= '1'; The new opcodes defined in W8Y_Control.

15


Download ppt "Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How."

Similar presentations


Ads by Google