15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Full Adder<br />

Definition 415 The 1-bit full adder is a circuit FA 1<br />

that implements the function f 1 FA : B × B × B → B2<br />

with (FA 1 (a, b, c ′ )) = B(〈〈a〉〉 + 〈〈b〉〉 + 〈〈c ′ 〉〉)<br />

The result of the full-adder is also denoted with 〈c, s〉,<br />

i.e., a carry and a sum bit. The bit c ′ is called the input<br />

carry.<br />

the easiest way to implement a full adder is to use two<br />

half adders and an OR gate.<br />

Lemma 416 (Cost and Depth)<br />

C(FA 1 ) = 2C(HA) + 1 = 5 and<br />

dp(FA 1 ) = 2dp(HA) + 1 = 3<br />

c’<br />

a<br />

b<br />

HA<br />

s<br />

c<br />

HA<br />

s<br />

c<br />

s<br />

c<br />

c○: Michael Kohlhase 244<br />

a b c ′ c s<br />

0 0 0 0 0<br />

0 0 1 0 1<br />

0 1 0 0 1<br />

0 1 1 1 0<br />

1 0 0 0 1<br />

1 0 1 1 0<br />

1 1 0 1 0<br />

1 1 1 1 1<br />

Of course adding single digits is a rather simple task, and hardly worth the effort, if this is all we<br />

can do. What we are really after, are circuits that will add n-bit binary natural numbers, so that<br />

we arrive at computer chips that can add long numbers for us.<br />

Full n-bit Adder<br />

Definition 417 An n-bit full adder (n > 1) is a circuit that corresponds to<br />

f n FA : Bn × B n × B → B × B n ; 〈a, b, c ′ 〉 ↦→ B(〈〈a〉〉 + 〈〈b〉〉 + 〈〈c ′ 〉〉)<br />

Notation 418 We will draw the n-bit full adder with the following symbol in circuit diagrams.<br />

Note that we are abbreviating n-bit input<br />

and output edges with a single one that<br />

has a slash and the number n next to it.<br />

There are various implementations of the full n-bit adder, we will look at two of them<br />

c○: Michael Kohlhase 245<br />

This implementation follows the intuition behind elementary school addition (only for binary<br />

numbers): we write the numbers below each other in a tabulated fashion, and from the least<br />

134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!