0% found this document useful (0 votes)
39 views18 pages

DLCA-Data Representation

This document discusses different data types and representations used in computer systems, including: - Binary, decimal, hexadecimal, and other number systems for representing numeric data. Conversion methods between these systems are also covered. - Binary-coded decimal for representing decimal numbers in a way that requires more bits than straight binary but is easier for humans to interpret. - Representation of alphanumeric characters using codes like ASCII. - The use of complements to simplify subtraction and logical operations in computers. Conversion between numeric bases, binary-coded decimal, and character codes are fundamental aspects of data representation in computer systems.

Uploaded by

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

DLCA-Data Representation

This document discusses different data types and representations used in computer systems, including: - Binary, decimal, hexadecimal, and other number systems for representing numeric data. Conversion methods between these systems are also covered. - Binary-coded decimal for representing decimal numbers in a way that requires more bits than straight binary but is easier for humans to interpret. - Representation of alphanumeric characters using codes like ASCII. - The use of complements to simplify subtraction and logical operations in computers. Conversion between numeric bases, binary-coded decimal, and character codes are fundamental aspects of data representation in computer systems.

Uploaded by

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

1 / 23

Computer System Architecture


(THIRD EDITION)

M. Morris Mano

PRENTICE HALL
Computer System Architecture Chap. 3 Data Representation Ref: bazi.pe.kr
Data Types 2 / 23

 Data Types
 Binary information is stored in memory or processor registers
 Registers contain either data or control information
 Data are numbers and other binary-coded information
 Control information is a bit or a group of bits used to specify the sequence
of command signals
 Data types found in the registers of digital computers
 Numbers used in arithmetic computations
 Letters of the alphabet used in data processing
 Other discrete symbols used for specific purpose

 The binary number system is the most natural system to use in a digital
computer
 Number Systems
 Base or Radix r system : uses distinct symbols for r digits
 Most common number system :Decimal, Binary, Octal, Hexadecimal
 Positional-value(weight) System : r2 r 1r0.r-1 r-2 r-3
» Multiply each digit by an integer power of r and then form he sum of all weighted
digits

Computer System Architecture Chap. 3 Data Representation


Data Types 3 / 23

 Decimal System/Base-10 System


 Composed of 10 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0)

 Binary System/Base-2 System


 Composed of 10 symbols or numerals(0, 1)
 Bit = Binary digit

 Hexadecimal System/Base-16 System : Tab. 3-2


 Composed of 16 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,
B, C, D, E, F)
 Binary-to-Decimal Conversions
1011.1012 = (1 x 23) + (0 x 22)+ (1 x 21) + (1 x 2o) + (1 x 2-1) + (0 x 2-2) + (1 x 2-3)
= 810+ 0 + 210 + 110 + 0.510 + 0 + 0.12510
= 11.62510
 Octal-to-Decimal Conversions
(736.4)8 = 7 x 82 + 3 x 81 + 6 x 80 + 4 x 8-1
= 7 x 64 + 3 x 8 + 6 x 1 + 4/8 = (478.5) 10
 Hexadecimal-to-Decimal Conversions
(F3)16 = F x 16 + 3 = 15 x 16 + 3 = (243)10

Computer System Architecture Chap. 3 Data Representation


Data Types 4 / 23

Conversion of decimal 41.6875 into binary


Repeated division(See p. 69, Fig. 3-1)

Integer = 41
41 / 2 = 20 remainder 1 (binary number will end with 1) : LSB
20 / 2 = 10 remainder 0
10 / 2 = 5 remainder 0
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (binary number will start with 1) : MSB
Read the result upward to give an answer of (41) 10 = (101001)2

Fraction = 0.6875
0.6875 x 2 = 1.3750 integer 1 : MSB
1.3750 x 2 = 0.7500 integer 0 .
0.7500 x 2 = 1.5000 integer 1
1.5000 x 2 = 1.0000 integer 1 : LSB
Read the result downward (0.6875)10 = (0.1011)2

(41.6875)10 = (101001.1011)2 Fractional part


(Not to be Reversed)

Computer System Architecture Chap. 3 Data Representation


Data Types 5 / 23

 Hex-to-Decimal Conversion Table 3-2


Hex Binary
2AF16 = (2 x 16 ) + (10 x 16 ) + (15 x 16 )
2 1 o Decimal
0 0000 0
= 51210 + 16010 + 1510 1 0001 1
2 0010 2
= 68710 3 0011 3
4 0100 4
 Decimal-to-Hex Conversion 5
6
0101
0110
5
6
7 0111 7
42310 / 16 = 26 remainder 7 (Hex number will end with 7) : LSB 8 1000 8
2610 / 16 = 1 remainder 10 9 1001 9
A 1010 10
110 / 16 = 0 remainder 1 (Hex number will start with 1) : MSB B 1011 11
C 1100 12
Read the result upward to give an answer of 423 10 = 1A716 D 1101 13
E 1110 14
F 1111 15
14 0001 0100 20
 Hex-to-Binary Conversion  Binary-to-Hex Conversion F8 1111 1000 248

9F216 = 9 F 2 1 1 1 0 1 0 0 1 1 02 = 0 0 1 1 1 0 1 0 0 1 1 0

= 1001 1111 0010 3 A 6


= 1001111100102 = 3A616

 Binary, octal,
1 and
2 hexadecimal
7 5 Conversion
4 3
Octal
Binary
1 0 1 0 1 1 1 1 0 1 1 0 0 0 1 1
Hexadecimal
A F 6 3

Computer System Architecture Chap. 3 Data Representation


Data Types 6 / 23

 Binary-Coded-Decimal Code
 Each digit of a decimal number is represented by its binary equivalent
8 7 4 (Decimal)

1000 0111 0100 (BCD)


 Only the four bit binary numbers from 0000 through 1001 are used
 Comparison of BCD and Binary
13710 = 100010012 (Binary) - require only 8 bits
13710 = 0001 0011 0111BCD (BCD) - require 12 bits
 Alphanumeric Representation
 Alphanumeric character set
» 10 decimal digits, 26 letters, special character($, +, =,….)
» 0 to 32- Non- alpha numeric characters
» 33 to 47,58 to 64,91 to 96, 123 to 127 - Special Characters
» 48-57- Numeric ( 0 to 9)
» 40 to 64-Spectial Characters
» 9 to 122 - Uppercase Letters
» 65 to 90 - Lowercase Letters

Computer System Architecture Chap. 3 Data Representation


ASCII Table 7 / 23

Computer System Architecture Chap. 3 Data Representation


Complements 8 / 23

 Complements are used in digital computers for simplifying the subtraction


operation and for logical manipulation

 There are two types of complements for base r system


 1) r’s complement 2) (r-1)’s complement
» Binary number : 2’s or 1’s complement
» Decimal number : 10’s or 9’s complement

N : given number
 (r-1)’s Complement r : base
 (r-1)’s Complement of N = (rn-1)-N n : number of digits

» 9’s complement of N=546700


(106-1)-546700= (1000000-1)-546700= 999999-546700
= 453299 546700(N) + 453299(9’s compl.)
» 1’s complement of N=101101 =999999
(26-1)-101101= (1000000-1)-101101= 111111-101101
= 010010 101101(N) + 010010(1’s compl.)
=111111
 r’s Complement
 r’s Complement of N = rn-N * r’s Complement
» 10’s complement of 2389= 7610+1= 7611 (r-1)’s Complement +1 =(rn-1)-N+1= rn-N
» 2’s complement of 1101100= 0010011+1= 0010100

Computer System Architecture Chap. 3 Data Representation


Complements 9 / 23

 Subtraction of Unsigned Numbers (M-N), N0


Steps:
1) M + (rn-N)
2) M  N : Discard end carry, Result = M-N
3) M  N : No end carry, Result = - r’s complement of (N-M)

M  N » Decimal Example) MN 13250(M) - 72532(N) = -59282


72532(M) - 13250(N) = 59282 13250
Discard 72532 + 27468 (10’s complement of 72532)
No End
End Carry + 86750 (10’s complement of 13250)
Carry
0 40718
1 59282 Result = -(10’s complement of 40718)
Result = 59282 = -(59281+1) = -59282

X  Y » Binary Example) XY 1000011(X) - 1010100(Y) = -0010001


1010100(X) - 1000011(Y) = 0010001 1000011
+ 0101100 (2’s complement of 1010100)
1010100
0 1101111
+ 0111101 (2’s complement of 1000011)
Result = -(2’s complement of 1101111)
1 0010001
Result = 0010001 = -(0010000+1) = -0010001

Computer System Architecture Chap. 3 Data Representation


Fixed-Point Representation 12 / 23

 Overflow
 An overflow may occur if the two numbers added are both positive or both
negative
» When two unsigned numbers are added
BCD 코드를 연산 하려면  an overflow is detected from the end carry out of the MSB position
특별한 연산기가
» When two signed numbers are added * Overflow Exam)
필요하다
out in out in
 the MSB always represents the sign
carries 0 1 carries 1 0
- the sign bit is treated as part of the number
+ 70 0 1000110 - 70 1 0111010
- the end carry does not indicate an overflow
+ 80 0 1010000 - 80 1 0110000
 Overflow Detection
+ 150 1 0010110 - 150 0 1101010
 Detected by observing the carry into the sign bit position and the carry out of
the sign bit position
 If these two carries are not equal, an overflow
*Decimal Exam) (+375) + (-240)
condition is produced(Exclusive-OR gate = 1) 375 + (10’s comp of 240)= 375 + 760
 Decimal Fixed-Point Representation
0 375 (0000 0011 0111 0101)
 A 4 bit decimal code requires four F/Fs +9 760 (1001 0111 0110 0000)
* Advantage * for each decimal digit 0 135 (0000 0001 0011 0101)
Computer I/O data  The representation of 4385 in BCD requires 16 F/Fs (0100 0011 1000 0101)
are generated by
people who use  The representation in decimal is wasting a considerable amount of storage
the decimal space and the circuits required to perform decimal arithmetic are more complex
system

Computer System Architecture Chap. 3 Data Representation


Other Binary Codes 14 / 23

 Gray Code
Gray code changes by only one bit

Computer System Architecture Chap. 3 Data Representation


Other Binary Codes 15 / 23

 Other Decimal Codes


 Binary codes for decimal digits require four bits. A few possibilities are
shown in Tab. 3-6
 Excess-3 Gray Code
» Gray code
» Self-Complementing : excess-3 code
» 9’s complement of a decimal number is easily obtained by 1’s
complement(=changing 1’s to 0’s and 0’s to 1’s)
 Weighted Code : 2421 code
* Self-Complement Exam)
» The bits are multiplied by the weights, and the sum
410 = 0111 (3-excess)
of the weighted bits gives the decimal digit = 1000 ( 1’s comp)
 Other Alphanumeric Codes = 510 (3-excess in Tab. 3-6)
 ASCII Code 에서 Tab. 3-4 이외 : p. 384, Tab. 11-1 = 510( 9’s comp of 4)
» Format effector : Functional characters for controlling the layout of printing or
display devices(carriage return-CR, line feed-LF, horizontal tab-HT,…)
» Data communication flow control(acknowledge-ACK, escape-ESC, synchronous-
SYN,…)
 EBCDIC(Extended BCD Interchange Code)
» Used in IBM equipment( 제어 문자만 약간 다름 )

Computer System Architecture Chap. 3 Data Representation


3-5. Other Binary Codes 16 / 23

Decimal BCD Excess-3


digit 8421 2421 Excess-3 gray
0 0000 0000 0011 0010
1 0001 0001 0100 0110
2 0010 0010 0101 0111
3 0011 0011 0110 0101
4 0100 0100 0111 0100
5 0101 1011 1000 1100
6 0110 1100 1001 1101
7 0111 1101 1010 1111
8 1000 1110 1011 1110
9 1001 1111 1100 1010
1010 0101 0000 0000
Unused 1011 0110 0001 0001
bit 1100 0111 0010 0011
combi- 1101 1000 1101 1000
nations 1110 1001 1110 1001
1111 1010 1111 1011
Table 3-6. Four Different Binary Codes for the Decimal Digit
Computer System Architecture Chap. 3 Data Representation
3-6. Error Detection Codes 17 / 23

 3-6 Error Detection Codes


 Binary information transmitted through some form of communication
medium is subject to external noise


Transmitter Receiver

~
 Parity Bit
 An extra bit included with a binary message to make the total number of 1’s
either odd or even(Tab. 3-7)
 Even-parity method
 The value of the parity bit is chosen so that the total number of 1s (including
the parity bit) is an even number
1 1 0 0 0 0 1 1
Added parity bit
 Odd-parity method
 Exactly the same way except that the total number of 1s is an odd number

1 1 0 0 0 0 0 1
Added parity bit

Computer System Architecture Chap. 3 Data Representation


3-6. Error Detection Codes 18 / 23

 Parity Generator/Checker
 At the sending end, the message is applied to a parity generator
 At the receiving end, all the incoming bits are applied to a parity checker

1 1 0 0 0 0 1 1 “C” 1 1 0 0 0 0 1 0 ”B”
(Even-parity Generator) (Even-parity Checker)

 Can not tell which bit in error


 Can detect only single bit error(odd number of errors)
 3 bit data line example : Fig. 3-3
 4 bit data line example :

Next Page

Computer System Architecture Chap. 3 Data Representation


3-6. Error Detection Codes 19 / 23

 Odd Parity Generator/Checker


 Truth Table  K-Map(Odd Parity)
A B C D E O C
0 0 0 0 0 1
0 0 0 1 1 0 0 1 3 2
0 0 1 0 1 0 4 5 7 6
0 0 1 1 0 1 B
0 1 0 0 1 0 12 13 15 14
A
0 1 0 1 0 1 8 9 11 10
0 1 1 0 0 1
0 1 1 1 1 0 D
1 0 0 0 1 0  Expression
1 0 0 1 0 1
1 0 1 0 0 1 A B C D  A B CD  A BC D  A BCD  ABC D  ABCD  AB C D  AB CD
1 0 1 1 1 0  A B (C D  CD)  A B (C D  CD )  AB(C D  CD)  AB (C D  CD )
1 1 0 0 0 1  A B (C  D )  A B(C  D )  AB(C  D )  AB (C  D )  : XOR
1 1 0 1 1 0  (C  D )( A B  AB)  (C  D )( A B  AB )  : XNOR
1 1 1 0 1 0  (C  D )( A  B )  (C  D )( A  B )
1 1 1 1 0 1 xCD
 (C  D )( A  B )  (C  D )( A  B )
y  A B
 x y  xy
 x y
 x y
 (C  D )  ( A  B )
 C  D  A B

Computer System Architecture Chap. 3 Data Representation


3-6. Error Detection Codes 20 / 23

☞ Parity check
Error 검출용 비트를 하나 더 추가 시켜서 언제나 전체 부호 속에 포함 되어 있는
1 의 수가 홀수 또는 짝수개가 되도록 하는 것
10 진수 23 22 21 20 패리티비트 1 의 합계
0 0 0 0 0 1 1
1 0 0 0 1 0 1
2 0 0 1 0 0 1
3 0 0 1 1 1 3
4 0 1 0 0 0 1
5 0 1 0 1 1 3
6 0 1 1 0 1 3
7 0 1 1 1 0 3
8 1 0 0 0 0 1
9 1 0 0 1 1 3
Computer System Architecture Chap. 3 Data Representation
3-6. Error Detection Codes 21 / 23

☞ Word parity
코드를 한 묶음 단위로 하는 Block 단위 , 에러 검출은 물론 정정 까지도 가능 하다
Odd parity bit
0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 1
0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1
1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1 Parity Error 검출 ( 짝수
)

0 1 1 0 1 1 1 0 0 1 1 0 1 1 1 0
0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 1
0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0
1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1
1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0

Odd parity word Parity Error 검출 ( 짝수 )


Computer System Architecture Chap. 3 Data Representation

You might also like