CS计算机代考程序代写 CS 2204: Digital Circuits

CS 2204: Digital Circuits

Lecture 13

comparator
Check if A>B, A=B, or AB?

Hint: look at the bits from right to left.

REPLACE ALL XORS with XNORS

comparator
When is A>B

– If a3 is 1 and b3 is 0; OR
– If a3=b3, and a2 is 1 and b2 is 0; OR
– If a3=b3; a2=b2, and a1 is 1 and b1 is 0; OR
– If a3=b3; a2=b2, a1=b1, and a0 is 1 and b0 is 0.

Circuit diagram

Exercise: Design a 4-bit comparator using a 4-bit adder
You can use a 4-bit unsigned adder, ands/ors/nots/MUXes.

Latches, flip-flops, and registers
So far we have seen “combinational” logic, i.e., the output
depends only on current inputs. But often times we need to
remember the past.

RINGER_ON

Rings as if
ON=1 and is off
if ON=0

IS_SMOKE?

1 if there is
smoke, 0 if not

1 if pushed, 0 if
not

IS_PUSHED?

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Combinational circuit implementation

RINGER_ON

Rings as if
ON=1 and is off
if ON=0

IS_SMOKE?

1 if there is
smoke, 0 if not

1 if pushed, 0 if
not

IS_PUSHED?

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Does this work?

Does this work?

RINGER_ON

Rings as if
ON=1 and is off
if ON=0

IS_SMOKE?
1 if there
is smoke, 0
if not

1 if pushed, 0 if
not

IS_PUSHED?

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Does this work?

t=1

t=10

t=1

Lets try something else

1

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

0
1

Ringer on if smoke

1

Lets try something else

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

0
1

Ringer on even after
fire is doused!!

1 1

Lets try something else

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer turns off
when push-button is
pressed!

1
00

1

Lets try something else

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer remains off
when push-button is
released!!

0
00

1

Putting it all together

1

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer ON when fire
detected

0
11

0

Putting it all together

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer remains ON
when fire doused

0
11

0

Putting it all together

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer remains OFF
when push-button
pressed

1
00

1

Putting it all together

0

Build a smoke alarm that starts
ringing if there is smoke and keeps
ringing till reset is pushed

Ringer remains OFF
when push-button
released

0
00

1

Take home: The smoke detector “remembers” its output
when both inputs are zero!!!

S/R Latch
R (reset)

S (set)
QaQb