1 / 162

Experiment 6 Labs 9 - 13 Outline Presentation

Experiment 6 Labs 9 - 13 Outline Presentation Design of Block 6 of the Ppm Digital System (using Term Project pages 38 – 48 and Digital System Design Example ) Individual work Developing Ppm Block 6. Analysis of the Term Project Polytechnic Playing Machine, Ppm

vivian
Download Presentation

Experiment 6 Labs 9 - 13 Outline Presentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Experiment 6 Labs 9 - 13 Outline • Presentation • Design of Block 6 of the Ppm Digital System (using Term Project pages 38 – 48 and Digital System Design Example) • Individual work • Developing PpmBlock 6 CS 2204 Spring 2014

  2. Analysis of the Term Project • Polytechnic Playing Machine, Ppm • The term project is human vs. machine • The black-box view From page 2 of the Term Project Handout CS 2204 Spring 2014

  3. LD0-LD2 on the FPGA board show the current state Ppm Input/output relationship From page 8 of the Term Project Handout Ppm operation diagram CS 2204 Spring 2014

  4. The Ppm Digital SystemPartitioning From page 9 of the Term Project Handout CS 2204 Spring 2014

  5. Digital Systems • A digital systemperformsmicrooperations • A digital systemconsists of digital circuits • A digital system consists of • A data unit (datapath) • It performs microoperations • A control unit • It controls the datapath CS 2204 Spring 2014

  6. Digital Systems • This first partitioning of a digital system is universal • A microprocessor is a digital system • An iPhone is a digital system • A computer is a collection of digital systems CS 2204 Spring 2014

  7. Digital Systems • The Data Unit has registers, ALUs and buses to perform microoperations • Registers keep (store) data (operands and results) • Arithmetic Logic Units (ALUs) perform additions, subtractions, multiplications, ANDS, ORs, etc. • Buses interconnect registers and ALUs CS 2204 Spring 2014

  8. Digital Systems • The Control Unit (Sequencer) • The control unit determines the sequence of microoperations based on the current state and status signals • In each state, it enables the microoperations of that state to happen in the data unit based on the status signals • Microoperations must start at the right time with correct inputs and end at the right time with correct outputs  We should notlose data and we should not use old data • Glitches, gate delays must be accounted for  When we design it, we account for every possible gate delay • The control unit also determines which state is next : Next State CS 2204 Spring 2014

  9. Digital Systems • The Control Unit (Sequencer) • The state register indicates the current state • Logic to generate the control signals and the next state more irregular than the Data Unit From page 11 of the Term Project Handout CS 2204 Spring 2014

  10. Digital Systems • The Control Unit (Sequencer) design • Hardwiring vs microprogramming • Since our Ppm system is simple, we use hardwiring and so we will concentrate on hardwiring from this point on Gate/FF networks = random logic = irregular Memory bits generate control signals and NS Highly regular but slower Not as regular as the datapath CS 2204 Spring 2014

  11. Often a decoder is used to generate the control and next state signals Often a counter is used instead of a register since we frequently trace the states sequentially • Digital Systems • The Control Unit (Sequencer) design • Hardwired Control Unit design • First partitioning on the Control Unit • Control Signal generationSubblock • Next State GenerationSubblock CS 2204 Spring 2014

  12. Digital Systems • The Control Unit (Sequencer) design • Hardwired Control Unit design • Often a counter+decoder combination is used in the sequencer If it is state 0,S0is1 Status signals Current state Next state S0 n D0 Control signals Control Signals & Next State Circuits S1 D1 Data n ..... n-to-2n Decoder n-bit up counter Next State Load S2(n-1) D3 clock CS 2204 Spring 2014

  13. 20 23 Block 1 • The Ppm Control Unit • Block 1, the Control Unit (the sequencer) • It controls the Data Unit • It determines the sequence of microoperations • Which microoperation happens when CS 2204 Spring 2014

  14. The Ppm Control Unit • Block 1, the Control Unit (the sequencer) • The control unit determines the sequence of microoperations based on the status signals • Implemented by using the finite-state machine (FSM) technique • Uses hardwiring • Gate and flip-flip networks generate control signals • Partitioned into • Control Signal generationSubblock • Next State GenerationSubblock CS 2204 Spring 2014

  15. The Ppm Control Unit • Block 1, the Control Unit (the sequencer) Hardwired Control Unit Gate and flip-flop networks generate control and next state signals Control Signal Generation Subblock Control signals Next State Generation Subblock Counter- Decoder combination to keep track of the current state CS 2204 Spring 2014

  16. Digital Systems • How can we design a digital system ? • If the digital system is complex • It is the case with real chips, such as microprocessors • Write an HDL program ►VHDL program ►Verilog HDL program CS 2204 Spring 2014

  17. Digital Systems • How can we design a digital system ? • If the digital system is simple • It is the case with our term project • Use the finite state machine (FSM) technique ► We draw a finite-state diagram • One obtains the operation diagram then converts it to a FSM state diagram with same number of states ►Get a finite-state diagram directly from the operation diagram CS 2204 Spring 2014

  18. Register← Source Wire/bus= Source • Digital Systems • How can we design a digital system ? • If the digital system is simple • It is the case with our term project • Use the finite state machine (FSM) technique ► Obtain a high-level state diagram directly from the operation diagram  Use the Register-Transfer Level (RTL) notation ► Obtain the datapath from the high-level state diagram ► Obtain the low-level state diagram from the datapath andhigh-level state diagram ► Obtain the Control Unit CS 2204 Spring 2014

  19. Digital System Design Using FSM • The Data Unit (Datapath) • The data unit performs microoperations based on the control signals • The data unit goes through states • The high-level state diagram indicates the microoperations ► Each state indicates the microoperations to perform in that clock period The Data Unit generates status signals as it performs microoperations ► In each state, the controlsignals indicate which microoperations should happen The low-level state diagram indicates which control signals should be active CS 2204 Spring 2014

  20. Digital System Design Using FSM • The Control Unit (Sequencer) • The control unit determines the sequence of microoperations based on the status signals • The control unit goes through states • Each state has a unique number to identify ► The state register value is the current state number • In each state, it enables the microoperations of that state to happen in the data unit based on the status signals • It generates the control signals and next state signals timely CS 2204 Spring 2014

  21. Digital System Design Using FSM • The Control Unit (Sequencer) • The sequencer is treated as a state machine • A low-level state diagram (with finite number of states) shows which microoperation happens when in terms of control signals • Each state shows ► Which control signal is active ► Which state to go to next based on status signals CS 2204 Spring 2014

  22. Digital System Design Using FSM • On paper • Start with the black box view and the textual input/outputrelationship of the digital system • Convert the textual input/output relationship to an operation diagram • Convert the operation diagram to a high-level state diagram with microoperations with the same number of states • A diagram with finite number of states • From the high-level state diagram, obtain the datapath • From the high-level state diagram and the datapath, obtain the low-level state diagram • Decide about how to implement the control unit (sequencer) • Hardwiring or microprogramming • Hardwiring is acceptable if it is not a complex digital system • It is the case with the Ppm term project CS 2204 Spring 2014

  23. Digital System Design Using FSM • On paper • Implement the sequencer which is treated as a state machine • The low-level state diagram (a state diagram with finite number of states) shows which microoperation happens when • Each state shows ►Which control signal is active ►Which state to go to next based on status signals • Each state has a unique number to identify ►The state register value is the current state • Convert control signal and next state information of the low-level state diagram to sequencer hardware • Place the counter (state register) + decoder combination if hardwiring is used • Obtain Expressions ►Obtain gate networks of the sequencer • Start implementing the circuits on computer • Start drawing the schematics by using the design on paper CS 2204 Spring 2014

  24. 70 15 Block 6 • Machine Play Block, Block 6 • The implementation at the course web site From page 40 of the Term Project Handout CS 2204 Spring 2014

  25. Machine Play Block, Block 6 • The implementation at the course web site Decision making M2 Sequencing Information gathering M4 M3 CS 2204 Spring 2014

  26. Machine Play Block, Block 6 • The implementation at the course web site • The inputs P1PT is Player 1 points P2PT is Player 2 points RWD is the regular reward points RD is the random digit DISP is the four displays NSD is the adjacency R1D is the next random digit BRWD is the digit played CODERWD is the code reward points PSEL indicates on which position the current player played CS 2204 Spring 2014

  27. Means at least one of them must be used • Machine Play Block, Block 6 • The implementation at the course web site • The inputs Means must be used P2sturn is 1 when it is Player 2 to play Stp2pt stores Player 2 points, here used to increment a counter to check if Player 2 has played 3 times or less Clearp2ffs stores 0 on registers, counters and FFs after Player 2 plays Clear stores 0 on registers, counters and FFs after reset Sysclk is the system clock at 6 Hz P2clk is the Player2 clock at 48 Hz CS 2204 Spring 2014

  28. 70 15 Block 6 • Machine Play Block, Block 6 • The implementation at the course web site • The outputs Students have to generate these 7 lines no matter what the playing strategy is P2CODE outputs the code digits that are discovered by the machine player P2CODE outputs are all zero if the code digits are not discovered CS 2204 Spring 2014

  29. Machine Play Block, Block 6 • The implementation at the course web site • The outputs P2add is 1 if the machine player adds the random digit to a display P2played is 1 if the machine player plays the random digit on a display P2SEL has a 1 corresponding to the position played when the machine player plays the random digit P2skip is 1 if the machine player skips the plays CS 2204 Spring 2014

  30. Machine Play Block, Block 6 • The implementation at the course web site • Its playing strategy (intelligence) • Play for now and future : Play differently for different game situations to eventually win the game • If the largest regular reward points wins the game it plays for the largest regular reward points (Action 0) • If it can play a code digit, it plays the digit on that position (Action 4) • If there is an adjacency and the next RD is a code digit, it plays on the largest adjacency position (Action 1) • If the game has just started, it plays on zeros (Action 2) • If it is behind, it plays on the largest regular reward points position (Action 0) • If no  If there is an adjacency, it plays on the largest adjacency position (Action 1)  Otherwise, if RD is not zero and the largest regular reward points is less than 8, it plays on the largest display position (Action 3)  Otherwise, it skips (Action 5) CS 2204 Spring 2014

  31. Course web site machine player playing strategy Player 2 wins the game with regular reward Player 2 cannot win the game with regular reward Action 0 Player 2 is behind Action 4 Action 1 From page42of the Term Project Handout Action 2 Adjacency Action 1 Action 0 Action 3 Action 5 CS 2204 Spring 2014

  32. Machine Play Block, Block 6 • The implementation at the course web site • How can we implement the machine player ? • We have to convert the playing strategy and game rules to major operations • We partition Block 6 into subblocks • An intelligent machine player has to gather substantial amount of information about the game and then decide how to play • It must have an informationgathering subblock and a decision making subblock CS 2204 Spring 2014

  33. Machine Play Block, Block 6 • The implementation at the course web site • How can we implement the machine player ? • It must have an informationgathering subblock and an decision making subblock • We collect and process information in several clock periods : Sequentially It gathers information sequentially  A sequential circuit !  We have to obtain an operation diagram since we have many FFs  Also, we need a controller to determine what to do in every clock period • The controller and operation diagram also imply that the Block 6 is a tiny digital system itself CS 2204 Spring 2014

  34. Machine Play Block, Block 6 • The implementation at the course web site • How can we implement the machine player ? • Three major operations, three subblocks • Information gathering about the current situation ► Information Gathering Subblock • Decision making about what to do with the random digit ► Decision Making Subblock • Controlling the operations in the block ► Sequencing Subblock CS 2204 Spring 2014 Experiment 6 Labs 9-13

  35. Machine Play Block, Block 6 • The implementation at the course web site • Convert the playing strategy and game rules to major operations From page44of the Term Project Handout • If the largest regular reward points wins the game it plays for the largest regular reward points (Action 0) • If it can play a code digit, it plays the digit on that position (Action 4) • If there is an adjacency and the next RD is a code digit, it plays on the largest adjacency position (Action 1) • If the game has just started, it plays on zeros (Action 2) • If it is behind, it plays on the largest regular reward points position (Action 0) • If no  If there is an adjacency, it plays on the largest adjacency position (Action 1)  Otherwise, if RD is not zero and the largest regular reward points is less than 8, it plays on the largest display position (Action 3)  Otherwise, it skips (Action 5) CS 2204 Spring 2014

  36. Machine Play Block, Block 6 • The implementation at the course web site • Convert the playing strategy and game rules to major operations • To an operation diagram • Sequential gather CS 2204 Spring 2014

  37. IG IG IG IG IG IG IG IG 9 P2clk periods D 2 Sysclk periods ≡ 0.364 seconds • Machine Play Block, Block 6 • The implementation at the course web site • Convert the playing strategy and game rules to major operations • To an operation diagram • Sequential gather IG≡ Information gather D≡ Decision making P2clk 48 Hz Sysclk 6 Hz CS 2204 Spring 2014

  38. Machine Play Block, Block 6 • The implementation at the course web site • Implement the controller (sequencer) as a state machine • Design the sequencer • A counter + decoder combination is needed to keep track of the states • A major portion of the Sequencing Subblock 9 P2clk clock periods Use this counter+decoder circuit if your machine player hasnine states CS 2204 Spring 2014

  39. Machine Play Block, Block 6 • The implementation at the course web site • Final digital system design Decision making Sequencing Information gathering CS 2204 Spring 2014

  40. ? 15 Block 6 • The Ppm Data Unit • Block 6, Machine Play Block • Plays as the machine player • Generates seven outputs to play correctly • Seven specific outputs must be generated no matter what the machine playing strategy is • The remaining 8 outputs can be output as 0 if the code digits are not discovered CS 2204 Spring 2014 Experiment 6 Labs 9-13

  41. 4 P2SEL Machine Player . . . P2played P2skip P2add • The Ppm Data Unit • Block 6, Machine Play Block • The playing strategy (intelligence) • Must generate the seven outputs for correct operation • The Ppm will stay in state 4 when the machine thinks : both P2played and P2skip are zero • It stays in state 4 at least one Sysclk period • The selection of inputs depends on the strategy and the implementation CS 2204 Spring 2014 Experiment 6 Labs 9-13

  42. 4 P2SEL Machine Player . . . P2played P2skip P2add • The Ppm Data Unit • Block 6, Machine Play Block • The black box view where the outputs are fixed • The input/output relationship consists of • The game rules and how the machine player has to interact with the rest of the Ppm digital system • The playing strategy (intelligence) The other 8 outputs are 0 CS 2204 Spring 2014 Experiment 6 Labs 9-13

  43. The Ppm Data Unit • Block 6, Machine Play Block • If the random digit is played • P2SEL and P2add are determined & P2played = 1 • No more than one of P2SEL can be one at a time • If the random digit is not played • The machine player skips : P2skip = 1 • P2played and P2skip are not 1 at the same time • If both P2played and P2skip are 0, it means the machine player is thinking by usingBlock4 andBlock 5 • Developing Block 6 is determining these seven outputs • Additional outputs (other than the 8) can be generated depending on the strategy • These extra outputs are used by the other five blocks • The five blocks need to be changed ! • Not recommended ! CS 2204 Spring 2014 Experiment 6 Labs 9-13

  44. The Ppm Data Unit • Block 6, Machine Play Block • The black box view where the outputs are fixed : 15 outputs ! • The inputs ? • We will collect the information sequentially and so we will stay in state 4 more than one clock period • The Machine Play Block is a digital system • We have to use the mandatory inputs ! The other 8 outputs are 0 P2SEL . . 4 Machine Player P2played Clearp2ffs P2skip P2sturn P2add P2clk CS 2204 Spring 2014 Experiment 6 Labs 9-13

  45. Design it as a Digital System • The Ppm Data Unit • Block 6, Machine Play Block • Seven critical outputs of the block • P2SEL : 4 bits indicating on which position the machine player has played • Only one of the lines can be 1 to play on a position • P2add : A line indicating if the machine player adds to a position • P2played : A line indicating that the machine player has played the random digit on a position • When it is 1, only one of P2SEL lines can be 1 • P2skip : A line indicating that the machine player has skipped the play • When it is 1, P2played must be 0 and vice versa • These seven outputs must be generated no matter what the machine playing strategy is Use the 7-step Design Procedure How can we implement the block ? CS 2204 Spring 2014 Experiment 6 Labs 9-13

  46. Lab 9/10 • Block 6, Machine Play Block Development • Plays as the machine player • On paper • Start with the black box view where the outputs are fixed and the input/output relationship • Understand the game rules and how the machine player has to interact with the rest of the Ppm digital system • Determine the playing strategy (intelligence) • Determine the inputs • Convert the black box view with the inputs determined and the textual input/output relationship (including the playing strategy) to an operation diagram • Convert the playing strategy to major operations • PartitionBlock 6 into subblocks • Operation diagram implies the machine player goes through steps taking several clock periods • The operation diagram also implies that the Block 6 is a tiny digital system itself • Convert the operation diagram to a high-level state diagram with microoperations with the same number of states • A diagram with finite number of states • Distributemicrooperations to states CS 2204 Spring 2014 Experiment 6 Labs 9-13

  47. Lab 9/10 Lab 11-13 • Block 6, Machine Play Block Development • On paper • From the high-level state diagram, obtain the datapath • Continue to partition the datapath into subblocks • Design each (sub)block • Implementmicroperations in datapath hardware • From the high-level state diagram and the datapath, obtain the low-level state diagram • Decide about how to implement the control unit (sequencer) • Hardwiring or microprogramming • Hardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term project • Implement the sequencer which is treated as a state machine • Design the sequencer • Start moving the circuits of Block 6 to the computer • Copy the termproject folder and paste it as exp6 • Startdrawing the schematics by using the design on paper • Label the components How can we implement the block ? CS 2204 Spring 2014 Experiment 6 Labs 9-13

  48. ? ? Block 6 • Block 6, Machine Play Block Development • Start with the black box view where the outputs are fixed and the input/output relationship • Understand the game rules and how the machine player has to interact with the rest of the Ppm digital system • Determine the playing strategy (intelligence) • Determine the inputs Example 1 We know the game rules already ! Play on the (rightmost) largest regularreward position (directly) (Action 0) CS 2204 Spring 2014 Experiment 6 Labs 9-13

  49. Block 6, Machine Play Block Development • Start with the black box view where the outputs are fixed and the input/output relationship • Determine the playing strategy (intelligence) • Always plays (does not skip at all) • Plays on the largest regular reward points position directly or with an addition (choose direct playing if reward points are equal) • If two or more positions have the same regular reward, selects the rightmost one (can also select randomly, or round robin, etc.) • If playing directly on a left side position gives the same regular reward points as playing with an addition on the right side, playing directly on the left side is chosen Example 1 Play on the (rightmost) largest regularreward position (directly) (Action 0) CS 2204 Spring 2014 Experiment 6 Labs 9-13

More Related