Chapter 1
Chapter 1
Data Representation
(4 Hrs)
Prepared By: Rolisha Sthapit
CONTENTS
1.1 Data Representation: Binary Representation, BCD, Alphanumeric
Representation, Complements ((r-1)’s Complement and r’s complement), Fixed
Point representation, Representing Negative Numbers, Floating Point
Representation, Arithmetic with Complements (Subtraction of Unsigned Numbers,
Addition and Subtraction of Signed Numbers), Overflow, Detecting Overflow
1.2 Other Binary Codes: Gray Code, self Complementing Code, Weighted Code
(2421 and 8421 codes), Excess-3 Code, EBCDIC
1.3 Error Detection Codes: Parity Bit, Odd Parity, Even parity, Parity Generator &
Checker
Computer Organization vs Architecture
• Computer Architecture refers to those attributes of a system that have a direct impact on the
logical execution of a program. Examples:
- the instruction set
- the number of bits used to represent various data types
- I/O mechanisms
- memory addressing techniques
• Computer Organization refers to the operational units and their interconnections that
realize the architectural specifications. Examples are things that are transparent to the
programmer:
- control signals
- interfaces between computer and peripherals
- the memory technology being used.
• So, for example, the fact that a multiply instruction is available is a computer
architecture issue. How that multiply is implemented is a computer organization issue.
• Architecture is those attributes visible to the programmer - Instruction set, number of
bits used for data representation, I/O mechanisms, addressing techniques. e.g. Is there a
multiply instruction?
• Organization is how features are implemented - Control signals, interfaces, memory
technology. e.g. Is there a hardware multiply unit or is it done by repeated addition?
• Computer architecture is concerned with the structure and behavior of computer
system as seen by the user.
• Computer organization is concerned with the way the hardware components operate
and the way they are connected together to form a computer system.
1.1 Data Representation: Data Types:
• The term “data” refers to factual information used for analysis or reasoning.
• The data types found in the registers of digital computers may be classified as being
one of the following categories:
(1) Numbers used in arithmetic computation,
(2) Letters of the alphabet used in data processing,
(3) Other discrete symbols used for specific purposes.
• Data are numbers and other binary-coded information that are operated on to achieve
required computational results.
• The Binary Number System is the most natural system used in digital computer but
sometimes it is convenient to employ different number system especially decimal
number system since it is used by people for performing arithmetic operations.
Number System
• A number system of base or radix is a system that uses distinct symbols for ‘r’
digit symbols to determine the quantity that the number represents. It is necessary
to multiply each digit by an integer power of ‘r’ and the sum all the weighted
digits.
• We can categorize number system as below:
- Binary number system (r = 2)
- Octal Number System (r = 8)
- Decimal Number System (r = 10)
- Hexadecimal Number system (r = 16)
Exercise
1. Convert binary 101101 to decimal
2. Convert Hexadecimal number F3 to decimal
3. Convert decimal 41 to Binary
4. Convert decimal 153 to octal.
5. Convert decimal 235 to hexadecimal
6. Convert decimal (0.6875) to binary
(Answer 1: 45 2: 243 3: 101001 4:231 5: EB 6: 0.1011)
Complements
• Complements are used in digital systems for simplifying the subtraction operation
and for logic manipulation, simplifying operations leads to simpler, less expensive
to implement.
• Two types of complements are:
i) r’s complement (Radix Complement)
ii) (r-1)’s complement (The Diminished Radix Complement)
i. r-1’s Complement:
Sign of a
number Sign of Exponent Mantissa
exponent (Always number after decimal)
Example:
Decimal (-13.9) into binary 8- bits
• Solution:
8-bit word
1 0 0 1 1 1 0 1
Single Precision Floating Point (32-bit)
• It is computer number format that occupies 4-bytes i.e. 32 bits in computer memory and represents
a wide dynamic range of values by using a floating point. Single Precision binary floating point is
used due to wider range over fixed point (of the same bit and width).
- Sign : 1- bit
- Exponent : 8-bits
- Significant precision = 24 bits (23 explicitly stored)
- Sign bit determined the sign of the number, which is the sign of the significand as well. Exponent
is either an 8-bit signed integer from -128 to +127 or an 8-bit unsigned integer from 0 to 255.
- The true significand includes 23 fraction bits to the right of the binary point.
1-bit 8-bit 23-bit
S E Mantissa
S E Mantissa