CS231_SP11_HW7_Solution - CS231Spring2011 Homework7Solution

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS231Spring2011 Homework7Solution Dueat5:00pm,Wednesday,Mar.30th,2011 inCS231HWboxesinSiebelCenter'sbasement Introductorynotes: Writeyourname,yournetID,and"CS231"clearlyonthefirstpage. YoumustfollowtheFormattingGuidelineslistedontheassignmentspage oryourscorewillbepenalized. Thereareatotalof5questionsinthishomeworkworthatotalof100points. Youmustworkindividuallyonhomework.Youmaydiscussmaterialwith otherstudents,theTAs,andtheProfessorforthepurposeofunderstanding, butyourworkmustbeyourown.Seethesyllabusforourcheatingpolicy. Thegeneralguidelinefordoingassignmentsisthatyoumustconvinceus thatyouknowwhatyou'redoing.Toreceivecredit,makesureyoursolutions areneatandlegible,andthatyoushowenoughwork. TurnintheassignmentintheHWboxes.TheHWboxesarelocatedinthe eastendofthebasementofSiebelCenter(nearthevendingmachines). Pleasedonotsubmititanywhereelse.Youmayturnintheassignmentupto 24hoursaftertheduedatei.e.byThursday,Mar.31st,at5:00pm,butyou willreceivea20%latepenalty.HomeworkwillNOTbeacceptedafterthis (asthisiswhenwewillpostthesolutions).Seethesyllabusforourlate policy. Youareencouragedtousebookproblemsforpractice. Pleasestapleallyourpagestogetherwithareal,metalstaple. Feelfreetoaskusquestionsatofficehoursoronthecoursenewsgroup. 1.(20pts):SequentialCircuitAnalysis BelowisadiagrammadeoftwoJKflipflops.Therearenoinputsandtheoutputs arejusttheflipflopstatesQ1andQ0themselves. A(12points).Fillintherestofthestatetablebelowforthiscircuit. CurrentState Q0 0 0 1 1 B(8points).Drawthestatediagramforthiscircuit.Sincethereareno inputsoroutputs,youdonotneedtolabelyourstatetransitionarrows. Q1 0 1 0 1 J0 1 1 0 0 Flipflopinputs K0 1 1 0 0 J1 1 1 0 1 K1 0 1 0 0 NextState Q0 1 1 1 1 Q1 1 0 0 1 2.(20pts):SequentialCircuitAnalysisII Analyze the following circuit diagram made of two JK flipflops and answer the questionsthatfollow.ThereisoneinputvariableXandtwostatevariablesQ1and Q2forFF1andFF2respectively. (A).(16points)Fillintherestofthefollowingtable. Present Input NextState Q2 0 0 0 0 1 1 1 1 Q1 0 0 1 1 0 0 1 1 X 0 1 0 1 0 1 0 1 Q2 0 1 0 0 1 0 1 1 Q1 0 1 1 1 1 0 0 1 (B). (4 points) If the initial state is 11, does the circuit have any unused state? If yes, name the unused state. If no, justify that there is no unused state. Yes,state01isunusedasitisnotreachablethroughanyotherstate. 3.(20points)VendingMachineController Designacircuitforavendingmachinethatdispensestwentyfivecentcandybars. Themachineacceptsonlynickels(5cents),dimes(10cents)andquarters(25 cents).Assoonasthebalancebecomesgreaterthanorequalto25cents,it automaticallydispensesacandybar. Notethatifthecustomeroverpaysforthecan,thenthemachinedoesnotreturnthe change,butinsteadkeepsthebalanceforfuturetransactions.(Forexample,ifa customerdepositsthreedimes(30cents),thenthemachinedispensesacandybar andkeepstheremaining5centsasabalanceforthenexttransaction). Yourcircuitshouldhavetwoinputbitsandoneoutputbit: Meaningoftheinputs: Meaningoftheoutput: 00nocoindeposited Ifthebitis1:dispensetheproduct 01nickeldeposited 10dimedeposited 11quarterdeposited Listouthowmanystatesareneededandbrieflyexplainthemeaningofeachstate. Drawastatediagramforthiscircuit.Clearlyidentifyyourstartstate.Ifyouneedto havemultiplelinesbetweenthesamepairofstates,justdrawonearrowwith multiplelabelsseparatedbycommas. Statesneeded:5 Meaningofstates: A:0centsbalance B:5centsbalance C:10centsbalance D:15centsbalance E:20centsbalance Solution: 4.(28points)Drawstatediagramsforthefollowing:(SameasQ5inHW6) (a)(10points)Drawastatediagramthatrecognizetwodistinctandpossibly overlappingpatternssimultaneously,010and001.Thecircuitwillacceptoneinput XandhaveoneoutputZwhichis1immediatelyaftereither010or001hasbeen enteredand0otherwise.Usetheminimumnumberofstatesforfullcredit. (b)(18points)Drawastatediagramthatrecognizesthepattern 10((0101)+(1010))*.Theoperator+heremeanseitherthepartoftheexpression immediatelybeforeorimmediatelyafterthe+symbol,and*heremeanszeroor morerepetitionsoftheimmediatelyprecedingexpression(i.e.0(11)*representsa set{0,011,01111;0111111,......},italsocalledtheKleeneclosure).TheoutputZ shouldbe0immediatelyafterthepatternhasbeenrecognized,and1otherwise. Itispossibletointerpretetheabovestatement(particularlythe+operator),intwo ways;oneistointerpretitasnotallowinganyoverlapping,soapatternininputis recognizedonlywhenitslengthis2(mod4);theotheristointerpretaspartathat the0101and1010arepossiblyoverlappingandcanbereadsimultaneously.Here pleasefillinthemissingtransitionsforeachinterpretation Part1.nonoverlapping Part2.Overlapping PossibleSolution1: PossibleSolution2: 5.(12points)CountersUp/DownCounter Implementacountertocount0,1,2,3,4,5,6,7,7,6,5,4,3,2,1,0,.usingthe standardfourbitcounter.Youmayusegatesandothercombinatorialcircuit elements.Makeyourdesignassimpleaspossible.ThepinsD2,D1,D0shouldbe countingtheabovesequence. Note:DoNOTuseoraltertheUP/DOWNorLDpin. ...
View Full Document

This note was uploaded on 04/28/2011 for the course CS 231 taught by Professor Staff during the Spring '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online