What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

Similar documents
Binary Representation of Numbers Autar Kaw

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

Algebra Review. How well do you remember your algebra?

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Math 135 Circles and Completing the Square Examples

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

MATH 150 HOMEWORK 4 SOLUTIONS

SPECIAL PRODUCTS AND FACTORIZATION

Operations with Polynomials

Lecture 3 Gaussian Probability Distribution

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

2 DIODE CLIPPING and CLAMPING CIRCUITS

Section 5-4 Trigonometric Functions

A.7.1 Trigonometric interpretation of dot product A.7.2 Geometric interpretation of dot product

Factoring Polynomials

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 16 th May Time: 14:00 16:00

Learning Outcomes. Computer Systems - Architecture Lecture 4 - Boolean Logic. What is Logic? Boolean Logic 10/28/2010

CS99S Laboratory 2 Preparation Copyright W. J. Dally 2001 October 1, 2001

Treatment Spring Late Summer Fall Mean = 1.33 Mean = 4.88 Mean = 3.

Reasoning to Solve Equations and Inequalities

Vectors Recap of vectors

Homework 3 Solutions

AREA OF A SURFACE OF REVOLUTION

Lec 2: Gates and Logic

Small Business Networking

Physics 43 Homework Set 9 Chapter 40 Key

Small Business Networking

Graphs on Logarithmic and Semilogarithmic Paper

Small Business Networking

Experiment 6: Friction

Linear Equations in Two Variables

Basically, logarithmic transformations ask, a number, to what power equals another number?

1. In the Bohr model, compare the magnitudes of the electron s kinetic and potential energies in orbit. What does this imply?

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

RIGHT TRIANGLES AND THE PYTHAGOREAN TRIPLETS

Chapter 2 The Number System (Integers and Rational Numbers)

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

Novel Methods of Generating Self-Invertible Matrix for Hill Cipher Algorithm

Small Business Networking

Multiplication and Division - Left to Right. Addition and Subtraction - Left to Right.

1.2 The Integers and Rational Numbers

How To Network A Smll Business

9 CONTINUOUS DISTRIBUTIONS

Basic Analysis of Autarky and Free Trade Models

Or more simply put, when adding or subtracting quantities, their uncertainties add.

Words Symbols Diagram. abcde. a + b + c + d + e

6.2 Volumes of Revolution: The Disk Method

Rotating DC Motors Part II

LECTURE #05. Learning Objective. To describe the geometry in and around a unit cell in terms of directions and planes.

Section 7-4 Translation of Axes

Radius of the Earth - Radii Used in Geodesy James R. Clynch February 2006

EQUATIONS OF LINES AND PLANES

Integration by Substitution

Integration. 148 Chapter 7 Integration

Unit 6: Exponents and Radicals

Decision Rule Extraction from Trained Neural Networks Using Rough Sets

Small Business Cloud Services

Lectures 8 and 9 1 Rectangular waveguides

Helicopter Theme and Variations

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS Spring 2009

Regular Sets and Expressions

Understanding Logic Design

4.11 Inner Product Spaces

Lecture 5. Inner Product

Cypress Creek High School IB Physics SL/AP Physics B MP2 Test 1 Newton s Laws. Name: SOLUTIONS Date: Period:

Chapter. Contents: A Constructing decimal numbers

Health insurance exchanges What to expect in 2014

How To Set Up A Network For Your Business

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

Lecture 8: Binary Multiplication & Division

Health insurance marketplace What to expect in 2014

How To Reduce Telecommunictions Costs

MODULE 3. 0, y = 0 for all y

Vectors and dyadics. Chapter 2. Summary. 2.1 Examples of scalars, vectors, and dyadics

19. The Fermat-Euler Prime Number Theorem

5.6 POSITIVE INTEGRAL EXPONENTS

One Minute To Learn Programming: Finite Automata

Solution to Problem Set 1

Understanding Basic Analog Ideal Op Amps

COMPARISON OF SOME METHODS TO FIT A MULTIPLICATIVE TARIFF STRUCTURE TO OBSERVED RISK DATA BY B. AJNE. Skandza, Stockholm ABSTRACT

Binary Adders: Half Adders and Full Adders

e.g. f(x) = x domain x 0 (cannot find the square root of negative values)

PHY 222 Lab 8 MOTION OF ELECTRONS IN ELECTRIC AND MAGNETIC FIELDS

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials

CHAPTER 11 Numerical Differentiation and Integration

Unit 29: Inference for Two-Way Tables

Unleashing the Power of Cloud

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

Vectors. The magnitude of a vector is its length, which can be determined by Pythagoras Theorem. The magnitude of a is written as a.

Review guide for the final exam in Math 233

Econ 4721 Money and Banking Problem Set 2 Answer Key

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

Welch Allyn CardioPerfect Workstation Installation Guide

MULTIPLYING OUT & FACTORING

VoIP for the Small Business

Transcription:

Wht do ll those bits men now? bits (...) Number Systems nd Arithmetic or Computers go to elementry school instruction R-formt I-formt... integer dt number text chrs... floting point signed unsigned single precision double precision............ Questions About Numbers How do you represent negtive numbers? frctions? relly lrge numbers? relly smll numbers? How do you do rithmetic? identify errors (e.g. overflow)? Wht is n nd wht does it look like? =rithmetic logic unit Introduction to Binry Numbers Consider 4-bit binry number Deciml Binry Deciml Binry 4 5 6 7 Exmples of binry rithmetic: = 5 = 6

Negtive Numbers? Some Alterntives We would like number system tht provides uses for ddition single vlue of equl coverge of positive nd negtive numbers esy esy negtion Sign Mgnitude -- MSB is sign bit, rest the sme - == -5 == One s complement -- flip ll bits to negte - == -5 == Two s Complement Representtion s complement representtion of negtive numbers Tke the bitwise inverse nd dd Biggest 4-bit Binry Number: 7 Smllest 4-bit Binry Number: - Deciml - -7-5 - - - 4 5 6 7 Two s Complement Binry Two s Complement Arithmetic Deciml s Complement Binry Deciml s Complement Binry - - - 4-5 5 6-7 7 - Exmples: 7-6 = 7 (- 6) = - 5 = (- 5) = -

Some Things We Wnt To Know About Our Number System Detection negtion sign extension => - => overflow detection 5 6 5 7 - -5 7 So how do we detect overflow? Instruction Fetch Instruction Decode Opernd Fetch Execute Store Next Instruction Arithmetic -- The hert of instruction execution b opertion result Designing n Arithmetic Logic Unit A B N N op Control Lines (op) Function And Or Add Subtrct Set-on-less-thn N Zero

A One Bit A One-bit Full (Review) This -bit will perform AND, OR, nd ADD This is lso clled (, ) dder Hlf : No Truth Tble: A B -bit Full S - b Inputs Outputs A B Sum Comments = = = = = = = = Logic Eqution for (Review) Logic Eqution for Sum (Review) Inputs Outputs Inputs Outputs A B Sum Comments = = = = = = = = A B Sum Comments = = = = = = = = = (!A & B & ) (A &!B & ) (A & B &!) (A & B & ) = B & A & A & B Sum = (!A &!B & ) (!A & B &!) (A &!B &!) (A & B & )

A -bit -bit -bit b b How About Subtrction? Keep in mind the following: (A - B) is the sme s: A (-B) s Complement negte: Tke the inverse of every bit nd dd Bit-wise inverse of B is!b: A - B =??? Binvert b b b b Detection Logic Crry into MSB! = Crry out of MSB For N-bit : =???? Zero Detection Logic Zero Detection Logic is just one BIG NOR gte Any non-zero input to the NOR gte will cuse its output to be zero A B A B A B A B -bit -bit -bit -bit X Y X XOR Y A B A B A B A B -bit -bit -bit -bit Zero

Set-on-less-thn Binvert b Binvert Full Bnegte Do subtrct use sign bit route to bit of result ll other bits zero. Binvert b b b b b b b wht signls ccomplish: neg oper dd? sub? nd? Zero or? beq? slt? Set b. detection b b Set Set sign bit (dder output from bit ) The Disdvntge of Ripple Crry The dder we just built is clled Ripple Crry The crry bit my hve to propgte from LSB to MSB Worst cse dely for n N-bit RC dder: N-gte dely Problem: ripple crry dder is slow A B A B A B A B -bit -bit -bit -bit A B Is there more thn one wy to do ddition? two extremes: ripple crry nd sum-of-products Cn you see the ripple? How could you get rid of it? c = b c c b c = b c c b c = c = b c c b c = c 4 = b c c b c 4 = Not fesible! Why?

Crry Lookhed s (Review) Cin Cout B A -bit Cin We ll define two new terms, bsed on the reltionship between C in nd C out Generte Crry t Bit i gi = Ai & Bi Propgte Crry vi Bit i pi = Ai or Bi Cin Cout B A -bit Crry Lookhed (Continued) Using the two new terms we just defined: Generte Crry t Bit i gi = Ai & Bi Propgte Crry vi Bit i pi = Ai or Bi We cn rewrite: Cin = g (p & Cin) Cin = g (p & g) (p & p & Cin) Cin = g (p & g) (p & p & g) (p & p & p & Cin) Crry going into bit is if We generte crry t bit (g) Or we generte crry t bit (g) nd bit llows it to propgte (p & g) Or we generte crry t bit (g) nd bit s well s bit llows it to propgte (p & p & g) Or we hve crry input t bit (Cin) nd bit,, nd ll llow it to propgte (p & p & p & Cin) A Prtil Crry Lookhed It is very expensive to build full crry lookhed dder Just imgine the length of the eqution for Cin Common prctices: Connect severl N-bit Lookhed s to form big dder Exmple: connect four -bit crry lookhed dders to form -bit prtil crry lookhed dder A[:4] B[:4] -bit Crry Lookhed [:4] C4 A[:6] B[:6] -bit Crry Lookhed [:6] C6 A[5:] -bit Crry Lookhed B[5:] [5:] C A[7:] -bit Crry Lookhed B[7:] [7:] C b b b b 4 b4 5 b5 6 b6 7 b7 b 9 b9 b b b b 4 b4 5 b5 P G P G P G P G C C C C4 pi gi ci pi gi ci pi gi ci pi gi ci 4 -- Crry-lookhed unit 4--7 -- --5 Hierrchicl Crry- Lookhed s P = p & p & p & p Worst-cse dely?? Worst-cse dely??

MULTIPLY Pper nd pencil exmple: Multiplicnd Multiplier x Product m bits x n bits = bit product Binry mkes it esy: => plce ( x multiplicnd) => plce multiplicnd ( x multiplicnd) we ll look t couple of versions of multipliction hrdwre MULTIPLY HARDWARE Version 64-bit Multiplicnd reg, 64-bit, 64-bit Product reg, -bit multiplier reg 64-bit Product Multiplicnd Shift left 64 bits 64 bits Write Control test Multiplier Shift right bits Multiply Algorithm Version Multiplier Multiplicnd Product Multiplier =. Add multiplicnd to product nd plce the result in Product register Strt. Test Multiplier. Shift the Multiplicnd register left bit. Shift the Multiplier register right bit nd repetition? Multiplier = No: < repetitions Observtions on Multiply Version clock per cycle => clocks per multiply Rtio of multiply to dd : / bits in multiplicnd lwys => 64-bit dder is wsted s inserted in left of multiplicnd s shifted => lest significnt bits of product never chnged once formed Insted of shifting multiplicnd to left, shift product to right? Wsted spce (zeroes) in product register exctly mtches meningful bits of multiplier t ll times. Combine? Yes: repetitions Done

MULTIPLY HARDWARE Version -bit Multiplicnd reg, -bit, 64-bit Product reg, (-bit Multiplier reg) -bit Multiplicnd bits Product 64 bits Shift right Write Control test Product =. Add multiplicnd to the left hlf of the product nd plce the result in the left hlf of the Product register Strt. Test Product Product =. Shift the Product register right bit Observtions on Multiply Version steps per bit becuse Multiplier & Product combined -bit dder MIPS registers Hi nd Lo re left nd right hlf of Product Gives us MIPS instruction MultU Wht bout signed multipliction? esiest solution is to mke both & remember whether to product when done (leve out the sign bit, run for steps) nd repetition? No: < repetitions Yes: repetitions Done Key Points Instruction Set drives the design performnce, CPU clock speed driven by dder dely Multiply is expensive