6
1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on the input sequence System state changes with input and a set of input applied in a different sequence produce different output Consider the following state transition For example, going from Ames to Chicago, one may pass through the following states while driving, but may fly back One is in Ames One is in Ceder Rapids One is in DeKalb One is in Chicago State machine S0 S3 S2 S1 Ames DeKalb Ceder Rapids Chicago

1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

Embed Size (px)

Citation preview

Page 1: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

1

• Thus far what we only dealt with a pure combination circuit• That means output was simply dependent on the current input• However, output may depend on the input sequence• System state changes with input and a set of input applied in a

different sequence produce different output• Consider the following state transition• For example, going from Ames to Chicago, one may pass

through the following states while driving, but may fly back– One is in Ames– One is in Ceder Rapids– One is in DeKalb– One is in Chicago

State machine

S0 S3

S2S1

Ames

DeKalbCeder Rapids

Chicago

Page 2: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

2

• States can be coded as binary combinations of variables• Each state is represented by n=log N bits• N is total number of states• 2 bits will represent 4 state, 3 bits will represent eight, and so on• For 4 states we use two bits X and Y• A truth table will then give the next state• Xn and Yn can be specified in terms Xo and Yo

Truth tables to represent state transitions

Current Statexo yo

Next Statexn yn

0 0 0 10 1 1 01 0 1 11 1 0 0

xn = xo’ yo + xo yo’

yn = xo’ yo’ + xo yo’ = yo’

Page 3: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

3

• In a state transition diagram, state may change with time• A clock signal represents passage of time• Each time a clock arrives, state changes to next state• There is no other explicit input (or there is an implicit input)

• There may be an explicit input, say i• Next state may depend on current state and the value of input• Let us assume a binary input• Thus i can be 0 or 1• The state changes are shown

State Change, with clock and/or input

S0 S3

S2S1

Ames

DeKalbCeder Rapids

Chicago

0

1

1 1

1

0

0

0

Page 4: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

4

• States transition table will have two sets of inputs• Current state variable and input variables• Total number of row in table is 2(n+m)

– n is number of variables representing states– m is number of input variables

Truth tables with input for state transitions

Currentxo yo

Inputi

Next Statexn yn

0 0 0 0 10 0 1 1 00 1 0 1 00 1 1 1 11 0 0 1 11 0 1 0 01 1 0 0 01 1 1 0 1

xn=xo’ yo’ i+xo’ yo i’+xo’ yo i+xo yo’ i’

=xo’ i + xo’ yo + xo yo’ i’

yn=xo’ yo’ i’+xo’ yo i+xo yo’ i’+xo yo i

= yo’ i’ + yo i

Page 5: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

5

• Identify how many different things we need to keep track of• This is critical to know• Otherwise the number of states (and their meaning) may get out

of hand very quickly • This is different than what is the output of interest (in each

state we may have some outputs)• For example, if we are to process a sequence of inputs• Depending on interest, the number of states may be different

– If we need to know how many 1’s are there, we need states corresponding to count

– If we need to know if we have even or odd number of 1’s, we may need only two states

Determining number of states

Page 6: 1 Thus far what we only dealt with a pure combination circuit That means output was simply dependent on the current input However, output may depend on

6

• Start writing a state diagram– It has an initial state– It has other states to keep track of various activities

• Generate a state table• Generate state table in binary

– Needs state assignment, i.e., what state will have what code– State assignment is a complex process– For the time being assume straightforward combinations

• Derive canonical sum-of-products form equations– You can simplify the equations

• When the next state depend upon the inputs, the inputs are examined at the clock ticks

Steps in designing a state machine