Counters2020/09/16  · •up/down signed nbit counter (default 8 bit) Counters add 1 select + or -...

Post on 04-Nov-2020

13 views 0 download

Transcript of Counters2020/09/16  · •up/down signed nbit counter (default 8 bit) Counters add 1 select + or -...

Counters

Last updated 9/16/20

2 © tjEE 3921

Counters

These slides review the design for several types of counters

Upon completion: You should be able to design various types of counters

(up/dn/signed/unsigned/mod)

3 © tjEE 3921

Counters

• Up Counter

• Count in binary• 0000 → 0001 → 0010 → 0011 → 0100 … 1111 → 0000 …

b0 b1 b2 bn-1

D Q

QB

RSTB

D Q

QB

RSTB

D Q

QB

RSTB

D Q

QB

RSTB

clk_in

rstb

What’s wrong with this solution

4 © tjEE 3921

• Counter - n bit - unsigned

Counters

why?2 - reasons

cast

5 © tjEE 3921

Counters

• Counter - n bit – unsigned – (default)

adds 14 bits, hex 1

4 FF’s

adder logic

6 © tjEE 3921

Counters

• Counter - n bit – unsigned (6 bit version)

7 © tjEE 3921

Counters

• Counter - n bit – unsigned (6 bit version)

reset counting

wrap

8 © tjEE 3921

Counters

Mod counter

9 © tjEE 3921

• Mod 11 counter

Counters

10 © tjEE 3921

Counters

• Mod 11 counter

control selection ofcnt+1 or 0

add 1

check for < 0cnt – 10 (4bit, hex a)

11 © tjEE 3921

• Mod 11 counter

Counters

counting mod11 wrapreset

12 © tjEE 3921

Counters

Up/Down counter

13 © tjEE 3921

• up/down signed nbit counter

Counters

14 © tjEE 3921

• up/down signed nbit counter (default 8 bit)

Counters

add 1 select + or -

subtract 1cnt & 1 → a bcde fgh11fd → + 1 1111 1101

n opqr stuv

cnt - 1

subtract 1Shift and concatenate 1 2x + 1Add -3 + -3

2x – 2

Only select upper bits → /2 x - 1

15 © tjEE 3921

• up/down signed nbit counter (6 bit test)

Counters

16 © tjEE 3921

• up/down signed nbit counter (6 bit version)

Counters

reset counting up

transition to negative

counting down

transition to positive