Binary Multiplication. CMPE 325 Computer Architecture II. Implementing Multiplication. Multiplication. Solution #1. Solution #1: Operations

Size: px
Start display at page:

Download "Binary Multiplication. CMPE 325 Computer Architecture II. Implementing Multiplication. Multiplication. Solution #1. Solution #1: Operations"

Transcription

1 CMPE 5 Computer Architecture II Cem Ergün Eastern Mediterranean University Binary Multiplication At each step we multiply the multiplicand by a single digit from the multiplier. In binary, we multiply by either or 0 (much simpler than decimal). Keep a running sum instead of storing and adding all the partial products at the end. Multiplication Longhand multiplication ( 9 = 08) 0 0 = ten (n bit Multiplicand) 0 0 = 9 ten (m bit Multiplier) = 08 ten (n + m bit Product) The result is a number that is n + m bits long Implementing Multiplication Several different ways to implement Things to note about previous method At each step we either copied or set the value to 0 LSBs of the product don t change once computed Can form product by shifting and adding Solution # Shift multiplicand left at each step (same as adding 0 s) Shift multiplier right so we can always consider the 0 th bit Solution # Multiplication without sign ( 9 = 08) 0 0 = ten (n bit Multiplicand) 0 0 = 9 ten (m bit Multiplier) = 08 ten Solution #: Operations Multiplier0 = a. Add multiplicand to product and place the result in Product register Start. Test Multiplier0 Multiplier0 = 0. Shift the Multiplicand register left bit. Shift the Multiplier register right bit Multiplicand Multiplier 0 0 Product No: < repetitions nd repetition? Yes: repetitions Done 5 6

2 Solution #: Example Solution #: Hardware Iter Step Multiplier Multiplicand Product 0 Initial Values Multiplier[0]= Prod+Mcand Shift multiplicand left Shift multiplier right Multiplier[0]=0 Do nothing Multiplicand Shift Left Shift multiplicand left Shift multiplier right Multiplier[0]=0 Do nothing bit ALU Add Multiplier bits Shift multiplicand left Shift multiplier right Multiplier[0]= Prod+Mcand Shift multiplicand left Product Shift multiplier right Adjustments to Algorithm One big problem with the algorithm/implementation shown: need a 6 bit ALU (adder). Half of the multiplicand bits are always 0 Either high or low bits are 0, even as shifted LSB of product never changes once set Half of the 6 bit adder is therefore wasted We can fix this by: Leaving the multiplicand alone (don t shift). Instead of shifting multiplicand left, shift the product right Add multiplicand to left half of running sum. Adder only needs to be bits wide 9 Solution #: Adjusted Algorithm Revised Addition Shift partial sum instead of multiplicand Multiplier0 = a. Add multiplicand to the left half of the product and place the result in the left half of the Product register Start. Test Multiplier0. Shift the Product register right bit. Shift the Multiplier register right bit nd repetition? Done Multiplier0 = 0 No: < repetitions Yes: repetitions 0 Solution #: Example Solution #: Hardware Iter Step Multiplier Multiplicand Product 0 Initial Values Multiplier[0]= Prod+Mcand Shift product right Shift multiplier right Multiplier[0]=0 Do nothing Multiplicand bits Shift product right Shift multiplier right Multiplier[0]=0 Do nothing Shift product right Shift multiplier right Multiplier[0]= Prod+Mcand Shift product right Shift multiplier right bit ALU Product Upper bits Add Multiplier bits

3 Issues and Alternative In the implementation of the adjusted algorithm it is possible to save space by putting the multiplier in the rightmost bits of the product register. If you notice, half of the product register is useless at the beginning At the end, the multiplier register becomes useless Solution # The algorithm is the same, but steps and are done at the same time. Remove the multiplier register Place the multiplier value in the lower half of the product register Solution #: Operations Solution #: Example Solution #: Hardware Iter Step Multiplicand Product 0 Initial Values Product[0]= Prod+Mcand Shift product right Multiplicand bit ALU bits Add Product[0]=0 Do nothing Shift product right Product[0]=0 Do nothing Shift product right Product[0]= Prod+Mcand Shift product right Product Upper bits Multiplier LSB 5 6 Signed Multiplication Previous algorithms work for unsigned. We could: convert both multiplier and multiplicand to positive before starting, but remember the signs. adjust the product to have the right sign (might need to negate the product). Set the sign bit to make the number negative if the multiplicand and multiplier disagree in sign Positive Positive = Positive Negative Negative = Positive Positive Negative = Negative Negative Positive = Negative Supporting Signed Integers We can adjust the previous algorithm to work with signed integers make sure each shift is an arithmetic shift right shift extend the sign bit (keep the MS bit the same instead of shifting in a 0). Since addition works for signed numbers, the multiply algorithm will now work for signed numbers. 7 8

4 Step a, a, 0 x 00 ( x ) Multiplicand Product multiplier is rightmost bits st partial product in left bits Signed Third Multiplication Algorithm, , 00 Result is s complement 9 0 Improving the speed with Combinational Array Multiplier Combinational Array Multiplier Combinational Array Multiplier bit Example Booth s Algorithm Requires that we can do an addition or a subtraction each iteration (not always an addition). Uses the following property the value of any consecutive string of s in a binary number can be computed with one subtraction.

5 A different way to compute integer values 00 (8=6) (568 = 8) 8 A little more complex example An overview of Booth s Algorithm When doing multiplication, strings of 0s in the multiplier require only shifting (no addition). When doing multiplication, strings of s in the multiplier require operation and shifting. We need to add or subtract only at positions in the multiplier where there is a transition from a 0 to a, or from a to a 0. 7 Booth Explanation Booth also works for negative numbers Booth Algorithm Add additional bit to the right of product Use right two bits of product to determine action Use arithmetic right shift End of string ( ) Middle of string Beginning of string Current Bit Right Bit Explanation Action 0 0 Middle of string of 0s Do nothing 0 End of string of s Add multiplicand 0 Beginning of string of s Subtract multiplicand Middle of string of s Do nothing 8 Shifting The second step of the algorithm is the same as before: shift the product/multiplier right one bit. Arithmetic shift needed for signed arithmetic. The bit shifted off the right is saved and used by the next step (which looks at bits). Booth s Algorithm Booth Example Consider the same example, but think of it as a signed multiplication ( 7=8) Iter Step Multiplicand Product 0 Initial Values Product=0 ProdMcand Shift product right Product=0 Prod+Mcand Shift product right Product=00 Do nothing Shift product right Product=0 ProdMcand Shift product right

6 Multiply in MIPS Divide Product stored in two bit registers called Hi and Low mult $s0, $s multu $s0, $s Results are moved from Hi/Low mfhi $t0 mflo $t0 # $s0 * $s high/low # $s0 * $s unsigned # $t0 = Hi # $t0 = Low Pseudoinstruction mul $t0, $s0, $s # $t0 = $s0 * $s Longhand division (08 = 9) 0 0 (n bit Quotient) () (Dividend) N + Steps (Remainder) Divide Solution # Solution # Start with quotient = 0, remainder = dividend, and divisor s top bits set On each iteration set remainder to be remainder divisor If large enough (remainder 0), then shift quotient left and set rightmost to If not large enough (remainder < 0), then set remainder to remainder + divisor (restore) Shift divisor right Continue for n+ () iterations rem = rem div if rem < 0 then // divisor too big rem = rem + div quo <<= LSB(quo) = 0 else // can divide quo <<= LSB(quo) = fi div >>= repeat unless done Divide Solution # a. Shift the Quotient register to the left, setting the new rightmost bit to Start. Subtract the register from the Remainder register and place the result in the Remainder register Remainder > 0 Test Remainder. Shift the register right bit rd repetition? Done Remainder < 0 b. Restore the original value by adding the register to the Remainder register and place the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0 No: < repetitions Yes: repetitions Solution #: Hardware 6bit ALU Quotient bits Shift Left Remainder MSB 5 6 6

7 Step b b a a a Quotient / Remainder final quotient initial values after subtraction after restore shift right final remainder 7 Division Example: 0000/00 Initial Values ( in LHS) Quotient Remainder a. Rem. < Rem xxxx b. Rem.<0, Add Div., LSh Q, Q 0 =0; RSh Div. xxxx a. Rem. < Rem b. Rem>=0, LSh Q, Q xxx =; RSh Div. a. Rem. < Rem xxx b. Rem>=0, LSh Q, Q 0 =; RSh Div. xx a. Rem. < Rem b. Rem>=0, LSh Q, Q xx =; RSh Div. 5a. Rem. < Rem x b. Rem<0, Add Div., LSh Q, Q 0 =0; RSh Div. x ShRight bit ShLeft Quotient bit bit Remainder 6 bit 0000/00 = 0 rem 00 7/5 = rem N+ Steps, but first step cannot produce a. 8 Issues and Alternative Solution #: Hardware Just as before Half of the divisor bits are always 0 Either high or low bits are 0, even as shifted Half of the 6 bit adder is therefore wasted Solution # Instead of shifting divisor right, shift the remainder left Adder only needs to be bits wide Can also remove iteration by switching order to shift and then subtract Remainder is in left half of register bits bit ALU Shift Left Remainder MSB Quotient bits Shift Left 9 0 Improved Divider: 0000/00 Initial Values Quotient Remainder 0. LSh Rem xxxx a. Rem. < Rem xxxx x b. Rem>=0, LSh Q, Q 0 =; LSh Rem. a. Rem. < Rem xxxx x b. Rem>=0, LSh Q, Q 0 =; LSh Rem. xxx xx a. Rem. < Rem xxx xx b. Rem>=0, LSh Q, Q 0 =; LSh Rem. xx 00 00xxx a. Rem. < Rem xx xxx b. Rem<0, Add Div., LSh Q, Q 0 =0 x 00 00xxxx x 00 0xxxx bit ShLeft Quotient xxxx bit bit 0000/00 = 0 rem 00 LH Rem. RH Rem. ShLeft 7/5 = rem 6 bit Issues and Alternative Just as before, half of the remainder register is useless at the beginning At the end, the quotient register becomes useless Solution # Remove the quotient register Place the quotient in the lower half of the remainder register Need to unshift in the last step to account for offbyone 7

8 Further Modifications Solution# Same space savings as with multiplication: use right ½ of remainder register to hold the quotient. bit ALU bits Shift right Remainder Shift left quotient test Divide Solution # rem <<= rem = (div >> ) if rem < 0 then rem += (div >> ) rem <<= LSB(rem) = 0 else rem <<= LSB(rem) = fi repeat unless done Correct remainder Start. Shift the Remainder register left bit. Subtract the register from the left half of the Remainder register and place the result in the left half of the Remainder register Remainder > 0 Remainder < 0 Test Remainder a. Shift the Remainder register to the b. Restore the original value by adding left, setting the new rightmost bit to the register to the left half of the Remainder register and place the sum in the left half of the Remainder register. Also shift the Remainder register to the left, setting the new rightmost bit to 0 No: < repetitions nd repetition? Yes: repetitions Done. Shift left half of Remainder right bit Solution #: Example Improved Improved Divider: 0000/00 Initial Values 0. LSh RemQuo. a. Rem < Rem b. Rem>=0, LSh RemQuo, Q 0 = a. Rem. < Rem b. Rem>=0, LSh RemQuo, Q 0 = a. Rem. < Rem b. Rem>=0, LSh RemQuo, Q 0 = a. Rem. < Rem b. Rem<0, Add Div., LSh RemQuo, Q 0 =0 bit bit Final: RSh Rem RemainderQuotient LH Rem. RemQuot. 6 bit ShLeft 0000/00 = 0 rem 00 7/5 = rem 5 6 Signed Division Divide in MIPS Same process as naïve integer multiply Make divisor and dividend positive Negate quotient if signs of divisor and dividend disagree Set sign of remainder Dividend = Quotient + Remainder Sign should match dividend Quotient/Remainder stored in two bit registers called Hi and Low div $s0, $s # $s0 / $s high/low divu $s0, $s # $s0 / $s unsigned Results are moved from Hi/Low mfhi $t0 # $t0 = Hi mflo $t0 # $t0 = Low Pseudoinstructions div $t0, $s0, $s # $t0 = $s0 / $s rem $t0, $s0, $s # $t0 = $s0 % $s div $s0,$s Lo = $s0/$s (integer) Hi Hi = $s0 % $s 7 8 8

Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

More information

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1 Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

More information

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

CS201: Architecture and Assembly Language

CS201: Architecture and Assembly Language CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary

More information

Decimals Adding and Subtracting

Decimals Adding and Subtracting 1 Decimals Adding and Subtracting Decimals are a group of digits, which express numbers or measurements in units, tens, and multiples of 10. The digits for units and multiples of 10 are followed by a decimal

More information

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1 Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal

More information

Useful Number Systems

Useful Number Systems Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

More information

Number and codes in digital systems

Number and codes in digital systems Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

More information

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits. Module #2 Number Systems EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

More information

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8 ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

More information

Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:

Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will: 6 Objectives After completing this lab you will: know how to do integer arithmetic in MIPS know how to do floating point arithmetic in MIPS know about conversion from integer to floating point and from

More information

Chapter 2. Binary Values and Number Systems

Chapter 2. Binary Values and Number Systems Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

More information

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points. 2 MODULE 4. DECIMALS 4a Decimal Arithmetic Adding Decimals Recall the process used for adding decimal numbers. Adding Decimals. To add decimal numbers, proceed as follows: 1. Place the numbers to be added

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

More information

Positional Numbering System

Positional Numbering System APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated

More information

Lecture 2. Binary and Hexadecimal Numbers

Lecture 2. Binary and Hexadecimal Numbers Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

More information

NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS. 1.1 Introduction NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

More information

PREPARATION FOR MATH TESTING at CityLab Academy

PREPARATION FOR MATH TESTING at CityLab Academy PREPARATION FOR MATH TESTING at CityLab Academy compiled by Gloria Vachino, M.S. Refresh your math skills with a MATH REVIEW and find out if you are ready for the math entrance test by taking a PRE-TEST

More information

CPEN 214 - Digital Logic Design Binary Systems

CPEN 214 - Digital Logic Design Binary Systems CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

More information

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic: Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

More information

Lecture 11: Number Systems

Lecture 11: Number Systems Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

More information

Binary Representation

Binary Representation Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems

More information

Implementation of Modified Booth Algorithm (Radix 4) and its Comparison with Booth Algorithm (Radix-2)

Implementation of Modified Booth Algorithm (Radix 4) and its Comparison with Booth Algorithm (Radix-2) Advance in Electronic and Electric Engineering. ISSN 2231-1297, Volume 3, Number 6 (2013), pp. 683-690 Research India Publications http://www.ripublication.com/aeee.htm Implementation of Modified Booth

More information

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

The string of digits 101101 in the binary number system represents the quantity 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

More information

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal. Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

More information

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR! DETAILED SOLUTIONS AND CONCEPTS - DECIMALS AND WHOLE NUMBERS Prepared by Ingrid Stewart, Ph.D., College of Southern Nevada Please Send Questions and Comments to ingrid.stewart@csn.edu. Thank you! YOU MUST

More information

Number Systems and Radix Conversion

Number Systems and Radix Conversion Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

More information

3. Convert a number from one number system to another

3. Convert a number from one number system to another 3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

Student Worksheet 1 TI-15 Explorer : Finding Patterns

Student Worksheet 1 TI-15 Explorer : Finding Patterns Student Worksheet 1 W1 3 and the remainder is always 0 Use a trail and error approach and 3 to make the TI-15 present the following output displays. When you get it to work, write down the dividends (starting

More information

Introduction to MIPS Assembly Programming

Introduction to MIPS Assembly Programming 1 / 26 Introduction to MIPS Assembly Programming January 23 25, 2013 2 / 26 Outline Overview of assembly programming MARS tutorial MIPS assembly syntax Role of pseudocode Some simple instructions Integer

More information

The Euclidean Algorithm

The Euclidean Algorithm The Euclidean Algorithm A METHOD FOR FINDING THE GREATEST COMMON DIVISOR FOR TWO LARGE NUMBERS To be successful using this method you have got to know how to divide. If this is something that you have

More information

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers: Session 9 Scientific Notation and Laws of Exponents If you have ever taken a Chemistry class, you may have encountered the following numbers: There are approximately 60,4,79,00,000,000,000,000 molecules

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people

More information

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi ASCII and BCD Arithmetic Chapter 11 S. Dandamudi Outline Representation of Numbers ASCII representation BCD representation» Unpacked BCD» Packed BCD Processing ASCII numbers» ASCII addition» ASCII subtraction»

More information

CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

More information

AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k 4 0 4. Design Consultant

AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k 4 0 4. Design Consultant Thi d t t d ith F M k 4 0 4 Fixed Point Routines AN617 Author: INTRODUCTION Frank J. Testa Design Consultant This application note presents an implementation of the following fixed point math routines

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

MATH-0910 Review Concepts (Haugen)

MATH-0910 Review Concepts (Haugen) Unit 1 Whole Numbers and Fractions MATH-0910 Review Concepts (Haugen) Exam 1 Sections 1.5, 1.6, 1.7, 1.8, 2.1, 2.2, 2.3, 2.4, and 2.5 Dividing Whole Numbers Equivalent ways of expressing division: a b,

More information

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

More information

BINARY CODED DECIMAL: B.C.D.

BINARY CODED DECIMAL: B.C.D. BINARY CODED DECIMAL: B.C.D. ANOTHER METHOD TO REPRESENT DECIMAL NUMBERS USEFUL BECAUSE MANY DIGITAL DEVICES PROCESS + DISPLAY NUMBERS IN TENS IN BCD EACH NUMBER IS DEFINED BY A BINARY CODE OF 4 BITS.

More information

A Prime Investigation with 7, 11, and 13

A Prime Investigation with 7, 11, and 13 . Objective To investigate the divisibility of 7, 11, and 13, and discover the divisibility characteristics of certain six-digit numbers A c t i v i t y 3 Materials TI-73 calculator A Prime Investigation

More information

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

More information

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 January 22, 2013 Name: Grade /10 Introduction: In this lab you will write, test, and execute a number of simple PDP-8

More information

Typy danych. Data types: Literals:

Typy danych. Data types: Literals: Lab 10 MIPS32 Typy danych Data types: Instructions are all 32 bits byte(8 bits), halfword (2 bytes), word (4 bytes) a character requires 1 byte of storage an integer requires 1 word (4 bytes) of storage

More information

Solution for Homework 2

Solution for Homework 2 Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

More information

Paramedic Program Pre-Admission Mathematics Test Study Guide

Paramedic Program Pre-Admission Mathematics Test Study Guide Paramedic Program Pre-Admission Mathematics Test Study Guide 05/13 1 Table of Contents Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Page

More information

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

More information

Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

Factoring Whole Numbers

Factoring Whole Numbers 2.2 Factoring Whole Numbers 2.2 OBJECTIVES 1. Find the factors of a whole number 2. Find the prime factorization for any number 3. Find the greatest common factor (GCF) of two numbers 4. Find the GCF for

More information

Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1 Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

More information

Warm-Up ( 454 3) 2 ( 454 + 2) 3

Warm-Up ( 454 3) 2 ( 454 + 2) 3 Warm-Up ) 27 4 ST/HSEE: 4 th Grade ST Review: 4 th Grade ST t school, there are 704 desks to place into classrooms. If the same number of desks is placed in each classroom, how many desks will be in each

More information

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook. Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

More information

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15 Addition Methods Methods Jottings Expanded Compact Examples 8 + 7 = 15 48 + 36 = 84 or: Write the numbers in columns. Adding the tens first: 47 + 76 110 13 123 Adding the units first: 47 + 76 13 110 123

More information

Let s put together a Manual Processor

Let s put together a Manual Processor Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

More information

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule. Sequences A sequence is a list of numbers, or a pattern, which obeys a rule. Each number in a sequence is called a term. ie the fourth term of the sequence 2, 4, 6, 8, 10, 12... is 8, because it is the

More information

COMPSCI 210. Binary Fractions. Agenda & Reading

COMPSCI 210. Binary Fractions. Agenda & Reading COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example

More information

Activity 1: Using base ten blocks to model operations on decimals

Activity 1: Using base ten blocks to model operations on decimals Rational Numbers 9: Decimal Form of Rational Numbers Objectives To use base ten blocks to model operations on decimal numbers To review the algorithms for addition, subtraction, multiplication and division

More information

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem.

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve word problems that call for addition of three whole numbers

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

3 cups ¾ ½ ¼ 2 cups ¾ ½ ¼. 1 cup ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼

3 cups ¾ ½ ¼ 2 cups ¾ ½ ¼. 1 cup ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼ cups cups cup Fractions are a form of division. When I ask what is / I am asking How big will each part be if I break into equal parts? The answer is. This a fraction. A fraction is part of a whole. The

More information

64-Bit Architecture Speeds RSA By 4x

64-Bit Architecture Speeds RSA By 4x 64-Bit Architecture Speeds RSA By 4x MIPS Technologies, Inc. June 2002 Public-key cryptography, and RSA in particular, is increasingly important to e-commerce transactions. Many digital consumer appliances

More information

Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

Sistemas Digitais I LESI - 2º ano

Sistemas Digitais I LESI - 2º ano Sistemas Digitais I LESI - 2º ano Lesson 6 - Combinational Design Practices Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática UNIVERSIDADE DO MINHO ESCOLA DE ENGENHARIA - PLDs (1) - The

More information

Design and FPGA Implementation of a Novel Square Root Evaluator based on Vedic Mathematics

Design and FPGA Implementation of a Novel Square Root Evaluator based on Vedic Mathematics International Journal of Information & Computation Technology. ISSN 0974-2239 Volume 4, Number 15 (2014), pp. 1531-1537 International Research Publications House http://www. irphouse.com Design and FPGA

More information

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of

More information

Playing with Numbers

Playing with Numbers PLAYING WITH NUMBERS 249 Playing with Numbers CHAPTER 16 16.1 Introduction You have studied various types of numbers such as natural numbers, whole numbers, integers and rational numbers. You have also

More information

8-bit Microcontroller. Application Note. AVR201: Using the AVR Hardware Multiplier

8-bit Microcontroller. Application Note. AVR201: Using the AVR Hardware Multiplier AVR201: Using the AVR Hardware Multiplier Features 8- and 16-bit Implementations Signed and Unsigned Routines Fractional Signed and Unsigned Multiply Executable Example Programs Introduction The megaavr

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011 CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

More information

A Step towards an Easy Interconversion of Various Number Systems

A Step towards an Easy Interconversion of Various Number Systems A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology

More information

Roman Numerals. Symbol Decimal Value I One (1) V Five (5) X Ten (10) L Fifty (50) C Hundred (100) D Five Hundred (500) M Thousand (1000)

Roman Numerals. Symbol Decimal Value I One (1) V Five (5) X Ten (10) L Fifty (50) C Hundred (100) D Five Hundred (500) M Thousand (1000) Roman Numerals Pre-requisite: Number System, Addition and Subtraction. Target Audience: Standard V to Standard VII. In Syllabus Standard V. Revision Standard VI & VII. Symbol Decimal Value I One (1) V

More information

ADDITION. Children should extend the carrying method to numbers with at least four digits.

ADDITION. Children should extend the carrying method to numbers with at least four digits. Y5 AND Y6 ADDITION Children should extend the carrying method to numbers with at least four digits. 587 3587 + 475 + 675 1062 4262 1 1 1 1 1 Using similar methods, children will: add several numbers with

More information

Sheet 7 (Chapter 10)

Sheet 7 (Chapter 10) King Saud University College of Computer and Information Sciences Department of Information Technology CAP240 First semester 1430/1431 Multiple-choice Questions Sheet 7 (Chapter 10) 1. Which error detection

More information

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems This assignment is designed to familiarize you with different numbering systems, specifically: binary, octal, hexadecimal (and decimal)

More information

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Introduction to Programming (in C++) Loops Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Example Assume the following specification: Input: read a number N > 0 Output:

More information

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification: Example Introduction to Programming (in C++) Loops Assume the following specification: Input: read a number N > 0 Output: write the sequence 1 2 3 N (one number per line) Jordi Cortadella, Ricard Gavaldà,

More information

Binary Numbers. Binary Octal Hexadecimal

Binary Numbers. Binary Octal Hexadecimal Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

More information

FRACTIONS MODULE Part I

FRACTIONS MODULE Part I FRACTIONS MODULE Part I I. Basics of Fractions II. Rewriting Fractions in the Lowest Terms III. Change an Improper Fraction into a Mixed Number IV. Change a Mixed Number into an Improper Fraction BMR.Fractions

More information

Multipliers. Introduction

Multipliers. Introduction Multipliers Introduction Multipliers play an important role in today s digital signal processing and various other applications. With advances in technology, many researchers have tried and are trying

More information

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

More information

POLYNOMIAL FUNCTIONS

POLYNOMIAL FUNCTIONS POLYNOMIAL FUNCTIONS Polynomial Division.. 314 The Rational Zero Test.....317 Descarte s Rule of Signs... 319 The Remainder Theorem.....31 Finding all Zeros of a Polynomial Function.......33 Writing a

More information

The finite field with 2 elements The simplest finite field is

The finite field with 2 elements The simplest finite field is The finite field with 2 elements The simplest finite field is GF (2) = F 2 = {0, 1} = Z/2 It has addition and multiplication + and defined to be 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 0 0 = 0 0 1 = 0

More information

Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

More information

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal 2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

More information

Chapter 1: Order of Operations, Fractions & Percents

Chapter 1: Order of Operations, Fractions & Percents HOSP 1107 (Business Math) Learning Centre Chapter 1: Order of Operations, Fractions & Percents ORDER OF OPERATIONS When finding the value of an expression, the operations must be carried out in a certain

More information

3-17 15-25 5 15-10 25 3-2 5 0. 1b) since the remainder is 0 I need to factor the numerator. Synthetic division tells me this is true

3-17 15-25 5 15-10 25 3-2 5 0. 1b) since the remainder is 0 I need to factor the numerator. Synthetic division tells me this is true Section 5.2 solutions #1-10: a) Perform the division using synthetic division. b) if the remainder is 0 use the result to completely factor the dividend (this is the numerator or the polynomial to the

More information

FRACTIONS OPERATIONS

FRACTIONS OPERATIONS FRACTIONS OPERATIONS Summary 1. Elements of a fraction... 1. Equivalent fractions... 1. Simplification of a fraction... 4. Rules for adding and subtracting fractions... 5. Multiplication rule for two fractions...

More information

Welcome to Basic Math Skills!

Welcome to Basic Math Skills! Basic Math Skills Welcome to Basic Math Skills! Most students find the math sections to be the most difficult. Basic Math Skills was designed to give you a refresher on the basics of math. There are lots

More information