162
Digital Logic and State Machine Design Labs 9, 10, 11, 12, 13 CS 2204 CS 2204 Experiment 6 Spring Spring 2014 2014

Expg 6 Lab 910111213

Embed Size (px)

DESCRIPTION

rtryr

Citation preview

  • Experiment 6 Labs 9 - 13 OutlinePresentationDesign of Block 6 of the Ppm Digital System (using Term Project pages 38 48 and Digital System Design Example)

    Individual workDeveloping Ppm Block 6Experiment 6Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Analysis of the Term ProjectPolytechnic Playing Machine, PpmThe term project is human vs. machineThe black-box view

    Page *From page 2 of the Term Project HandoutExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *PpmInput/outputrelationshipPpmoperationdiagramFrom page 8 of the Term Project HandoutLD0-LD2 on the FPGA board show the current stateExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • The Ppm Digital System PartitioningExperiment 6 Labs 9-13Page *CS 2204 Spring 2014From page 9 of the Term Project Handout

    CS 2204 Spring 2014

  • Page *Digital SystemsA digital system performs microoperationsA digital system consists of digital circuitsA digital system consists of A data unit (datapath)It performs microoperationsA control unitIt controls the datapath

    Experiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThis first partitioning of a digital system is universal

    A microprocessor is a digital systemAn iPhone is a digital systemA computer is a collection of digital systemsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Data Unit has registers, ALUs and buses to perform microoperationsRegisters keep (store) data (operands and results)Arithmetic Logic Units (ALUs) perform additions, subtractions, multiplications, ANDS, ORs, etc.Buses interconnect registers and ALUsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Control Unit (Sequencer)The control unit determines the sequence of microoperations based on the current state and status signalsIn each state, it enables the microoperations of that state to happen in the data unit based on the status signalsMicrooperations must start at the right time with correct inputs and end at the right time with correct outputs We should not lose data and we should not use old dataGlitches, gate delays must be accounted for When we design it, we account for every possible gate delayThe control unit also determines which state is next : Next StateExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Control Unit (Sequencer)The state register indicates the current stateLogic to generate the control signals and the next state more irregular than the Data Unit

    From page 11 of the Term Project HandoutExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Control Unit (Sequencer) designHardwiring vs microprogramming

    Since our Ppm system is simple, we use hardwiring and so we will concentrate on hardwiring from this point onGate/FF networks = random logic = irregularHighlyregularbut slowerMemory bits generate control signals and NSNot as regularas the datapathExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Control Unit (Sequencer) designHardwired Control Unit designFirst partitioning on the Control UnitControl Signal generation SubblockNext State Generation SubblockExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsThe Control Unit (Sequencer) designHardwired Control Unit designOften a counter+decoder combination is used in the sequencern-bit up counternclockn-to-2n DecoderD0D1D3S0S1.....S2(n-1)LoadDatanControlsignalsNextStateControlSignals&NextStateCircuitsStatus signalsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Control UnitBlock 1, the Control Unit (the sequencer)

    It controls the Data UnitIt determines the sequence of microoperations Which microoperation happens whenExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Control UnitBlock 1, the Control Unit (the sequencer)The control unit determines the sequence of microoperations based on the status signalsImplemented by using the finite-state machine (FSM) techniqueUses hardwiringGate and flip-flip networks generate control signalsPartitioned into Control Signal generation Subblock Next State Generation SubblockExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Control UnitBlock 1, the Control Unit (the sequencer)ControlSignalGenerationSubblockGate and flip-flop networks generate control and next state signalsHardwiredControl UnitNextStateGenerationSubblockControlsignalsCounter-Decodercombinationto keep trackof the currentstateExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsHow can we design a digital system ?If the digital system is complexIt is the case with real chips, such as microprocessorsWrite an HDL program VHDL program Verilog HDL programExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsHow can we design a digital system ?If the digital system is simpleIt is the case with our term projectUse the finite state machine (FSM) technique We draw a finite-state diagramOne 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 diagramExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital SystemsHow can we design a digital system ?If the digital system is simpleIt is the case with our term projectUse 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 and high-level state diagram Obtain the Control UnitExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital System Design Using FSMThe Data Unit (Datapath)The data unit performs microoperations based on the control signalsThe data unit goes through statesThe 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 control signals indicate which microoperations should happen The low-level state diagram indicates which control signals should be activeExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital System Design Using FSMThe Control Unit (Sequencer)The control unit determines the sequence of microoperations based on the status signalsThe control unit goes through statesEach state has a unique number to identify The state register value is the current state numberIn each state, it enables the microoperations of that state to happen in the data unit based on the status signalsIt generates the control signals and next state signals timelyExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital System Design Using FSMThe Control Unit (Sequencer)The sequencer is treated as a state machineA low-level state diagram (with finite number of states) shows which microoperation happens when in terms of control signalsEach state shows Which control signal is active Which state to go to next based on status signalsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital System Design Using FSMOn paperStart with the black box view and the textual input/output relationship of the digital systemConvert the textual input/output relationship to an operation diagramConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesA diagram with finite number of statesFrom the high-level state diagram, obtain the datapathFrom 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 microprogrammingHardwiring is acceptable if it is not a complex digital systemIt is the case with the Ppm term projectExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Digital System Design Using FSMOn paperImplement the sequencer which is treated as a state machineThe low-level state diagram (a state diagram with finite number of states) shows which microoperation happens whenEach state shows Which control signal is active Which state to go to next based on status signalsEach state has a unique number to identify The state register value is the current stateConvert control signal and next state information of the low-level state diagram to sequencer hardwarePlace the counter (state register) + decoder combination if hardwiring is usedObtain Expressions Obtain gate networks of the sequencerStart implementing the circuits on computerStart drawing the schematics by using the design on paperExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteFrom page 40 of the Term Project HandoutExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteM2M3M4SequencingInformation gatheringDecision makingExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteThe inputsP1PT is Player 1 pointsP2PT is Player 2 pointsRWD is the regular reward pointsRD is the random digitDISP is the four displaysNSD is the adjacencyR1D is the next random digitBRWD is the digit playedCODERWD is the code reward pointsPSEL indicates on which position the current player played Experiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteThe inputsP2sturn is 1 when it is Player 2 to playStp2pt stores Player 2 points, here used to increment a counter to check if Player 2 has played 3 times or lessClearp2ffs stores 0 on registers, counters and FFs after Player 2 playsClear stores 0 on registers, counters and FFs after resetSysclk is the system clock at 6 HzP2clk is the Player2 clock at 48 HzMeans must be usedMeans at least one of them must be usedExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteThe outputsP2CODE outputs the code digits that are discovered by the machine playerStudents have to generate these 7 lines no matter what the playing strategy isP2CODE outputs are all zero if the code digits are not discoveredExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteThe outputsP2add is 1 if the machine player adds the random digit to a displayP2played is 1 if the machine player plays the random digit on a displayP2SEL has a 1 corresponding to the position played when the machine player plays the random digitP2skip is 1 if the machine player skips the playsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteIts playing strategy (intelligence)Play for now and future : Play differently for different game situations to eventually win the gameIf 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)Experiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Course web site machine player playing strategyExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteHow can we implement the machine player ?We have to convert the playing strategy and game rules to major operationsWe partition Block 6 into subblocksAn intelligent machine player has to gather substantial amount of information about the game and then decide how to playIt must have an information gathering subblock and a decision making subblockExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteHow can we implement the machine player ?It must have an information gathering subblock and an decision making subblockWe 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 periodThe controller and operation diagram also imply that the Block 6 is a tiny digital system itselfExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteHow can we implement the machine player ?Three major operations, three subblocksInformation gathering about the current situation Information Gathering SubblockDecision making about what to do with the random digit Decision Making SubblockControlling the operations in the block Sequencing SubblockExperiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteConvert the playing strategy and game rules to major operationsIf 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)From page 44 of the Term Project HandoutExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteConvert the playing strategy and game rules to major operationsTo an operation diagramSequential gatherExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteConvert the playing strategy and game rules to major operationsTo an operation diagramSequential gatherIG Information gatherD Decision making Sysclk6 HzP2clk 48 HzExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteImplement the controller (sequencer) as a state machineDesign the sequencerA counter + decoder combination is needed to keep track of the statesA major portion of the Sequencing SubblockUse this counter+decoder circuit if your machine player has nine states9 P2clk clock periodsExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Machine Play Block, Block 6The implementation at the course web siteFinal digital system designExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockPlays as the machine playerGenerates seven outputs to play correctly

    Seven specific outputs must be generated no matter what the machine playing strategy isThe remaining 8 outputs can be output as 0 if the code digits are not discoveredExperiment 6Labs 9-13CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockThe playing strategy (intelligence)Must generate the seven outputs for correct operationThe Ppm will stay in state 4 when the machine thinks : both P2played and P2skip are zeroIt stays in state 4 at least one Sysclk periodThe selection of inputs depends on the strategy and the implementationExperiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockThe 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 systemThe playing strategy (intelligence)The other 8 outputs are 0Experiment 6Labs 9-13CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockIf the random digit is playedP2SEL and P2add are determined & P2played = 1No more than one of P2SEL can be one at a timeIf the random digit is not played The machine player skips : P2skip = 1P2played and P2skip are not 1 at the same timeIf both P2played and P2skip are 0, it means the machine player is thinking by using Block4 and Block 5Developing Block 6 is determining these seven outputsAdditional outputs (other than the 8) can be generated depending on the strategyThese extra outputs are used by the other five blocksThe five blocks need to be changed !Not recommended !Experiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockThe 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 periodThe Machine Play Block is a digital systemWe have to use the mandatory inputs !Machine

    PlayerP2SEL4P2playedP2skipP2addThe other 8 outputs are 0Experiment 6Labs 9-13CS 2204 Spring 2014

  • Page *The Ppm Data UnitBlock 6, Machine Play BlockSeven critical outputs of the blockP2SEL : 4 bits indicating on which position the machine player has playedOnly one of the lines can be 1 to play on a positionP2add : A line indicating if the machine player adds to a positionP2played : A line indicating that the machine player has played the random digit on a positionWhen it is 1, only one of P2SEL lines can be 1P2skip : A line indicating that the machine player has skipped the playWhen it is 1, P2played must be 0 and vice versaThese seven outputs must be generated no matter what the machine playing strategy isHow can we implement the block ?Design it as a Digital SystemUse the 7-step Design ProcedureExperiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentPlays as the machine playerOn paperStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine 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 diagramConvert the playing strategy to major operationsPartition Block 6 into subblocksOperation diagram implies the machine player goes through steps taking several clock periodsThe 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 statesA diagram with finite number of statesDistribute microoperations to statesExperiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentOn paperFrom the high-level state diagram, obtain the datapathContinue to partition the datapath into subblocksDesign each (sub)blockImplement microperations in datapath hardwareFrom 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 microprogrammingHardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term projectImplement the sequencer which is treated as a state machineDesign the sequencerStart moving the circuits of Block 6 to the computerCopy the termproject folder and paste it as exp6Start drawing the schematics by using the design on paperLabel the componentsHow can we implement the block ?Experiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsPlay on the (rightmost) largest regular reward position (directly)(Action 0)We know the game rules already !Example 1Experiment 6Labs 9-13CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentStart 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 chosenPlay on the (rightmost) largest regular reward position (directly)(Action 0)Example 1Experiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the inputsWe have to collect eight regular reward points for eight possibilitiesFour regular reward points on four displays with direct playingFour regular reward points on four displays with additionsWe will collect the eight regular reward points sequentiallyThis will take 8 clock periods !Then, we will play on a position in the ninth clock periodPlay on the (rightmost) largest regular reward position (directly)(Action 0)Example 1Experiment 6Labs 9-13CS 2204 Spring 2014

  • Page *Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExample 1We need to collect the regular reward points : RWDWe will collect eight regular reward points sequentiallyWe have to input : P2sturn, Clearp2ffs, P2clkPlay on the (rightmost) largest regular reward position (directly)(Action 0)Experiment 6Labs 9-13CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Block 6RWD8P2sturnP2clkWe input RWDWe input P2sturn, Clearp2ffs, P2clkClearp2ffs?Play on the (rightmost) largest regular reward position (directly)(Action 0)

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputs

    Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1The outputs are fixed !Block 6RWD8P2sturnP2clkClearp2ffsWe must connect 8 zeros to the P2CODE lines to avoid unnecessary warningsP2SELP2addP2played4P2skipP2CODE8Play on the (rightmost) largest regular reward position (directly)(Action 0)

    CS 2204 Spring 2014

  • Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipMust generate the seven outputs for correct operationThe Ppm will stay in state 4 when the machine thinks : both P2played and P2skip are zeroIt stays in state 4 at least one Sysclk periodThe selection of inputs depends on the strategy and the implementationExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramConvert the playing strategy to major operationsThe goal is to develop an intelligent machine player It gathers information about the current situationDecides how to playPartition Block 6 into subblocksThere are at least two major operations: gather reward information and decide which position to playTherefore, Block 6 must have at least two subblocksInformation Gathering SubblockThe information gathering subblock obtains the regular reward points with additions on the four positions and determines the largest regular reward positionDecision Making Subblock The decision making subblock plays on the largest regular reward positionExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramPartition Block 6 into subblocksDo we need another major operation ?The information gathering subblock has to obtain the regular reward points with additionHow can we gather and compare the four regular reward points and then decide ? Sequentially !A sequencing circuit is needed to get the regular reward points for each position one by one ! A new subblock is needed as the mini sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramPartition Block 6 into subblocksThe information gathering is done in several stepsThe machine player goes through steps taking several clock periodsAnother major operation, controlling major operation is needed A new subblock, a Sequencing Subblock is neededOperation diagram is needed to describe what happens in each stepThe operation diagram and the controller imply that the Block 6 is a tiny digital system itselfExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramWe have sequential gather and sequential compareA sequencing circuit is needed to get reward points, compare with the previous largest reward and update the rewardThe machine player takes several clock periods to make a decisionAn operation diagram is neededConvert the game rules and playing strategy to major operationsPartition Block 6 into subblocksBlock 6 is a tiny digital system itselfExperiment 6 Labs 9-13Page *CS 2204 Spring 2014To get the operation diagram, check the playing strategy and determine what to do when : All actions happen in the last state Some actions indicate which data to collect All conditions indicate what to collectExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramHow can we gather and compare the four regular reward points and then decide sequentially ?The information gathering subblock has to obtain the regular reward points with direct playing and additionsThis is already done in Block 5 ! Block 5 has the Regular Reward Calculation Subblock which uses the Adjacency Subblock ! Block 5 receives the digit played and the position tested from Block 4Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1DO NOT IMPLEMENT THIS INFORMATION GATHERING CIRCUITRY COMBINATIONALLY

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramThere is only one action and no conditionThe action indicates we have toCollect regular reward points When the random digit is played with direct playing and addition on the four displaysDetermine which display has the largest regular reward points Play on the largest regular reward positionSince the information gathering subblock determines which position has the largest regular reward, decision making subblock is simple !We can use Block 5 to get the regular reward points for each displayWe indicate which position we are testing (collecting the regular reward points of) with direct playing and addition one by one and Block 5 determines the regular reward points for the position testedCollecting eight regular reward points and comparing them takes eight clock periodsThen, in the next clock period, the ninth one, we decide where to playThis strategy requires nine clock periods to play !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Play on the (rightmost) largest regular reward position (directly )(Action 0)

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramIn summary, we have Eight clock periods of regular reward collection and comparisonBy using the output of Block 5 : RWDOne clock period of decision makingHow do we handle the secondary strategy ?If two or more displays have the same largest regular reward points, we play on the rightmost of theseIf playing directly and with an addition give the same regular reward points, we play directlyIf 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 chosenDo we need separate hardware for this ?NO as we will see on the next slide !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Play on the (rightmost) largest regular reward position (directly )(Action 0)

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramHow do we convert the strategy to an operation diagram ?Write down the steps to playGet the regular reward points for position 0 with a direct playGet the regular reward points for position 1 with a direct play and compare with position 0 If position 1 has a larger regular reward than position 0, keep it !Get the regular reward points for position 2 a direct play If position 2 has a larger regular reward than the previous two positions, keep it !Get the regular reward points for position 3 with a direct play If position 3 has a larger regular reward than the previous three positions, keep it !Get the regular reward points for position 0 with an addition If position 0 has a larger regular reward than the previous four cases, keep it !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1DO NOT IMPLEMENT THIS INFORMATION GATHERING CIRCUITRY COMBINATIONALLYPlay on the (rightmost) largest regular reward position (directly )(Action 0)

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramHow do we convert the strategy to an operation diagram ?Write down the steps to playGet the regular reward points for position 1 with an addition and compare with position 0 If position 1 has a larger regular reward than previous five points, keep it !Get the regular reward points for position 2 with an addition If position 2 has a larger regular reward than the previous six points, keep it !Get the regular reward points for position 3 with an addition If position 3 has a larger regular reward than the previous seven points, keep it !Play on the position that has the largest regular reward with an additionImplementing the secondary strategy is done by checking positions From right to left and Keeping a position only if its regular reward is greater than those to the right Selecting direct playing if it has the same points as playing with an additionExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1DO NOT IMPLEMENT THIS INFORMATION GATHERING CIRCUITRY COMBINATIONALLYPlay on the (rightmost) largest regular reward position (directly )(Action 0)

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the textual input/output relationship (including the playing strategy) to an operation diagramExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Determine position 0 regular reward with direct playing & record the position number4Player 2 plays on a positionBased on the stored information select the position to playP2st0P2st1Determine position 1 regular reward with direct playing, keep it if it is larger & record the position numberP2st2P2st3Determine position 2 regular reward with direct playing, keep it if it is larger & record the position numberDetermine position 3 regular reward with direct playing, keep it if it is larger & record the position numberP2st4Determine position 0 regular reward with an addition, keep it if it is larger & record the position numberP2st5Determine position 1 regular reward with an addition, keep it if it is larger & record the position numberP2st6Determine position 2 regular reward with an addition, keep it if it is larger & record the position numberP2st7Determine position 3 regular reward with an addition, keep it if it is larger & record the position numberP2st8IGIGIGIGDIGIGIGIGExample 1Sequential gather and Sequential compareAn operation diagram is needed

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesHow do we get the regular reward points without actually playing ?How do we test each position without actually playing ?Get the regular reward points for position 0 with a direct playIndicate to Block 4 and Block 5 that position 0 is tested with a direct playP2SEL = 0001 ; P2add = 0 ; P2played = 0 ; P2skip = 0Store RWD on register LRGRWD & store the position on register POSLRGRWD RWD ; POS 00001Get the regular reward points for position 1 with a direct play and compare with position 0Indicate to Block 4 and Block 5 that position 1 is tested with a direct playP2SEL = 0010 ; P2add = 0 ; P2played = 0 ; P2skip = 0If RWD is greater than LRGRWD, then store RWD on LRGRWD & store the position on POSIf RWD > LRGRWD then LRGRWD RWD ; POS 00010

    Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesHow do we get the regular reward points without actually playing ?How do we test each position without actually playing ?Get the regular reward points for position 2 with a direct playIndicate to Block 4 and Block 5 that position 2 is tested with a direct playP2SEL = 0100 ; P2add = 0 ; P2played = 0 ; P2skip = 0Store RWD on register LRGRWD & store the position on register POSLRGRWD RWD ; POS 00100Get the regular reward points for position 3 with a direct play and compare with position 0Indicate to Block 4 and Block 5 that position 3 is tested with a direct playP2SEL = 1000 ; P2add = 0 ; P2played = 0 ; P2skip = 0If RWD is greater than LRGRWD, then store RWD on LRGRWD & store the position on POSIf RWD > LRGRWD then LRGRWD RWD ; POS 01000

    Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesHow do we get the regular reward points without actually playing ?How do we test each position without actually playing ?Get the regular reward points for position 0 with with an additionIndicate to Block 4 and Block 5 that position 0 is tested with an additionP2SEL = 0001 ; P2add = 1 ; P2played = 0 ; P2skip = 0Store RWD on register LRGRWD & store the position on register POSLRGRWD RWD ; POS 10001Get the regular reward points for position 1 with an addition and compare with position 0Indicate to Block 4 and Block 5 that position 1 is tested with an additionP2SEL = 0010 ; P2add = 1 ; P2played = 0 ; P2skip = 0If RWD is greater than LRGRWD, then store RWD on LRGRWD & store the position on POSIf RWD > LRGRWD then LRGRWD RWD ; POS 0010

    Experiment 6 Lab 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesHow do we get the regular reward points without actually playing ?How do we test each position without actually playing ?Get the regular reward points for position 2 with a direct playIndicate to Block 4 and Block 5 that position 2 is tested with an additionP2SEL = 0100 ; P2add = 1 ; P2played = 0 ; P2skip = 0Store RWD on register LRGRWD & store the position on register POSLRGRWD RWD ; POS 10100Get the regular reward points for position 3 with a direct play and compare with position 0Indicate to Block 4 and Block 5 that position 3 is tested with an additionP2SEL = 1000 ; P2add = 1 ; P2played = 0 ; P2skip = 0If RWD is greater than LRGRWD, then store RWD on LRGRWD & store the position on POSIf RWD > LRGRWD then LRGRWD RWD ; POS 11000

    Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014P2SEL = 0001 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; LRGRWD RWD ; POS 000014Player 2 plays on a positionP2SEL = 0010 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 00010P2SEL = POS[3:0] ; P2add = POS[4] ; P2played =1 ; P2skip = 0P2st0RTL Notation usedP2st1P2SEL = 0100 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 00100P2st2P2SEL = 1000 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 01000P2st3P2SEL = 0001 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 10001P2st4P2SEL = 0010 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 10010P2st5P2SEL = 0100 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 10100P2st6P2SEL = 1000 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 11000P2st7P2st8Example 1Sequential gather and Sequential compareA diagram with finite number of states

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Sequential gather and Sequential compareA diagram with finite number of states

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Block 4Block 5NSDBRWD

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesSequential gather and Sequential compareA diagram with finite number of statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Test0 is 1 if position 0 is tested : 0001Test1 is 1 if position 1 is tested : 0010Test2 is 1 if position 2 is tested : 0100Test3 is 1 if position 3 is tested : 1000The control unit generates four Test signals one for each position and a direct/add signal : Test3, Test2, Test1 and Test0 and TestaddTestadd is 0 the first four clock periodsTestadd is 1 the next four clock periodsHow can we generate position selection and direct/add signals ?

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathSequential gather and Sequential compareContinue to partition the datapath into subblocksDesign each (sub)blockImplement microperations in datapath hardwareExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1DatapathInformationGathering

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathSequential gather and Sequential compareContinue to partition the datapath into subblocksDesign each (sub)blockImplement microperations in datapath hardwareExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1DatapathDecision MakingIn Information Gathering

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram and the datapath, obtain the low-level state diagramExperiment 6 Labs 9-13Page *CS 2204 Spring 2014P2SEL = 0001 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; LRGRWD RWD ; POS 000014Player 2 plays on a positionP2SEL = 0010 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 00010P2SEL = POS ; P2add = POS[4] ; P2played =1 ; P2skip = 0P2st0P2st1P2SEL = 0100 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 00100P2st2P2SEL = 1000 ; P2played = 0 ; P2skip = 0 ; P2add = 0 ; If RWD > LRGRWD then LRGRWD RWD ; POS 01000P2st3P2SEL = 0001 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 1 0001P2st4P2SEL = 0010 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 10010P2st5P2SEL = 0100 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 10100P2st6P2SEL = 1000 ; P2played = 0 ; P2skip = 0 ; P2add = 1 ; If RWD > LRGRWD then LRGRWD RWD ; POS 11000P2st7P2st8Test0 = 1; TestAdd = 0 ; Store = 1Test1 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 14Play = 1Test2 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 1Test3 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 1Test0 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test1 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test2 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test3 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Player 2 plays on a positionP2st0P2st1P2st2P2st3P2st4P2st5P2st6P2st7P2st8Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentDecide about how to implement the control unit (sequencer)Sequential gather and Sequential compareHardwiring or microprogramming ?Hardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term projectExperiment 6 Labs 9-13Page *CS 2204 Spring 2014RWD8Control UnitClearp2ffsP2clkTest2Test1ClrStoreGtTest0Test3P2clkPlayEight control signalsOne status signal Always plays on a position : It does not skip Plays on the position with the largest regular reward by trying directly or with an addition If two or more positions have the same reward, plays on the rightmost positionP2sturnP2addP2SEL4P2playedP2skipTestAddExample 1Gather reward points & compare themSelect one Make a decisionDatapath

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentDecide about how to implement the control unit (sequencer)Sequential gather and Sequential compareHardwiring or microprogramming ?Hardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term projectExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Test0 = 1; TestAdd = 0 ; Store = 1Test1 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 14Play = 1Test2 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 1Test3 = 1 ; TestAdd = 0 ; If Gt == 1 then Store = 1Test0 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test1 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test2 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Test3 = 1 ; TestAdd = 1 ; If Gt == 1 then Store = 1Player 2 plays on a positionP2st0P2st1P2st2P2st3P2st4P2st5P2st6P2st7P2st8Example 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1We need a counter (not a register) to keep track of the statesHow do we implement the roundrobin trace of the states ?0 1 2 3 4 5 6 7 80 1 2 3 4 5 6 7 8A counter + decoder combination is needed to keep track of the statesWe need a combination of 4-bit Up counter 3-to-8 DecoderTo keep track of the current state

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1We start counting when it is PPm state 4 (P2sturn =1) How do we stop counting when we reach state 8 ?0 1 2 3 4 5 6 7 8When we reach state 8, P2s8 is 1 since we play in state 8We count up (enable counting) if we are in Ppm state 4 and P2s8 is 0How do we know when we have to count up ?0 1 2 3 4 5 6 7 8Counter enable input = P2sturn P2s8

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014A counter + decoder combination is needed to keep track of the statesExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014A counter + decoder combination is needed to keep track of the statesClearp2ffs is 1 after Player 2 playsExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Obtain ExpressionsTest0 = P2s0 + P2s4Test0 is 1 when it is state 0 or state 4Test1 = P2s1 + P2s5Test1 is 1 when it is state 1 or state 5Test2 = P2s2 + P2s6Test2 is 1 when it is state 2 or state 6Test3 = P2s3 + P2s7Test3 is1 when it is state 3 or state 7Play = P2s8Play is 1 when it is state 8 Obtain gate networks for the control signals

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Obtain Expressions Obtain gate networks for the control signals

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Store is 1 when it is not state 8 and it is either state 0 or Gt is 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1TestAdd is 1 when it is state 4 or 5 or 6 or state 7

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 1Clr is 1 when Clearp2ffs is 1Clr = Clearp2ffs Clearp2ffs is 1 after Player 2 plays

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Use this counter+decoder circuit if your machine player does not skip and has nine statesControl UnitExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart implementing the circuits of Block 6 on computerSequential gather and Sequential compareFinal digital system design on paperExperiment 6 Labs 9-13Page *CS 2204 Spring 2014DatapathControl UnitExample 1

    CS 2204 Spring 2014

  • Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Block 6, Machine Play Block DevelopmentStart implementing the circuits of Block 6 on computerSequential gather and Sequential compareCopy the termproject folder and paste it as exp6Start drawing the schematics by using the design on paperPerform simulationsExample 1

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2Decision making is more complex !

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014We know the game rules already !Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart 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)If there is no adjacency, it plays on the largest regular reward points position directly or with an addition (chooses direct playing if the two reward points are equal). Otherwise, it plays on the largest regular adjacency position directly or with an addition (chooses direct playing if adjacencies are equal)In either case, if two or more positions equally playable, selects the rightmost oneIf playing on the left side directly has the same adjacency/regular reward points as playing on the right side with addition, select playing on the left side directlyExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the inputsWe have to collect eight regular reward points for eight possibilitiesFour regular reward points on four displays with direct playingFour regular reward points on four displays with additionsWe have to collect eight adjacencies for eight possibilitiesFour adjacencies on four displays with direct playingFour adjacencies on four displays with additionsWe will collect the eight regular reward points and eight adjacencies sequentiallyThis will take 8 clock periods !Then, we will play on a position in the ninth clock periodExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2We need to collect the regular reward points : RWDWe will collect eight regular reward points sequentiallyWe have to input : P2sturn, Clearp2ffs, P2clkWe need to collect the adjacencies : NSD

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2Block 6RWD8P2sturnP2clkWe input RWD, NSDWe input P2sturn, Clearp2ffs, P2clkClearp2ffs?NSD2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputs

    Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2The outputs are fixed !Block 6We must connect 8 zeros to the P2CODE lines to avoid unnecessary warningsP2SELP2addP2played4P2skipP2CODE8RWD8P2sturnP2clkNSD2Clearp2ffs

    CS 2204 Spring 2014

  • Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationshipMust generate the seven outputs for correct operationThe Ppm will stay in state 4 when the machine thinks : both P2played and P2skip are zeroIt stays in state 4 at least one Sysclk periodThe selection of inputs depends on the strategy and the implementationExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentGet the black box view with the inputs determined and convert the textual input/output relationship (including the playing strategy) to an operation diagramSequential gather and Sequential compareAn operation diagram is neededConvert the playing strategy to major operationsPartition Block 6 into subblocksBlock 6 is a tiny digital system itselfThe machine player takes several clock periods to make a decisionExperiment 6 Labs 9-13Page *CS 2204 Spring 2014To get the operation diagram, check the playing strategy and determine what to do when : All actions happen in the last state Some actions indicate which data to collect All conditions indicate what to collectExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the textual input/output relationship (including the playing strategy) to an operation diagramExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Determine position 0 regular reward and adjacency with direct playing & record the position number4Player 2 plays on a positionBased on the stored information select the position to playP2st0P2st1Determine position 1 regular reward and adjacency with direct playing, keep each if it is larger & record the position numberP2st2P2st3Determine position 2 regular reward and adjacency with direct playing, keep each if it is larger & record the position numberDetermine position 3 regular reward and adjacency with direct playing, keep each if it is larger & record the position numberP2st4Determine position 0 regular reward and adjacency with an addition, keep each if it is larger & record the position numberP2st5Determine position 1 regular reward and adjacency with an addition, keep each if it is larger & record the position numberP2st6Determine position 2 regular reward and adjacency with an addition, keep each if it is larger & record the position numberP2st7Determine position 3 regular reward and adjacency with an addition, keep each if it is larger & record the position numberP2st8IGIGIGIGDIGIGIGIGMachine

    PlayerRWD8P2sturnClearp2ffsP2clkP2addP2SEL4P2playedP2skipNSD2Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014RTL Notation usedMachine

    PlayerRWD8P2sturnClearp2ffsP2clkP2addP2SEL4P2playedP2skipNSD2Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathExperiment 6 Labs 9-13Page *CS 2204 Spring 2014DatapathInformation GatheringExample 2AdjLRGNSD1LRGNSD0

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathExperiment 6 Labs 9-13Page *CS 2204 Spring 2014P2SEL0Test0P2SEL1Test1P2SEL2Test2P2SEL3Test3P2addP2playedPlayP2skip0TestAdd5-bit2-to-1 MUXEA0B0A1B1Y0Y1Y2Y3PlayA2Y4B2A3B3SelA4B4Decision MakingPOSNSD0POSNSD1POSNSD2POSNSD3P2BPOSRWD0POSRWD1POSRWD2POSRWD3P2ADatapathAdjExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Decision MakingDatapathInformation GatheringExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram and the datapath, obtain the low-level state diagramExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Example 2Test0 = 1; TestAdd = 0 ; Storerwd = 1 ; Storensd = 1Test1 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 14Play = 1Test2 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test0 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test1 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test2 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1If Gtnsd == 1 then Storensd = 1Player 2 plays on a positionP2st0P2st1P2st2P2st3P2st4P2st5P2st6P2st7P2st8

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentDecide about how to implement the control unit (sequencer)Sequential gather and Sequential compareHardwiring or microprogramming ?Hardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term projectExperiment 6Labs 9-13Page *CS 2204 Spring 2014RWD8Clearp2ffsP2clkTest2Test1ClrStorerwdGtrwdTest0Test3P2clkPlayNine control signalsTwo status signalsP2sturnP2addP2SEL4P2playedP2skipTestAddNSD2GtnsdStorensdControl UnitDatapathGather reward points & adjacencies & compare themSelect one based on the adjacency Make a decisionExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentDecide about how to implement the control unit (sequencer)Sequential gather and Sequential compareHardwiring or microprogramming ?Hardwiring is acceptable if it is not a complex digital system : It is the case with the Ppm term projectExperiment 6Labs 9-13Page *CS 2204 Spring 2014Test0 = 1; TestAdd = 0 ; Storerwd = 1 ; Storensd = 1Test1 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 14Play = 1Test2 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test0 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test1 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test2 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1If Gtnsd == 1 then Storensd = 1Player 2 plays on a positionP2st0P2st1P2st2P2st3P2st4P2st5P2st6P2st7P2st8Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014A counter + decoder combination is needed to keep track of the statesTest0 = 1; TestAdd = 0 ; Storerwd = 1 ; Storensd = 1Test1 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 14Play = 1Test2 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 0 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test0 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test1 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test2 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1 ;If Gtnsd == 1 then Storensd = 1Test3 = 1 ; TestAdd = 1 ; If Gtrwd == 1 then Storerwd = 1If Gtnsd == 1 then Storensd = 1Player 2 plays on a positionP2st0P2st1P2st2P2st3P2st4P2st5P2st6P2st7P2st8Example 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplement the sequencer which is treated as a state machineSequential gather and Sequential compareDesign the hardwired sequencerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Use this counter+decoder circuit if your machine player does not skip and has nine statesExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart implementing the circuits of Block 6 on computerSequential gather and Sequential compareFinal digital system design on paperExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Control UnitInformation GatheringExample 2DatapathDecision Making

    CS 2204 Spring 2014

  • Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Block 6, Machine Play Block DevelopmentStart implementing the circuits of Block 6 on computerSequential gather and Sequential compareCopy the termproject folder and paste it as exp6Start drawing the schematics by using the design on paperPerform simulationsExample 2

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the playing strategy (intelligence)How to determine of the machine player strategy is acceptable ?Experiment 6 Labs 9-13Page *CS 2204 Spring 2014At least 3 (three) different complex conditionsAt least 4 (four) different complex actionsLab 9-10

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the playing strategy (intelligence)Students can use the following conditions and actions in case they cannot agree upon themExperiment 6 Labs 9-13Page *CS 2204 Spring 2014At least 3 (three) different complex conditionsLab 9-10

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the playing strategy (intelligence)Students can use the following conditions and actions in case they cannot agree upon themExperiment 6 Labs 9-13Page *CS 2204 Spring 2014At least 4 (four) different complex actionsLab 9-10

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the playing strategy (intelligence)Non-intelligent machine player strategiesPlay in a permanently fixed way : always play on the rightmost position which does not have a display overflow. If all positions result in display overflows, skipsPlay randomly : when it is time to play, stop a freely running 2-bit counter and play on that positionPlay in a fixed way-round robin fashion : every time it is the turn, increment a 2-bit counter and play on that positionExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Do not implement these strategiesLab 9-10

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentStart with the black box view where the outputs are fixed and the input/output relationship Determine the playing strategy (intelligence)Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9-10If you do not specify the secondary strategy for even a single action, it means the machine player does not work and so you will lose 30 points

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentConvert the textual input/output relationship (including the playing strategy) to an operation diagramDecide about the parallel/sequential implementation issueGet the subblocksConvert the playing strategy to major operationsConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesIf sequential gather and Sequential compare+decide is decidedA diagram with finite number of statesDistribute microoperations to statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9-10

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentFrom the high-level state diagram, obtain the datapathSequential gather and Sequential compare+decideDesign each (sub)blockImplement microperations in datapath hardwareFrom the high-level state diagram and the datapath, obtain the low-level state diagramIf Sequential gather and Sequential compare+decide is chosenDecide about how to implement the control unit (sequencer)Hardwiring or microprogramming ? Choose hardwiringImplement the sequencer which is treated as a state machineDesign the sequencerUse the 5-state or 9-state counter+decoder combinations given on previous slidesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9-10Make sure the machine player takes at least 9 clock periods to play

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentMove the design to the computer Implement Block 6 on computerPlan where to place the subblocks on the screenDelete your Block 6 circuits if they are not neededStart drawing the schematicsFirst place the components, then their outputs and then their inputsLabel the componentsSave schematic 6, ppm6.schExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentMove the design to the computer Implement Block 6 on computerStart drawing the schematicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Make sure your circuits in Block 6 follow the Term Project Check List handoutDO NOT IMPLEMENT INFORMATION GATHERING CIRCUITRY COMBINATIONALLYUSE available circuits in Blocks 1, 2, 3, 4 and 5Lab 11-13

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentMove the design to the computer Implement Block 6 on computerStart drawing the schematicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13Your machine player would not work completely because of three reasonsIt does not follow the game rulesIt does not follow your playing strategyYour playing strategy is not complete

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentMove the design to the computer Implement Block 6 on computerRemember also the followingFollow all the suggestions and warnings, including the timetable !Follow the 7-step procedure to design Block 6 !Start debugging Block 6 starting with the outputs, proceeding backwardMake sure everybody has everything related to Block 6 all the timeDo not have black boxes (macros)Only six schematics in the projectsTAs and I will not answer design related questions !Experiment 6 is like an exam : It must be your work !No communication with other teams !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Block 6, Machine Play Block DevelopmentImplementing the machine player, Block 6Every member of a team must do the schematic design to remember better for the final examThe timetable for the rest of the semesterThe last day to submit Experiment 5 as a team is April 4, 2014Students will submit the Experiment 6 project which will include the implementation of Block 6The deadline : 6:50 PM, Friday, May 2, 2014Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13Submit your Experiment 6 during a lab session !

    CS 2204 Spring 2014

  • CS2204 LabStudents will receive a lab grade5% of the term gradeLab workLab attendance, arrival, departureConcentration on lab workHow well he/she cooperates with the teammatesTerm project grade based on the Experiment 6 Check List handoutArriving late would delay the team workAlso, teammates cannot synchronize wellIf this happens frequently, the team member would fall behind the teammatesExam grades would go down as well Labs affect the term grade moreLabs are on all examsLabs reinforce lecture topicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Lab GradeCalculating the lab grade5% of the term gradeTerm project (Experiment 6) grade based on the Term Project Check List handout : 80Lab work : 90 based onLab attendance, arrival, departureConcentration on lab workHow well he/she cooperates with the teammatesThe lab grade : (0.90 * 0.80) * 5 = (0.72) * 5 = 3.6

    Labs affect the term grade moreLabs are on all examsLabs reinforce lecture topicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • QUESTIONS ?Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Read all the slides to learn about the software, Project Navigator, Schematic design and other related topicsContinue reading the Term Project handoutThink about the machine player strategyDo not leave the lab before your partners finish Help your partnersMake sure you have the LABS account and see the S driveMake sure you have installed WebPACK 12.4 on your laptopMake sure you create a CS2204 folder on both

    CS 2204 Spring 2014

  • Todays Individual Xilinx WorkWe will develop (implement) Block 6 of the term projectWe will replace the machine player with our own circuitsHelp our partners complete todays projectWe will continue reading the Term Project handoutAlso read slides at the end to learn about the software, Project Manager, Schematic design and other related topicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkOpen the ppm project in the exp5 folderOpen the Project Manager and then open the Ppm project in the exp5 folderLook at the six Ppm schematicsMake sure all schematics are not Non-ProjectEnter the team information to the schematics if it has not been enteredSave the schematic if the team information is enteredExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkOpen the ppm project in the exp4 folderMake sure Experiment 1, Experiment 2, Experiment 3, Experiment 4 and Experiment 5 are completedThat is you have the following in Schematic 3 and two circuits in Schematic 6 on the next slide :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10And the next slideExperiment 1Experiment 2

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkOpen the ppm project in the exp4 folderMake sure Experiment 1, Experiment 2, Experiment 3, Experiment 4 and Experiment 5 are completedThat is you have the following on Schematic 6 and a circuit on Schematic 3 on the previous slide :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10Experiments 3, 4 and 5Make sure your circuits in blocks 3 and 6 follow the Term Project Check List handout

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkOpen the ppm project in the exp4 folderMake sure Experiment 1, Experiment 2, Experiment 3, Experiment 4 and Experiment 5 are completedIf they are not complete finish the designs by studyingLab 4 presentation for Experiment 1Lab 5 presentation for Experiment 2Lab 6 presentation for Experiment 3Lab 7 presentation for Experiment 4Lab 8 presentation for Experiment 5So that eventually Block 3 looks like as follows :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10Experiment 2Experiment 1Make sure your circuits in blocks 3 and 6 follow the Term Project Check List handoutExperiments 3, 4 and 5

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkOpen the ppm project in the exp3 folderMake sure Experiment 1, Experiment 2, Experiment 3, Experiment 4 and Experiment 5 are completedSo that eventually Block 3 and Block 6 look like as follows :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Make sure your circuits in blocks 3 and 6 follow the Term Project Check List handoutLab 9/10Experiment 1Experiment 2Experiments 3, 4 and 5

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkSubmit the Experiment 5 project after deciding whose project is the best to submitDecide whose project on the team will be submittedBlock 3 and Block 6 must look like as follows :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Make sure your circuits in blocks 3 and 6 follow the Term Project Check List handoutExperiment 1Experiment 2Experiments 3, 4 and 5

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkSubmit the Experiment 5 project after deciding whose project is the best to submitFill out a Term Project Check List handout before signaling to the TABlock 3 and Block 6 must look like as follows :Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Make sure your circuits in blocks 3 and 6 follow the Term Project Check List handoutExperiment 1Experiment 2Experiments 3, 4 and 5

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkBy using Xilinx ISE create exp5 from the exp6Remember that we must create a new project from an earlier one by using Xilinx ISEWe will experiment with the Ppm schematicsOpen the Ppm project in exp6Look at the six Ppm schematicsIf it has not been entered, place your team info on the schematicsSave the schematic if you enter the team informationExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkSwitch to schematic 6Completely zoom outCheck your Block 6 implementation !Analyze your Block 6 circuits and compare them with the original Block 6 circuits by reading the slides of this presentation and the Term Project handoutPerform functional simulations on your Block 6 circuitsRecord your test vectors to use laterExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence) Draw a graph Students should study the slides in the presentation section to decide about choosing a strategy : Students cannot implement them ! They have to come up with their own strategy and implementation ! The slides are ordered from the simplest to the most complex !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10At least 3 (three) different complex conditionsAt least 4 (four) different complex actions

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipDetermine the playing strategy (intelligence)Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10At least 3 (three) different complex conditions

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipDetermine the playing strategy (intelligence)Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10At least 4 (four) different complex actions

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipDetermine the playing strategy (intelligence)Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10If you do not specify the secondary strategy for even a single action, it means the machine player does not work and so you will lose 30 points

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperStart with the black box view where the outputs are fixed and the input/output relationshipUnderstand the game rules and how the machine player has to interact with the rest of the Ppm digital systemDetermine the playing strategy (intelligence)Determine the inputsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDraw the circuit in schematic 6 by using General Design Rules and Digital Product DevelopmentFirst, do the design on paperConvert the textual input/output relationship (including the playing strategy) to an operation diagramDecide about the parallel/sequential implementation issueGet the subblocksConvert the playing strategy to major operationsConvert the operation diagram to a high-level state diagram with microoperations with the same number of statesIf sequential gather and Sequential compare+decide is decided A diagram with finite number of states Distribute microoperations to statesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDraw the circuit in schematic 6From the high-level state diagram, obtain the datapathSequential gather and Sequential compare+decideDesign each (sub)blockImplement microperations in datapath hardwareFrom the high-level state diagram and the datapath, obtain the low-level state diagramIf Sequential gather and Sequential compare+decide is chosenDecide about how to implement the control unit (sequencer)Hardwiring or microprogramming ? Choose hardwiringImplement the sequencer which is treated as a state machineDesign the sequencer Use the 5-state or 9-state counter+decoder combinations given on previous slidesExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 9/10Make sure the machine player takes at least 9 clock periods to play

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDraw the circuit in schematic 6Move the design to the computer Implement Block 6 on computerPlan where to place the subblocks on the screenDelete your Block 6 circuits if they are not neededStart drawing the schematicsFirst place the components, then their outputs and then their inputsLabel the componentsSave schematic 6, ppm6.schExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDraw the circuit in schematic 6Move the design to the computer Implement Block 6 on computerStart drawing the schematicsExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13Make sure your circuits in Block 6 follow the Term Project Check List handoutDO NOT IMPLEMENT INFORMATION GATHERING CIRCUITRY COMBINATIONALLYUSE available circuits in Blocks 1, 2, 3, 4 and 5

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDraw the circuit in schematic 6Move the design to the computer Implement Block 6 on computerStart drawing the schematicsExperiment 6Labs 9-13Page *CS 2204 Spring 2014Lab 11-13Your machine player would not work completely because of three reasonsIt does not follow the game rulesIt does not follow your playing strategyYour playing strategy is not complete

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDraw the circuit in schematic 6Move the design to the computer Implement Block 6 on computerRemember also the followingFollow all the suggestions and warnings, including the timetable !Follow the 7-step procedure to design Block 6 !Start debugging Block 6 starting with the outputs, proceeding backwardMake sure everybody has everything related to Block 6 all the timeDo not have black boxes (macros)Only six schematics in the projectsTAs and I will not answer design related questions !Experiment 6 is like an exam : It must be your work !No communication with other teams !Experiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDo a schematic check on the new designSchematic checks do not catch all the errorsThat is why after the Schematic checks we have to performFunctional simulationsXilinx IMPLEMENTATIONsTiming simulationsPerform functional simulations in schematic 6 to verify that it is workingUse the test vectors you recorded in step 10 if necessaryMake sure the circuit is beautified and the schematic is saved againExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDo a Xilinx IMPLEMENTATIONMake sure there are no errorsRead the warningsConfirm that the warnings are acceptableThe FPGA chip utilization does not have to be 6%The utilization depends on the strategy, the intelligence of the machine player designedExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkDownload the Ppm project to the FPGA chip and play the game and to verify that the schematic works correctlyIn order to test the circuit fast you can input random digits directly to the machine playerAfter you play, when the state is 3, leave one of switches SW7 SW4 on to signal you will input the random digitUse switches SW3 SW0 to select a random digit valuePress push button BTN2 so the machine player starts with the random digit you inputTurn off the signaling switch (one of SW7 SW4) before you press push button BTN3 to playExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkDownload the Ppm project to the FPGA chip and play the game and to verify that the schematic works correctlyIf it does not work, inspect your circuit in Block 6 and correct the circuitExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Individual Xilinx Lab WorkEnsure that all circuits related to Experiment 1, Experiment 2, Experiment 3, Experiment 4 and Experiment 5 are completeIncludingComponent labelsWell drawn circuitsIf you are sure your circuit is correct thenCopy your experiment 6 folder from the D drive to your USB memory stick

    Help your partners complete the projectExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkSubmitting the term projectAfter drawing the schematics, simulating circuits separately and testing them on the FPGA board, make sure thatThe components are labeledThe subsubblocks and the subblocks are separated by lines and labelledThe circuit is beautified The schematic is saved againFunctional simulations of the subblocks are done againA Xilinx IMPLEMENTATION is done againDownloading to the FPGA board and testing are done againYour experiment 6 folder from the S drive is copied to your laptopExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13

    CS 2204 Spring 2014

  • Todays Xilinx Lab WorkSubmitting the term projectAfter drawing the schematics, simulating circuits separately and testing them on the FPGA boardDetermine whose project will be submitted and then signal to a TA to submit your projectFill out a Term Project Check List HandoutThe team project will be copied by the TA Once copied, open the project and download to the FPGA board to make sure it is copied correctly Print all schematics to prepare for the final exam If you have any files on the local drive, delete themExperiment 6 Labs 9-13Page *CS 2204 Spring 2014Lab 11-13Submit your Experiment 6 during a lab session !The deadline : 6:50 PM, May 2, 2014

    CS 2204 Spring 2014

  • Understand Critical WiresRD : 4 bitsThe random digitR1D : 4 bitsNext random digitR2D : 4 bitsThe random digit after next random digitDISP : 16 bitsThey represent the four position displaysIn HexDISP15-DISP12 : The leftmost position display, PD3DISP11-DISP8 : position display PD2, etcNPDISP : 16 bitsThe result of RD to each display digitIn HexNPDISP15-NPDISP12 : The leftmost position, PD3, value + RDNPDISP11-NPDISP8 : Position display PD2 value + RDNPSELDISP : 4 bitsSelects one of NPDISP display valuesIn HexExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Understand Critical WiresBRWD : 4 bitsBasic rewardIn HexThe digit played and also minimum points earnedIt is selected from RD or NPSELDISP Based on how the player played : Directly or with an additionBrwdeqz : 1 bitBRWD is zero when it is 1PDPRD : 4 bitsDisplay overflow bits after additionPdprd : 1 bitThe display overflow bit of the position playedSelplyr : 1 bitThe current player If it is 0, it is the human player, otherwise, it is the machine playerExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Understand Critical WiresP1SEL : 4 bitsThe position played by the human playerP2SEL : 4 bitsThe position played by the machine playerPSEL : 4 bitsPosition Select bits of current playerENCPSEL : 2 bitsThe number of the position playedEQ : 4 bitsThe equality of the four displays to the digit playedNSD : 2 bitsThe number of similar digits, i.e. the adjacency information of the position playedRWD : 8 bitsThe regular reward points calculated based on adjacenciesIn Unsigned BinaryCODERWD : 8 bitsThe code reward points calculated based on the code digitsIn Unsigned BinaryExperiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Understand Critical WiresP1PT : 8 bitsPlayer 1 pointsIn HexP2PT : 8 bitsPlayer 2 pointsIn HexPT : 8 bitsThe points of the current playerIn HexNPT : 8 bitsNew player points for the current playerIn HexPtovf : 1 bitThe points overflow if it is 1, the new player points is above (255)10Experiment 6 Labs 9-13Page *CS 2204 Spring 2014

    CS 2204 Spring 2014

  • Understand Critical WiresP1add : 1 bitPlayer 1 adds when it is 1P2add :