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.

So, the conditional sum adder has a smaller depth than the carry chain adder. This smaller<br />

depth is paid with higher cost.<br />

There is another adder that combines the small cost of the carry chain adder with the low<br />

depth of the conditional sum adder. This carry lookahead adder CLA n has a cost C(CLA n ) ∈<br />

O(n) and a depth of dp(CLA n ) ∈ O(log 2(n)).<br />

c○: Michael Kohlhase 250<br />

Instead of perfecting the n-bit adder further (and there are lots of designs and optimizations out<br />

there, since this has high commercial relevance), we will extend the range of arithmetic operations.<br />

The next thing we come to is subtraction.<br />

3.2.2 Arithmetics for Two’s Complement Numbers<br />

This of course presents us with a problem directly: the n-bit binary natural numbers, we have<br />

used for representing numbers are closed under addition, but not under subtraction: If we have<br />

two n-bit binary numbers B(n), and B(m), then B(n + m) is an n + 1-bit binary natural number.<br />

If we count the most significant bit separately as the carry bit, then we have a n-bit result. For<br />

subtraction this is not the case: B(n − m) is only a n-bit binary natural number, if m ≥ n<br />

(whatever we do with the carry). So we have to think about representing negative binary natural<br />

numbers first. It turns out that the solution using sign bits that immediately comes to mind is<br />

not the best one.<br />

Negative Numbers and Subtraction<br />

Note: So far we have completely ignored the existence of negative numbers.<br />

Problem: Subtraction is a partial operation without them.<br />

Question: Can we extend the binary number systems for negative numbers?<br />

Simple Solution: Use a sign bit. (additional leading bit that indicates whether the number is positive)<br />

Definition 426 ((n + 1)-bit signed binary number system)<br />

〈〈an, . . . , a0〉〉 − <br />

:=<br />

〈〈an−1, . . . , a0〉〉<br />

−〈〈an−1, . . . , a0〉〉<br />

if an = 0<br />

if an = 1<br />

Note: We need to fix string length to identify the sign bit. (leading zeroes)<br />

Example 427 In the 8-bit signed binary number system<br />

10011001 represents -25 ((〈〈10011001〉〉 − ) = −(2 4 + 2 3 + 2 0 ))<br />

00101100 corresponds to a positive number: 44<br />

c○: Michael Kohlhase 251<br />

Here we did the naive solution, just as in the decimal system, we just added a sign bit, which<br />

specifies the polarity of the number representation. The first consequence of this that we have to<br />

keep in mind is that we have to fix the width of the representation: Unlike the representation for<br />

binary natural numbers which can be arbitrarily extended to the left, we have to know which bit<br />

is the sign bit. This is not a big problem in the world of combinational circuits, since we have a<br />

fixed width of input/output edges anyway.<br />

139

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

Saved successfully!

Ooh no, something went wrong!