Lecture 4 Review Question #1 Find the groupings in the following - - PowerPoint PPT Presentation

lecture 4 review question 1
SMART_READER_LITE
LIVE PREVIEW

Lecture 4 Review Question #1 Find the groupings in the following - - PowerPoint PPT Presentation

Lecture 4 Review Question #1 Find the groupings in the following K-Map C D C D C D C D A B 1 0 X 1 A B X 0 X 1 A B 1 X 1 1 A B 1 X X X Produce a logical equation for these groupings: A + D Question


slide-1
SLIDE 1

Lecture 4 Review

slide-2
SLIDE 2

Question #1

§ Find the groupings in the following K-Map § Produce a logical equation for these

groupings:

C·D C·D C·D C·D A·B 1 X 1 A·B X X 1 A·B 1 X 1 1 A·B 1 X X X

A + D

slide-3
SLIDE 3

Question #1: alternative

§ Find the groupings in the following K-Map § Produce a logical equation for these

groupings:

C·D C·D C·D C·D A·B 1 X 1 A·B X X 1 A·B 1 X 1 1 A·B 1 X X X

D + C

slide-4
SLIDE 4

Question #2

§ Complete the truth table

R Q S Q

S R QT QT QT+1 QT+1

1 1 1 1 1 X X 1 1 X X 1 1 1 X X ß Set ß Reset ß Hold ß Forbidden

slide-5
SLIDE 5

Question #2

§ Complete the truth table

R Q S Q

S R QT QT QT+1 QT+1

1 1 1 1 1 X X 1 1 X X 1 1 1 X X ß Set ß Reset ß Hold ß Forbidden

slide-6
SLIDE 6

Question #3

§ What are the output

values from Q and Q given the following inputs on S, R and C?

Q Q S R C

Time

S R C Q Q

1 ? ? 1 1 1 1 1 1 1 1 1 1 1

slide-7
SLIDE 7

Question #3

§ What are the output

values from Q and Q given the following inputs on S, R and C?

Q Q S R C

Time

S R C Q Q

1 ? ? 1 1 1 1 1 1 1 1 1 1 1

slide-8
SLIDE 8

Question #4

§ Assuming all

inputs start low, complete the timing diagram

Clock

S R

S1 R1 C Q1 Q1 S0 C Q0 Q0 R0

S R Q Q C Q0 Q

slide-9
SLIDE 9

Lecture 5 Review

slide-10
SLIDE 10

Question #1

Assume we want to build a change machine

§ We can add either $0.05 or $0.10 at a time § We want to keep track of the current amount

in the machine

§ We can hold a maximum of $0.50 § Draw the state diagram

slide-11
SLIDE 11

Question #1b

§ How many flip-

flops would you need to implement the following finite state machine (FSM)?

ú 11 states ú # flip-flops =

élog2 (# of states)ù

ú # flip-flops = 4 Zero Five Twenty-Five Ten Fifteen Thirty-Five Twenty Forty-Five Forty Fifty Thirty 10¢ 10¢ 10¢ 10¢ 10¢ 10¢ 10¢ 10¢ 10¢ 5¢ 5¢ 5¢ 5¢ 5¢ 5¢ 5¢ 5¢ 5¢ 5¢

slide-12
SLIDE 12

Question 2: Barcode Reader

§ When scanning UPC

barcodes, the laser scanner looks for black and white bars that indicate the start of the code.

§ If black is read as a 1 and white is read as a 0,

the start of the code (from either direction) has a 1010 pattern.

ú Can you create a state machine that detects this

pattern?

slide-13
SLIDE 13

Step #1: Draw state diagram

A B

1

C D

1

E

1 1 1

slide-14
SLIDE 14

Step #2: State Table

§ Write state table with Z § Output Z is determined

by the current state.

ú Denotes Moore machine.

§ Next step: allocate flip-

flops values to each state.

ú How many flip-flops will

we need for 5 states?

# flip-flops = élog(# of states) ù

Present State

X

Z Next State

A A A 1 B B C B 1 B C A C 1 D D E D 1 B E 1 A E 1 1 D

slide-15
SLIDE 15

Step #3: Flip-Flop Assignment

§ 3 flip-flops

needed here.

§ Assign states

carefully though!

§ Can’t simply do this:

Ø A = 100 Ø C = 010 Ø E = 000

A B

1

C D

1

E

1 1 1

ØB = 011 ØD = 001

Why not?

slide-16
SLIDE 16

Step #3: Flip-Flop Assignment

§ Be careful of

race conditions.

§ Better solution:

Ø A = 000 Ø C = 011 Ø E = 100

  • Still has race conditions (CàD, CàA), but is safer.
  • “Safer” is defined according to output behaviour.
  • Sometimes, extra flip-flops are used for extra insurance.

A B

1

C D

1

E

1 1 1

ØB = 001 ØD = 101

slide-17
SLIDE 17

Present State

X

Z Next State

A A A 1 B B C B 1 B C A C 1 D D E D 1 B E 1 A E 1 1 D

Step #4: Redraw State Table

§ From here, we can

construct the K-maps for the state logic combinational circuit.

ú Derive equations for each

flip-flop value, given the previous values and the input X.

ú Three equations total,

plus one more for Z (trivial for Moore machines).

F2 F1 F0

X

Z F2 F1 F0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

slide-18
SLIDE 18

Step 5: Circuit design

§ Karnaugh map for F2:

F0·X F0·X F0·X F0·X F2·F1 F2·F1 X X 1 F2·F1 X X X X F2·F1 1 1

F2 = F1X + F2F0X + F2F0X

slide-19
SLIDE 19

Step 5: Circuit design

§ Karnaugh map for F1:

F0·X F0·X F0·X F0·X F2·F1 1 F2·F1 X X F2·F1 X X X X F2·F1

F1 = F2F1F0X

slide-20
SLIDE 20

Step 5: Circuit design

§ Karnaugh map for F0:

F0·X F0·X F0·X F0·X F2·F1 1 1 1 F2·F1 X X 1 F2·F1 X X X X F2·F1 1 1

F0 = X + F2F1F0

slide-21
SLIDE 21

Step 5: Circuit design

§ Output value Z goes high based on the

following output equation:

§ Note: All of these equations would be

different, given different flip-flop assignments!

ú Practice alternate assignment for the midterm J

Z = F2F1F0