02 1563019 Logic

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

1563019

Logic Circuit Design


2nd Lesson

Doç. Dr. Ali YILDIZ


2 Chapter 1.5 Complements of Numbers

Complements are used in digital computers to simplify the subtraction operation


and for logical manipulation. Simplifying operations leads to simpler, less
expensive circuits.

When we talk about complement;

1-) Complement of a digit

2-) Complement of a number

a-) r’s complement of a number

b-) (r-1)’s complement of a number


3 Complement of a digit d :

Definition: Complement of a digit d = (r - 1) - d


4
5 Complement of a Number N :

a-) r’s complement

Definition: Complement of a number N = r n - N


6 Example

Example
7
Example:

Example:
8 Complement of a Number N :

b-) (r-1)’s complement

Definition: Complement of a number N = r n - r m - N


9 Example
10

Example
11
Example
12 For Binary
13 * Important The complement of the complement must restore the number
to its original value.

Example

Example
14 Chapter 1.6 Signed Binary Numbers

Positive integers (including zero) can be represented as unsigned numbers.


However, to represent negative integers, we need a notation for negative values.

Number Respresentation Systems:

- Digital systems cannot represent negative number as decimal


(putting a ( - ) minus sign in front of the number)

- Each computer chooses one representation system.


15 1-) Signed Magnitude Representation

Let’s assume n bit number

Left most bit (Most Significant Bit, MSB) indicates sign

0 means +
1 means -
Remaining bits give magnitude
16
17 Example
18 Example
19 2-) Signed ONE’s Complement Representation

Let’s assume n bit number

Left most bit (Most Significant Bit, MSB) indicates sign

If sign bit = 0, then the number is positive (+) and remaining bits
give magnitude

If sign bit = 1, then the number is negative (-) and remaining bits
are ONE’s complement of the number
20 Example

Recall: in Signed Magnitude Representation


21 3-) Signed TWO’s Complement Representation

Let’s assume n bit number

Left most bit (Most Significant Bit, MSB) indicates sign

If sign bit = 0, then the number is positive (+) and remaining bits
give magnitude

If sign bit = 1, then the number is negative (-) and remaining bits
are TWO’s complement of the number
22 Example

Recall: in Signed ONE’s Complement Representation


23

16 different numbers in each of them.


However, in SM & SOC; +0 & -0 are
respresented seperately. But, in STC -0
is excluded.

In modern computers, S2C (STC)


representation is used.

You might also like