Digital Logic Design: Complements of Numbers and Signed Binary Numbers, Lecture notes of Digital Logic Design and Programming

Lecture Number 2 of Digital Logic Design

Typology: Lecture notes

2018/2019

Uploaded on 12/02/2019

bareera-choudhry
bareera-choudhry 🇵🇰

2 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
DIGITAL LOGIC DESIGN
Lecture 2
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Digital Logic Design: Complements of Numbers and Signed Binary Numbers and more Lecture notes Digital Logic Design and Programming in PDF only on Docsity!

DIGITAL LOGIC DESIGN

Lecture 2

COMPLEMENTS OF NUMBERS

  • Complements in digital computers simplify the subtraction operation
  • Simplifying operations leads to simpler, less expensive circuits to implement the operations.
  • There are two types of complements for each base‐ r system:
  • The radix complement and the diminished radix complement.
  • The first is referred to as the r ’s complement and the second as the ( r - 1)’s complement.
  • When the value of the base r is substituted in the name, the two types are referred to as the 2’s complement and 1’s complement for binary numbers and the 10’s complement and 9’s complement for decimal numbers.

COMPLEMENTS OF NUMBERS

  • Example
    • Find the complement of 37 10
  • Solution
    • Since the number has 2 digits and the value of base is 10,
      • (Base)n^ - 1 = 10^2 - 1 = 99
      • Now 99 - 37 = 62
  • Hence, complement of 37 10 = 62 10

COMPLEMENTS OF NUMBERS

Complementary Method of Subtraction

Complementary Subtraction (Example 1)

Binary Subtraction Using Complementary Method

(Example 1)

Binary Subtraction Using Complementary Method

(Example 2)

Diminished Radix Complement

  • For binary numbers, r = 2 and r - 1 = 1, so the 1’s complement of N is (2 n^ - 1) - N.
  • Again, 2 n^ is represented by a binary number that consists of a 1 followed by n 0 ’s.
  • 2 n^ – 1 is a binary number represented by n 1 ’s.
  • For example, if n = 4, we have 2^4 = (10000)2 and 2^4 - 1 = (1111)2.
  • Thus, the 1’s complement of a binary number is obtained by subtracting each digit from 1. However, when subtracting binary digits from 1, we can have either 1 - 0 = 1 or 1 - 1 = 0, which causes the bit to change from 0 to 1 or from 1 to 0, respectively.
  • Therefore, the 1’s complement of a binary number is formed by changing 1’s to 0 ’s and 0’s to 1’s.
  • The ( r - 1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F (decimal 15), respectively

Radix Complement

  • The r ’s complement of an n ‐digit number N in base r is defined as r n^ - N for N not equal to 0 and as 0 for N = 0.
  • Comparing with the ( r - 1)’s complement, we note that the r’s complement is obtained by adding 1 to the ( r - 1)’s complement, since r n^ - N = [( r n^ - 1) - N ] +
  • Thus, the 10’s complement of decimal 2389 is 7610 + 1 = 7611 and is obtained by adding 1 to the 9’s complement value.
  • The 2’s complement of binary 101100 is 010011 + 1 = 010100 and is obtained by adding 1 to the 1’s‐complement value.
  • Since 10 is a number represented by a 1 followed by n 0 ’s, 10 n^ - N , which is the 10’s complement of N , can be formed also by leaving all least significant 0 ’s unchanged, subtracting the first nonzero least significant digit from 10, and subtracting all higher significant digits from 9.

Radix Complement

  • Similarly, the 2’s complement can be formed by leaving all least significant 0’s and the first 1 unchanged and replacing 1’s with 0’s and 0’s with 1’s in all other higher significant digits.
  • For example, the 2’s complement of 1101100 is 0010100 and
  • the 2’s complement of 0110111 is 1001001
  • The 2’s complement of the first number is obtained by leaving the two least significant 0’s and the first 1 unchanged and then replacing 1’s with 0’s and 0’s with 1’s in the other four most significant digits.
  • The 2’s complement of the second number is obtained by leaving the least significant 1 unchanged and complementing all other digits.

Subtraction with Complements

Subtraction with Complements

Subtraction with Complements