0% found this document useful (0 votes)
63 views34 pages

Chapter - 2 Comp Org.

The document discusses different number systems used in computers like binary, decimal, octal and hexadecimal. It explains how to convert between these number systems using various steps. For example, to convert a decimal number to binary, we divide the decimal number by 2 repeatedly and note the remainders from least to most significant. It also discusses signed and unsigned number representation for integers in computers.

Uploaded by

Aynalem
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)
63 views34 pages

Chapter - 2 Comp Org.

The document discusses different number systems used in computers like binary, decimal, octal and hexadecimal. It explains how to convert between these number systems using various steps. For example, to convert a decimal number to binary, we divide the decimal number by 2 repeatedly and note the remainders from least to most significant. It also discusses signed and unsigned number representation for integers in computers.

Uploaded by

Aynalem
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/ 34

Number

systems

computer organization and


architecture chapter 5/30/2020 1
2
 Data in computers is represented in binary form. The
represented data can be number, text, movie, colour
(picture), sound, or anything else.
 Computers understand and respond to only the flow

of electrical charge.
 Data representation using the binary number system

results in a large string of 0s and 1s. This makes the


represented data large and difficult to read.

computer organization and


architecture chapter 5/30/2020 2
2
1.Non-positional number system

 Thevalue of a symbol (digit) in a number does not


depend on the position of the digit in number.
2. Positional number system

 The value of a symbol in the number is determined


by its position, the symbol and the base of the
number system.

computer organization and


architecture chapter 5/30/2020 3
2
 Decimal number system
 called the base 10 number system
 It has 10 different symbols identified as 0, 1, 2, 3, 4,

5, 6, 7, 8, and 9.
 Binary number system
 known as base 2 number system,
 has two digits 0 and 1.

computer organization and


architecture chapter 5/30/2020 4
2
 Octal number system
 also called base 8 number system,
 has 8 different symbols: 0, 1, 2, 3, 4, 5, 6, and 7.
 Hexadecimal number system
 also called base 16 number system,
 has 16 different symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,

B, C, D, E, and F.
 It is used to write binary numbers in short form.

computer organization and


architecture chapter 5/30/2020 5
2
1. Conversion from Decimal to Base m
Step 1: Divide the given decimal number by m (the
desired base).
The result will have a quotient and a remainder.
Step 2: Repeat step 1 until the quotient becomes 0,
the quotient is 0 whenever the number < m.
Step 3: Collect and arrange the remainders in such a
way that the first remainder is the least significant
digit and the last remainder is the most significant
digit.

computer organization and


architecture chapter 5/30/2020 6
2
Eg: Convert the decimal number 47 into binary, octal,
and hexadecimal.
a. Conversion to binary divide by 2.

computer organization and


architecture chapter 5/30/2020 7
2
Hence the result is 1011112.

b. Conversion to octal: Here the numbers are divided


by 8

computer organization and


architecture chapter 5/30/2020 8
2
Therefore, 47 = 578
c. Conversion to hexadecimal
numbers are divided by 16.

The hexadecimal equivalent for the decimal 15 is F and


that of 2 is2.
Therefore, 47 = 2F16

computer organization and


architecture chapter 5/30/2020 9
2
2. Conversion from Base m to Decimal
Step 1: Multiply each digit by its positional value.
Step 2: Calculate the sum of the products you get in
step 1.
Example 1: Convert the binary number 110001 into
decimal.
1100012 = (1 × 25) + (1 × 24) + (0 × 23) + (0 × 22)
+
(0 × 21) + (1 × 20) = (1 × 32) + (1 × 16) + (0 × 8) +
(0 ×
4) + (0 × 2) + (1 × 1) = 32 + 16 + 0 + 0 + 0 + 1 = 49
Therefore, 1100012 = 49.
computer organization and
architecture chapter 5/30/2020 10
2
Example 2: Convert the octal number 22 into decimal.
228 = (2 × 81) + (2 × 80) =
(2 × 8) + (2 × 1) = 16 + 2 = 18
Therefore, 228 = 18
Example 3: Convert the hexadecimal number D1 into
decimal.
D116 = (13 × 161) + (1 × 160)
Therefore, D116 = 209

computer organization and


architecture chapter 5/30/2020 11
2
3. Conversion from Binary to Octal
 It is possible to use decimal number system as an
intermediate base to convert from any base to any
other base. However, for conversion from binary to
octal or vice versa, there is a very simple method.
.

computer organization and


architecture chapter 5/30/2020 12
2
Step 1: Group the binary digits (bits) starting from
the rightmost dig into 3 bits.
If the remaining bits at the leftmost position are fewer than 3,
add 0s at the front.
Step 2: For each 3-bit binary string, find the corresponding
octal number
Example: Convert the binary numbers 110011 and
1101111 to octal.

computer organization and


architecture chapter 5/30/2020 13
2
 The bits are grouped in three with the equivalent octal
digit given below the three bit group.
Thus, 1100112 = 638
The result is 11011112 = 1578.
4. Conversion from Octal to Binary
Step 1: For each octal digit, find the equivalent three
digit binary number.
Step 2: If there are leading 0s for the binary equivalent of
the leftmost octal digit, remove them.

computer organization and


architecture chapter 5/30/2020 14
2
Example: Find the binary equivalent for the octal
numbers 73 and 160.

computer organization and


architecture chapter 5/30/2020 15
2
 Therefore,738 = 1110112 and
 Thus, 1608 = 11100002

5. From Binary to Hexadecimal


One possible way to convert a binary number to
hexadecimal, is first to convert the binary number to
decimal and then from decimal to hex.
The simple steps states are stated below.

computer organization and


architecture chapter 5/30/2020 16
2
Step 1: Starting from the rightmost bit, group the bits in 4. If
the remaining bits at the leftmost position are fewer than 4,
add 0s at the front.
Step 2: For each 4-bit group, find the corresponding
hexadecimal number.
Example: Convert the binary numbers 10011110 to
hexadecimal.

computer organization and


architecture chapter 5/30/2020 17
2
Therefore, 100111102 = 9E16
6. Conversion from Hexadecimal to Binary
Step 1: For each hexadecimal digit, find the
equivalent four digit binary number.
Step 2: If there are leading 0s for the binary
equivalent of the leftmost hexadecimal digit, remove
them.

computer organization and


architecture chapter 5/30/2020 18
2
Example: Find the binary equivalents for the
hexadecimal numbers 1C and 823

Thus, 1C16 = 111002 and 82316 = 1000001000112

computer organization and


architecture chapter 5/30/2020 19
2
7. Conversion from Octal to Hexadecimal of Vice
Versa
The decimal number system can be used as an
intermediate conversion base.
second alternative is using the binary number
system as an intermediate base.
Step 1: Convert the given number into binary.
Step 2: Convert the binary number you got in step 1
into the required base.

computer organization and


architecture chapter 5/30/2020 20
2
Example : Convert the octal number 647 to hexadecimal.

Therefore, 6478 = 1A716

Hence, 82316 = 1000001000112.

computer organization and


architecture chapter 5/30/2020 21
2
8. Conversion from Octal to Hexadecimal or Vice
Versa
Example 2: Find the octal equivalent for the
hexadecimal number 3D5

Therefore, 3D516 = 17258

computer organization and


architecture chapter 5/30/2020 22
2
 If the numbers we want to represent are only positive
(unsigned) integers,
 simply represent the unsigned integer with its binary
value.
 Signed integer representations are sign
magnitude, 1’s complement and 2’s complement.

computer organization and


architecture chapter 5/30/2020 23
2
 treat the most significant bit as a sign bit the
remaining bits are used to represent the magnitude of
the integer.
 a 0 on the sign bit indicates the integer is positive
and a 1 indicates the integer is a negative.

As example, the sign-magnitude
representation of 79 and -79 in 8 bits are
01001111 and 11001111 respectively.

computer organization and


architecture chapter 5/30/2020 24
2
 Every number system has two complement systems.
For a given base n the complements are n’s
complement and (n-1)’s complement.
 The one’s complement of a binary integer is found by

inverting all 0s to 1s and all 1s to 0s. In one’s


complement integer representation, the negative of an
integer is represented by its complement.

computer organization and


architecture chapter 5/30/2020 25
2
For example, the one’s complement representation of
16 and -16 in 8 bits are 00010000 and 11101111
respectively.
For 8-bits number system:
Largest Positive Number: 0 1111111= +(127)10
Largest Negative Number: 1 0000000 =-(127)10

computer organization and


architecture chapter 5/30/2020 26
2
The two’s complement of an integer is found by
adding 1 to its one’s complement
Example,
two’s complement representation of 19 and -19
in 8
bits are 00010011 and 11101101 respectively.

computer organization and


architecture chapter 5/30/2020 27
2
 Floating Point representation of a number has two
parts. The first part represents a signed, fixed-point
number called the mantissa.
 The second part designates the position of the

decimal (or binary) point and is called the exponent.


Floating point is always represented as follows:

m x re where, m (mantissa) r(radix)
and e(exponent)

computer organization and


architecture chapter 5/30/2020 28
2
Binary Coded Decimal (BCD)
The BCD (Binary Coded Decimal), also called
packed decimal, in order to have representations for
the ten digits of the decimal number system, we need
a four bit string.
Notes: BCD is not equivalent to binary

computer organization and


architecture chapter 5/30/2020 29
2
 Characters refer to a unit of Information that
roughly corresponds to a Grapheme, grapheme-like
unit, or symbol, such as in an Alphabet in
the Written form of a natural language.
 Examples of characters are, letters of the alphabet,
the ten digits (0 through 9), punctuation marks
Whitespace.

computer organization and


architecture chapter 5/30/2020 30
2
 characters that are used to format the layout of text on
pages such as the newline, space, and tab characters,
and other characters that are useful for
communication.
 Characters are typically combined into String.

computer organization and


architecture chapter 5/30/2020 31
2
 eachcharacter is represented by 7 bits; hence a total
of 128 characters are represented.
 The eighth bit is used for parity (error detection).
 ASCII: 7-bit, plus a parity bit for error detection

(odd/even parity).

computer organization and


architecture chapter 5/30/2020 32
2
 Another character encoding system is the EBCDIC.
 It uses 8 bits per character (and a ninth parity bit),

thus represents 256 characters.


 As with IRA, EBCDIC is compatible with BCD.

In the case of EBCDIC, the codes 11110000
through 11111001 represent the digits 0 through 9.

computer organization and


architecture chapter 5/30/2020 33
2
In order to be compatible with older systems that
didn't support Unicode, Encoding Forms were
defined by the Unicode Consortium to be a
representation of the character in bits.
The number indicates the encoding form that is to be
used: UTF-8 indicates an 8-bit encoding form,
while UTF-16 indicates a 16-bit encoding form.

computer organization and


architecture chapter 5/30/2020 34
2

You might also like