Upload
infodotz
View
222
Download
0
Embed Size (px)
DESCRIPTION
Ieee State of Mind English
Citation preview
IEEEStateofMindProblemStatement
FiniteStateMachines(FSMs)canbeusedtomodelsystemswhoseoutputdependsonthecurrentstateanditsinputs.Thestatescanrepresentmanydifferentsystemsliketheon/offstateoftrafficlightsatanintersection,thevalvestateofthrustersonaspacecraft,theclick/keycombinationsenteredbyauserforakeyboardshortcut,orthesend/receivestepsinacommunicationprotocol.
AnFSMisdefinedbyasetofstates,inputs,andoutputs.Thestatesrepresentaknownconfigurationofthesystemataspecifictime.Transitioningtoanewstatedependsonthecurrentstateandtheinputsprovided.Thiswillinturnalsoproduceanassociatedoutputforthesystem.
OneoftheusesofFSMsistodesignandanalyzelogiccircuitswithmemorieslikeflip-flops.Yourtaskistowriteaprogramtovisualizethetimingdiagramrelatingtheinputsandoutputswhileprintingthecurrentstatenumbertohelpanalyzethecircuit.
Forthepurposeoftheprogram,youcanassumethatthereareNstateswithMinputs.StatesarelabeledwithnumberedsubscriptsintherangeS toS .Theinputsareeachlabeledwithasingleuppercasecharacterintherange'A'to'J',inclusive.Youmayassumethatnoletterorstatenumberisskipped.EachstatehasPuniquelydefinedtransitionstootherstates(thetransitionsareuniqueinthesensethatnosetofinputswilltriggermorethan1transition).Atransitionisonlytakenwhentheinputconditionsaresatisfied.TransitionsareevaluatedatthebeginningofeachoftheTdiscretetimesteps.
InputFormat
InputbeginswithalinecontainingNandM,where1≤N<100and1<M<10.
ThenthereareNlines,eachdescribingtheoutputofthesystemandthetransitionsfromthisstate.ThefirstlinecontainsadescriptionofstateS ,thesecondlinedescribesS ,etc.Theselinesallhavethefollowingformat:
StateOutputPVariableExpression /Dest VariableExpression /Dest ...VariableExpression /Dest
where
StateOutputiseithera0or1,representingthevaluethatisoutputwhenthesystemisinthisstate
Pisthenumberoftransitionsfromthisstate
VariableExpression isacomma-delimitedlistofVariable=Valuetokens.Foratransitionitobeactivated,alloftheinputvariablesgivenintheVariableExpression musthavethevalueslistedinthisexpression
Dest ,1<=i<=P,isadestinationstatenumber,intherange[0..N),fortransitioni
Followingthedescriptionofthestates,isalinecontainingtwointegers,TandI,whereTgivesthenumberoftimesteps(1<=T<1000),andIgivesthenumberoftheinitialstate(0<=I<N).
TheinputendswithM*TlinesthatprovidetheinputsforallMvariablesineachoftheTtimesteps.ThefirstMvaluesprovideinputsfortheMvariablesduringthefirsttimestep,thesecondMvaluesprovideinputsfortheMvariablesduringthesecondtimestep,andsoon.
Thetransitionsshouldbeinterpretedasfollows.AssumethatweareinastateS .Assumefurtherthattherearefourinputs,andthecurrentinputprovidedforthecurrenttimestepis(1,0,1,0).Wemaptheseinputsto
0 N-1
0 1
1 1 2 2 P P
ii
i
j
thevariables,startingwithletter'A',soA=1,B=0,C=1,andD=0.WewouldthenlookfortransitionsdefinedonthelinecorrespondingtostateS .Sincetransitionsmustbeunique,onlyoneofthefollowingVariableExpressionscouldappearinthelistofexpressions: A=1 , B=0 , C=1 , D=0 , A=1,B=0 , A=1,C=1 ,A=1,D=0 , A=1,B=0,C=1 ,etc.Ifsuchatransitionisthei transitionspecified,thenewstatewouldbeDest .Iftherearenomatches,thesystemremainsinthecurrentstate.
OutputFormat
Theoutputconsistsofawaveform.Thewaveformisrepresentedbyunderscores,‘_’,forthenumber0,andasterisks,‘*’,forthenumber1.
Amaximumof16ticksareprintedtogether,whereeachtimetickis3characterswide.Thelinenumbersarelabeledwiththesignalnamesasshownintheexample.
Asshownintheexamplebelow,onthefirstlineofthegroupingisthetext Tick#X where X isreplacedbythenumberofthefirsttickinthegrouping.
Nextcomewaveformsforeachofthevariables,inalphabeticalorder,oneperline.Ontheselinesthevariablenameisoutput,followedbyfivespaces,andthenthewaveform.
Thenthewaveformofthesystemoutputisdisplayed.Thislinebeginswiththeword OUT ,followedby3spaces,andthenthewaveform.
Finally,onthelastlinethenumericvalueofthesystemoutputisdisplayed.ThislinebeginswiththewordSTATE .Thenumericvaluesofsystemoutputshouldalwaysbealignedwiththethirdcolumnoftherespectivetick.
Ifnotalltickshavebeendisplayed,thenablanklineshouldbeoutput,followedbythenextgroupofticksinthesameformat.
SampleInput
2312A=1,B=1,C=1/1A=1,B=0/001A=0/0200000001010011100101110111000001010011100101110111000001010011
SampleOutput
Tick#1A____________************____________************B______******______******______******______******C___***___***___***___***___***___***___***___***
j
th i
OUT*********************___*********************___STATE0000000100000001
Tick#17A____________B______******C___***___***OUT************STATE0000
Explanation
ThesampleinputexecutesaparitycheckFSM.ThereareN=2stateswithM=3inputs.Sincethereare3inputs,theseinputsarelabeled A , B ,and C .
State0,S ,outputsthevalue 1 (logichigh).Therearetwotransitionsoriginatingfromthisstate.ThefirsttransitiongoestoS wheninput A=1, B=1,and C=1.ThesecondtransitiongoestoS wheninput A=1and B=0(that’saself-looptothesamestate). C cantakeanyvalueinthesecondtransition.
S outputsthevalue 0 (logiclow).Thereisonlyonetransitionoriginatingfromthisstatedefinedintheinput.ThistransitiongoestoS when A=0.
Notethatalthoughnotdefined,thereareimplicittransitionstosatisfytheothercasesthatarenotexplicitlydescribedintheinput.Theimplicittransitionsareallself-loopstothesamestate.
Priortotickt=1,weareintheinitialstate,S .Theinputissetto A=0, B=0,and C=0,thereforewetaketheimplicitself-looptransitionandstayinS andoutputthevalueassociatedwiththestate,i.e. 1 .
Whenwestarttickst=2throught=7,wearestillinS .Ineachofthesecases,wetaketheimplicitlooptothesamestateandnothingchangesintheoutput.
Intickt=8,theinputs, A=1, B=1,and C=1,triggerthetransitiontostateS .Thischangestheoutputofourlogiccircuittoa 0 .
Intickt=9,theinput, A=0,triggerthetransitiontostateS .Thischangestheoutputofourlogiccircuittoa 1 .
Thesamepatternofinputsisrepeatedafewmoretimes.Tick17beginsonanewlinebecausewelimittheoutputto16ticksperline.
01 0
10
00
0
1
0