Sequential Circuit Design: Creating a Sequence Recognizer, Assignments of Computer Architecture and Organization

Learn how to design a sequential circuit, specifically a sequence recognizer, by creating a state diagram, making a state table, and finding flip-flop input values. The basics of sequential circuit design and provides an example of recognizing a specific bit pattern.

Typology: Assignments

Pre 2010

Uploaded on 03/16/2009

koofers-user-j5n-1
koofers-user-j5n-1 🇺🇸

10 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
October 22, 2003 Sequential circuit design 1
Sequential circuit design
Now let’s reverse the process: In sequential circuit design, we turn
some description into a working circuit.
We first make a state table or diagram to express the computation.
Then we can turn that table or diagram into a sequential circuit.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Sequential Circuit Design: Creating a Sequence Recognizer and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Sequential circuit design^

Sequential circuit design • Now let’s reverse the process: In sequential circuit design, we turnsome description into a working circuit.– We first make a state table or diagram to express the computation.– Then we can turn that table or diagram into a sequential circuit.

Sequential circuit design^

Sequence recognizers • A sequence recognizer is a special kind of sequential circuit that looksfor a special bit pattern in some input.• The recognizer circuit has only one input, X.– One bit of input is supplied on every clock cycle. For example, itwould take 20 cycles to scan a 20-bit input.– This is an easy way to permit arbitrarily long input sequences.• There is one output, Z, which is 1 when the desired pattern is found.• Our example will detect the bit pattern “1001”:Inputs:^ 1 1 1 0 0 1 1 0 1 0 0 1 0 0 1 1 0 …Outputs:^ 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 …Here, one input and one output bit appear every clock cycle.• This requires a sequential circuit because the circuit has to “remember”the inputs from previous clock cycles, in order to determine whether ornot a match was found.

Sequential circuit design^

Step 1: Making a state table • The first thing you have to figure out is precisely how the use of statewill help you solve the given problem.– Make a state table based on the problem statement. The tableshould show the present states, inputs, next states and outputs.– Sometimes it is easier to first find a state diagram and thenconvert that to a table.• This is usually the most difficult step. Once you have the state table,the rest of the design procedure is the same for all sequential circuits.• Sequence recognizers are especially hard! They’re the hardest examplewe’ll see in this class, so if you understand this you’re in good shape.

Sequential circuit design^

A basic state diagram • What state do we need for the sequence recognizer?– We have to “remember” inputs from previous clock cycles.– For example, if the previous three inputs were 100 and the currentinput is 1, then the output should be 1.– In general, we will have to remember occurrences of parts of thedesired pattern—in this case, 1, 10, and 100.• We’ll start with a basic state diagram:A B^ C^

D

1/0^ 0/^

State^

Meaning A^ None of the desired pattern (1001) has been input yet.B^ We’ve already seen the first bit (1) of the desired pattern.C^ We’ve already seen the first two bits (10) of the desired pattern.D^ We’ve already seen the first three bits (100) of the desired pattern.

Sequential circuit design^

Filling in the other arrows • Remember that we needtwo outgoing arrows for each node, to accountfor the possibilities of X=0 and X=1.• The remaining arrows we need are shown in blue. They also allow for thecorrect detection of overlapping occurrences of 1001.A B^ C

D

1/0^ 0/^

1/0 1/0 0/0 State

Meaning A^ None of the desired pattern (1001) has been input yet.B^ We’ve already seen the first bit (1) of the desired pattern.C^ We’ve already seen the first two bits (10) of the desired pattern.D^ We’ve already seen the first three bits (100) of the desired pattern.

Sequential circuit design^

Finally, making the state table A B^

C^ D

1/0^ 0/^

PresentNextState^ InputState^ OutputA^0 A^

0 A 1 B 0 B 0 C 0 B 1 B 0 C 0 D 0 C 1 B 0 D 0 A 0 D 1 B 1

Remember how the state diagramarrows correspond to rows of thestate table:input/outputnextpresentstatestate

October 22, 2003^

Sequential circuit design^ PresentNextState^ InputState^ OutputA^0 A^

Step 2: Assigning binary codes to states^ PresentState^ Input^0 A 1 B^0 B 0 C^0 B 1 B^0 C 0 D^0 C 1 B^0 D 0 A^0 D 1 B^1

NextState^ OutputQ Q X Q^ Q^ Z 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 0 1 1

•^ We have four states ABCD, so we need at least two flip-flops Q

Q^. 10

•^ The easiest thing to do is represent state A with Q

Q^ = 00, B with 01, 10

C with 10, and D with 11.• The state assignment can have a big impact on circuit complexity, butwe won’t worry about that too much in this class.

October 22, 2003^

Sequential circuit design^

Step 3: Finding flip-flop input values PresentNextState^ InputState^

Flip flop inputs^ Output Q^ Q^ X^ Q^ Q^1 0 1

JKJKZ^1 1 0

•^ Next we have to figure out how to actually make the flip-flops changefrom their present state into the desired next state.•^ This depends on what kind of flip-flops you use!•^ We’ll use two JKs. For each flip-flip Q

, look at its present and nexti

states, and determine what the inputs J

and Kshould be in order toi^ i^

make that state change.

Sequential circuit design^

JK excitation table • An excitation table shows what flip-flop inputs are required in order tomake a desired state change.Q(t) Q(t+1)^ J^ K^ Operation 0 0 0 x^ No change/reset 0 1 1 x^ Set/complement 1 0 x^1 Reset/complement 1 1 x^0 No change/set• This is the same information that’s given in the characteristic table,but presented “backwards.”J^ K^ Q(t+1)^ Operation^0 0 Q(t)^ No change^0 1 0 Reset^1 0 1 Set^1 1 Q’(t)^ Complement

Sequential circuit design^

Excitation tables for all flip-flops^ Q(t)^ Q(t+1)

Q(t)^ Q(t+1)^ D^ Operation^0 0 0 Reset^0 1 1 Set^1 0 0 Reset^1 1 1 Set^ J^ K^ Operation^0 0 0 x^ No change/reset^0 1 1 x^ Set/complement^1 0 x^1 Reset/complement^1 1 x^0 No change/setQ(t)^ Q(t+1)^ T^ Operation^0 0 0 No change^0 1 1 Complement^1 0 1 Complement^1 1 0 No change

October 22, 2003^

Sequential circuit design^

•^ Now you can make K-maps and find equations for each of the four flip-flop inputs, as well as for the output Z.•^ These equations are in terms of the present state and the inputs.•^ The advantage of using JK flip-flops is that there are many don’t careconditions, which can result in simpler MSP equations.

J^ = X’ Q^1 0 K= X + Q^1 0 J^ = X + Q^0 1 K= X’^0 Z = Q^ Q^ X^10

Step 4: Find equations for the FF inputs and output^ PresentNextState^ InputState^

Flip flop inputs^ Output Q^ Q^ X^ Q^ Q^1 0 1

JKJKZ^1 1 0

0 x^0 x^0 0 0 1 0 1

0 x^1 x^0 0 1 0 1 0

1 x^ x^1 0 1 1 0 1

0 x^ x^0 1 0 0 1 1

x^0 1 x^0 1 0 1 0 1

x^1 1 x^0 1 1 0 0 0

x^1 x^1 1 1 1 0 1

x^1 x^0

Sequential circuit design^

Step 5: Build the circuit • Lastly, we use these simplified equations to build the completedcircuit. J = X’ Q 1 0 K= X + Q 1 0 J = X + Q 0 1 K= X’ 0 Z = Q Q X 10

Sequential circuit design^

Building the same circuit with D flip-flops • What if you want to build the circuit using D flip-flops instead?• We already have the state table and state assignments, so we can juststart from Step 3, finding the flip-flop input values.• D flip-flops have only one input, so our table only needs two columns forD and D^. 1 0 PresentState^ Input

NextFlip-flopStateinputs^ OutputQ Q X Q^ Q^ DDZ 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 0 1 1

Sequential circuit design^

D flip-flop input values (Step 3) • The D excitation table is pretty boring;set the D input to whatever the nextstate should be.• You don’t even need to show separatecolumns for Dand D; you can just use^1 0 the Next State columns.PresentNextState^ InputState

Flip flopinputs^ Output Q^ Q^ X^ Q^ Q^1 0 1

DDZ^1

Q(t)^ Q(t+1)^ D^ Operation^0 0 0 Reset^0 1 1 Set^1 0 0 Reset^1 1 1 Set 0 1 1