0% found this document useful (0 votes)
65 views65 pages

Unit 1 - Updated

Here are the steps to convert an octal number to decimal: 1) Write the octal number with place values: For example, 257 octal would be: 2 * 81 5 * 80 7 * 7^0 2) Multiply each place value by its corresponding octal digit and add them up: 257 octal = 2 * 81 = 128 5 * 80 = 40 7 * 7^0 = 7 Total = 128 + 40 + 7 = 175 3) The decimal equivalent of 257 octal is 175 decimal. So in summary, to convert octal to decimal: 1) Write it with place values

Uploaded by

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

Unit 1 - Updated

Here are the steps to convert an octal number to decimal: 1) Write the octal number with place values: For example, 257 octal would be: 2 * 81 5 * 80 7 * 7^0 2) Multiply each place value by its corresponding octal digit and add them up: 257 octal = 2 * 81 = 128 5 * 80 = 40 7 * 7^0 = 7 Total = 128 + 40 + 7 = 175 3) The decimal equivalent of 257 octal is 175 decimal. So in summary, to convert octal to decimal: 1) Write it with place values

Uploaded by

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

Digital Electronics and

Logic Design
Dr. Saffrine Kingsly / Prof. Yogita Patil
Introduction

• Digital electronics is the branch of electronics that deals with


the study of digital signals, and the components that use or
create them.
• Digital electronic circuits are usually made from large assemblies
of logic gates, often packaged in integrated circuits.
• Examples of such devices are computers, information appliances,
digital cameras, digital televisions, flash memory, key USB
memory, mobile phones, hard disks, and devices of computer
memory.
Units

• Number System
• Boolean Algebra for logic circuits
• Logic Design Minimization Techniques
• Combinational Logic
• Sequential Logic Circuit Design
Evaluation plan

Tentative
Sr. No. Component CO Max marks Weight
date
Sr. No. Component CO Max marks Weight Tentative
1 Assignments 1 7 date 7 1/8/2022
1 Assignments 1 7 7  

Mini project
2
on
Mini project on 2&3

2 Tinker cad
2&3 9
9 9  
9 29/8/2022
Tinker cad software. software.
3 MCQs 4 7 7  
4 Class Test 5 7 7  
3 MCQs
    4   30 7 30   7 26/9/2022
4 Class Test 5 7 7 31/10/2022
      30 30  
Number System

• Different Number Systems:


• Binary numbers
• Decimal numbers
• hexadecimal numbers
• octal numbers
• number conversion
• signed binary number representation:
• signed magnitude
• 1’s complement and 2’s complement representation
• Arithmetic operations:
• binary addition and binary subtraction using 1’s complement and 2’s complement
• binary multiplication and division, 2’s complement arithmetic
• octal addition, Octal subtraction using 8’s complement
• hexadecimal addition, Hexadecimal subtraction using 16’s complement
Different Number Systems
Why to study Number system?
• A/D and D/A conversion
• Real world signals come in continuous/analog format and it is good to know
generally how they become 0’s and 1’s (and visa versa).
• Binary numbers
• All computers work with 0’s and 1’s so it is like learning alphabets before learning
English
• Number systems
• There are more than one way to express a number in binary. So 1010 could be -2, -
5 or -6 and need to know which one.
• Base conversion
• For convenience, people use other bases (like decimal, hexdecimal) and we need to
know how to convert from one to another.
Why binary is used in computers?

• Computers use binary because it’s the simplest method for counting available and is
how a computer codes everything from memory to HD video streaming
• Binary allows for a computer to process millions of inputs very quickly.
• With binary, there are only two options, on or off.
• Computers communicate by stringing a series of ons and offs into complex groups which
tell the computer what it is supposed to do.
• To achieve this, computer systems use a series of switches and electrical signals to
understand what it is supposed to do.
• Think of a standard light switch, there are two options for the switch: on and off.
• Computers rely on this same concept and use transistors as electrical switches.
• The transistor is either switched on or off through an electrical signal.
Binary Numbers 10

• Binary numbers has two digits, 1 and 0.


• The binary numbering system has a base of 2 with each position
weight by a factor of 2.
Binary numbers: Example 11

• 10010 is binary
• 1x24 + 0x23 + 0x22 + 1x21 + 0x20 = 18
• Binary is the base 2 number system
• Most common in digital electronics
• Weight: Most Significant bit (MSB)
Least Significant bit (LSB)

10010
MSB LSB
Integers and Fractional Parts 12

• Binary numbers can contain fractional parts as well as integer


parts
Origin of decimal number system
Decimal Numbers 14

• Decimal numbers has ten digits. (0, 1, 2, 3, …, 9)


• The decimal numbering system has a base of 10 with each position
weighted by a factor of 10:
Octal Number System

• Octal Number System has a base of eight and uses


the numbers from 0 to 7.
• The octal numbers are usually represented by
binary numbers when they are grouped in pairs of
three.
• For example, an octal number 128 is expressed as
0010102 in the binary system, where 1 is equivalent
to 001 and 2 is equivalent to 010.
Hexadecimal Number System 16

• Hexadecimal system: base 16


• There are 16 digits:
• 0 123456789ABCDEF
• Each Hex digit represents a group of 4 bits (i.e. half
of a byte) 0000 thru 1111
• Generally used as shorthand notation for binary
numbers => easier to read
• Binary: 0101 1010 1001 1110
• Decimal: 5 10 914
• Hex: 5 A 9E
Primary conversion table
Different Number Systems
The basics: Binary numbers

• Bases we will use


• Binary: Base 2
• Octal: Base 8
• Decimal: Base 10
• Hexadecimal: Base 16

• Positional number system


• 1012= 1×22 + 0×21 + 1×20
• 638 = 6×81 + 3×80
• A116= 10×161 + 1×160

• Addition and subtraction 1011 1011


+ 1010 – 0110
10101 0101
Binary → hex/decimal/octal conversion

• Conversion from binary to octal/hex


• Binary: 10011110001
• Octal: 10 | 011 | 110 | 001=23618
• Hex: 100 | 1111 | 0001=4F116

• Conversion from binary to decimal


• 1012= 1×22 + 0×21 + 1×20 = 510
• 63.48 = 6×81 + 3×80 + 4×8–1 = 51.510
• A116= 10×161 + 1×160 = 16110
Binary to Decimal Conversion

A binary number can be converted to decimal equivalent by multiplying each


binary digit by its positional weightage.

Example: Convert (11101.1011)2 into decimal.

= (11101 . 1011)2
= (1 * 24) + (1 * 23) + (1 * 22) + (0 * 21) + (1 * 20) +
(1 * 2-1) + (0 * 2-2 ) + (1 * 2-3) + (1 * 2-4)
= 16 + 8 + 4 + 0 + 1 + 0.5 + 0 + 0.125 +0.0625
= (28.6875)10
Binary − Octal Conversion

8 = 23
Each group of 3 bits represents an octal digit Octal Binary
0 000
Example:
Assume Zeros
1 001
2 010
( 1 0 1 1 0 . 0 1 )2 3 011
4 100
5 101

( 2 6 . 2 )8 6 110
7 111
 Works both ways (Binary to Octal & Octal to Binary)
Binary − Hexadecimal Conversion

 16 = 24
 Each group of 4 bits represents a hexadecimal
digit

Example:
Assume Zeros

( 1 0 1 1 0 . 0 1 )2

(1 6 . 4 )16
• Works both ways (Binary to Hex & Hex to Binary)
Decimal→ binary/octal/hex conversion

• First method: Sum of weights method


• Second method:
• Repeated division by base for integers
• Repeated multiplication by base for fraction

• Why does this work?


• N=5610=1110002
• Q=N/2=56/2=111000/2=11100 remainder 0

• Each successive divide liberates an LSB (least


significant bit)
Decimal to binary - Sum of weights method
Conversion: Decimal to Binary 26

(Method 1)
• The decimal numbers is simply expressed as a sum of power of 2, and then
1s and 0s are written in the appropriate bit positions.

50 = 32 + 18 322 = ?
= 32 + 16 + 2
= 1x25 + 1x24 + 1x21
5010 = 1100102
Decimal to binary - Repeated division by base
for integers
Decimal to binary - Repeated division by base
for integers
Decimal to binary - Repeated multiplication
by base for fraction
Decimal to binary - Repeated multiplication
by base for fraction
Q. (127.34)10 =( )2
Examples:

Q. Convert Decimal to binary


a) (254)10
b) (0.250)10
c) (163.875)10
Decimal to Octal Conversion

Example: (175)10
Quotient Remainder Coefficient
175 / 8 = 21 7 a0 = 7
21 / 8 = 2 5 a1 = 5
2 /8= 0 2 a2 = 2
Answer: (175)10 = (a2 a1 a0)8 = (257)8

Example:(0.3125)10
0.3125 * 8 = 2 . 5 a-1 = 2
0.5 *8= 4 . 0 a-2 = 4

Answer: (0.3125)10 = (0.a-1 a-2 a-3)8 = (0.24)8


Octal to Decimal Conversion

A binary number can be converted to decimal equivalent by multiplying each


binary digit by its positional weightage.

Example: Convert (4057.06)8 into decimal.

= (4057.06)8
= (4 * 83) + (0 * 82) + (5 * 81) +(7 * 80) + (0 * 8-1) +
(6 * 8-2)
= 2048 + 0 + 40 + 7 + 0 + 0.0937
= (2095.0937)10
Decimal to Hexadecimal Conversion

Example: (675)10
Quotient Remainder Coefficient
675 / 16 = 42 3 a0 = 3
42 / 16 = 2 10=A a1 = A
2 / 16 = 0 2 a2 = 2
Answer: (675)10 = (a2 a1 a0)16 = (2A3)16

Example:(0.625)10
0.625 * 16 = 10 (= A) 0 a1 = A

Answer: (0.625)10 = (0.a-1 a-2 a-3)16 = (0.A)16


Binary – Octal - Hexadecimal
Complements

• How do we write negative binary numbers?

• Historically: 3 approaches
• Sign-and-magnitude
• Ones-complement
• Twos-complement

• For all 3, the most-significant bit (MSB) is the sign digit


• 0 ≡ positive
• 1 ≡ negative

• twos-complement is the important one


• Simplifies arithmetic
• Used almost universally
Complements

• Complements are used in digital computers for simplifying the


subtraction operation and for logical manipulation.
• There are two types of complement for each base system the r’s
and (r-1)’ complement.

• r represents the base of the system


Sign-and-magnitude
• The most-significant bit (MSB) is the sign digit
• 0 ≡ positive
• 1 ≡ negative

• The remaining bits are the number’s magnitude

• Problem 1: Two representations for zero


• 0 = 0000 and also –0 = 1000

• Problem 2: Arithmetic is cumbersome


Ones-complement
• Negative number: Bitwise complement positive number
• 0011 ≡ 310
• 1100 ≡ –310

• Solves the arithmetic problem

• Remaining problem: Two representations for zero


• 0 = 0000 and also –0 = 1111
Ones-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 …
Twos-complement

• Negative number: Bitwise complement plus one


• 0011 ≡ 310
–1 0
• 1101 ≡ –310 –2 +1
1111 0000
–3 1110 0001 +2
• Number wheel
1101 0010
• Only one zero! –4
1100 0011
+3

• MSB is the sign digit – 5 1011 0100 + 4


• 0 ≡ positive 1010 0101
• 1 ≡ negative –6 1001 0110 +5

–7 1000 0111 +6
–8 +7
Twos-complement

2’s Complement (Radix Complement)


• Take 1’s complement then add 1
or
• Toggle all bits to the left of the first ‘1’ from the right(untill receive
“1”first time)
Example:
Number:10110000

1’s Comp.:
Twos-complement (con’t)

• Complementing a complement  the original number

• Arithmetic is easy
• Subtraction = negation and addition
• Easy to implement in hardware
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:
Signed Binary Numbers
Facts regarding number representation

• Twos-complement of non-integers (After taking one’s complement add 1 to the LSB)


• 1.687510 = 01.10112
• –1.687510 = 10.01012

• Sign extension
• Write +6 and –6 as twos complement
• 0110 and 1010
• Sign extend to 8-bit bytes (add the additional sign bits on MSB)
• 00000110 and 11111010

• Can’t infer a representation from a number


• 11001 is 25 (unsigned)
• 11001 is –9 (sign magnitude)
• 11001 is –6 (ones complement)
• 11001 is –7 (twos complement)
Twos-complement overflow - conditions

• Conditions for overflow: –1 0 –1 0


–2 1111 0000 + 1 –2 1111 0000 + 1
• Summing two positive numbers –3 1110 0001 + 2 –3 1110 0001 + 2
gives a negative result 1101 0010 1101 0010
– 4 1100 0011 + 3 – 4 1100 0011 + 3
• Summing two negative numbers
– 5 1011 0100 + 4 – 5 1011 0100 + 4
gives a positive result 1010 0101 1010 0101
–6 1001 0110 + 5 –6 1001 0110 + 5
• Make sure to have enough –7 1000 0111 + 6 –7 1000 0111 + 6
bits to handle overflow –8 +7 –8 +7

• check for the sign of the sum


and compare it against the signs 6 + 4 ⇒ –6 –7 – 3 ⇒ +6
of the numbers added.
Binary Number Complement

• In binary number system we have the 1’s and 2’s complement


• the 1’s complement is obtained by replacing 0s with 1s and 1s with
0s.
• 2’s complement = 1’s complement +1.
• Example : Find the 1’s and 2’s complement of the following
number : 1011000.
• Solution :
1’s comp.=0100111 ;
2’s comp.=0100111+1=0101000
Decimal Number Complement

• In decimal number system we have the 9’s and 10’s complement


the 9’s is obtained by subtracting each digit from 9
• 10’s complement = 9’s complement +1.
• Example : Find the 9’s and 10’s complement of the following
number :2496.
• Solution :
9’s comp.= 9999-2496 = 7503;
10’s comp.=7503+1=7504
Octal Number Complement

• In octal number system we have the 7’s and 8’s complement the
7’s is obtained by subtracting each digit from 7
• 8’s complement = 7’s complement +1.
• Example : Find the 7’s and 8’s complement of the following
number :562.
• Solution :
7’s comp.= 777- 562 = 215;
8’s comp.=215+1=216
Hexadecimal Number Complement

• In hexadecimal number system we have the 15’s and 16’s


complement the 15’s is obtained by subtracting each digit from 15
• 16’s complement = 15’s complement +1.
• Example : Find the 15’s and 16’s complement of the following
number :3BF.
• Solution :
15’s comp.= 15 15 15 – 3 B F = C 4 0;
16’s comp.=C 4 0+1=C 4 1
BASIC ARITHMETIC OPERATIONS

In Number system, the most common arithmetical operations are:


• Addition
• Subtraction
• Multiplication
• Division
Subtraction with Complements

• The efficient method for subtraction is using the complement. The


subtraction of two n-digit numbers M-N can be :
• 1- If use (r-1)’s complement [1’s 9’s 7’s 15’s]:
a. If the sum produce an end carry which can be added to the sum.
b. If the sum does not produce an end carry take the (r-1)’s comp. of
the sum and place – sign.
• 2- If use (r)’s complement [2’s 10’s 8’s 16’s]:
a. If the sum produce an end carry which can be discarded.
b. If the sum does not produce an end carry take the (r)’s comp. of
the sum and place – sign.
Binary Subtraction

The rules of binary subtraction are as follows: 0 - 0 = 0


1-0=1
1-1=0
0 - 1 = 1 with a borrow of 1
Example: Subtract 11011 and 10110?
Solution:
Subtract the binary number

Example : Subtract the following binary number :


a) 1010100-1000011 b)1000011-1010100
Solution :
1)Using 1’s comp. 2)Using 2’s comp.
a)1010100 b)1000011 a)1010100 b) 1000011
1000011- 1010100- 1000011- 1010100-
1010100 1000011 1010100 1000011
0111100+ 0101011+ 0111101+ 0101100+
10010000 1101110 10010000 1101111
1+ 1’s=0010001 2’s=0010001
0010001 -(0010001) discarded -(0010001)
Subtract the decimal number

Example : Subtract the following decimal number : 72532-


3250
Solution:
1)Using 9’s comp. 2)Using 10’s comp.
72532 72532
03250- 03250-
72532 72532
96749+ 96750
169281 169282
1+
69282 discarded
Example: Find 543 - 123
10 10
Example: Find 123 - 543
10 10
Subtract the octal number

Example : Subtract the following octal number : 256-341


Solution :
1)Using 7’s comp. 2)Using 8’s comp.
256 256
341- 341-
256 256
436+ 437+
714 715
7’s comp. =063 8’s comp.= 063
-(63) –(63)
Subtract the hexadecimal number

Example : Subtract the following hexadecimal number : 592-3A5


Solution :
1)Using 15’s comp. 2) Using 16’s comp.
592 592
3A5 3A5
592 592
C5A C5B
11EC 11ED
1+
1ED
Binary Addition

Basic Rules of Addition:


• The basic rules of binary addition as follows:
1. 0 + 0 = 0.
2. 0 + 1 = 1.
3. 1 + 0 = 1.
4. 1 + 1 = 0 with a carry of ‘1’ to the next more significant bit.
5. 1 + 1 + 1 = 1 with a carry of ‘1’ to the next more significant bit.
Binary Addition

• The rules for binary addition are as follows:


0+0=0
1+0=1
0+1=1
1 + 1 = 0 and a carry 1 (i.e. 10 in binary)
Example: Add 110110 and 101101

• Here, (arrow) indicates carry


Binary multiplication

The rules of binary multiplication are as follows.


0×0=0
1×0=0
0×1=0
1×1=1
Example:(1111)2 × (1111)2 =?
Binary Division

You might also like