0% found this document useful (0 votes)
16 views134 pages

CA - Unit 1 - SEP

The document provides an overview of number systems used in computer architecture, including binary, octal, decimal, and hexadecimal systems. It explains the positional value of digits in these systems and details the conversion methods between them, including exercises for practice. Additionally, it covers complements in binary systems, arithmetic operations, and the use of 2's complement for binary addition.

Uploaded by

jadugark80
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)
16 views134 pages

CA - Unit 1 - SEP

The document provides an overview of number systems used in computer architecture, including binary, octal, decimal, and hexadecimal systems. It explains the positional value of digits in these systems and details the conversion methods between them, including exercises for practice. Additionally, it covers complements in binary systems, arithmetic operations, and the use of 2's complement for binary addition.

Uploaded by

jadugark80
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/ 134

COMPUTER ARCHITECTURE

UNIT – I

By: Amruta Gadad


Assistant Professor
St. Francis De Sales College(Autonomous)
What is Number System?
Number System

Number systems are the technique to represent


numbers in the computer system architecture,
every value that you are saving or getting
into/from computer memory has a defined
number system.
• Computer architecture supports following
number systems.
Binary number system
Octal number system
Decimal number system
Hexadecimal (hex) number system

2
Decimal Number System
 Decimal number system is a base 10 number system having 10 digits from 0
to 9.
 This means that any numerical quantity can be represented using these 10
digits.
 Decimal number system is also a positional value system.
 This means that the value of digits will depend on its position
 Say we have three numbers – 734, 971 and 207. The value of 7 in all three
numbers is different−
 In 734, value of 7 is 7 hundreds or 700 or 7 × 100 or 7 × 102
 In 971, value of 7 is 7 tens or 70 or 7 × 10 or 7 × 101
 In 207, value 0f 7 is 7 units or 7 or 7 × 1 or 7 × 100

3
Binary Number System

 The easiest way to vary


instructions through electric signals
is two-state system – on and off. In any binary number, the rightmost digit
 On is represented by 1 and off by is called least significant bit (LSB) and
0, though 0 is not actually no signal leftmost digit is called most significant
but signal at a lower voltage. bit (MSB).
 The number system having just
these two digits – 0 and 1 – is
called binary number system.

4
Octal Number System

 Octal number
system has eight
digits – 0, 1, 2, 3, 4, 5,
6 and 7.
 Octal number system
Decimal equivalent of any octal number is sum of
is also a positional
product of each digit with its positional value.
value system with 7268 = 7×82 + 2×81 + 6×80
where each digit has = 448 + 16 + 6
its value expressed in = 47010
powers of 8

5
Hexadecimal Number System
 Hexadecimal number
system has 16 symbols – 0
to 9 and A to F where A is
equal to 10, B is equal to 11
and so on till F.

Decimal equivalent of any


 Hexadecimal number system
hexadecimal number is sum of
is also a positional value
system with where each product of each digit with its
positional
27FB value.
16 = 2×16 + 7×16 + 15×16 +
3 2 1
digit has its value expressed
in powers of 16, 10×160
= 8192 + 1792 + 240 +10
= 10234
Here A is
10 10, B is 11, C is 12, D is
13, E is 14 and F is 15.

6
Number System Conversions
Binary to Decimal
Decimal conversion is The binary number
done to convert a system is used in
number given in the computers and
binary number electronic systems
system to its to represent data
equivalent value in and it consists of
the decimal number only two digits
The binary number which are 0 and 1.
system.
system has a base of 2
because it has only two
digits to represent any
number.

8
Binary to Decimal
 Step 2: Now multiply each digit in the binary number starting from the right with
its respective weight based on its position and evaluate the product.

 Step 3: Now, express the binary number as a decimal number: 1011012 = 4510

9
Exercises
 Convert 11102, from binary to decimal using the binary to decimal
formula.
 Convert 11112, from binary to decimal using the binary to decimal
formula.
 Convert 10102, from binary to decimal using the binary to decimal
formula.

10
Decimal to Binary Then, the
Decimal to remainders are
binary conversion is noted down till we
done through get 0 as the final
various methods. quotient. After this
One of the methods step, these
to convert decimal remainders are
to binary is by written in reverse
dividing the given order to get the
decimal number binary value of the
recursively by 2. given decimal
number.

11
Decimal to binary conversion

 To convert numbers
from decimal to binary,
the given decimal
number is divided
repeatedly by 2 and
the remainders are
noted down till we get
0 as the final quotient.

12
Exercises
 25
 39
 72
 55

13
Decimal to Octal

 In the number system, each of the types has its own base number i.e. octal
number has a base number of 8 and the decimal number has a base number of
10.
 To convert decimal to octal, we need to divide the decimal number by the octal
base number 8 and write the acquired remainder in reverse to derive at the
equivalent octal number.

14
Convert Decimal to Octal

 In this method, the decimal number is divided by 8, each time a reminder is


obtained from the previous digit.
 The first remainder obtained is the least significant digit(LSD) and the last
remainder is the most significant digit(MSD).
 Once the quotient is less than 8, we obtain the octal number by writing the
remainder in reverse order.

15
Example
 Convert the decimal number (85)10 to an octal number.
 Step 1: Check if the decimal number is less than 8. If yes, the octal number is
the same. If no, then proceed forward. In this case, 85 is more than 8 so let's go
to step 2.
 Step 2: Divide 85 by 8 (octal base number).
 Note down the quotient and the remainder in the quotient-remainder form.
Repeat this process (dividing the quotient again by 8) until we get the quotient
to be less than 8.

16
Example

17
Exercises
 67
 99
 350

18
Octal to decimal

19
20
Exercises
 (121)8
 (454)8

21
Hexadecimal Number System

 The base of a hexadecimal system is 16. The 16 symbols involved in this


system include 10 decimal digits and the first six letters of the English
alphabet, i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Here, the alphabets
can be treated 10, 11, 12, 13, 14 and 15, respectively.

22
Conversion from Hex to Decimal
 Convert 7CF (hex) to decimal.
 Given hexadecimal number is 7CF.
 In hexadecimal system,
 7=7
 C = 12
 F = 15
 To convert this into a decimal number system, multiply each digit with the powers
of 16 starting from units place of the number.
 7CF = (7 × 162) + (12 × 161) + (15 × 160)
 = (7 × 256) + (12 × 16) + (15 × 1)
 = 1792 + 192 + 15
 = 1999

23
 Convert (1DA6)16 to decimal.
 Convert (E8B)16 to decimal system.
 (2bf)16

24
Conversion from Decimal to Hexadecimal number
system

 Take decimal number as dividend.


 Divide this number by 16 (16 is base of hexadecimal so
divisor here).
 Store the remainder in an array (it will be: 0 to 15 because
of divisor 16, replace 10, 11, 12, 13, 14, 15 by A, B, C, D, E,
F respectively).
 Repeat the above two steps until the number is greater
than zero.
 Print the array in reverse order (which will be equivalent
hexadecimal number of given decimal number).

25
Convert 60010 into a hexadecimal number.

26
Binary to octal Conversion

27
Octal to Binary Conversion

28
Hexa Decimal to Binary Conversion

29
Binary to Hexa Decimal Number
(1000101)2

Start from the right and divide into 4 Blocks


0100 0101

30
Octal to Hexa Decimal Number
 Step1: Convert Octal to Binary
 Group 4 bits together and represent equivalent hexa decimal digit

31
Hexa decimal to Octal conversion
 Step1: Convert Hexa decimal to binary
 Step2: Regrouping the bits into 3 bits

32
Complements
Complements
 complement number system An alternative representation of numbers in
a fixed-radix number system
 Complements are used in the digital computer in order to simplify the
subtraction operation and for logical manipulation.
 For Each Radix system( Radix r represents the number system)
 There are 2 types of Complements(r, r-1) complements
 r-radix complement,r-1=Diminished radix complement.

34
Binary system Complements
 There are 2 complements in Binary System
1. 1’s Complement
2. 2’s complement

35
1’s Complement
 To generate a 1’s complement for any given binary number, you only
need to invert that number.
 For a binary number like 110010, the 1’s complement would be 001101.

36
2’s complement
 To generate a 2’s complement for any given binary number, you need to invert
it. Then you need to add 1 to the LSB (Least Significant Bit) of the generated
result.
 1’s complement + 1

37
Complements of numbers
The r and r-1’s complement can be found for all the number systems.
Basically there are 4 number systems and hence r and r-1’s complements can
be found for only these 4 number systems.
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
•For decimal numbers the
base or r = 10 and r- 1= 9,
•so the 9’s complement of N 9 9 9 9 9
is (10n-1)-N
•99999……. - N
- Digit
n
Digit
n-1
Next
digit
Next
digit
First
digit
9’s complement Examples

2- Find the 9’s complement of 546700 and 9 9 9 9 9 9


12389

The 9’s complement of 546700 is 999999 -


- 5 4 6 7 0 0

546700= 453299 4 5 3 2 9 9

and the 9’s complement of 12389 is


99999- 12389 = 87610. 9 9 9 9 9

- 1 2 3 8 9

8 7 6 1 0

Note: Similarly we can find the r and (r-1)’s complements for any given number of
octal and hexadecimal numbers also
r’s Complement

•Given a number N in base r having n digits,


•the r’s complement of N is defined as
rn - N.

•For decimal numbers the


base or r = 10,
1 0 0 0 0 0
•so the 10’s complement of N
is 10n-N. - Digit
n
Digit
n-1
Next
digit
Next
digit
First
digit

•100000……. - N
Number Systems Arithmetic
Binary Arithmetic

 Binary Arithmetic includes the basic operation


like
1. Binary addition
2. Binary Subtraction
3. Binary multiplication
4. Binary Division.

42
Binary Addition

 The addition of 2 Binary numbers is performed exactly same as the


decimal number addition.

43
Addition using 2’s complement
 The 2’s complement is most commonly used code for processing positive
and negative binary numbers. There are 4 different cases
1. Both the numbers are positive
2. Larger of 2 numbers are positive
3. The larger of 2 numbers are negative
4. Both the numbers are negative

44
 Case 2: Larger of 2 numbers are positive
Example: 1101 and -1001
 First, find the 2's complement of the negative number 1001. So, for finding 2's complement,
change all 0 to 1 and all 1 to 0 or find the 1's complement of the number 1001. The 1's
complement of the number 1001 is 0110, and add 1 to the LSB of the result 0110. So the 2's
complement of number 1001 is 0110+1=0111
 Add both the numbers, i.e., 1101 and 0111;
1101+0111=1 0100
 By adding both numbers, we get the end-around carry 1. We discard the end-around carry. So,
the addition of both numbers is 0100.

45
Case 3: The larger of 2 numbers are negative
Example: 1101 and -1110
 First, find the 2's complement of the negative number 1110. So, for finding 2's
complement, add 1 to the LSB of its 1's complement value 0001.
0001+1=0010
 Add both the numbers, i.e., 1101 and 0010;
1101+0010= 1111
 Find the 2's complement of the result 1110 that is the final result. So, the 2's complement
of the result 1110 is 0001, and add a negative sign before the number so that we can
identify that it is a negative number.

46
Case 4: Both the numbers are negative
Example: -1101 and -1110 in five-bit register
 Firstly find the 2's complement of the negative numbers 01101 and 01110. So, for finding
2's complement, we add 1 to the LSB of the 1's complement of these numbers. 2's
complement of the number 01110 is 10010, and 01101 is 10011.
 We add both the complement numbers, i.e., 10001 and 10010;
10010+10011= 1 00101
 By adding both numbers, we get the end-around carry 1. This carry is discarded and the
final result is the 2.s complement of the result 00101. So, the 2's complement of the result
00101 is 11011, and we add a negative sign before the number so that we can identify
that it is a negative number.

47
Binary Subtraction
 Binary subtraction is one of the four binary operations, where we perform the
subtraction method for two binary numbers (comprising only two digits, 0 and
1).
 This operation is similar to the basic arithmetic subtraction performed on
decimal numbers in Maths.
 Binary Subtraction
 0–0=0
 1–0=1
 1–1=0
 0 – 1 = 1 (Borrow 1)

48
Case i) Binary subtraction without borrowing
Case ii) Binary subtraction with borrowing

Case i) Binary subtraction without borrowing


Subtract 100 from 1111 .Here number 4 is represented in binary as 100 and number 15 is
represented as 1111.

49
Case ii) Binary subtraction with borrowing:

50
Binary Subtraction Using 2's
Complement
 Step 1: Determine the 2’s complement of the smaller number
 Step 2: Add this to the larger number.
 Step 3: Omit the carry. Note that there is always a carry in this case.

51
Binary Multiplication
 The binary multiplication is very much similar to the usual multiplication method of
integers.
 First, we need to multiply each digit of one binary number to each digit of another binary
number.

52
Binary Division
 The binary division operation is similar to
the base 10 decimal system, except the base 2.
 The division is probably one of the most
challenging operations of the basic arithmetic operations.
 Solve 01111100 ÷ 0010

53
Octal Arithmetic
 Octal rules are similar to the decimal or binary arithmetic.

 This number system is normally used to enter long strings of binary data into a
digital system like a microcomputer.

 This makes the task of entering binary data in a microcomputer easier.

 Arithmetic operations can be performed by converting the octal numbers to


binary numbers and then using the rules of binary arithmetic.
Octal Addition
Octal Subtraction
Application of Octal Number System
Hexadecimal Arithmetic
 Hexadecimal rules are similar to the decimal, octal or binary arithmetic.

 The information can be handled only in binary form in a digital circuit and
it Is easier to enter the information using hexadecimal number system.

 Arithmetic operations can be performed by converting the Hexadecimal


numbers to binary numbers and then using the rules of binary arithmetic.
Hexadecimal Addition
Hexadecimal Subtraction
Binary Coded Decimal

Introduction:
Although binary data is the most efficient storage scheme;
every bit pattern represents a unique, valid value. However,
some applications may not be desirable to work with binary
data.
For instance, the internal components of digital clocks keep
track of the time in binary. The binary value must be
converted to decimal before it can be displayed.
Binary Coded Decimal

Because a digital clock is preferable to store the value as a series of decimal


digits, where each digit is separately represented as its binary equivalent, the
most common format used to represent decimal data is called binary coded
decimal, or BCD.
64 1) BCD Numeric Format

Every four bits represent one decimal digit.


 Use decimal values
from 0 to 9
65 1) BCD Numeric Format

 4-bit values above 9 are not used in BCD.


The unused 4-bit values are:
BCD Decimal
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15
66 1) BCD Numeric Format

Multi-digit decimal numbers are stored as multiple


groups of 4 bits per digit.
Summary of BCD addition
Add two
BCD
numbers

Sum <= Sum > 9, Sum < =


9, carry = carry = 0 9, carry =
0 1

Add 6 to
Answer is sum to Add 6 to
correct no get sum to
correction correct get
required answer correct
answer
BCD arithmetic
BCD Addition
BCD subtraction

 Two methods:
1. 9’s complement method
2. 10’s complement method
BCD subtraction using 9’s
complement
 Perform BCD subtraction using 9’s
complement method (A)10 - (B)10
1. Obtain 9’s complement of no. B

2. Add no. A and 9’s complement of no. B

3. If carry is generated in step 2 then add it to sum to obtain final result. The

carry is called as end around carry.

4. If carry is not produced then the result is negative hence take 9’s complement

of the result.
Examples
 Perform (8)10 - (3)10

8
9’s complement
of 3
Ex.
Ex.
Ex.
Solve following subtraction of decimal
numbers using 9’s complement method.

1. Perform (7)10 - (3)10


2. Perform (4)10 - (7)10
3. Perform (83)10 - (21)10
4. Perform (52)10 – (89)10
BCD subtraction 10’s complement method

 Perform BCD subtraction using 10’s


complement method (A)10 - (B)10
1. Obtain 10’s complement of no. B
2. Add no. A and 10’s complement of no. B
3. If carry is generated in step 2 then discard it.
4. If carry is not produced then the result is negative hence take 10’s
complement of the result.
Example using 10’s complement
Binary Codes
1.7 Binary Codes
83

Digital data is represented, stored and transmitted as groups of binary digits also known as binary
code.

Weighted codes: In weighted codes, each digit is assigned a specific weight according to its position.
Non-weighted codes: In non-weighted codes are not appositionally weighted.
Reflective codes: A code is reflective when the code is self complementing. In other words, when the code for 9 is the
complement the code for 0, 8 for 1, 7 for 2, 6 for 3 and 5 for 4.
Sequential codes: In sequential codes, each succeeding 'code is one binary number greater than its preceding code.
Alphanumeric codes: Codes used to represent numbers, alphabetic characters, symbols
Error defecting and correcting codes: Codes which allow error defection and correction are called error detecting and'
correcting codes.
 BCD Code
 A number with k decimal digits will require 4k bits
84
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.
Example: Consider decimal 185 and its corresponding value in BCD and binary:

BCD addition
Binary Codes - Other Decimal Codes

85
Binary Codes - Gray Code

 The advantage is that only bit in


86
the code group changes in going
from one number to the next.
 Error detection.
 Representation of analog
data.
 Low power design.

000 001

010 011
100 101

110 111
1-1 and onto!!
Alphanumeric codes

Computers work with only 0’s and 1’s. However, there is a need for
more advanced forms of communication with machines. This is why
alphanumeric code is important. It includes 26 characters for the letters
of the alphabet, and 10 more for symbols like !@#$%^&.
1-5 ALPHANUMERIC CODES - ASCII Character Codes
Chapter 1

88

Alphanumeric code represents both numbers and alphabetical characters. The most
common types of alphanumeric code are EBCDIC and ASCII.
American Standard Code for Information Interchange
This code is 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).
ASCII Character Codes and Properties
89  American Standard Code for Information Interchange (Refer to Table 1.7)
 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).
 ASCII has some interesting properties:
 Digits 0 to 9 span Hexadecimal values 3016 to 3916
 Upper case A-Z span 4116 to 5A16
 Lower case a-z span 6116 to 7A16
 Lower to upper case translation (and vice versa) occurs by flipping bit 6 .
 ASCII Character Code
90
EBCDIC
 EBCDIC stands for Extended Binary Coded Decimal Interchange Code. EBCDIC code is an 8-bit code that is mainly used
in IBM mainframe and IBM midrange computer operating systems.
UNICODE
 Unicode is an international character encoding standard that provides a unique number for every character across
languages and scripts, making almost all characters accessible across platforms, programs, and devices.

 Unicode is a universal character encoding standard. This standard includes roughly 100000 characters to represent
characters of different languages. While ASCII uses only 1 byte the Unicode uses 4 bytes to represent characters. Hence, it
provides a very wide variety of encoding. It has three types namely UTF-8, UTF-16, UTF-32. Among them, UTF-8 is used
mostly it is also the default encoding for many programming languages.

 UNICODE extends ASCII to 65,536 universal characters codes


 For encoding characters in world languages
 Available in many modern applications
 2 byte (16-bit) code words
Error detection codes

 Error detection and correction code plays an important role in the transmission of
data from one source to another. The noise also gets added into the data when it
transmits from one system to another, which causes errors in the received binary
data at other systems. The bits of the data may change(either 0 to 1 or 1 to 0)
during transmission.

 It is impossible to avoid the interference of noise, but it is possible to get back the
original data. For this purpose, we first need to detect either an error z is present
or not using error detection codes. If the error is present in the code, then we will
correct it with the help of error correction codes.
 Error-Detecting Code
95

 To detect errors in data communication and processing, an eighth bit


is sometimes added to the ASCII character to indicate its parity.
 A parity bit is an extra bit included with a message to make the total
number of 1's either even or odd.
 Example:
 Consider the following two characters and their even and odd parity:
 Error-Detecting Code
96
 Redundancy (e.g. extra information), in the form of extra bits, can
be incorporated into binary code words to detect and correct errors.

 A simple form of redundancy is parity, an extra bit appended onto


the code word to make the number of 1’s odd or even. Parity can
detect all single-bit errors and some multiple-bit errors.
 A code word has even parity if the number of 1’s in the code word
is even.
 A code word has odd parity if the number of 1’s in the code word is odd.
 Example:
Message A: 10001001 1 (even parity)
Message B: 10001001 0 (odd parity)
Hamming Codes
 Invented W.B Hamming and Simple 1parity bit can tell us an error occurred
 Multiple parity bits can also tell us where it occurred
 O(lg(n)) bits needed to detect and correct one bit errors.
 In generally we use 7 bits hamming code
 4 data bits/message bit (m) and 3 parity bits (2 P>= P+m+1)

Example: Byte 1011 0001


Two data blocks, 1011 and 0001.
Expand the first block to 7 bits: _ _ 1 _ 0 1 1.
Bit 1 is 0, because b3+b5+b7 is even.
Bit 2 is 1, b3+b6+b7 is odd.
bit 4 is 0, because b5+b6+b7 is even.
Our 7 bit block is: 0 1 1 0 0 1 1

Repeat for right block giving 1 1 0 1 0 0 1


Error detectings: 0 1 1 0 1 1 1
Re-Check each parity bit
Bits 1 and 4 are incorrect
1 + 4 = 5, so the error occurred in bit 5 Dr. V. Krishnanaik Ph.D
97
Digital Computers
DIGITAL COMPUTER:
 Consists of electronic components and electromechanical devices.
 These components can maintain only two discrete states (i.e high
voltage/low voltage or ON/OFF).
 The word digital implies that the information in the computer is
represented by variables that take a finite number of discrete values
(0 or 1).
 By using various coding techniques (groups of bits) can be made to
represent not only binary numbers but also other decimal digits,
letters, or meaningful symbols
 Digital computer’s functions are:
 General Purpose machine
 more reliable and accurate results.
 Count Quantities rather than measuring
 Input / Output in digits as well as in graphical form. 99
Block Diagram of Digital Computer

100
101
A Digital Computer Example

Memory

Control
CPU unit Datapath

Inputs: Keyboard, Outputs: CRT,


mouse, modem, LCD, modem,
Input/Output
microphone speakers

Synchronous or
Asynchronous?
Transfer of information
102

Figure 1.1 Transfer of information among register


103
Transfer of information
 The other major component of a
digital system
 Circuit elements to manipulate
individual bits of information
 Load-store machine
LD R1;
LD R2;
ADD R3, R2, R1;
SD R3;

Figure 1.2 Example of binary information processing


Logic Gates
105

 Digital
 Concerned with the interconnection among digital components and modules
 Best Digital System example is General Purpose
Computer
 Logic Design
 Deals with the basic concepts and tools used to design digital hardware
consisting of logic circuits
 Circuits to perform arithmetic operations (+, -, x, ÷)
 Digital Signal : Decimal values are difficult to represent in electrical systems. It
106 is easier to use two voltage values than ten.

 Digital Signals have two basic states:

1 (logic “high”, or H, or “on”)


0 (logic “low”, or L, or “off”)
 Digital values are in a binary format. Binary means 2 states.

 A good example of binary is a light (only on or off)

on off

Power switches have labels “1” for on and “0” for off.
Binary Logic
107
 Definition of Binary Logic
 Binary logic consists of binary variables and a set of logical operations.
 The variables are designated by letters of the alphabet, such as A, B, C, x, y, z, etc, with
each variable having two and only two distinct possible values: 1 and 0,
 Three basic logical operations: AND, OR, and NOT.
Binary Logic gates
 Truth Tables, Boolean Expressions, and Logic Gates

AND OR NOT
x y z x y z x z
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1

z=x•y=xy z=x+y z = x = x’

x x x
y z y z z
Universal Gate

 NAND and NOR Gates are called Universal Gates because AND, OR
and NOT gates can be implemented &created by using these gates.

NAND Gate Implementations NOR Gate Implementations


Binary Logic
111

 Logic gates
 Example of binary signals

3
Logic 1
2
Un-define
1
Logic 0
0

Figure 1.3 Example of binary signals


Binary Logic
112
 Logic gates
 Graphic Symbols and Input-Output Signals for Logic gates:

Fig. 1.4 Symbols for digital logic circuits

Fig. 1.5 Input-Output signals for gates


113
Binary Logic
 Logic gates
 Graphic Symbols and Input-Output Signals for Logic gates:

Fig. 1.6 Gates with multiple inputs


Boolean Algebra

Boolean Algebra : George Boole(English mathematician), 1854


 Invented by George Boole in 1854
 An algebraic structure defined by a set B = {0, 1}, together with two
binary operators (+ and ·) and a unary operator ( )
“An Investigation of the Laws of Thought, on Which Are Founded the Mathematical Theories of Logic
and Probabilities”

Boolean Algebra
{(1,0), Var, (NOT, AND, OR), Thms}

Mathematicaltool to expression and analyze digital (logic) circuits


Claude Shannon, the first to apply Boole’s work, 1938
– “A Symbolic Analysis of Relay and Switching Circuits” at MIT
Thischapter covers Boolean algebra, Boolean expression and its
evaluation and simplification, and VHDL program
114
Basic Functions
Boolean functions : NOT, AND, OR,
Exclusive OR(XOR) : odd function
Exclusive NOR(XNOR) : even function(equivalence)

Basic functions
• AND Z=X  Y or Z=XY
Z=1 if and only if X=1 and Y=1, otherwise Z=0
• OR Z=X + Y
Z=1 if X=1 or if Y=1, or both X=1and Y=1. Z=0 if and only if X=0 and Y=0
• NOT Z=X or
115
Z=1 if X=0, Z=0 if X=1
116
Boolean Operations and Expressions

 Boolean Addition
 Logical OR operation
Ex 4-1) Determine the values of A, B, C, and D that make the sum term
A+B’+C+D’
Sol) all literals must be ‘0’ for the sum term to be ‘0’
A+B’+C+D’=0+1’+0+1’=0 A=0, B=1, C=0, and D=1

 Boolean Multiplication
 Logical AND operation
Ex 4-2) Determine the values of A, B, C, and D for AB’CD’=1
Sol) all literals must be ‘1’ for the product term to be ‘1’
AB’CD’=10’10’=1 A=1, B=0, C=1, and D=0

117
Basic Identities of Boolean Algebra

The relationship between a sin-


gle variable X, its complement
X, and the binary constants 0
and 1

118
Laws of Boolean Algebra
 Commutative Law: the order of literals does not matter
A+ B = B +A AB =BA

 Associative Law: the grouping of literals does not matter


A + (B + C) = (A + B) + C (=A+B+C) A(BC) = (AB)C (=ABC)

 Distributive Law : A(B + C) = AB + AC (A+B)(C+D) = AC + AD + BC + BD

119
Rules of Boolean Algebra
 A+0=A In math if you add 0 you have changed nothing in Boolean Algebra
ORing with 0 changes nothing
 A•0=0 In math if 0 is multiplied with anything you get 0. If you
AND anything with 0 you get 0
 A•1 =A ANDing anything with 1 will yield the anything
 A+A = A ORing with itself will give the same result
 A+A’=1 Either A or A’ must be 1 so A + A’ =1
 A•A = A ANDing with itself will give the same result
 A•A’ =0 In digital Logic 1’ =0 and 0’ =1, so AA’=0 since one of the inputs must
be 0.
 A = (A’)’ If you not something twice you are back to the beginning
120
 A + A’B = A + B
If A is 1 the output is 1 If A is 0 the output is B
 A + AB = A
 (A + B)(A + C) = A + BC
• DeMorgan’s Theorem
– F(A,A, , + , 1,0) = F(A, A, + , ,0,1)
– (A • B)’ = A’ + B’ and (A + B)’ = A’ • B’
– DeMorgan’stheorem will help to simplify digital circuits using NORs and
NANDs his theorem states

121
Boolean Analysis of Logic Circuits
 Constructing a Truth Table for a Logic Circuit

 Convert the expression into the min-terms containing all the input literals
 Get the numbers from the min-terms
 Putting ‘1’s in the rows corresponding to the min-terms and ‘0’s in the remains
Ex) A(B+CD)=AB(C+C’) (D+D’) +A(B+B’)CD =ABC(D+D’) +ABC’(D+D’)
+ABCD+AB’CD =ABCD+ABCD’+ABC’D+ABC’D’ +ABCD+AB’CD
=ABCD+ABCD’+ABC’D+ABC’D’ +AB’CD
=m11+m12+m13+m14+m15=(11,12,13,14,15)
A(B+CD) = m11+m12+m13+m14+m15 =(11,12,13,14,15)

122
Standard Forms of Boolean Expressions
The Sum-of-Products(SOP) Form Ex) AB+ABC, ABC+CDE+B’CD’
The Product-of-Sums(POS) Form Ex) (A+B)(A+B+C), (A+B+C)(C+D+E)(B’+C+D’)
Principle of Duality : SOP  POS
Domain of a Boolean Expression : The set of variables contained in the expression
Ex) A’B+AB’C : the domain is {A, B, C}

Standard SOP Form (Canonical SOP Form)


– For all the missing variables, apply (x+x’)=1 to the AND terms of the expression
– List all the min-terms in forms of the complete set of variables in ascending order

Ex : Convert the following expression into standard SOP form: AB’C+A’B’+ABC’D


Sol) domain={A,B,C,D}, AB’C(D’+D)+A’B’(C’+C)(D’+D)+ABC’D
=AB’CD’+AB’CD+A’B’C’D’+A’B’C’D+A’B’CD’+A’B’CD+ABC’D
=1010+1011+0000+0001+0010+0011+1101 =0+1+2+3+10+11+13 = (0,1,2,3,10,11,13)

123
Standard POS Form (Canonical POS Form)
– For all the missing variables, apply (x’x)=0 to the OR terms of the
expression
– List all the max-terms in forms of the complete set of variables in
ascending order

Ex : Convert the following expression into standard POS form: (A+B’+C)


(B’+C+D’)(A+B’+C’+D)
Sol) domain={A,B,C,D}, (A+B’+C)(B’+C+D’)(A+B’+C’+D)
=(A+B’+C+D’D)(A’A+B’+C+D’)(A+B’+C’+D) =(A+B’+C+D’)
(A+B’+C+D)(A’+B’+C+D’)(A+B’+C+D’)(A+B’+C’+D)=(0100) )(0101)
(0110)(1101)= (4,5,6,13)

124
Converting Standard SOP to Standard POS
Step 1. Evaluate each product term in the SOP expression. Determine the
binary numbers that represent the product terms
Step 2. Determine all of the binary numbers not included in the evaluation
in Step 1
Step 3. Write in equivalent sum term for each binary number Step 2 and
expression in POS form

Ex : Convert the following SOP to POS


Sol) SOP= A’B’C’+A’BC’+A’BC+AB’C+ABC=0+2+3+5+7 =(0,2,3,5,7)
POS=(1)(4)(6) = (1, 4, 6) (=(A+B+C’)(A’+B+C)(A’+B’+C))

 SOP and POS Observations


 Canonical Forms (Sum-of-minterms, Product-of-Maxterms), or other
standard forms (SOP, POS) differ in complexity
 Boolean algebra can be used to manipulate equations into simpler
forms
 Simpler equations lead to simpler implementations
125
Summary of Minterms and Maxterms
126
 There are 2n minterms and maxterms for Boolean functions with n variables.
 Minterms and maxterms are indexed from 0 to 2n – 1
 Any Boolean function can be expressed as a logical sum of minterms and as
a logical product of maxterms
 The complement of a function contains those minterms not included in the
original function
 The complement of a sum-of-minterms is a product-of-maxterms with the
same indices
Dual of a Boolean Expression
 To changing 0 to 1 and + operator to – vise versa for a given boolean function
 Example: F = (A + C) · B + 0
dual F = (A · C + B) · 1 = A · C + B
 Example: G = X · Y + (W + Z)
dual G =
 Unless it happens to be self-dual, the dual of an expression does not equal the expression
itself
 Are any of these functions self-dual? (A+B)(A+C)(B+C)=(A+BC)(B+C)=AB+AC+BC
Karnaugh Map
 Simplification methods
 Boolean algebra(algebraic method)
 Karnaugh map(map method))
XY+XY=X(Y+Y)=X
 Quine-McCluskey(tabular method)
 Three- and Four-input Kanaugh maps

127
Karnaugh Map (K- Map) Steps
1. Sketch a Karnaugh map grid for the given problem.in power of 2 N Squares
2. Fill in the 1’s and 0’s from the truth table of sop or pos Boolean function
3. Circle groups of 1’s.
 Circle the largest groups of 2, 4, 8, etc. first.
 Minimize the number of circles but make sure that every 1 is in a circle.
4. Write an equation using these circles.

Example) F(X,Y,Z)=m(2,3,4,5) =XY+XY Example) F(X,Y,Z)=m(0,2,4,6) = XZ+XZ  =Z(X+X)=Z

128
Four-Variable K-Map : 16 minterms : m0 ~ m15
Rectangle group
 2-squares(minterms) : 3-literals product term
 4-squares : 2-literals product term
 8-squares : 1-literals product term
 16-squares : logic 1

129
F(W, X,Y,Z)=m(0,2,7,8,9,10,11) = WX’ + X’Z’ + W’XYZ

Ex 4-28) Minimize the following expression


AB’C+A’BC+A’B’C+A’B’C’+AB’C’

Sol) B’+A’C

130
Ex Minimize the following expression
B’C’D’+A’BC’D’+ABC’D’+A’B’CD+AB’CD+A’B’CD’+A’BCD’
+ABCD’+AB’CD’
Sol) D’+B’C

 Don’t Care Conditions

• it really does not matter since they will never occur(its


output is either ‘0’ or ‘1’)
• The don’t care terms can be
used to advantage on the
Karnaugh map

131
Ex K- Map for POS (B+C+D)(A+B+C’+D)(A’+B+C+D’)(A+B’+C+D)
(A’+B’+C+D)
Sol) (B+C+D)=(A’A+B+C+D)=(A’+B+C+D)(A+B+C+D)
(1+0+0+0)(0+0+0+0)(0+0+1+0)
(1+0+0+1)(0+1+0+0)(1+1+0+0)
F=(C+D)(A’+B+C)(A+B+D)

 Converting Between POS and


SOP Using the K-map
Ex 4-33) (A’+B’+C+D)(A+B’+C+D)
(A+B+C+D’)(A+B+C’+D’) (A’+B+C+D’)
(A+B+C’+D)

132
133
Thank You

You might also like