Docsity

Computer Architecture and Organization - Data representation - Saritha, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Computer Architecture and Organization - Data representation - Saritha and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Data Representation

Data Representation

• Data Types

• Complements

• Fixed Point Representations

• Floating Point Representations

• Character Codes

Numeric Data Representation

R = 10 Decimal number system, R = 2 Binary

R = 8 Octal, R = 16 Hexadecimal

Radix point(.) separates the integer

portion and the fractional portion

Data

Numeric data - numbers(integer, real)

Non-numeric data - symbols, letters

Number System

Nonpositional number system

  • Roman number system

Positional number system

  • Each digit position has a value called a weight

associated with it

  • Decimal, Octal, Hexadecimal, Binary

Base (or radix) R number

  • Uses R distinct symbols for each digit
  • Example AR = an-1 an-2 ... a 1 a 0 .a-1…a-m
  • V(AR ) =

n 1

i m

i

i

a R

Fixed Point Representation

Binary Fixed-Point Representation

X = xnxn-1xn-2 ... x 1 x 0. x-1x-2 ... x-m

Sign Bit(xn): 0 for positive, 1 for negative

Remaining Bits(xn-1xn-2 ... x 1 x 0. x-1x-2 ... x-m)

Numbers: Fixed Point Numbers and Floating Point Numbers

Pros and cons of integer representation

  • (^) Signed magnitude representation:
    • (^) 2 representations for 0
    • (^) Simple
    • (^) 255 different numbers can be represented.
    • (^) Need to consider both sign and magnitude in arithmetic
    • (^) Different logic for addition and subtraction
  • (^) 1’s complement representation:
    • (^) 2 representations for 0
    • (^) Complexity in performing addition and subtraction
    • (^) 255 different numbers can be represented.
  • (^) 2’s complement representation:
    • (^) Only one representation for 0
    • (^) 256 different numbers can be represented.
    • (^) Arithmetic works easily
    • (^) Negating is fairly easy

Floating Point Number representation

* The location of the fractional point is not fixed to a certain location

* The range of the representable numbers is wide

F = EM

mn ekek-1 ... e 0 mn-1mn-2 … m 0. m-1 … m-m

sign exponent mantissa

  • Mantissa

Signed fixed point number, either an integer or a fractional number

  • Exponent

Designates the position of the radix point

Decimal Value

V(F) = V(M) * RV(E)^ M: Mantissa

E: Exponent

R: Radix

Normal Form

  • There are many different floating point number representations of

the same number

→ Need for a unified representation in a given computer

  • the most significant position of the mantissa contains a non-zero digit

IEEE-754 Floating Point Formats

IEEE-754 Conversion Example Represent -12.62510 in single precision IEEE-754 format.

  • Step #1: Convert to target base. -12.62510 = -1100.101 2
  • Step #2: Normalize. -1100.101 2 = -1.100101 2 × 23
  • Step #3: Fill in bit fields. Sign is negative, so sign bit is 1. Exponent is in excess 127 (not excess 128!), so exponent is represented as the unsigned integer 3 + 127 = 130. Leading 1 of significant is hidden, so final bit pattern is: 1 1000 0010. 1001 0100 0000 0000 0000 000

Character Representation ASCII

ASCII (American Standard Code for Information Interchange) Code

0 1 2 3 4 5 6 7 8 9 A B C D E F
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
SP
@ A B C D E F G H I J K L M N O

P Q R S T U V W X Y Z [ \ ] m n ‘ a b c d e f g h I j k l m n o P q r s t u v w x y z { | } ~ DEL

DLE
DC
DC
DC
DC
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
LSB

(4 bits) MSB (3 bits)

The EBCDIC character code, shown with hexadecimal indices

The EBCDIC control character representation