Advanced Computer Architecture-CS501

Similar documents
Number System. Introduction. Decimal Numbers

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Chapter 3: part 3 Binary Subtraction

COMPUTER ARITHMETIC (Part 1)

Binary Adders: Half Adders and Full Adders

Computer Architecture and Organization

Chapter 4 Arithmetic Functions

Principles of Computer Architecture. Chapter 3: Arithmetic

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Lecture 2: Number Systems

Chapter 5 : Computer Arithmetic

Floating Point Arithmetic

Lecture 8: Addition, Multiplication & Division

THE LOGIC OF COMPOUND STATEMENTS

Number Systems. Both numbers are positive

Number Systems and Computer Arithmetic

CS 101: Computer Programming and Utilization

Arithmetic Processing

Basic Arithmetic (adding and subtracting)

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

CS 64 Week 1 Lecture 1. Kyle Dewey

CHW 261: Logic Design

Divide: Paper & Pencil

Arithmetic Logic Unit

Chapter 10 - Computer Arithmetic

CHAPTER 5: Representing Numerical Data

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Chapter 3: Arithmetic for Computers

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

SE311: Design of Digital Systems

To design a 4-bit ALU To experimentally check the operation of the ALU

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

World Inside a Computer is Binary

EE 486 Winter The role of arithmetic. EE 486 : lecture 1, the integers. SIA Roadmap - 2. SIA Roadmap - 1

Number Systems CHAPTER Positional Number Systems

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

Chapter 4. Operations on Data

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j

CO212 Lecture 10: Arithmetic & Logical Unit

Representation of Non Negative Integers

Module 2: Computer Arithmetic

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

CS101 Lecture 04: Binary Arithmetic

CPE300: Digital System Architecture and Design

Computer Arithmetic Ch 8

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Computer Arithmetic Ch 8

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Signed umbers. Sign/Magnitude otation

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Number Systems (2.1.1)

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Inf2C - Computer Systems Lecture 2 Data Representation

MC1601 Computer Organization

T02 Tutorial Slides for Week 2

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Lab Assignment 1. Developing and Using Testbenches

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Computer Organisation CS303

Chapter 10 Binary Arithmetics

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

Digital Fundamentals

Binary Representations and Arithmetic

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

EE 109 Unit 6 Binary Arithmetic

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

COMP 122/L Lecture 2. Kyle Dewey

Digital Systems and Binary Numbers

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Data Representation in Computer Memory

By, Ajinkya Karande Adarsh Yoga

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah


UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

Numbering systems. Dr Abu Arqoub

Korea University of Technology and Education

Topics. 6.1 Number Systems and Radix Conversion 6.2 Fixed-Point Arithmetic 6.3 Seminumeric Aspects of ALU Design 6.4 Floating-Point Arithmetic

Numeric Encodings Prof. James L. Frankel Harvard University

CHAPTER 2 Data Representation in Computer Systems

BINARY SYSTEM. Binary system is used in digital systems because it is:

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016

ECE 30 Introduction to Computer Engineering

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 1 Numerical Representation

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

Integer Multiplication and Division

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

COMP2121: Microprocessors and Interfacing. Number Systems

Transcription:

Advanced Computer Architecture Lecture No. 34 Reading Material Vincent P. Heuring & Harry F. Jordan Chapter 6 Computer Systems Design and Architecture 6.1, 6.2 Summary Introduction to ALSU Radix Conversion Fixed Point Numbers Representation of Numbers Multiplication and Division using Shift Operation Unsigned Addition Operation Introduction to ALSU 29 ALSU is a combinational circuit so inside an ALSU, we have AND, OR, NOT and other different gates combined together in different ways to perform addition, subtraction, and, or, not, etc. Up till now, we consider ALSU as a black box which takes two operands, a and b, at the input and has c at the output. Control signals whose values depend upon the opcode of an instruction were associated with this black box. In order to understand the operation of the ALSU, we need to understand the basis of the representation of the numbers. For example, a designer needs to specify how many bits are required for the source operands and how many will be needed for the destination operand after an operation to avoid overflow and truncation. Radix Conversion Now we will consider the conversion of numbers from a representation in one base to another. As human works with base 10 and computers with base 2, this radix conversion operation is important to discuss here. We will use base c notion for decimal representation and base b for any other base. The following figure shows the algorithm of converting from base b to base c: 29 In our discussion we have used ALU and ALSU for the same thing. We use ALSU when the shift aspect also needs to be emphasized. Last Modified: 01-Nov-06 Page 327

Example 1 Convert the hexadecimal number B3 16 to base 10. According to the above algorithm, X=0 X= x+b (=11) =11 X=16*11+3= 179 Hence B3 16 =179 10 The following figure shows the algorithm of converting from base c to base b: Last Modified: 01-Nov-06 Page 328

Example 2 Convert 390 10 to base 16. According to the above algorithm 390/16 =24( rem=6), x0=6 24/16= 1(rem=8), x1=8, x2=1 Thus 390 10 =186 16 Fixed Point Numbers Suppose we have a number with a radix point. For example, in 16.12, there are two digits on the left side and two digits on the right of the decimal point. In this case, the radix point is a decimal point because we suppose that given number is a decimal number. If we have an integer, then this decimal point will be on the right most position i.e. 1612.0 and if it is in fraction then decimal will be at the left most position i.e. 0.1612 There are situations when we shift the position of the radix point. Shifting of the radix point towards left or right is called scaling and we could have multiplication with a base or division by a base respectively. The following figure shows the algorithm of converting a base b fraction to base c: Example 3 Convert (.4cd) 16 to Base 10. F=0 F=(0+13)/16=0.8125 Last Modified: 01-Nov-06 Page 329

F=(0.8125+12)/16=0.80078125 F=(0.80078125+4)/16=(0.3000488) 10 The following figure shows the algorithm of converting fraction from base c to base b: Example 4 Convert 0.24 10 to base 2. 0.24*2=0.48, f -1 =0 0.48*2=0.96, f -2 =0 0.96*2=1.92, f -3 =1 0.92*2=1.84, f -4 =1 0.84*2=1.68, f -5 =1, Thus 0.24 10 =(0.00111) 2 Representation of Numbers There are four possibilities to represent integers. 1. Sign magnitude form 2. Radix complement form 3. Diminished radix complement form 4. Biased representation Sign magnitude form This is the simplest form for representing a signed number A symbol representing the sign of the number is appended to the left of the number Last Modified: 01-Nov-06 Page 330

This representation complicates the arithmetic operations Radix complement form This is the most common representation. Given an m-digit base b number x, the radix complement of x is x c = ( b m x) mod b m This representation makes the arithmetic operations much easier. Diminished radix complement form The diminished radix complement of an m-digit number x is x c =b m -1- x This complement is easier to compute than the radix complement. The two complement operations are interconvertible, as x c = ( x c +1)mod b m Table 6.1 of the text book shows the complement representation of negative numbers for radix complement and diminished radix complement form: Table 6.2 of the text book shows the base 2 complement representation for 8-bit 2 s and 1 s complement numbers. Example 5 The following table shows the decimal values in 2 s complement, 1 s complement, sign magnitude, 16 s complement and in unsigned form: Multiplication and Division using Shift Operation Last Modified: 01-Nov-06 Page 331

Shift left and shift right are two important operations used for various purposes. One typical example could be multiplication or division by base b. The following examples explain multiplication and division by using shift operation. Example 6 6x4 00110 2 x 4 10 =11000 2 =24 10 Overflow would occur if we will use 4 bits instead of 5 bits here. 60/16 0111100 2 /16 10 =0000011 2 =3 10 The fractional portion of the result is lost. Example 7-6x4-6 = (11010) 2-6x4 = (01000) 2=8 which is wrong! using less no. of bits might change sign So, -6 = (111010) 2-6x4 = (101000) 2 = -24 Example 8 Multiplication and division of negative numbers -24x2-24= (101000) 2-24x2= (010100) 2 = 20-24x2= (110100) 2 = -12 Changing the size of the number, 24= 011000 (n=6) to 00011000 (n=8) -24= 101000 (n=6) to 11101000 (n=8) Unsigned Addition Operation The following diagram shows the digit wise procedure for adding m-digit base b numbers, x and y: Example 9 Unsigned addition in base 2 and base16. Last Modified: 01-Nov-06 Page 332

Base 16 addition A B 4 2 16 + 3 1 C 1 16 carry 0 1 0 0 sum D D 0 3 16 Base 2 addition 100011 2 + 011011 2 carry 000110 sum 111110 2 The following diagram shows the logic circuit for 1-bit half adder. It takes two 1-bit inputs x and y and as a result, we get a 1-bit sum and a 1-bit carry. This circuit is called a half adder because it does not take care of input carry. In order to take into account the effect of the input carry, a 1-bit full adder is used which is also shown in the figure. We can add two m-bit numbers by using a circuit which is made by cascading m 1-bit full adders. The situation, when addition of unsigned m-bit numbers results in an m+1 bit number, is called overflow. Overflow is treated as exception in some processors and the overflow flag is used to record the status of the result. Last Modified: 01-Nov-06 Page 333