data representation in computer architecture, Assignments of Computer Architecture and Organization

data representation in computer architecture

Typology: Assignments

2019/2020

Uploaded on 04/08/2020

j-z-rifath-rifath
j-z-rifath-rifath 🇧🇩

1 document

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 3 – Data Representation
Section 3.1 – Data Types
Registers contain either data or control information
Control information is a bit or group of bits used to specify the sequence of
command signals needed for data manipulation
Data are numbers and other binary-coded information that are operated on
Possible data types in registers:
o Numbers used in computations
o Letters of the alphabet used in data processing
o Other discrete symbols used for specific purposes
All types of data, except binary numbers, are represented in binary-coded form
A number system of base, or radix, r is a system that uses distinct symbols for r
digits
Numbers are represented by a string of digit symbols
The string of digits 724.5 represents the quantity
7 x 102 + 2 x 101 + 4 x 100 + 5 x 10-1
The string of digits 101101 in the binary number system represents the quantity
1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 45
(101101)2 = (45)10
We will also use the octal (radix 8) and hexidecimal (radix 16) number systems
(736.4)8 = 7 x 82 + 3 x 81 + 6 x 80 + 4 x 8-1 = (478.5)10
(F3)16 = F x 161 + 3 x 160 = (243)10
Conversion from decimal to radix r system is carried out by separating the
number into its integer and fraction parts and converting each part separately
Divide the integer successively by r and accumulate the remainders
Multiply the fraction successively by r until the fraction becomes zero
Computer Architecture 1
Chapter 3
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download data representation in computer architecture and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Chapter 3 – Data Representation

Section 3.1 – Data Types

  • Registers contain either data or control information
  • Control information is a bit or group of bits used to specify the sequence of command signals needed for data manipulation
  • Data are numbers and other binary-coded information that are operated on
  • Possible data types in registers: o Numbers used in computations o Letters of the alphabet used in data processing o Other discrete symbols used for specific purposes
  • All types of data, except binary numbers, are represented in binary-coded form
  • A number system of base , or radix, r is a system that uses distinct symbols for r digits
  • Numbers are represented by a string of digit symbols
  • The string of digits 724.5 represents the quantity

7 x 10^2 + 2 x 10^1 + 4 x 10^0 + 5 x 10-

  • The string of digits 101101 in the binary number system represents the quantity

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

  • We will also use the octal (radix 8) and hexidecimal (radix 16) number systems

(736.4) 8 = 7 x 8^2 + 3 x 8^1 + 6 x 8^0 + 4 x 8-1^ = (478.5) 10

(F3) 16 = F x 16^1 + 3 x 16^0 = (243) 10

  • Conversion from decimal to radix r system is carried out by separating the number into its integer and fraction parts and converting each part separately
  • Divide the integer successively by r and accumulate the remainders
  • Multiply the fraction successively by r until the fraction becomes zero

Computer Architecture 1

  • Each octal digit corresponds to three binary digits
  • Each hexadecimal digit corresponds to four binary digits
  • Rather than specifying numbers in binary form, refer to them in octal or hexadecimal and reduce the number of digits by 1/3 or ¼, respectively

Computer Architecture 2

  • A binary code is a group of n bits that assume up to 2 n^ distinct combinations
  • A four bit code is necessary to represent the ten decimal digits – 6 are unused
  • The most popular decimal code is called binary-coded decimal (BCD)
  • BCD is different from converting a decimal number to binary
  • For example 99, when converted to binary, is 1100011
  • 99 when represented in BCD is 1001 1001

Computer Architecture 4

  • The standard alphanumeric binary code is ASCII
  • This uses seven bits to code 128 characters
  • Binary codes are required since registers can hold binary information only

Computer Architecture 5

  • The 9’s complement of 453299 is 999999 – 453299 = 546700
  • For binary, the 1’s complement of N is (2 n^ – 1) – N
  • The 1’s complement of 1011001 is 1111111 – 1011001 = 0100110
  • The 1’s complement is the true complement of the number – just toggle all bits
  • The r ’s complement of an n -digit number N in base r is defined as rn^ – N
  • This is the same as adding 1 to the ( r – 1)’s complement
  • The 10’s complement of 2389 is 7610 + 1 = 7611
  • The 2’s complement of 101100 is 010011 + 1 = 010100
  • Subtraction of unsigned n -digit numbers: M – N o Add M to the r ’s complement of N – this results in M + ( rn^ – N ) = M – N + rn o If MN , the sum will produce an end carry rn^ which is discarded o If M < N , the sum does not produce an end carry and is equal to rn^ – ( N – M ), which is the r ’s complement of ( N – M ). To obtain the answer in a familiar form, take the r ’s complement of the sum and place a negative sign in front.

Example: 72532 – 13250 = 59282. The 10’s complement of 13250 is 86750.

M = 72352 10’s comp. of N = + Sum = 159282 Discard end carry = - Answer = 59282

Example for M < N: 13250 – 72532 = -

M = 13250 10’s comp. of N = + Sum = 40718 No end carry Answer = -59282 (10’s comp. of 40718)

Example for X = 1010100 and Y = 1000011

X = 1010100 2’s comp. of Y = + Sum = 10010001 Discard end carry = - Answer X – Y = 0010001

Y = 1000011 2’s comp. of X = + Sum = 1101111

Computer Architecture 7

No end carry Answer = -0010001 (2’s comp. of 1101111)

Section 3.3 – Fixed-Point Representation

  • Positive integers and zero can be represented by unsigned numbers
  • Negative numbers must be represented by signed numbers since + and – signs are not available, only 1’s and 0’s are
  • Signed numbers have msb as 0 for positive and 1 for negative – msb is the sign bit
  • Two ways to designate binary point position in a register o Fixed point position o Floating-point representation
  • Fixed point position usually uses one of the two following positions o A binary point in the extreme left of the register to make it a fraction o A binary point in the extreme right of the register to make it an integer o In both cases, a binary point is not actually present
  • The floating-point representations uses a second register to designate the position of the binary point in the first register
  • When an integer is positive, the msb, or sign bit, is 0 and the remaining bits represent the magnitude
  • When an integer is negative, the msb, or sign bit, is 1, but the rest of the number can be represented in one of three ways o Signed-magnitude representation o Signed-1’s complement representation o Signed-2’s complement representation
  • Consider an 8-bit register and the number + o The only way to represent it is 00001110
  • Consider an 8-bit register and the number – o Signed magnitude: 1 0001110 o Signed 1’s complement: 1 1110001 o Signed 2’s complement: 1 1110010
  • Typically use signed 2’s complement
  • Addition of two signed-magnitude numbers follow the normal rules o If same signs, add the two magnitudes and use the common sign o Differing signs, subtract the smaller from the larger and use the sign of the larger magnitude o Must compare the signs and magnitudes and then either add or subtract
  • Addition of two signed 2’s complement numbers does not require a comparison or subtraction – only addition and complementation o Add the two numbers, including their sign bits o Discard any carry out of the sign bit position o All negative numbers must be in the 2’s complement form o If the sum obtained is negative, then it is in 2’s complement form

Computer Architecture 8

0 375 (0000 0011 0111 1010)BCD

+9 760 (1001 0111 0110 0000)BCD

0 135 (0000 0001 0011 0101)BCD

Section 3.4 – Floating-Point Representation

  • The floating-point representation of a number has two parts
  • The first part represents a signed, fixed-point number – the mantissa
  • The second part designates the position of the binary point – the exponent
  • The mantissa may be a fraction or an integer
  • Example: the decimal number +6132.789 is o Fraction: +0. o Exponent: + o Equivalent to +0.6132789 x 10+
  • A floating-point number is always interpreted to represent m x re
  • Example: the binary number +1001.11 (with 8-bit fraction and 6-bit exponent) o Fraction: 01001110 o Exponent: 000100 o Equivalent to +(.1001110) 2 x 2+
  • A floating-point number is said to be normalized if the most significant digit of the mantissa is nonzero
  • The decimal number 350 is normalized, 00350 is not
  • The 8-bit number 00011010 is not normalized
  • Normalize it by fraction = 11010000 and exponent = -
  • Normalized numbers provide the maximum possible precision for the floating- point number

Section 3.5 – Other Binary Codes

  • Digital systems can process data in discrete form only
  • Continuous, or analog, information is converted into digital form by means of an analog-to-digital converter
  • The reflected binary or Gray code , is sometimes used for the converted digital data
  • The Gray code changes by only one bit as it sequences from one number to the next
  • Gray code counters are sometimes used to provide the timing sequences that control the operations in a digital system

Computer Architecture 10

  • Binary codes for decimal digits require a minimum of four bits
  • Other codes besides BCD exist to represent decimal digits

Computer Architecture 11

  • A parity bit is an extra bit included with a binary message to make the total number of 1’s either odd or even
  • The P(odd) bit is chosen to make the sum of 1’s in all four bits odd
  • The even-parity scheme has the disadvantage of having a bit combination of all 0’s
  • Procedure during transmission: o At the sending end, the message is applied to a parity generator o The message, including the parity bit, is transmitted o At the receiving end, all the incoming bits are applied to a parity checker o Any odd number of errors are detected
  • Parity generators and checkers are constructed with XOR gates (odd function)
  • An odd function generates 1 iff an odd number if input variables are 1

Computer Architecture 13

  • Computer Architecture
  • Computer Architecture