0% found this document useful (0 votes)
0 views

Unit I Binary numbers and Arithmetic

The document covers the fundamentals of binary numbers and arithmetic, focusing on various number systems including decimal, binary, octal, and hexadecimal. It explains the conversion between these systems, the representation of numbers using one's and two's complement, and the principles of binary arithmetic operations such as addition, subtraction, multiplication, and division. Additionally, it discusses the significance of Boolean algebra and logic gates in computer organization and architecture.

Uploaded by

akarshkeshav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Unit I Binary numbers and Arithmetic

The document covers the fundamentals of binary numbers and arithmetic, focusing on various number systems including decimal, binary, octal, and hexadecimal. It explains the conversion between these systems, the representation of numbers using one's and two's complement, and the principles of binary arithmetic operations such as addition, subtraction, multiplication, and division. Additionally, it discusses the significance of Boolean algebra and logic gates in computer organization and architecture.

Uploaded by

akarshkeshav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Computer Organization and Architecture

UNIT – 1 BINARY NUMBERS AND


ARITHMETIC
STRUCTURE

1.0 Learning Objectives


1.1 Introduction
1.2 Data and number system
1.3 Conversion of Numbers from One Number System to other
1.4 Representation 1‘s and 2‘s Complement
1.5 Weighted and Un-weighted Codes
1.6 Computer Arithmetic
1.7 Boolean Expression
1.8 Let Us Sum Up
1.9 Key Words
1.10 Answer to check your progress
1.11 Some Useful Books
1.12 Terminal Questions

1.0 OBJECTIVES
At the end of this unit, the student will be able to:
• Explain the number system and its usage in computer systems

• Describe the conversion of number systems from one to the


other

• Discuss the Binary-complement of number systems

• Explain the BCD and ASCII number systems

• Analyze the concept of weighted and unweighted codes

• Apply the Binary arithmetic and Computer Arithmetic

• Analyze the concept of Logic gates and k-map

• Describe the fundamentals of Boolean algebra


1.1 INTRODUCTION

Decimal number system (base 10) is the standard number system


followed for counting and measurements in daily use. Computers, being
made from transistors use binary (base 2) number system. They operate
in two states - on and off. Another widely used number system in
computing, is hexadecimal (base 16) or octal (base 8) number systems.
They follow a compact form for representing binary numbers. In
general, a number system of base, or radix, r uses r digits with distinct
symbols. In any number system, numbers are represented by a string of
valid digit symbols of that system. To determine the quantity the number
represents, it is necessary to multiply each digit by the weight of the
digit, which is an integer power of r and then form the sum of all
weighted digits.

1.2 DATA AND THE NUMBER SYSTEM

The term data refers to factual information used for analysis or


reasoning. These ‗raw facts‘ are processed to arrive at meaningful
information. Data stored in digital computers are binary-coded.
Information is a processed data or computational results that is
communicated. Digital computers store binary information in
memory or processor registers. These data are either data or control
information. Control information indicate the command signals
needed for the control of data. These signals may be a bit or group
of bits.

Following are the categories of data handled by digital computers:

• Numbers used in calculations

• Letters used in data handling, and

• Other characters used for specific functions

Registers are made up of two-state devices called flip-flops. They


can store only l‘s and 0‘s. So, the binary number system is the most

6
Computer Organization and Architecture
ideal system to use in a digital computer. But human being is
comfortable doing computations in the decimal number system.

Decimal (Base 10) Number System

Decimal number system has digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. It


follows positional notation, wherein, the least-significant digit
(right-most digit) is of the order of 10^0 (units or ones), the second
right-most digit is of the order 10^1 (tens), the third right-most digit
is of the order 10^2 (hundreds), and so on, where ^ denotes
exponent. For example, the quantity represented by sequence of
digits 322.1 is calculated as:

3 x 102 + 2 x 101 + 2 x 100 + 1 x 10 -1

i.e., 3 hundred, plus 2 tens, plus 2 units, plus 1 tenths. This way one
can calculate the quantity represented by any decimal number.
Binary (Base 2) Number System

Binary is a base-2 or radix 2 number system that uses two states 0


and 1 to represent a number. The only digits used here are 0 and 1,
which are also called as a true state and a false state. These digits are
called bits. A sequence of eight bits is called a byte (8=2 3). Any
number can be represented by these two digits.

Binary number system also follows a positional notation. For


example, the string of digits 101001 represents the decimal
quantity:

1 x 2^5 + 0 x 2^4 + 1 x 2^3 + 0 x 2^2 + 0 x 2^1 + 1 x 2^0 = 41

To recognize different number systems, the radix or base of the


number is included as asubscript. For example, following statement
equates binary and decimal forty-one:

(101001)2 = (41)10

Binary operations such as add, subtract, multiply, and divide binary


numbers is an essential part of digital systems.

7
Computer Organization and Architecture

1.3 CONVERSION OF NUMBERS FROM


ONE NUMBERSYSTEM TO THE OTHER

Decimal to Binary conversion

Following example shows steps involved in converting (28)10 to


binary:

Base Number Carry

2 28 0

2 14 0

2 7 1

2 3 1

2810 = (11100)2

Binary Addition

When we perform additions in any number system, there will be two


outputs: Sum (S) and Carry(C).

Rules for binary addition:

Input A Input B Sum (S) = A+B Carry (C)

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

Table 1.1 Binary addition Rules for binary subtraction


Computer Organization and Architecture
When we perform subtractions in any number system, there will be
two outputs: Subtract (S) and Borrow (B). Here a Borrow 1 is
required only when we subtract 1 from 0. So, the result became 0.

Input A, minuend Input B, Subtrahend Subtract (S) A-B Borrow (B)

0 0 0 0

0 1 0 1

1 0 1 0

1 1 0 0

Table 1.2 Binary subtraction Rules for binary multiplication

Input A Input B Multiply (M) A x B

0 0 0

0 1 0

1 0 0

1 1 1

Table 1.3 Binary multiplication

When all the inputs are 1, result is 1 and result is always 0, whenever
at least one input is 0.

9
Rules for binary division:

Four components in any division are Dividend, Divisor, Quotient, and


Remainder.

Input A, Input B, Divide (D) A/B,


Dividend Divisor Quotient

0 0 Not defined

0 1 0

1 0 Not defined

1 1 1

Table 1.4 Binary division

The result is always not defined, whenever the divisor is 0. Octal (base
8) and Hexadecimal (base 16) Number System Digits of the octal
number system are 0, 1, 2, 3, 4, 5, 6, and 7.
Digits of Hexadecimal number system are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, and F, alsocalled as hex digits. Both follow positional
notation.

Examples:

Conversion of octal 136.6 to decimal:

(136.6)8 = 1 x 82 + 3 x 81 + 6 x 80 + 6x 8-1

= 1 x 64 + 3 x 8 + 6 x 1 + 6/8 = (94.75)10

Conversion of hexadecimal F9 to decimal


(F9)16 = F x 16 + 9 = 15 x 16 + 9 = (249)10

An octal digit relates to three binary digits as 8=23 and each


hexadecimal digit relates to fourbinary digits as 16= 24 .

10
Computer Organization and Architecture
Convert 261(base 10) to hexadecimal (base 16):

quotient remainder

261 5
16

16 16 0

261D = 105H

1.4 REPRESENTATION 1’S AND 2’S


COMPLEMENT

Number theorists have proven that one decimal number can be


subtracted from another by finding the diminished radix
complement of the subtrahend or casting out 9s as below:
1. Find the difference of the subtrahend from all nines

2. Add the result to minuend

3. Add the carry if any, back to the result.

This method is also called as taking the nine‘s complement of the


subtrahend. Consider an example to find 167 − 52.

1. 999-52= 947.

2. 167+947=1114

Now, the ―carry‖ from the thousands column is added back


to the units‘ place, 1+114=115 Thus, giving us a correct
result, i.e., 167 − 52 = 115.
To simplify computer arithmetic, this method has been extended to
binary operations too.Complement systems give us advantage over
signed magnitude as there is no need to process sign bits separately.
Just by looking at its high-order bit, we can check the sign of a
number.

11
One’s Complement of a Signed Binary Number

Negative binary numbers in a signed binary number system are


represented using One‘s Complement or 1‘s Complement method.
In one‘s complement, positive numbers (also known as non-
complements) remain unchanged with the sign-magnitude numbers.
Positive number always starts with a ‗0‘. Negative numbers are
represented by negating or by taking inverse (taking the one‘s
complement ) of its unsigned positive number. Negative numbers in
complement form always starts with a ―1‖ .

The one‘s complement of ―1‖ is ―0‖ and vice versa. For example,
just by complementing each bit of 101101012, we get its one‘s
complement 010010102.

Subtraction of Two Binary Numbers

Consider subtracting two numbers 99 and 23, using one‘s


complement. In decimal this would be:99 – 23 =76.

Step 1: Convert the two decimal numbers into binary. Make sure that
each number has the samenumber of bits by adding leading zeros to
produce an 8-bit number (byte). Therefore:

(99)10 in binary is: (01100011)2

(23)10 in binary is: (00010111)2

Step 2: Now find the complement of the subtrahend, by changing all


the 1‘s to 0‘s and 0‘s to 1‘s, the one‘s complement of 0010111 is equal
to 11101000. Adding the minuend and the complement of the
subtrahend gives:

01100011+ 11101000

Overflow → 1 01001011

There is an overflow due to the carry forward generated by the sum


of most significant column. Positive results will always have an
overflow. If the answer is negative, there is no overflow. The

12
Computer Organization and Architecture
overflow can be ignored or passed to next circuit if system works
with 8 bits.

Now convert the 8-bit answer from a one‘s complement answer to


the real answer by adding ―1‖, therefore:

01001011

+1

010011002

So, the result of subtracting 23 (000101112) from 99(011000112),


using 1‘s complement in binary gives the answer of: 010011002 or
(64 + 8+ 4) = 7610 in decimal.

Thus, One‘s Complement has the advantage of subtracting two


binary numbers just by using addition. This can be compared to
decimal subtraction equivalents such as A – B, is the same as saying
A + (-B) or -B + A etc.

Two’s Complement of a Signed Binary Number

Positive numbers in two‘s complement are same as 1‘s complement.


and a negative number is itsone‘s complement plus one.

Following are advantages of two‘s complement over one‘s


complement:

1. There is no double- zero problem(1‘s complement has two


representations for zero, positive and negative)

2. It is very easy to generate the two‘s complement of a signed binary


number which results insimpler arithmetic operations.

13
Consider the subtraction of two 8-bit numbers 99 and 23 using
two‘s complement.

Step 1: Convert the two decimal numbers into binary. Make sure that
each number has the samenumber of bits by adding leading zeros to
produce an 8-bit number (byte). Therefore:

(99)10 in binary is: (01100011)2

(23)10 in binary is: (00010111)2

Now find the 2‘s complement of (23)10

i.e., (11101000 ) 2+1 (complement individual bits +1)=(11101001) 2

The complementation of the subtrahend means that the


subtraction becomes a much easieraddition of the two numbers,
the sum is: 99 + ( 2‘s complement of 23 ) which is:

(01100011)2

+ (11101001) 2 = (101001100) 2

The 9th overflow bit is disregarded, so the result is: (01001100)2 or (64
+ 8 + 4) = 7610.

(r-1)’s & r’s complement

Digital computers use complement number system for logical


operations and for easing the subtraction operation. If we generalize,
in any base r system, there are two types of complements: the r‘s
complement and the (r - l)‘s complement. In Binary number system,
base r is substituted by 2 and the complement systems are 2‘s and
l‘s complement and in decimal system it is 10‘s and 9‘s
complement.

(r - l)’s Complement

Given a number N in base r having n digits, the (r - l)‘s complement


of N is defined as (rn - 1) -
14
Computer Organization and Architecture
N. For decimal numbers r = 10 and r - 1 = 9, so the 9‘s complement
of N is (10n - 1) -N. Now,10n represents a number that consists of a
single 1 followed by n 0‘s. 10n - 1 is a number represented by n 9‘s.
For example, with n = 3 we have 103 = 1000 and 103- 1 = 999. Thus,
by subtracting each digit of a decimal number from 9 results in 9‘s
complement. For example, the 9‘s complement of 340700 is 999999
- 340700 = 659299 and the 9‘s complement of 72380 is 99999 -
72380 = 27619.

For binary numbers, r = 2 and r - 1 = 1, so the 1‘s complement of N


is (2n -1) - N. Again, 2n is represented by a binary number that
consists of a 1 followed by n 0‘s. 2n - 1 is a binary number
represented by n l‘s. For example, with n = 3, we have 2 3 = (1000)2
and 23 - 1 = (111)2. Thus, bysubtracting each binary digit from 1, l‘s
complement of a binary number is obtained.

It is also observed that the subtraction of a binary digit from 1 causes


the bit to change from 0 to 1 and vice versa. Therefore, the l‘s
complement of a binary number is formed by changing l‘s into 0‘s
and 0‘s into l‘s. For example, the l‘s complement of 10101010 is
01010101.

These methods of finding (r-1)‘s complement holds good in octal or


hexadecimal numbersystems too.

(r’s) Complement

The r‘s complement of a n-digit number N in base r is defined as rn


-N for N ≠ 0 and 0 for N = 0. Comparing with the (r - l)‘s
complement, we note that the r‘s complement is obtained by adding
1 to the (r - l)‘s complement since rn - N = [(rn - 1) - N] + 1. Thus the
10‘s complement of the decimal 3389 is 6610 + 1 = 6611 and is
obtained by adding 1 to the 9‘s complement value.

The 2‘s complement of binary 101010 is 010101 + 1 = 010110 and


is obtained by adding 1 to thel‘s complement value.

Following method is one more interesting way to find r‘s


complement. 10‘s complement of number N, can be formed by
leaving all least significant 0‘s unchanged, subtracting the first

15
nonzero least significant digit from 10, and then subtracting all
higher significant digits from 9. The 10‘s complement of 4680 is
5320 and is obtained by leaving the first zero unchanged, subtracting
8 from 10, and subtracting the other two digits from 9. Similarly, the
2‘s complementcan be formed by leaving all least significant 0‘s and
the first 1 unchanged, and then replacing l‘s by 0‘s and 0‘s by l‘s in
all other higher, significant bits. The 2‘s complement of 10010 is
01110 and is obtained by leaving the first 0 and the first 1
unchanged, and then replacing l‘s by 0‘s and 0‘s by l‘s in the other
three most significant bits.

1.5 WEIGHTED AND UNWEIGHTED CODES

Digital devices always store and transmit data as groups of binary


digits, also known as binarycode. There are multiple categories of
binary code.

Weighted codes

In weighted codes, each digit is assigned a specific weight according to


its position. Individual bits are multiplied by their positional weights and
the sum of these products gives the decimal digit. For example, 1101 in
8421BCD code, the weights of digits from left to right, i.e., 1 0 1 1 are
8, 4, 2 and 1, respectively. The quantity is thus calculated as
1*8+0*4+1*2+1*1=11.

Suppose W1, W2, W3 and W4 are the weights of binary digits and
Xl, X2, X3 and X4 are the corresponding digit values then decimal
digit, N = W1 Xl + W2 X2 + W3 X3 + W4 X4 is represented by
binary sequence X4 X3 X2 X1.

In weighted codes, each digit is assigned a specific weight according to


its position. Individual bits are multiplied by their positional weights and
the sum of these products gives the decimal digit. For example, 1101 in
8421BCD code, the weights of digits from left to right, i.e., 1 0 1 1 are
8, 4, 2 and 1, respectively. The quantity is thus calculated as
1*8+0*4+1*2+1*1=11.

16
Computer Organization and Architecture
Suppose W1, W2, W3 and W4 are the weights of binary digits and
Xl, X2, X3 and X4 are the corresponding digit values then decimal
digit, N = W1 Xl + W2 X2 + W3 X3 + W4 X4 is represented by
binary sequence X4 X3 X2 X1.

Non-weighted codes:

The non-weighted codes are not positionally weighted, each digit


position within the number is not assigned a fixed value (or weight).

Examples: Excess-3 and Gray code

Reflective codes

A code is reflective when the code is self-complementing. In other


words, when the code for 9 is the complement for the code for 0, 8
for 1, 7 for 2, 6 for 3 and 5 for 4.

Example: 2421BCD, 5421BCD and Excess-3 code.

Sequential codes:

In sequential codes, each code is one binary number


greater than its preceding code. Example:8421 BCD
and Excess-3.
Alphanumeric codes:

Codes used to represent numbers, alphabetic characters, symbols,


and various instructions necessary for conveying intelligible
information.

Example: ASCII, EBCDIC, UNICODE.

Error defecting and correcting codes:

Codes which help in error detection and correction of data are called
error detecting and correcting codes.

Example: Hamming code.

Gray Code
17
Computer Organization and Architecture

Many physical systems supply analog or continuous output data. It


must be converted into digital form to be processed by a digital
computer. This conversion is done by analog-to-digital converter
which uses Gray code.

The Figure 1.1 lists the Gray code equivalents of the decimal number
0 – 15.

Figure 1.1 Gray codes

They are also called as the minimum change code as the successive
coded characters never differ in more than one-bit. Due to this
feature, the maximum error that can creep into a system is much less
than the worst -case error encountered in case of straight binary
encoding.

Gray code is not suitable for arithmetic operations as it is an


unweighted code. They are also used in input/output devices, and
Karnaugh map etc.

A three-bit Gray code can be obtained by merely reflecting the two-


bit code about an axis at the end of the code and assigning a third bit
as 0 above the axis and as 1 below the axis. The reflected Gray code
is nothing but code written in reverse order. By reflecting three-bit
code, a four-bit code may be obtained.
Computer Organization and Architecture

Figure 1.2 Three-bit Gray code

Let us consider a few examples. The four-bit Gray code for decimal
number 39 is 00101101.

Similarly, Gray code for (923.1)10 and (327) is

(923.1)10 = (1101 0011 0010.0001) Gray code

(327)10 = (100011 0100) Gray code

Excess-3 code

Excess-3, also called XS3, is a non-weighted code used to express


decimal number-s. It overcomes the shortcomings encountered
while adding two decimal digits whose sum exceeds 9 as in case of
8421 BCD Code.

The Excess-3 code is formed by adding ‗3‘ to each digit and then
replacing each digit by its four-bit binary equivalent.
The key feature of the Excess-3 code is .that it is self-
complementing. In other words, the l‘s complement of an Excess-3
number is the Excess-3 code for the 9‘s complement of the
corresponding decimal number. For example, the Excess-3 code for
decimal 6 is (0110+0011)=1001. The l‘s complement of 1001 is
0110, which is the Excess-3 code for decimal

3 (0011+0011), and 3 is the 9‘s complement of 6. This property of


Excess-3 code makes it useful in some arithmetic operations.
Binary-coded decimal (BCD)

For many applications, we need the exact binary equivalent of the


decimal system, which means we need an encoding for individual
decimal digits. This is precisely the case in many business
applications that deal with money—we cannot afford the rounding
errors that occur when we convert real numbers to floating point
during financial transactions!

Binary-coded decimal which is commonly referred to by its


abbreviation BCD is very common in electronics, particularly those
that display numerical data, such as alarm clocks and calculators.

Each decimal digit is individually converted to its binary


equivalent. For example, to encode146, the decimal digits are
replaced by 0001, 0100, and 0110, respectively.
Because most computers use bytes as the smallest unit of access, most
values are stored in 8 bits,not 4. That gives us two choices for storing
4-bit BCD digits.

Digit BCD

0 0000

1 0001

2 0010

3 0011

4 0100

20
Computer Organization and Architecture
5 0101

6 0110

7 0111

8 1000

9 1001

Zones

1111 Unsigned

1100 Positive

1101 Negative

Table 1.5 Binary-Coded Decimal

American Standard Code for Information Interchange (ASCII)

Digital computers deal with lot of alphanumeric information


through people, input, and output devices. So, there is a need for a
standard binary code for alphanumeric data. ASCII is a standard,
which uses seven bits to code 128 characters in binary. The letter A,
for example, is represented in ASCII as 1000001. The ASCII code
contains the following characters:

• 94 printing characters and 34 nonprinting characters.

• The printing characters consist of the 26 uppercase letters A


through Z, the 26 lowercase letters, the 10 numerals 0
through 9, and 32 special printable characters such as %, * ,
and
$.

• The nonprinting characters or control characters are used


for routing data and arrangingthe printed text into a
prescribed format. Following are three types of control
characters:
1. Format effectors: backspace (BS), horizontal tabulation
21
(HT), and carriage return (CR)which control the printing
layout.
2. Information separators: record separator (RS) and file
separator (FS) which separate thedata into paragraphs and
pages.
3. Communication control characters: STX (start of text) and
ETX (end of text), which areused to frame a text message
when transmitted through a communication medium.

ASCII characters most often are stored one per byte, though it is a
7-bit code. Most computers manipulate an 8-bit quantity as a single
unit called a byte. Therefore, ASCII characters most often are stored
one per byte. The extra bit is sometimes used for other purposes,
depending on the application. For example, some printers recognize
8-bit ASCII characters with the most significant bit set to 0.
Additional 128 8-bit characters with the most significant bit set to 1
are used for other symbols, such as the Greek alphabet or italic type
font. When used in data communication, the eighth bit may be
employed to indicate the parity of the binary-coded character. It
is possible to convert decimal digits in ASCII to BCD by removing
the three high-order bits, 011.

Binary codes can be prepared for any set of discrete elements


such as the musical notes andpositions on the chessboard.

Check Your Progress- 1


1. What is data type and number system?

..........................................................................................................
..........................................................................................................
..........................................................................................................
..........................................................................................................

2. What is the importance of number system?


..........................................................................................................
..........................................................................................................
..........................................................................................................
..........................................................................................................

22
Computer Organization and Architecture
3 What is the rule of number system?

..........................................................................................................
..........................................................................................................
..........................................................................................................
..........................................................................................................

1.6 COMPUTER ARITHMETIC

Computer arithmetic is a branch of computer engineering that deals


with the following:

• Representation of integers and real values in digital systems

• Hardware circuits and software algorithms for manipulating


numbers

Computers operate on binary data. The arithmetic of binary numbers


includes the operation of binary addition, binary subtraction, binary
multiplication, and binary division. It starts from the least significant
bit i.e., from the rightmost side.

Basic Binary arithmetic operations are:

Addition Subtraction Multiplication Division

1 0+0=0 0-0=0 0x0=0 0/1 = 0

2 0+1=1 1-0=1 0x1=0 1/1=1

3 1+0=1 1-1=0 1x0=0 0/0=not valid

4 1+1=10 0-1=0 with a borrow 1 1x1=1 1/0 = not valid

Table 1.6 Operation on binary numbers

The possible cases in binary addition, are:

0+0=0

0+1=1

23
1+0=1

1 + 1 = 0 (carry 1 to the next significant bit)

For example, let us add two binary numbers 10001001 and 10010101.

Binary Subtraction

0–0=0

0 – 1 = 1, borrow 1 from the next more significant bit

1–0=1

1–1=0

Now, let us subtract two binary numbers,

Binary Multiplication

0×0=0

1×0=0

0×1=0

1×1=1 (there is no carry or borrow for this)

24
Computer Organization and Architecture
Following are the steps to multiply binary numbers 10001001 and
10010101

Binary Division
Binary division is comprised of multiplication and subtraction;
Consider following example, which explains the operation more
easily.

Here 101 is the quotient and 1 is the remainder.

Fixed-point numbers

In a fixed-point number system, each number has the same number


of digits, and the ―point‖ is always in the same place. Examples
from the decimal number system would be 0.23, 5.12, and
9.11. In these examples each number has 3 digits, and the decimal
point is located two places from the right. Examples from the binary
number system would be 11.10, 01.10, and 00.11, where there are 4
binary digits, and the binary point is in the middle. The binary point
is not stored anywhere in digital computers but handled
programmatically. So, Fixed-point numbers in the same format can
be added like integers by simply ignoring the binary point. The basic
hardware circuit used for fixed point addition is a half-adder (HA).
Figure 1.3 shows the truth table and symbolic representation of
binary half-adder.

25
Figure 1.3 Truth table and schematic diagram for a binary half-adder

The truth table for the carry output is the logical AND of the two
inputs, while the sum output is the exclusive OR (XOR) of the
inputs. Half adder has the limitation of adding only two inputs. It
can be extended to binary Fulladder(FA) by adding a carry input .
Figure 1.4 shows the truth table and schematic diagram of Binary
full adder.

Figure 1.4 Truth table and schematic diagram for a binary full adder

A special kind of adder called a bit-serial adder can be formed by


connecting a flip-flop to a full- adder, for holding the carry bit from
one cycle to the next. In bit-serial adder, a clock signal is supplied
along with one input bit from each operand (beginning from the least
significant bits) resulting in one bit of output per clock cycle. Carry
from one cycle is held and used as input in the next cycle.

Multiplication

Machine multipliers without multiply hardware follow shift-add


multiplication process followed in dot notation

26
Computer Organization and Architecture
The figure 1.5 shows 4-digit multiplicand and 4 digit multiplier
resulting in 4 partial products (either all 0s (if the corresponding yi
= 0) or the same as x (if yi = 1). This method adds the multiplicand
X to itself Y times, where Y denotes the multiplier.

Figure 1.5 Multiplication of 4-bit numbers in dot notation

If the multiplier digit is 1, a copy of the multiplicand is placed in


the proper positions; if the multiplier digit is 0, 0 × multiplicand is
placed in the proper positions. it is easier if thecumulative partial
product is initialized to 0, each row of the bit-matrix added to it as
the corresponding term is generated, and the result of addition
shifted to the right by one bit to achieve proper alignment with the
next term, as depicted in Figure 1.5.

Division

Like multipliers, the simplest machine dividers are designed to


follow shift-subtract division depicted in Figure 1.6, where an 8-bit
dividend is divided by 4-bit divisor. Each row of dots is either all 0s
(if the corresponding qi = 0) or the same as y (if qi = 1). Basically,
it is reverse of multiply by shift-add. Repeat subtracting the
appropriate term (0 or a suitably shifted version of y) from the partial
remainder (initialized to the value of the dividend x) and proceed
until all bits of q have been determined.

27
Figure 1.6 Division of an 8-bit number by a 4-bit number in dot
notationFloating point representation

The floating-point representation of a number is of the form m x re,


which has two parts: m, the mantissa, a signed fixed-point number,
and e- the exponent which specifies the position of radix point. The
radix r and radix point is not stored inside computer. It is assumed
and managed by programmers. Only mantissa and exponent with
their signs are stored in computer.

For example, the decimal number +987.734 is represented in


floating-point with a fraction andan exponent as follows:

Fraction Exponent

+0.987734 +03

The value of the exponent indicates that the actual position of the
decimal point is three positions to the right of the indicated decimal
point in the fraction.

For example, the binary number +1011.01 is represented with an 8-


bit fraction and 6-bit exponent as follows:

Fraction Exponent

01011010 000100

Leftmost zero in mantissa denotes positive number. The exponent


has the equivalent binary number +4. The floating-point number is
equivalent to

m x 2e = +(.01011010)2 x 2+4

28
Computer Organization and Architecture
A floating-point number is said to be normalized if the most
significant digit of the mantissa is nonzero. For example, the 8-bit
binary number 00011100 is not normalized. when normalizedthe
number becomes 11100000. As the three shifts multiply the number
by 23 = 8, the exponent must be subtracted by 3. Normalized
numbers provide the maximum precision for the floating- point
number. A zero is represented in floating-point by all 0‘s in the
mantissa and exponent.

Two main standard forms of floating-point numbers are: ANSI


(American National Standards Institute) and IEEE (Institute of
Electrical and Electronic Engineers). The ANSI 32-bit floating-
point numbers in byte format with examples are given below:

Figure 1.7 Byte format

Check Your Progress- I I


1. What is conversion of number system?

..........................................................................................................
..........................................................................................................
..........................................................................................................
..........................................................................................................

2. How do you convert decimals to numbers?


..........................................................................................................
..........................................................................................................
..........................................................................................................
..........................................................................................................

29
3. What are the 4 types of number system?

..........................................................................................................
..........................................................................................................
..........................................................................................................
......................................................................................................

1.7 BOOLEAN EXPRESSION

Boolean Algebra

Boolean algebra is an algebra for objects that can take on only two
values, typically true(1) and false(0). Boolean algebra is ideal for
computer arithmetic as computers are built as collections of switches
that are either ―on‖ or ―off or low and high voltages.

A Boolean function typically has one or more input values which


are either 0 or 1 and yields a result. Boolean algebra deals with
binary variables and logical operations on those variables.

Three common Boolean operators are AND, OR, and NOT. A truth
table shows the relationship, between the input values and the result
of a specific Boolean operator or function on the input variables. It
lists all possible combinations of inputs along with their output.

The logical operator AND is represented by either a dot(x.y) or no


symbol(xy) and called as aBoolean product.

The Boolean operator OR is denoted by a plus sign (x+y) and called as


Boolean sum.

The logical operator, NOT, is represented by either an overscore(x¯


) or a prime( x‘) and called

―not x.‖

Boolean algebra is built on number of basc laws as listed in Table 1.7

30
Computer Organization and Architecture

Table 1.7 Basic Identities of Boolean Algebra Boolean expression


Combining the variables and operators yields Boolean
expressions

Table 1.8 summarizes a fewbasic properties of Boolean algebra that


can be applied to Boolean logic expressions.

31
Computer Organization and Architecture

Table 1.8 Basic properties of Boolean algebra Boolean expression


simplification

The most practical use of Boolean algebra is to simplify logic


circuits. A Boolean expression canbe implemented directly in a logic
circuit. The number of terms and operators in a Boolean expression
is directly related to the number of logic components. Through
Boolean algebra simplification, a Boolean expression is translated
to another form with a smaller number of terms and operations. A
logic circuit for the simplified Boolean expression performs the
identical function with fewer logic components as compared to its
original form. Additionally, the simplified Boolean expression
when implemented to a logic circuit is reliable with a reduced
cost.

Boolean expressions may be simplified by applying a series of


Boolean algebra laws. The simplification process is like that of
regular algebra. For example, the algebra expression

(12345/98765+ 67890 x 23456) x 0

is simplified to 0 based on the algebra rule that 0 times anything


number is 0. In Boolean algebra, there is a corresponding rule
called false law, which states that false AND anythingis false such
as
Computer Organization and Architecture

0 x= 0

where x is any Boolean expression. For example, the Boolean


expression

0 (A+BC+) =0, where A, B, C are Boolean variable and 0 indicates


Boolean false. There are 4 terms in the previous Boolean expression.
After the false rule is applied, the expression becomes one term, i.e.,
false. On the other hand, the true law states that true OR anything is
true, i.e.

1+A+B+C=1

where A, B, and C are any Boolean expression.

There may have different ways to simplification Boolean


expressions by applying Boolean algebra law. The following
example shows a simplification process for a Boolean expression to
be evaluated to true.

B
+
A
B
´
C
B
+
A
´
+
B
C
´
DeMorgan‘s law A´+B´+C´

DeMorgan‘s law B+B´+A´+C´

Commutative law (B+B´) + A´+C´

Associative law 1+A´+C´

Inverse law 1

True law

The above simplification process may not be unique. The


decomposition of ABC´ maybe considered as either A∙BC´ or
AB∙C´ where ∙ indicate an AND operation. Obviously, either case
will lead to A´+B´+C´ but the process is different.

A
B
+
A
´
B
+
A
B
´
+
A
´
B
´
(
A
+
A
´
34
Computer Organization and Architecture
)
B
+
A
B
´
+
A
´
B
´
Distribution law 1B+AB´+A´B´Inverse law B+AB´+A´B´
True law B+(A+A´)B´
Distribution law B+1B´
Inverse law B+B´

True law 1

Logic Gates

A logic gate is a physical device that implements a simple Boolean


function.

If we enumerate all possible assignments of switch settings for two


input variables, then we will obtain the 16 assignments shown in
Figure below. These functions are referred as Boolean logic
functions.
AND, OR, NOT, XOR, NAND, NOR

35
Table 1.9 Truth tables showing all possible functions of two
binary variables

Several assignments have special names. The AND function is true


(produces a 1) only when A and B are 1, whereas the OR function
is true when either A or B is 1, or when both A and B are
1. False function is a function whose output is always 0, whereas the
output of True function is always 1. The XNOR function is the
complement to XOR.

The A and B functions simply repeat the A and B inputs,


respectively, whereas the functions complement A and B, produce a
0 where the input is 1 and a 1 when the input is a 0. The NAND and
NOR functions are complements to AND and OR, respectively. The
XOR function is true when either of its inputs is true, but not both.
The manipulation of binary information is done by

36
Computer Organization and Architecture

logic circuits called gates. These are primitive element composed of


the actual physical components, or digital circuits which perform
arithmetic operations or make choices in a computer. Gates
implement each of the basic logic functions.

Gates

Gates are the basic building blocks for digital design. It is a small,
electronic device that computes various functions of two-valued
signals. A gate implements a simple Boolean function. To physically
implement each gate requires one to six or more transistors,
depending on the technology being used.

Gates are blocks of hardware that produce signals of binary 1 or 0


when input logic requirementsare satisfied.

The basic physical component of a computer is the transistor


whereas the basic logic element is the gate. Three simplest gates
correspond to the logical operators AND, OR, and NOT:

AND

The AND gate produces the AND logic function: that is, the output
is 1 if input A and input Bare both equal to 1; otherwise, the output
is 0. These conditions are also specified in the truth table for the
AND gate. In general, the output x is 1 only when all inputs are 1.
The algebraic operation symbol of the AND function is the same as
the multiplication symbol of ordinary arithmetic.

Figure 1.10 ANDOR


The OR gate gives a high output (1) if at least of its inputs are high.
A plus (+) is used to show the OR operation.

The OR gate produces the inclusive-OR function; that is, the output
is 1 if any or all inputs are 1; otherwise, the output is 0.

OR gates may have more than two inputs, and the output is 1 if any
input is 1.

Figure 1.11 ORNOT

The NOT gate produces a complemented version of the input, hence


the name inverter. If the input variable is A, the inverted output is
known as NOT A shown as A', or A with a bar over thetop, as shown
in Figure 1.10.

Figure 1.12 NOTNAND

This is called NOT-AND, i.e., AND gate followed by a NOT gate


as shown in Figure 1.11. Unlike AND gate, output of NAND gates
is high if any of the inputs are low.

38
Computer Organization and Architecture

Figure 1.13 NANDNOR

This is called NOT-OR gate, an OR gate followed by a NOT gate as


shown in Figure 1.12. The outputs of all NOR gates are low if any
of the inputs are high.

Figure 1.14 NORXOR

The XOR (exclusive-OR) gate acts in the same way as the logical
"either/or." The output is "true"(1) if either, but not both, of the
inputs are "true."(1) The output is "false"(0) if both inputs are
"false"(0) or if both inputs are "true."(1) In other words, the output
is 0 if the inputs are the same, is 1 if the inputs are different.
Computer Organization and Architecture

Figure 1.15 XOR Composition of logic gates

Logic gates can be made of resistors and transistors or diodes. A


resistor can commonly be used as a pull-up or pull-down resistor.
Pull-up and pull-down resistors are used when there are any unused
logic gate inputs to connect to a logic level 1 or 0. This prevents
any false switching ofthe gate. Pull-up resistors are connected to
Vcc (+5V), and pull-down resistors are connected to ground (0 V).

Commonly used logic gates are TTL and CMOS. TTL, or


Transistor-Transistor Logic, ICs will use NPN and PNP type Bipolar
Junction Transistors. CMOS, or Complementary Metal-Oxide-
Silicon, ICs are constructed from MOSFET or JFET type Field
Effect Transistors. TTL IC's may commonly be labelled as the 7400
series of chips, while CMOS ICs may often be marked as a 4000
series of chips.
Computer Organization and Architecture

Figure 1.16 Common Digital logic gatesMinterm

When a product term contains exactly one instance of every


variable, either in true or complemented form, it is called a minterm.
A minterm has a value of 1 for exactly one of the entries in the truth
table. That is, a minimum number of terms (one) will make the
function true. Using this method, the function is written as the sum
of the true entries in truth table as shown in below equation
Computer Organization and Architecture

Figure 1.17 Truth table for the majority functionMaxterms

When a sum term such as (A + B + C) contains exactly one instance


of every variable, either in true or complemented form, it is called a
maxterm. It has a value of 0 for only one entry in the truth table.
That is, it is true for the maximum number of truth table entries
without reducing to the trivial function of always being true. An
equation that consists of only maxterms in Product of Sums (POS)
form is said to be in ―canonical product-of-sums form.‖

Example:

The OR-AND form is logically equivalent to the AND-OR form.

Truth table

In a truth table, all possible input combinations of binary variables


are enumerated and a corresponding output value of 0 or 1 is
assigned for each input combination. For the truth table shown in
Figure 1.16, the output function Z depends upon input variables A
and B. For each combination of input variables there are two values
that can be assigned to Z: 0 or 1. We can choose a different
assignment for Figure 1.16, in which the light is on only when both
switches are up or both switches are down, in which case the truth
Computer Organization and Architecture
table Fig 1.17 enumerates all possible states of the light for each
switch setting. The wiring pattern would also need to be changed to
correspond. For two input variables, there are 2 2 = 4 input
combinations, and 24 = 16 possible assignments of outputs to input
combinations. In general, since there are 2 n input combinations for
n inputs, there are 2(2)n possible assignments of output values to input
combinations.

Figure 1.18 Truth table Figure 1.19 Truth tableCanonical Forms

In Boolean algebra, Boolean function can be expressed as Canonical


Disjunctive Normal Form known as Sum of minterm also known as
Sum of products (SOP) and some are expressed as Canonical
Conjunctive Normal Form known as Product of Maxterm also
known as Product of sum (POS)..

In Minterm, we look for output results ―1‖ in truth table, while in


Maxterm we look for output results ―0‖ in truth table.

or Boolean functions expressed as a sum of minterms or product of


maxterms are said to be in canonical form.

Canonical SoP form

Canonical Sum of Products(SoP) form is also called as sum of min


terms form. In SoP form, each product term or minterm contains all
literals. Boolean expression corresponding to the output variable is
formed by identifying terms for which, the output variable is one
and then do the logical OR of those min terms. Same procedure must
be repeated for other output variables also if there is more than one
output variable.

43
Example

Consider the following truth table.

Inputs Output

p Q R F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

Table 1.10 Truth tables

Look for cells where output F is ‗1‘. The corresponding min terms are
P‘QR, PQ‘R, PQR‘, PQR.By doing logical OR of these four min terms,
we will get the Boolean function of output F.

Therefore, the Boolean function of output is, F= P‘QR + PQ‘R +


PQR‘ + PQR which iscanonical SoP form of output, F. We can also
represent this function in following two notations.

44
Computer Organization and Architecture

Canonical PoS form

Canonical Product of Sums form is also called as product of Max


terms form because each sumterm contains all literals. .

First, identify the Maxterms for which, the output variable is zero
and then do the logical ANDof those Maxterms to get the Boolean
expression function corresponding to that output variable

Repeat the same procedure for other output variables also if there
is more than one outputvariable.
Karnaugh map

The Karnaugh map is an array of 2n squares, representing all


possible combinations of values ofn binary variables. Applicable
only for a small number(up to four) of variables, it is a convenient
way of representing a Boolean function.

Figure 1.20a (Figure 1.20b)

45
Computer Organization and Architecture

Figure 1.20a shows the map of four squares for a function of two
variables.

In the case of three variables, the representation is an arrangement


of eight squares (Figure 1.20b), with the values for one of the
variables to the left and for the other two variables above the
squares.

Each square corresponds to a unique product in the sum- of-


products form, with a 1 value corresponding to the variable and a 0-
value corresponding to the NOT of that variable. Thus, the product
AB‘ corresponds to the fourth square in Figure 11.18a. For each
such product in the function, 1 is placed in the corresponding square.
Thus, for the two- variable example, the map corresponds to .
Given the truth table of a Boolean function, it is an easy matter
toconstruct the map. For each combination of values of variables
that produce a result of 1 in the truth table, fill in the corresponding
square of the map with 1.

Figure 1.20b shows the result for the truth table of Table 1.11.

Table 1.11 Boolean functions of 3 variablesK-map up-to 4 variable


Computer Organization and Architecture

Figure 1.20c Figure 1.20d

For four variables, 16 squares are needed, with the arrangement


indicated in Figure 1.20c.

In Figure 1.20d the two rows embraced by the symbol A are those
in which the variable A has the value 1; the rows not embraced by
the symbol A are those in which A is 0; similarly, for B,C, and D.

Figure 1.21 illustrates the reduction of Boolean expressions too


tedious for Boolean algebrausing four
variable Karnaugh
maps:

Figure 1.21 Logic reductions of k-map


The Boolean expression has seven product terms. The first P-term
A‘B‘CD is the first row, 3rd cell, corresponding to map location
A=0, B=0, C=1, D=1.The other product terms are placed in a similar
manner. Look for groups of 1‘s in multiples of 2n, encircling the
largest groups possible, two groups of four are shown above.

In many cases the canonical sum-of-products (SOP) or product-of-


sums (POS) forms are not minimal in terms of their number and size.
Since a reduced Boolean equation transforms to a lower gate input
count in the target circuit, reduction of the equation is an important
consideration in complex circuits.

Three methods of reducing Boolean equations are described in the


sections that follow: algebraic reduction, Karnaugh map (K-Map)
reduction, and tabular reduction. The algebraic method is the most
abstract method, forms the basis for the other two methods. It relies
on the theorems of Boolean algebra. The K-map and tabular
methods visualize the reduction process, and to thus have a better
intuition for how the process works. These pencil and paper
implementations or manual processes of the algebraic method can
be used effectively to minimize functions that have (about) six or
fewer variables. For larger functions, a computer-aided design
(CAD) approach is generally more effective.

1.8 LET US SUM UP


• The term data refers to factual information used for analysis
or reasoning.
• Digital computers store data in memory or processor registers.
• Digital computers use the binary system to represent and
Binary arithmetic to manipulate numeric values.

• Binary number system provides various methods to add,


subtract, multiply, and dividebinary numbers.

• Subtraction and logical manipulations are done in digital


computers using Complementrepresentations.

• Binary code is the digital data which is represented,

48
Computer Organization and Architecture
stored, and transmitted as groups ofbinary digits.

• Boolean algebra is an algebra for the manipulation of


objects that can take on only twovalues, typically true and
false or 0 and 1.

• A boolean function is implemented by a logic gate, which


are basic building blocks fordigital design.

• The Karnaugh map is a convenient way of representing a


Boolean function.

1. 9 KEY WORDS

1. Decimal number system-The decimal number system has a base of 10


because it uses ten digits from 0 to 9. In the decimal number system, the
positions successive to the left of the decimal point represent units, tens,
hundreds, thousands and so on. This system is expressed in decimal
numbers. Every position shows a particular power of the base (10).

2.Binary number system-The base 2 number system is also known as


the Binary number system wherein, only two binary digits exist, i.e., 0 and
1. Specifically, the usual base-2 is a radix of 2. The figures described under
this system are known as binary numbers which are the combination of 0
and 1. For example, 110101 is a binary number.

3.Octal number system-In the octal number system, the base is 8 and it
uses numbers from 0 to 7 to represent numbers. Octal numbers are
commonly used in computer applications. Converting an octal number to
decimal is the same as decimal conversion and is explained below using
an example.

4.Number system-A number system is defined as a system of writing to


express numbers. It is the mathematical notation for representing numbers
of a given set by using digits or other symbols in a consistent manner. It
provides a unique representation of every number and represents the
arithmetic and algebraic structure of the figures. It also allows us to operate
arithmetic operations like addition, subtraction, multiplication and
division.

49
5.Hexadecimal number system-In the hexadecimal system, numbers are
written or represented with base 16. In the hexadecimal system, the
numbers are first represented just like in the decimal system, i.e. from 0 to
9. Then, the numbers are represented using the alphabet from A to F. The
below-given table shows the representation of numbers in the hexadecimal
number system.

1.10 ANSWER TO CHECK YOUR PROGRESS

4. Refer 1 for Answer to check your progress- 1 Q. 1 …


Ans.1 The four most common number system types are: Decimal
number system (Base- 10) Binary number system (Base- 2) Octal
number system (Base-8) Hexadecimal number system (Base- 16)
5. Refer 1 for Answer to check your progress- 1 Q. 2 …
Ans.2 In daily lives, people often have to depict, represent or associate
certain things or objects with a quantity. This is because of the fact
that assigning quantities to certain values or aspects in life makes
it easier to compare them with other similar aspects.
6. Refer 2 for Answer to check your progress- 1 Q. 3 …
Ans.3 Number system is a system of expressing numbers of a given
set using digits or symbols. The numbers are used as digits with 0 and
1 being the most common ones that are used to represent binary
numbers. The remaining digits from 0 to 9 are used to represent various
other types of number systems
Refer II for Answer to check your progress- 2 Q. 1 …
Ans4.As you know decimal, binary, octal and hexadecimal number
systems are positional value number systems. To convert binary, octal
and hexadecimal to decimal number, we just need to add the product
of each digit with its positional value. Here we are going to learn other
conversion among these number systems.
Refer II for Answer to check your progress- 2 Q. 2 …
Ans.5. To convert a decimal to a fraction, place the decimal number
over its place value. For example, in 0.6, the six is in the tenths place,
so we place 6 over 10 to create the equivalent fraction, 6/10. If needed,
simplify the fraction.
50
Computer Organization and Architecture
Refer II for Answer to check your progress- 2 Q. 3 …
Ans.6. The four most common number system types are:
• Decimal number system (Base- 10)

• Binary number system (Base- 2)


• Octal number system (Base-8)
• Hexadecimal number system (Base- 16)
7. Refer 1 for Answer to check your progress- 1 Q. 1 …
Ans.1 The four most common number system types are: Decimal
number system (Base- 10) Binary number system (Base- 2) Octal
number system (Base-8) Hexadecimal number system (Base- 16)
8. Refer 1 for Answer to check your progress- 1 Q. 2 …
Ans.2 In daily lives, people often have to depict, represent or associate
certain things or objects with a quantity. This is because of the fact
that assigning quantities to certain values or aspects in life makes
it easier to compare them with other similar aspects.
9. Refer 2 for Answer to check your progress- 1 Q. 3 …
Ans.3 Number system is a system of expressing numbers of a given
set using digits or symbols. The numbers are used as digits with 0 and
1 being the most common ones that are used to represent binary
numbers. The remaining digits from 0 to 9 are used to represent various
other types of number systems
Refer II for Answer to check your progress- 2 Q. 1 …
Ans4.As you know decimal, binary, octal and hexadecimal number
systems are positional value number systems. To convert binary, octal
and hexadecimal to decimal number, we just need to add the product
of each digit with its positional value. Here we are going to learn other
conversion among these number systems.
Refer II for Answer to check your progress- 2 Q. 2 …
Ans.5. To convert a decimal to a fraction, place the decimal number
over its place value. For example, in 0.6, the six is in the tenths place,
so we place 6 over 10 to create the equivalent fraction, 6/10. If needed,
simplify the fraction.
Refer II for Answer to check your progress- 2 Q. 3 …
Ans.6. The four most common number system types are:
• Decimal number system (Base- 10)

• Binary number system (Base- 2)


51
• Octal number system (Base-8)
• Hexadecimal number system (Base- 16)

1.11 SOME USEFUL BOOKS

1.12 TERMINAL QUESTIONS

1. Convert 256 from decimal number system to binary number

2. Convert 632 from hexadecimal number system to Octal number


system

3. Differentiate between fixed and floating number representations.

4. Elaborate the concept of Truth table

5. Define the use of k-map.

52

You might also like