• No results found

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

N/A
N/A
Protected

Academic year: 2021

Share "Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

ENEE244: Digital Logic Design

Design Example: Counters

• Counter:

a sequential circuit that repeats a specified sequence of output upon clock pulses.

– A,B,C,…, Z.

– G, O, T, E, R, P, S, !.

– 0,1,2,3,4,5,6,7.

– 7,6,5,4,3,2,1,0.

– 0,1,0,0,1,2,3,2,3,2,2,1.

• Binary counter:

follows the binary sequence.

– 2-bit (up) binary counter: 0,1,2,3.

– 3-bit down binary counter: 7,6,5,4,3,2,1,0

ENEE244: Digital Logic Design

Design Example: Counters

• Other useful counters:

– Decimal counter (e.g. BCD counter)

0000,0001,0010,…,1000,1001,0000,0001,…

– Modulo-k counter

Modulo-5 counter: 0,1,2,3,4,0,1,2,…

– M-to-N counter

3-to-8 counter: 3,4,5,6,7,8,3,4,…

– Ripple counter

– Ring counter and Johnson counter

ENEE244: Digital Logic Design

3-Bit Binary Counter

TC TB TA C B A C B A

1 1 1 0 0 0 1 1 1

1 0 0 1 1 1 0 1 1

1 1 0 0 1 1 1 0 1

1 0 0 1 0 1 0 0 1

1 1 1 0 0 1 1 1 0

1 0 0 1 1 0 0 1 0

1 1 0 0 1 0 1 0 0

1 0 0 1 0 0 0 0 0

current state next state flip-flop inputs

000 001 010 011

111 110 101 100

0 1 1

1 0 1

1 1 0

0 0 0

T Q(t+1) Q(t)

ENEE244: Digital Logic Design

3-Bit Binary Counter

• Flip-flop input functions

– TA = BC

– TB = C

– TC = 1 T Q

>

A T Q

>

B T Q

>

C

0 0 0

CP 1

• Figure 6.32 gives a 4-bit binary counter. When Q0=C, Q1=B, Q2=A, delete Q3, set Count enable bit to be constant 1, it becomes this 3-bit counter.

(2)

ENEE244: Digital Logic Design

Binary Counter with JK Flip-Flops

J

>

K Q Q’

A1

J

>

K Q Q’

A2

J

>

K Q Q’

A3

J

>

K Q Q’

A4 CP

E

0 x 1 1

1 x 0 1

x 1 1 0

x 0 0 0

K J Q(t+1) Q(t)

1 0 0 1

0 0 0 1

1 1 1 0

0 1 1 0

1 0 1 0

0 0 1 0

1 1 0 0

0 1 0 0

1 0 0 0

0 0 0 0

A1

A2

A3

A4

• when E = 1 and CP goes from 0 to 1:

– A1 – A2 – A3 – A4

ENEE244: Digital Logic Design

• Exercise:

Verify that the circuit is a binary counter that counts down from 15 to 0, and then back to 15 again.

J

>

K Q Q’

A1

J

>

K Q Q’

A2

J

>

K Q Q’

A3

J

>

K Q Q’

A4 CP

E

0 1 1 0

1 1 1 0

0 0 0 1

1 0 0 1

0 1 0 1

1 1 0 1

0 0 1 1

1 0 1 1

0 1 1 1

1 1 1 1

A1

A2

A3

A4

Count-Down Binary Counter

ENEE244: Digital Logic Design

Summary

• Sequential circuit design example

– Shift registers

– Basic counters

• Next time

– Binary counter with parallel load – Ripple counter

– Johnson counter

• Next Monday: Exam IV

– PLD, Chapter 6, 7.1, 7.2

– Discussion on Wednesday’s class

ENEE244: Digital Logic Design

Binary Counter with Parallel Load

• 2 control signals, 3 modes:

– Load (Qi=Di) Load = 1

– Count (up) Load = 0, Count = 1 – No change Load = 0, Count = 0 (change, load or count, happens only at

positive edge of the clock pulse.)

• Carry Out: 1 if and only if the counter is in “count” mode with content 1111.

• Read Figure 6.34 for the detailed implementation.

4-bit count D1 D2

D3 D0

Load Count

Q1

Q2 Q3

Q0

CO

>

(3)

ENEE244: Digital Logic Design

Modulo-7 Counter

4-bit count D1 D2

D3

D0

Load Count

Q1

Q2

Q3 Q0

CO

>

0 1 2 3 4 5 6 7

15 14 13 12 11 10 9 8 load

modulo-16

0 1 2 3 4 5 6 7

15 14 13 12 11 10 9 8 load

modulo-7 (when to load)

0 0 0 0

1

ENEE244: Digital Logic Design

3-To-8 Counter

4-bit count D1 D2 D3

D0

Load Count

Q1 Q2

Q3 Q0

CO

>

0 1 2 3 4 5 6 7

15 14 13 12 11 10 9 8 load

modulo-16

3-to-8 (when and what to load)

0 1 2 3 4 5 6 7

15 14 13 12 11 10 9 8 load 0

0 1 1

1

ENEE244: Digital Logic Design

Design Example

8-bit counter with two 4-bit counters

4-bit count D1 D2

D3 D0

Load Count

Q1

Q2 Q3

Q0

CO

>

4-bit count D1

D2

D3 D0

Load Count

Q1 Q2 Q3

Q0

CO

>

Q1 Q2 Q3

Q0

Q5

Q6 Q7

Q4

0 0

1

ENEE244: Digital Logic Design

Exam IV

• PLD

• Timing diagram for basic latch/flip-flop

• Sequential circuit analysis

• Sequential circuit design

• Registers and counters

(4)

ENEE244: Digital Logic Design

Ripple Counter

• Synchronous counter:

the CP signal of all flip- flops are from the common clock.

• Ripple counter:

the CP of some flip-flops are from other flip-flops (and through logic gates).

– Ripple counter is asynchronous

– Binary ripple (up) counter (read Figure 6.31) – Binary ripple down counter

– Where the CP signal comes from? (By default, flip-flop is positive edge triggered.)

ENEE244: Digital Logic Design

BCD Ripple Counter

• Verify the following circuit is a BCD Ripple counter triggered by negative edge.

J

>

K Q Q’

Q1

CP J

>

K Q Q’

J

>

K Q Q’

J

>

K Q Q’

Q2 Q4 Q8

1

ENEE244: Digital Logic Design

BCD Ripple Counter

• Verify the following circuit is a BCD Ripple counter triggered by negative edge.

CP

Q1 0 1 0 1 0 1 0 1 0 1 0 1

Q2

Q4

Q8

0 0 1 1 0 0 1 1 0 0 0 0

0 0 0 0 1 1 1 1 0 0 0 0

0 0 0 0 0 0 0 0 1 1 0 0

ENEE244: Digital Logic Design

Ring Counter

• Ring counter:

a circular shift register (with k flip- flops) that at any time, only one flip-flop is set (having value 1) and all others are cleared (with value 0). It is used to generate k (periodic) timing signals.

• Example: see Figure 6.37 for circuit.

CP QA

QD

QC

QB

(5)

ENEE244: Digital Logic Design

Ring Counter as “Counter + Decoder”

• To generate 4 (periodic) timing signals, we need

– a 4-bit ring counter, – or a 2-bit counter

and a 2x4 decoder.

CP

Count Load

2-bit count

0 0

1

2 x 4 decoder

2 0

3 1

QDQCQBQA

CO

ENEE244: Digital Logic Design

Johnson Counter

• Johnson counter:

a k-bit circular shift register with the complement of the last flip-flop connected to the input of the first flip-flop, and 2k decoding gates. It is used to generate 2k (periodic) timing signals.

D Q

>

S3 D Q

>

S2 D Q

>

S1

0 0 0

CP

Q’

6 AND gates for decoding

ENEE244: Digital Logic Design

Johnson Counter

1 1

0 0 6

1 1

1 0 5

1 1

1 1 4

1 0

1 1 3

1 0 0 1 2

1 0 0 0 1

T6 T5 T4 T3 T2 T1 S1 S2 S3

AND gate for output

T6 = S2’S1 T5 = S3’S2 T4 = S3S1 T3 = S2S1 T2 = S3S2 T1 = S3’S1

states

6 AND gates for decoding

S3 S2 S1

D Q

>

S3 D Q

>

S2 D Q

>

S1

0 0 0

CP

Q’

References

Related documents