NORTH CAROLINA STATE UNIVERSITY
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
ECE 212 FUNDAMENTALS OF LOGIC DESIGN

ECE212 Lecture Notes
Dr. Clay Gloster, Jr.

NUMBER SYSTEMS


Binary Representations of Numbers Representation of Negative Numbers

We will present three systems used for representing negative integers. They are:

We will use 4-bit numbers to illustrate these systems, however, the student should be able to represent n-bit numbers using any of these systems.

In all three systems, the leftmost bit is the sign bit.

If the sign bit is 0, then the number is positive.
If the sign bit is 1, then the number is negative.

Sign and Magnitude (Signed Magnitude)

The leftmost bit is the sign and the remaining bits are the magnitude of the number.

Addition and Subtraction using Sign and Magnitude numbers.

Subtraction is simply addition of negative numbers, therfore, we need only discuss addition in detail.

Case 1: The sign of the two operands is the same.

Simply add the two magnitudes and the sign of the result is the sign of the two operands.

Examples:

Case 2: The sign of the two operands is different.

Subtract the number with smaller magnitude number from the one with larger magnitude. The sign of the result is the sign of the number with the larger magnitude.

Examples:

Observation: Any adder circuit for sign and magnitude numbers must include a subtractor and a comparator.

One's Complement

Positive numbers are the same as in sign and magnitude representation.
Negative numbers are the bitwise complement of the positive number.

For 4-bit numbers, -2 = = 1101.
Considering 4-bit binary numbers,
Considering 4-bit binary numbers,
Considering 4-bit binary numbers,
Considering n-bit binary numbers,

Addition and Subtraction using One's Complement numbers.

Subtraction is simply addition of negative numbers, therfore, we need only discuss addition in detail.

Case 1: The sign of the two operands is the same.

Simply add the numbers.
If there is a carry, then add one to the result.
(End around carry condition.)

Examples:

Case 2: The sign of the two operands is different.

Simply add the numbers.
If there is a carry, then add one to the result.
(End around carry condition.)

Examples:

Observation: Subtraction in one's complement requires an adder and circuitry that adds one when there is a carry. (End around carry condition.)

Two's Complement

Positive numbers are the same as in sign and magnitude representation.
Negative numbers are the bitwise complement of the positive number + 1.

For 4-bit numbers, -2 = = 1110.
Considering 4-bit binary numbers,
Considering 4-bit binary numbers,
Considering 4-bit binary numbers,
Considering n-bit binary numbers,

Addition and Subtraction using Two's Complement numbers.

Subtraction is simply addition of negative numbers, therfore, we need only discuss addition in detail.

Case 1: The sign of the two operands is the same.

Simply add the numbers.
Ignore the carry out!!.

Examples:

Case 2: The sign of the two operands is different.

Simply add the numbers.
Ignore the carry out.

Examples:

Observation: Subtraction in two's complement requires an adder only.

Overflow Conditions

Overflow occurs during addition of two numbers when the sign of the two operands is the same and the sign of the result is different.

Case 1: If we add two positive numbers and get a negative result, overflow has occurred.
Case 2: If we add two negative numbers and get a positive result, overflow has occurred.

Examples (Two's complement):




Christopher Cornelius Doss
Tue Nov 11 23:23:59 EST 1997