Computer Architecture

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Binary Arithmetic Binary addition Binary subtraction
Lecture 3 Number Representation 2 This week – Recap Addition – Addition circuitry – Subtraction of integers in binary – Representing numbers with fractional.
Assembly Language and Computer Architecture Using C++ and Java
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Computer Science 210 Computer Organization Floating Point Representation.
Lecture 8 Floating point format
Number Systems Lecture 02.
Binary Number Systems.
School of Computer Science G51CSA 1 Computer Arithmetic.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Binary Representation and Computer Arithmetic
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Simple Data Type Representation and conversion of numbers
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Data Representation and Computer Arithmetic
Topic 2 – Introduction to Computer Codes. Computer Codes A code is a systematic use of a given set of symbols for representing information. As an example,
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 10 Department of Computer Science and Software Engineering University of.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
S. Rawat I.I.T. Kanpur. Floating-point representation IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent We can represent.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
9.4 FLOATING-POINT REPRESENTATION
Floating Point Representations CDA 3101 Discussion Session 02.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
Integer & Floating Point Representations CDA 3101 Discussion Session 05.
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
CEC 220 Digital Circuit Design Binary Codes
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
IT1004: Data Representation and Organization Negative number representation.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point Arithmetic – Part I
Floating Point Representations
Fundamentals of Computer Science
Introduction To Computer Science
Data Representation Data Types Complements Fixed Point Representation
Chapter3 Fixed Point Representation
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

Computer Architecture Data Representation Mark S. Staveley Mark.Staveley@mun.ca

Binary Coded Decimal Representation Octal Hexadecimal 3127 110011010001 6271 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110011010001 6271 B38 3217/2 = 1608 R 1 (Least Significant Bit) 1608/2 = 804 R 0 804/2 = 402 R 0 402/2 = 201 R 0 201/2 = 100 R 1 100/2 = 50 R 0 50/2 = 25 R 0 25/2 = 12 R 1 12/2 = 6 R 0 6/2 = 3 R 0 3/2 = 1 R 1 1/2 = 0 R 1 (Most Significant Bit) 321710 = 1100100100012 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 110011010001 6271 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 110011010001 6271 B38 3217/8 = 402 R 1 (Least Significant Bit) 402/8 = 50 R 2 50/8 = 6 R 2 6/8 = 0 R 6 (Most Significant Bit) 321710 = 62218 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 110011010001 6271 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 110011010001 6271 B38 3217/16 = 201 R 1 (Least Significant Bit) 201/16 = 12 R 6 2/16 = 0 R C (1210 Most Significant Bit) 321710 = C6116 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 C91 110011010001 6271 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 C91 110011010001 6271 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 110011010001 6271 B38 B3816 B16 – 10112 316 – 00112 816 – 10002 1011001110002 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 110011010001 6271 101100111000 B38 1011001110002 Split on 3-bits (base 8) 1012 – 58 1002 – 48 1112 – 78 0002 – 08 54708 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 110011010001 6271 2872 101100111000 5470 B38 1011001110002 = 0 x 20 + 0 X 21 + 0 X 22 + 1 X 23 + 1 x 24 + 1 x 25 + 0 x 26 + 0 x 27 + 1 x 28 + 1 x 29 + 0 x 210 + 1 x 211 = 287210 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

Binary Coded Decimal Representation Octal Hexadecimal 3217 110010010001 6221 C91 3281 110011010001 6321 CD1 3257 110010111001 6271 CB9 2872 101100111000 5470 B38 Complete the following table. Each row represents a specific unsigned integer value in the different radix forms listed in the table. For example, 1210 can be written as 11002, 14­8 or C16.

+21 -17 +14 -32 +31 Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 -17 +14 -32 +31 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 +21 (convert to Sign & Magnitude) Sign = + = 1 21 convert to 5-bit representation = 10101 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 +21 (convert to One’s Complement) Result = same as normal because it is positive = 010101 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 +21 (convert to Two’s Complement) Result = same as normal because it is positive = 010101 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 +21 (Convert to Excess 31) Positive and negative representations of a number are obtained by adding a bias to the two’s complement representation, ignoring any carry out from the most significant digit. 21 in Two’s Complement = 010101 Bias = 31 = 011111 010101 + 011111 = 110100 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -32 (convert to Sign & Magnitude) Sign = - = 1 32 convert to 5-bit representation = Error Why? Greatest number represented with 5 bits is 31 (11111) 32 is out of range. Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -32 (One’s Complement) Sign = - = 1 32 convert to 5-bit representation = Error Why? Greatest number represented with 5 bits is 31 (11111) 32 is out of range. Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -32 (convert to Two’s Complement) Minimum 2's complement value = -2n-1 Maximum 2's complement value = 2n-1 – 1 n = 6 = Max = +31, Min = -32 -32 converted = 100000 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -32 (Convert to Excess 31) Largest Negative Number = 000000 = - 31 Largest Positive Number = 111111 = + 32 Out of Range = N/A Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -17 (convert to Sign & Magnitude) Sign = - = 1 17 convert to 5-bit representation = 10001 Result = 110001 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -17 (One’s Complement) Sign = - = 1 17 convert to 5-bit representation = 10001 Complement each bit = 01110 Result = 101110 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -17 (convert to Two’s Complement) Add One to One’s Complement 101110 + 1 = 01111 Result = 101111 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Decimal Sign & Magnitude One’s Complement Two’s Complement Excess 31 +21 010101 110100 -17 110001 101110 101111 001110 +14 101101 -32 N/A 100000 +31 011111 111110 -17 (Convert to Excess 31) Positive and negative representations of a number are obtained by adding a bias to the two’s complement representation, ignoring any carry out from the most significant digit. 17 in Two’s Complement = 101111 Bias = 31 = 011111 101111 + 011111 = 001110 Complete the table below using 6-bit representation for sign and magnitude, ones’ complement, two’s complement, and excess 31. Each row in the table is to show a specific numerical value in the different data representations listed in the table. Note that for each numeric value listed below, it may not be possible to represent that value in all the data representations – in these cases just specify ‘N/A’.

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard.

IEEE-754 Floating Point Standard Developed in 1985. It can be supported in hardware, or a mixture of hardware and software. There are also single extended, and double extended formats (80 bits wide, 15-bit exponent, and 64-bit fraction). Excess-127 Hidden bit Excess-1023 Hidden bit

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard. a) Convert –17.5 to base 2: b) Express the value from (a) in binary scientific notation: c) Convert the exponent from (b) to excess 127: d) IEEE single point precision representation:

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard. Convert –17.5 to base 2: –10001.12

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard. b) Express the value from (a) in binary scientific notation: –1.000112 * 24

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard. c) Convert the exponent from (b) to excess 127: 12710 + 410 = 11111112 + 1002 = 100000112

Fill in the following steps to find the representation for –17 Fill in the following steps to find the representation for –17.5 in the IEEE single-precision floating-point standard. d) IEEE single point precision representation: Sine Bit = Negative = 1 Exponent = 12710+410 = 13110 = 100000112 Fraction = 1.000112 (leading 1 of fraction is hidden) = 00011000000000000000000 1 10000011 00011000000000000000000

Convert the following floating point numbers represented in IEEE single precision floating point representation to both binary and decimal representations in scientific notation, where feasible. 1 1 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 101000012 = 16110; 161 – 127 = 34; –1.110012 * 234

Convert the following floating point numbers represented in IEEE single precision floating point representation to both binary and decimal representations in scientific notation, where feasible. 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 011110102 = 12210; 122 – 127 = –5; 1.02 * 2–5 = 1.010 * 2–5 = 0.03125 = 3.125 * 10-2

Convert the following floating point numbers represented in IEEE single precision floating point representation to both binary and decimal representations in scientific notation, where feasible. 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100000012 = 12910; 129 – 127 = 2; 1.10102 * 22 = 110.102 = 6.5 = 6.5 * 100

Convert the following floating point numbers represented in IEEE single precision floating point representation to both binary and decimal representations in scientific notation, where feasible. 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 111000002 = 22410; 224 – 127 = 97; –1.011001112 * 297

Do the following using two’s complement arithmetic and indicate the carry (C) and overflow (V) values. (e.g., “C = 1” if there is a carry, “C = 0” otherwise).   a) 0 1 0 1 1 1 b) 0 1 1 0 0 0 c) 1 0 1 1 0 1 + 0 1 0 0 1 1 - 0 1 1 1 0 0 - 1 0 1 0 0 1 C = C = C = V = V = V = d) 1 1 0 0 1 1 e) 1 0 1 1 0 0 f) 0 1 1 1 1 1 - 0 0 0 0 0 1 + 1 0 0 1 1 0 + 1 0 1 0 1 0 C = C = C = V = V = V =

Do the following using two’s complement arithmetic and indicate the carry (C) and overflow (V) values. (e.g., “C = 1” if there is a carry, “C = 0” otherwise).   a) 0 1 0 1 1 1 b) 0 1 1 0 0 0 c) 1 0 1 1 0 1 + 0 1 0 0 1 1 - 0 1 1 1 0 0 - 1 0 1 0 0 1 1 0 1 0 1 0 = 0 1 1 0 0 0 0 0 0 1 0 0 + 1 0 0 1 0 0 1 1 1 1 0 0 C = 0 (no carry) C = 0 C = 1 V = 1 (sum out of range) V = 0 V = 0 Note: When the CPU adds two binary integers, if their sum is out of range when interpreted in the two’s complement representation, then V is set to 1. Otherwise V is cleared to 0

Do the following using two’s complement arithmetic and indicate the carry (C) and overflow (V) values. (e.g., “C = 1” if there is a carry, “C = 0” otherwise).   d) 1 1 0 0 1 1 e) 1 0 1 1 0 0 f) 0 1 1 1 1 1 - 0 0 0 0 0 1 + 1 0 0 1 1 0 + 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 C = 1 C = 1 C = 1 V = 0 V = 1 V = 0