Docsity

subtraction with compliments, Exercises of Digital Logic Design and Programming

Partial preview of the text

Download subtraction with compliments and more Exercises Digital Logic Design and Programming in PDF only on Docsity!

Digital Logic Design

Lecture No 05 Complements, Unsigned Binary Numbers Subtraction using Complements BSCS-6AB Dated 17 Feb 201 6

By Nasir Mahmood

[email protected]

Complements

● Complements^ are^ used^ to^ simplify^ subtraction

operations. We do subtraction by adding.

A – B = A+ (-B)

● There are two types:

● The^ radix complement, called the^ r’s complement.

● The diminished radix complement, called the (r-1)’s

complement.

DL

● The DRC or (r-1)’s complement of decimal number is

obtained by subtracting each digit from 9

● The^ (r-1)’s^ complement^ of^ octal^ or^ hexadecimal

number is obtained by subtracting each digit from 7

or F, respectively

● The^ DRC^ (1’s^ complement)^ of^ a^ binary^ number^ is

obtained by subtracting each digit from 1. It can also

be formed by changing 1’s to 0’s and 0’s to 1’s

Radix Complement

● The^ r’s complement^ of an^ n-digit number^ N^ in base-r^ is

defined as: r n

  • N - for N ≠ 0 0 - for N = 0

● We may obtain r’s complement by adding 1 to (r-1)’s

complement. Since r n

  • N = [(r n - 1) – N]+

● 10 ’s complement of 3229 is:

10 4

  • 3229 = 6771

● 2 ’s complement of 101101 is:

2 6

  • 101101 = 010011

● Note^ that^ to^ determine^2 ’s^ complement,^ leave^ the^ least

significant 0’s and the first 1 unchanged and then switch the remaining 1’s to 0’ and 0’s to 1’s.

The End