0% found this document useful (0 votes)
11 views49 pages

Unit-1 DLD

The document covers the fundamentals of number systems and Boolean algebra, including various number bases, conversions between them, and the concept of complements. It explains binary, octal, and hexadecimal systems, along with methods for converting between these bases and performing arithmetic operations using complements. The document also includes examples of 1's and 2's complements for binary numbers and their applications in subtraction.

Uploaded by

cikeki2941
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views49 pages

Unit-1 DLD

The document covers the fundamentals of number systems and Boolean algebra, including various number bases, conversions between them, and the concept of complements. It explains binary, octal, and hexadecimal systems, along with methods for converting between these bases and performing arithmetic operations using complements. The document also includes examples of 1's and 2's complements for binary numbers and their applications in subtraction.

Uploaded by

cikeki2941
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Unit-I

Number system and Boolean Algebra


Content

 Number Systems and conversion


 Complements

 Signed binary numbers

 Binary codes

 Boolean algebra

 Basic theorems and properties

Unit-I Number system and Boolean Algebra 2


Number System
 Each number system is associated with a base or radix
◦ The decimal number system is said to be of base or radix 10
 A number in base r contains r digits 0,1,2,...,r-1
◦ Decimal (Base 10): 0,1,2,3,4,5,6,7,8,9
 Numbers are usually expressed in positional notation
UNIT II – Logic Gates and Gate –Level Minimization

– MSD: most significant digit


– LSD: least significant digit
Unit-I Number system and Boolean Algebra 3
Unsigned Binary Numbers
• The binary number system: Base-2
• Two digits: 0 and 1
• The digits in a binary number are called bits

– MSB: most significant bit


– LSB: least significant bit

Unit-I Number system and Boolean Algebra 4


Unsigned Binary Numbers

Unit-I Number system and Boolean Algebra 5


Unsigned Binary Numbers
• For a computer with the word size of 32-bit
- 4 data-bit unit – nibble (half byte)
- 8 data-bit unit - byte
- 16 data-bit unit – two bytes (half-word)
- 32 data-bit unit – word (four bytes)
- 64 data-bit unit – double-word
Powers of 2:
20 = 1 24 = 16 28 = 256
21 = 2 25 = 32 29 = 512
22 = 4 26 = 64 210 = 1024
23 = 8 27 = 128

210 : K (kilo); 2 20 : M (mega); 230 : G ( giga)

Unit-I Number system and Boolean Algebra 6


Converting Binary to Decimal
• For example, here is 1101.01 in binary:
1 1 0 1 . 0 1 Bits
23 22 21 20 2-1 2-2 Weights (in base 10)

(1 x 23) + (1 x 22) + (0 x 21) + (1 x 20) + (0 x 2-1) +


(1 x 2-2) =

8 + 4+ 0+ 1+ 0 + 0.25 = 13.25

(1101.01)2 = (13.25)10

Unit-I Number system and Boolean Algebra 7


Converting Decimal to Binary
• To convert a decimal integer into binary, keep dividing by 2 until
the quotient is 0. Collect the remainders in reverse order
• To convert a fraction, keep multiplying the fractional part by 2
until it becomes 0. Collect the integer parts in forward order
• Example: 162.375:
• So, (162.375)10 = (10100010.011)2

162 / 2 = 81 rem 0
81 / 2 = 40 rem 1 0.375 x 2 = 0.750
40 / 2 = 20 rem 0 0.750 x 2 = 1.500
20 / 2 = 10 rem 0 0.500 x 2 = 1.000
10 / 2 =5 rem 0
5/2 =2 rem 1
2/2 =1 rem 0
1/2 =0 rem 1

Unit-I Number system and Boolean Algebra 8


Why does this work?
• This works for converting from decimal to any base
• Why? Think about converting 162.375 from decimal to decimal

162 / 10 = 16 rem 2 0.375 x 10 = 3.750


16 / 10 = 1 rem 6 0.750 x 10 = 7.500
1 / 10 = 0 rem 1 0.500 x 10 = 5.000

• Each division strips off the rightmost digit (the remainder). The
quotient represents the remaining digits in the number
• Similarly, to convert fractions, each multiplication strips off the
leftmost digit (the integer part). The fraction represents the
remaining digits

Unit-I Number system and Boolean Algebra 9


Octal and Hexadecimal Numbers
• The octal number system: Base-8
• Eight digits: 0,1,2,3,4,5,6,7
(127.4)8  1 82  2  81  7  80  4  81  (87.5)10
• The hexadecimal number system: Base-16
• Sixteen digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
• For our purposes, base-8 and base-16 are most
useful as a “shorthand” notation for binary
numbers
(B65F)16  11163  6162  5161 15160  (46687)10

Unit-I Number system and Boolean Algebra 10


Numbers with Different Bases
Decimal Binary Octal Hex
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
You can convert between
4 0100 4 4 base-10
5 0101 5 5 base-8 and base-16 using
6 0110 6 6
7 0111 7 7
techniques
8 1000 10 8 like the ones we just
9 1001 11 9 showed for
10 1010 12 A
11 1011 13 B converting between decimal
12 1100 14 C and
13 1101 15 D
14 1110 16 E binary
15 1111 17 F

Unit-I Number system and Boolean Algebra 11


Binary and Octal Conversions
• Converting from octal to binary: Replace each octal digit with its
equivalent 3-bit binary sequence
(673.12)8 = 6 7 3 . 1 2
= 110 111 011 . 001 010
(110111011 . 001010 )2

• Converting from binary to octal: Make groups of 3 bits, starting from the
binary point. Add 0s to the ends of the number if needed. Convert each bit
group to its corresponding octal digit.

10110100.0010112 =010 110 100 .001 011 2


= 2 6 4 . 1 38

Unit-I Number system and Boolean Algebra 12


Binary and Hex Conversions
• Converting from hex to binary: Replace each hex digit with its
equivalent 4-bit binary sequence
261.3516 = 2 6 1 . 3 516
= 0010 0110 0001 . 0011 01012
• Converting from binary to hex: Make groups of 4 bits, starting from the
binary point. Add 0s to the ends of the number if needed. Convert each bit
group to its corresponding hex digit

10110100.0010112 =1011 0100 .0010 11002


= B 4 . 2 C16
Hex Binary Hex Binary Hex Binary Hex Binary
0 0000 4 0100 8 1000 C 1100
1 0001 5 0101 9 1001 D 1101
2 0010 6 0110 A 1010 E 1110
3 0011 7 0111 B 1011 F 1111
Unit-I Number system and Boolean Algebra 13
Unsigned Binary Coded Decimal (BCD)

Unit-I Number system and Boolean Algebra 14


Complements
 There are two types of complements for each base-r system: the radix complement and diminished radix
complement.
 Diminished Radix Complement - (r-1)’s Complement
 Given a number N in base r having n digits, the (r–1)’s
complement of N is defined as:
(rn –1) – N
 Example for 6-digit decimal numbers:
 9’s complement is (rn – 1)–N = (106–1)–N = 999999–N
 9’s complement of 546700 is 999999–546700 = 453299
 Example for 7-digit binary numbers:
 1’s complement is (rn – 1) – N = (27–1)–N = 1111111–N
 1’s complement of 1011000 is 1111111–1011000 = 0100111
 Observation:
 Subtraction from (rn – 1) will never require a borrow
 Diminished radix complement can be computed digit-by-digit
 For binary: 1 – 0 = 1 and 1 – 1 = 0
15
Unit-I Number system and Boolean Algebra
Diminished Radix Complement
 1’s Complement (Diminished Radix Complement)
◦ All ‘0’s become ‘1’s
◦ All ‘1’s become ‘0’s
Example (10110000)2
 (01001111)2
If you add a number and its 1’s complement …

1 0 1 1 0 0 0
+0 1 O 0 1 1 1

1 1 1 1 1 1 1
16
Unit-I Number system and Boolean Algebra
Radix Complement
The r's complement of an n-digit number N in base r is defined as
rn – N for N ≠ 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 rn – N = [(rn  1) – N] + 1.

• Example: Base-10
The 10's complement of 012398 is 987602
The 10's complement of 246700 is 753300

• Example: Base-2
The 2's complement of 1101100 is 0010100
The 2's complement of 0110111 is 1001001

17
Unit-I Number system and Boolean Algebra
2’s Co Radix Complement
– Take 1’s complement then add 1
OR – Toggle all bits to the left of the first ‘1’ from the
right
Example:
Number: 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0
1’s Comp.:
0 1 0 0 1 1 1 1
+
1 0 10 1 0 0 0 0

0 1 0 1 0 0 0 0
18
Unit-I Number system and Boolean Algebra
Applications
• Subtraction with Complements
– The subtraction of two n-digit unsigned numbers
M – N in base r can be done as follows:

19
Unit-I Number system and Boolean Algebra
Complements
• Example
– Using 10's complement, subtract 72532 – 3250.

• Example Using 10's complement, subtract 3250 – 72532.

There is no end carry.

Therefore, the answer is – (10's complement of


30718) =  69282.
20
Unit-I Number system and Boolean Algebra
Complements
• Example
– Given the two binary numbers X = 1010100 and
– Y = 1000011, perform the subtraction (a) X – Y ;
and (b) Y  X, by using 2's complement.

There is no end carry.


Therefore, the answer
is Y – X =  (2's
complement of 1101111)
=  0010001.
21
Unit-I Number system and Boolean Algebra
• Subtraction of unsigned numbers can also be done by means of the (r  1)'s
complement. Remember that the (r  1) 's complement is one less then the
r's complement.
• Example 1.8

– Repeat Example, but this time using 1's complement.

There is no end carry,


Therefore, the answer is
Y – X =  (1's complement
of 1101110) =  0010001.

22
Unit-I Number system and Boolean Algebra
10’s Complement Examples
Example #1:
-003
Complement Digits

996
+1 Add 1
997
Example #2
: -214
Complement Digits

785
+1 Add 1
786
Unit-I Number system and Boolean Algebra 23
2’s Complement Examples
Example #1
5 = 00000101
Complement Digits

11111010
+1
Add 1
-5 = 11111011

Example #2
-13 = 11110011
Complement Digits

00001100
+1
Add 1
13 = 00001101 24
2’s Complement Examples
Example #1
5 = 00000101
Complement Digits

11111010
+1
Add 1
-5 = 11111011

Example #2
-13 = 11110011
Complement Digits

00001100
+1
Add 1
13 = 00001101 25
Using The 2’s Complement Process
Use the 2’s complement process to add together
the following numbers.

POS 9 NEG (-9)


+ POS + 5 + POS + 5
POS 14 NEG -4

POS 9 NEG (-9)


+ NEG + (-5) + NEG + (-5)
POS 4 NEG - 1426
POS + POS → POS Answer
If no 2’s complement is needed, use regular binary
addition.
9  00001001
+ 5  + 00000101
14  00001110

27
POS + NEG → POS Answer
Take the 2’s complement of the negative number and
use regular binary addition.
9  00001001
+ (-5) + 11111011
4  1]00000100
8th Bit = 0: Answer is Positive
Disregard 9th Bit

00000101
 2’s
11111010 Complement
Process
+1
11111011 28
POS + NEG → NEG Answer
Take the 2’s complement of the negative number and
use regular binary addition.

(-9) 11110111
+ 5  + 00000101
-4  11111100
8th Bit = 1: Answer is Negative

11111100 00001001
To Check:   2’s
Perform 2’s
Complement
00000011 11110110 Complement
Process
On Answer +1 +1
00000100 11110111 29
NEG + NEG → NEG Answer
Take the 2’s complement of both negative numbers
and use regular binary addition.
2’s Complement
(-9)  11110111 Numbers, See
Conversion Process

+ (-5)  + 11111011 In Previous Slides

-14  1]11110010
8th Bit = 1: Answer is Negative
Disregard 9th Bit

11110010
To Check: 
Perform 2’s
Complement
00001101
On Answer +1
00001110 30
Signed Binary Numbers
 To represent negative integers, we need a notation
for negative values.
 It is customary to represent the sign with a bit
placed in the leftmost position of the number
since binary digits.
 The convention is to make the sign bit 0 for
positive and 1 for negative.
 Example:

 lists all possible four-bit signed binary numbers in


the three representations.
31
Unit-I Number system and Boolean Algebra
Signed Binary Numbers

32
Unit-I Number system and Boolean Algebra
Signed Binary Numbers
• Arithmetic addition
– The addition of two numbers in the signed-magnitude system follows the
rules of ordinary arithmetic.

– If the signs are the same,we add the two magnitudes and give the sum
the common sign.
– If the signs are different, we subtract the smaller magnitude from the larger
and give the difference the sign if the larger magnitude.
– The addition of two signed binary numbers with negative numbers
represented in signed-2's-complement form is obtained from the addition
of the two numbers, including their sign bits.
– A carry out of the sign-bit position is discarded.

33
Unit-I Number system and Boolean Algebra
Example :
Examples

Unit-I Number system and Boolean Algebra


Signed Binary Numbers
• Arithmetic Subtraction
– In 2’s-complement form:
1. Take the 2’s complement of the subtrahend (including
the sign bit) and add it to the minuend (including sign
bit).
2. A carry out of sign-bit position is discarded.

(  A)  (  B )  (  A)  (  B )
(  A)  (  B )  (  A)  (  B )

(11111010  11110011)
( 6)  ( 13)
• Example: (11111010 + 00001101)
00000111 (+ 7)
35
Unit-I Number system and Boolean Algebra
Binary Codes
 BCD Code
◦ A number with k decimal digits will
require 4k bits in BCD.
◦ Decimal 396 is represented in BCD
with 12bits as 0011 1001 0110,
with each group of 4 bits
representing one decimal digit.
◦ A decimal number in BCD is the
same as its equivalent binary
number only when the number is
between 0 and 9.
◦ The binary combinations 1010
through 1111 are not used and
have no meaning in BCD.

36
Unit-I Number system and Boolean Algebra
Binary Code
• Example:
– Consider decimal 185 and its corresponding value
in BCD and binary:

• BCD addition

37
Unit-I Number system and Boolean Algebra
Binary Code
• Example:
– Consider the addition of 184 + 576 = 760 in BCD:

Hint 6: using 10’s of BCD

38
Unit-I Number system and Boolean Algebra
Binary Codes
• Other Decimal Codes

39
Unit-I Number system and Boolean Algebra
Binary Codes
• Gray Code
– The advantage is that
only bit in the code
group changes in going
from one number to the
next.
000
• Error detection. 001
• Representation of analog data.
• Low power design.

010 011
100 101

110 111
40
Unit-I Number system and Boolean Algebra
Binary Codes
• American Standard Code for Information Interchange (ASCII) Character
Code

41
Unit-I Number system and Boolean Algebra
Binary Codes
• ASCII Character Code

42
Unit-I Number system and Boolean Algebra
ASCII Character Codes
 American Standard Code for Information Interchange
 A popular code used to represent information sent as
character-based data.
 It uses 7-bits to represent:
◦ 94 Graphic printing characters.
◦ 34 Non-printing characters.
 Some non-printing characters are used for text format
(e.g. BS = Backspace, CR = carriage return).
 Other non-printing characters are used for record
marking and flow control
 (e.g. STX and ETX start and end text areas).

43
Unit-I Number system and Boolean Algebra
Boolean Algebra
• Boolean Constants
– these are ‘0’ (false) and ‘1’ (true)
– Boolean Variables
– variables that can only take the vales ‘0’ or ‘1’
• Boolean Functions
– each of the logic functions (such as AND, OR and
NOT) are represented by symbols as described
above
– Boolean Theorems
– a set of identities and laws – see text for details
44
Unit-I Number system and Boolean Algebra
Boolean identities

AND Function OR Function NOT function

00=0 0+0=0 0 1
01=0 0+1=1 1 0
10=0 1+0=1 A A
11=1 1+1=1
A0=0 A+0=A
0A=0 0+A=A
A1=A A+1=1
1A=A 1+A=1
AA=A A+A=A
A A  0 A  A 1
45
Unit-I Number system and Boolean Algebra
Boolean laws

Commutative law Absorption law


AB  BA A  AB  A
AB  B  A A(A  B)  A

Distributive law De Morgan’s law


A(B  C)  AB  BC A  B  AB
A  BC  (A  B)(A  C) AB  A  B

Associative law Note also


A(BC)  (AB)C A  AB  A  B
A  (B  C)  (A  B)  C A(A  B)  AB

46
Unit-I Number system and Boolean Algebra
Summary
• Computers are binary devices
– We’re forced to think in terms of base 2.
– We learned how to convert numbers between
binary, decimal, octal and hexadecimal
• We’ve already seen some of the recurring
themes of architecture:
– We use 0 and 1 as abstractions for analog voltages.
– We showed how to represent numbers using just
these two signals.

Unit-I Number system and Boolean Algebra 47


Summary…
• Most important properties of minterms:
– There are 2n minterms for n Boolean variables.
These minterms can be generated from the binary
numbers from 0 to 2n -1
– Any Boolean function can be expressed as a logical
sum of minterms.
– The complement of a function contains those
minterms not included in the original function.
– A function that contains all 2n minterms is equal to
a logical 1.

unit-1 Number systems 48


Summary…
• Computers are binary devices

– We are forced to think in terms of base 2.

– We learned how to convert numbers between binary,


– decimal, octal and hexadecimal

– We discuss about the basic gates AND ,OR and Not.

– We know about other logic gates like NAND, NOR XOR..

– Know about simplification in terms of SOP and POS forms

unit-1 Number systems 49

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy