EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 14 Electronic Dice Game: From ASM Chart to - PDF

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report
Category:

Essays & Theses

Published:

Views: 4 | Pages: 11

Share
Related documents
Description
EE 459/500 HDL Based Digital Design with Programmable Logic Lecture 14 Electronic Dice Game: From ASM Chart to Microprogrammed Control References: Chapter s 5 from textbook Overview Dice Game Description
Transcript
EE 459/500 HDL Based Digital Design with Programmable Logic Lecture 14 Electronic Dice Game: From ASM Chart to Microprogrammed Control References: Chapter s 5 from textbook Overview Dice Game Description ASM chart Controller Implementation 1: Behavioral Controller Implementation 2: Equations Microprogrammed Control Two address microcode 2 1 Electronic Dice Game: there are two dice to roll Rules of the game: After the first roll of the dice, the player (P) wins if the sum is 7 or 11. P loses if the sum is 2, 3, or 12. Otherwise, the sum P obtained on the first roll is referred to as a point, and P must roll again. On the second or subsequent roll of the dice, P wins if the sum equals the point, and loses if the sum is 7. Otherwise, P must roll again until finally wins or loses. 3 Electronic Dice Game: Flow Chart Reset: to initiate a new game Rb (Roll button): If Rb is pushed, dice counters count at a high speed When released, the values in the two counters are displayed, and the game proceeds Store sum 2 ASM Chart Inputs to Control Unit: Reset Rb D7 ( 1 if sum of dice is 7) D711 ( 1 if sum is 7 or 11) D2312 Eq (sum = Point) Outputs of Control Unit: Roll Sp (Sum to be stored) Win Lose Overview Dice Game Description ASM chart Controller Implementation 1: Behavioral Controller Implementation 2: Equations Microprogrammed Control Two address microcode 3 State Graph of Control Unit (Mealy or Moore?) Control Unit: Behavioral VHDL Code (1/2) library BITLIB; use BITLIB.bit_pack.all; entity DiceGame is port ( Rb, Reset, CLK: in bit; Sum: in integer range 2 to 12; Roll, Win, Lose: out bit); end DiceGame; architecture DiceBehave of DiceGame is signal State, Nextstate: integer range 0 to 5; signal Point: integer range 2 to 12; signal Sp: bit; begin process(rb, Reset, Sum, State) begin Sp = '0'; Roll = '0'; Win = '0'; Lose = '0'; case State is when 0 = if Rb = '1' then Nextstate = 1; end if; when 1 = if Rb = '1' then Roll = '1'; elsif Sum = 7 or Sum = 11 then Nextstate = 2; elsif Sum = 2 or Sum = 3 or Sum =12 then Nextstate = 3; else Sp = '1'; Nextstate = 4; end if; 4 Control Unit: Behavioral VHDL Code (2/2) when 2 = Win = '1'; if Reset = '1' then Nextstate = 0; end if; when 3 = Lose = '1'; if Reset = '1' then Nextstate = 0; end if; when 4 = if Rb = '1' then Nextstate = 5; end if; when 5 = if Rb = '1' then Roll = '1'; elsif Sum = Point then Nextstate = 2; elsif Sum = 7 then Nextstate = 3; else Nextstate = 4; end if; end case; end process; process(clk) begin if rising_edge(clk) then State = Nextstate; if Sp = '1' then Point = Sum; end if; end if; end process; end DiceBehave; Overview Dice Game Description ASM chart Controller Implementation 1: Behavioral Controller Implementation 2: Equations Microprogrammed Control Two address microcode 5 Control Unit: Just a Sequential Circuit Typical block diagram of sequential circuit Need three Flip- Flops for State register Construct State Transition Table and then use K-maps to derive equations for: A+, B+, C+, Win, Lose, Roll, Sp State Transition Table Derived from the ASM chart A row for each link path in the ASM chart 6 Control Unit: VHDL Code Overview Dice Game Description ASM chart Controller Implementation 1: Behavioral Controller Implementation 2: Equations Complete game Microprogrammed Control Two address microcode 7 Counters + Adder of Datapath: VHDL Code Complete Dice Game: VHDL Code 8 Overview Dice Game Description ASM chart Controller Implementation 1: Behavioral Controller Implementation 2: Equations Complete game Microprogrammed Control Two address microcode Hardware arrangement for microprogramming CAR SEL DATAPATH 9 ASM chart with Moore outputs and one qualifier per state ASM chart modifications: All output converted to Moore outputs Only one input variable must be tested in each state Two-address microprogram for Dice Game 10 Final hardware arrangement DATAPATH? CAR ROM 11 x 15 DATAPATH SEL NSF NST SEL 3 Summary Electronic Dice Game Multiple ways to design the control unit Microprogrammed control is a more structured approach for complex systems 22 11
Recommended

15 pages

10 pages

21 pages

26 pages

27 pages

48 pages

10 pages

94 pages

122 pages

26 pages

13 pages

7 pages

10 pages

33 pages

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 19 Pipeline Design

28 pages

View more...

FOOD FOR THOUGHT. Diet and Nutrition for Adults Living with Crohn s Disease & Ulcerative Colitis. - PDF 