T insn-mem T regfile T ALU T data-mem T regfile

Size: px
Start display at page:

Download "T insn-mem T regfile T ALU T data-mem T regfile"

Transcription

1 This Unit: rithmetic CI 371 Computer Organization and Design Unit 3: rithmetic pp pp pp ystem software Mem CPU I/O! little review! Binary + 2s complement! Ripple-carry addition (RC)! Fast integer addition! Carry-select (Ce)! hifters! Integer Multiplication and division! Floating point arithmetic CI371 (Roth/Martin): rithmetic 1 CI371 (Roth/Martin): rithmetic 2 Readings The Importance of Fast ddition! P&H! Chapter PC Insn Mem Register File s1 s2 d Data Mem T insn-mem T regfile T LU T data-mem T regfile! ddition of two numbers is most common operation! Programs use addition frequently! Loads and stores use addition for address calculation! Branches use addition to test conditions and calculate targets! ll insns use addition to calculate default next PC! Fast addition critical to high performance CI371 (Roth/Martin): rithmetic 3 CI371 (Roth/Martin): rithmetic 4

2 Review: Binary Integers! Computers represent integers in binary (base2) 3 = 11, 4 = 1, 5 = 11, 3 = ! Natural since only two values are represented! ddition, etc. take place as usual (carry the 1, etc.) 17 = = = 111! ome old machines use decimal (base1) with only /1 3 = 11! Unnatural for digial logic, implementation complicated & slow Fixed Width! On pencil and paper, integers have infinite width! In hardware, integers have fixed width! N bits: 16, 32 or 64! LB is 2, MB is 2 N-1! Range: to 2 N 1! Numbers >2 N represented using multiple fixed-width integers! In software CI371 (Roth/Martin): rithmetic 5 CI371 (Roth/Martin): rithmetic 6 What bout Negative Integers?! ign/magnitude! Unsigned plus one bit for sign 1 = 11, -1 = 111 +! Matches our intuition from by hand decimal arithmetic! Both and! ddition is difficult! Range: (2 N-1 1) to 2 N-1 1! Option II: two s complement (2C)! Leading s mean positive number, leading 1s negative 1 = 11, -1 = ! One representation for +! Easy addition! Range: (2 N-1 ) to 2 N-1 1 The Tao of 2C! How did 2C come about?! Let s design a representation that makes addition easy! Think of subtracting 1 from by hand! Have to borrow 1s from some imaginary leading 1 = 1-1 = 11-1 = ! Now, add the conventional way -1 = = 11 = 1 CI371 (Roth/Martin): rithmetic 7 CI371 (Roth/Martin): rithmetic 8

3 till More On 2C! What is the interpretation of 2C?! ame as binary, except MB represents 2 N 1, not 2 N 1! 1 = = ! Extends to any width! 1 = 1111 = ! Why? 2 N = 2*2 N 1! = ( *2 5 ) = ! Trick to negating a number quickly: B = B + 1! (1) = (1) +1 = = 1111 = 1! ( 1) = (1111) +1 = +1 = 1 = 1! () = () +1 = = =! Think about why this works 1st Grade: Decimal ddition ! Repeat N times! dd least significant digits and any overflow from previous add! Carry overflow to next addition! Overflow: any digit other than least significant of sum! hift two addends and sum one digit to the right! um of two N-digit numbers can yield an N+1 digit number CI371 (Roth/Martin): rithmetic 9 CI371 (Roth/Martin): rithmetic 1 Binary ddition: Works the ame Way The Half dder = = = 11! Repeat N times! dd least significant bits and any overflow from previous add! Carry the overflow to next addition! hift two addends and sum one bit to the right! um of two N-bit numbers can yield an N+1 bit number! More steps (smaller base) +! Each one is simpler (adding just 1 and )! o simple we can do it in hardware! How to add two binary integers in hardware?! tart with adding two bits! When all else fails... look at truth table B = C = 1 = 1 1 = = 1! = ^B! (carry out) = B! This is called a half adder B B H CI371 (Roth/Martin): rithmetic 11 CI371 (Roth/Martin): rithmetic 12

4 The Other Half! We could chain half adders together, but to do that! Need to incorporate a carry out from previous adder C B = C CI = 1 = 1 1 = 1 CI 1 1 = 1 1 = 1 B F 1 1 = 1 B 1 1 = = 1 1! = C B + C B + C B + CB = C ^ ^ B! = C B + C B + CB + CB = C + CB + B! This is called a full adder CI371 (Roth/Martin): rithmetic 13 Ripple-Carry dder! N-bit ripple-carry adder! N 1-bit full adders chained together! = CI 1, 1 = CI 2, etc.! CI =! N 1 is carry-out of entire adder! N 1 = 1! overflow! Example: 16-bit ripple carry adder! How fast is this?! How fast is an N-bit ripple-carry adder? F B 1 F 1 B 1 2 F 2 B 2 15 F 15 B 15 CI371 (Roth/Martin): rithmetic 14 Quantifying dder Delay! Combinational logic dominated by gate (transistor) delays! rray storage dominated by wire delays! Longest delay or critical path is what matters! Can implement any combinational function in 2 logic levels! 1 level of ND + 1 level of OR (PL)! NOTs are free : push to input (DeMorgan s) or read from latch! Example: delay(fulldder) = 2! d(carryout) = delay(b + C + BC)! d(um) = d( ^ B ^ C) = d(b C + BC + BC + BC) = 2! Note ^ means Xor (just like in C & Java)! Caveat: 2 assumes gates have few (<8?) inputs Ripple-Carry dder Delay! Longest path is to 15 (or 15 )! d( 15 ) = 2 + MX(d( 15 ),d(b 15 ),d(ci 15 ))! d( 15 ) = d(b 15 ) =, d(ci 15 ) = d( 14 )! d( 15 ) = 2 + d( 14 ) = d( 13 )! d( 15 ) = 32! D( N 1 ) = 2N! Too slow!! Linear in number of bits! Number of gates is also linear F B 1 F 1 B 1 2 F 2 B 2 15 F 15 B 15 CI371 (Roth/Martin): rithmetic 15 CI371 (Roth/Martin): rithmetic 16

5 Bad idea: a PL-based dder?! If any function can be expressed as two-level logic! why not use a PL for an entire 8-bit adder?! Not small! pprox ND gates, each with 2 16 inputs! Then, 2 16 OR gates, each with 2 16 inputs! Number of gates exponential in bit width!! Not that fast, either! n ND gate with 65 thousand inputs!= 2-input ND gate! Many-input gates made a tree of, say, 4-input gates! 16-input gates would have at least 8 logic levels! o, at least 16 levels of logic for a 16-bit PL! Even so, delay is still logarithmic in number of bits! There are better (faster, smaller) ways Theme: Hardware!= oftware! Hardware can do things that software fundamentally can t! nd vice versa (of course)! In hardware, it s easier to trade resources for latency! One example of this: speculation! low computation is waiting for some slow input?! Input one of two things?! Compute with both (slow), choose right one later (fast)! Does this make sense in software? Not on a uni-processor! Difference? hardware is parallel, software is sequential CI371 (Roth/Martin): rithmetic 17 CI371 (Roth/Martin): rithmetic 18 Carry-elect dder! Carry-select adder! Do B 15-8 twice, once assuming C 8 ( 7 ) =, once = 1! Choose the correct one when 7 finally becomes available +! Effectively cuts carry chain in half (break critical path)! But adds mux 15- B 15-! Delay? B B B CI371 (Roth/Martin): rithmetic 19 Multi-egment Carry-elect dder! Multiple segments! Example: 5, 5, 6 bit = 16 bit! Hardware cost! till mostly linear (~2x)! Compute each segment with and 1 carry-in! erial mux chain! Delay! 5-bit adder (1) + Two muxes (4) = B B B B B CI371 (Roth/Martin): rithmetic

6 Carry-elect dder Delay! What is carry-select adder delay (two segment)?! d( 15 ) = MX(d( 15-8 ), d( 7- )) + 2! d( 15 ) = MX(2*8, 2*8) + 2 = 18! In general: 2*(N/2) + 2 = N+2 (vs 2N for RC)! What if we cut adder into 4 equal pieces?! Would it be 2*(N/4) + 2 = 1? Not quite! d( 15 ) = MX(d( ),d( 11- )) + 2! d( 15 ) = MX(2*4, MX(d( 11-8 ),d( 7- )) + 2) + 2! d( 15 ) = MX(2*4,MX(2*4,MX(d( 7-4 ),d( 3- )) + 2) + 2) + 2! d( 15 ) = MX(2*4,MX(2*4,MX(2*4,2*4) + 2) + 2) + 2! d( 15 ) = 2*4 + 3*2 = 14 nother Option: Carry Lookahead! Is carry-select adder as fast as we can go?! Nope! nother approach to using additional resources! Instead of redundantly computing sums assuming different carries! Use redundancy to compute carries more quickly! This approach is called carry lookahead (CL)! N-bit adder in M equal pieces: 2*(N/M) + (M 1)*2! 16-bit adder in 8 parts: 2*(16/8) + 7*2 = 18 CI371 (Roth/Martin): rithmetic 21 CI371 (Roth/Martin): rithmetic 22 Carry Lookahead dder (CL) dders In Real Processors! Calculate propagate and generate based on, B! Not based on carry in! Combine with tree structure! Prior years: CL covered in great detail! Dozen slides or so! Not this year! Take aways! Tree gives logarithmic delay! Reasonable area C C 1 C 2 C 3 B 1 B 1 2 B 2 3 B 3 G P G 1- G 1 P 1 G 2 P 2 G 3 P 3 P 1- C 1 G 3-2 P 3-2 C 3 G 3- P 3- C 2! Real processors super-optimize their adders! Ten or so different versions of CL! Highly optimized versions of carry-select! Other gate techniques: carry-skip, conditional-sum! ub-gate (transistor) techniques: Manchester carry chain! Combinations of different techniques! lpha uses CL+Ce+RippleC! Used a different levels! Even more optimizations for incrementers! Why? C 4 C 4 CI371 (Roth/Martin): rithmetic 23 CI371 (Roth/Martin): rithmetic 24

7 ubtraction: ddition s Tricky Pal! ign/magnitude subtraction is mental reverse addition! 2C subtraction is addition! How to subtract using an adder?! sub B = add -B! Negate B before adding (fast negation trick: B = B + 1)! Isn t a subtraction then a negation and two additions? +! No, an adder can implement +B+1 by setting the carry-in to 1 B 1 CI371 (Roth/Martin): rithmetic 25 CI371 (Roth/Martin): rithmetic 26 ~ 16-bit LU! Build an LU with functions: add/sub, and, or, not,xor! ll of these already in CL adder/subtracter! add B, sub B check! not B is needed for subtraction! and B are first level Gs! or B are first level Ps! xor B?! i = i^b i^c i! What is still missing? B CI371 (Roth/Martin): rithmetic 27 ~ 1 & G P ^ dd -sum ^ hift and Rotation Instructions! Left/right shifts are useful! Fast multiplication/division by small constants (next)! Bit manipulation: extracting and setting individual bits in words! Right shifts! Can be logical (shift in s) or arithmetic (shift in copies of MB) srl 1111, 2 = 11 sra 1111, 2 = 1111! Caveat: sra is not equal to division by 2 of negative numbers! Rotations are less useful! But almost free if shifter is there! MIP and LC4 have only shifts, x86 has shifts and rotations CI371 (Roth/Martin): rithmetic 28

8 imple hifter! The simplest 16-bit shifter: can only shift left by 1! Implement using wires (no logic!)! lightly more complicated: can shift left by 1 or! Implement using wires and a multiplexor (mux16_2to1) Barrel hifter! What about shifting left by any amount 15?! 16 consecutive left-shift-by-1-or- blocks?! Would take too long (how long?)! Barrel shifter: 4 shift-left-by-x-or- blocks (X = 1,2,4,8)! What is the delay? O <<8 <<4 <<2 <<1 O 15 <<1 O <<1 O shift shift[3] shift[2] shift[1] shift[]! imilar barrel designs for right shifts and rotations CI371 (Roth/Martin): rithmetic 29 CI371 (Roth/Martin): rithmetic 3 3rd Grade: Decimal Multiplication 19 // multiplicand * 12 // multiplier // product! tart with product, repeat steps until no multiplier digits! Multiply multiplicand by least significant multiplier digit! dd to product! hift multiplicand one digit to the left (multiply by 1)! hift multiplier one digit to the right (divide by 1)! Product of N-digit, M-digit numbers may have N+M digits Binary Multiplication: ame Refrain 19 = 111 // multiplicand * 12 = 11 // multiplier = = 76 = = 111 = + = 228 = 1111 // product ±! maller base! more steps, each is simpler! Multiply multiplicand by least significant multiplier digit +! or 1! no actual multiplication, add multiplicand or not! dd to total: we know how to do that! hift multiplicand left, multiplier right by one digit CI371 (Roth/Martin): rithmetic 31 CI371 (Roth/Martin): rithmetic 32

9 oftware Multiplication! Can implement this algorithm in software! Inputs: md (multiplicand) and mr (multiplier) int pd = ; // product int i = ; for (i = ; i < 16 && mr!= ; i++) { if (mr & 1) { pd = pd + md; } md = md << 1; // shift left mr = mr >> 1; // shift right } CI371 (Roth/Martin): rithmetic 33 Hardware Multiply: Iterative Multiplicand Multiplier << 1 >> 1 (32 bit) (16 bit) 32 Product (32 bit) 32+! Control: repeat 16 times! If least significant bit of multiplier is 1! Then add multiplicand to product! hift multiplicand left by 1! hift multiplier right by 1 CI371 (Roth/Martin): rithmetic 34 we lsb==1? Hardware Multiply: Multiple dders C<<4 C<<3 C<<3 P C<<2 C<<2 C<<1 C<<1 C C C<<4 P Consecutive ddition F 3 B 3 2 B 2 1 B 1 F F F F T 3 D 3 T 2 D 2 T 1 D 1 T F F F F B C B D C D! 2 N-bit RC adders +! 2 + d(add) gate delays! M N-bit RC adders delay! Naïve: O(M*N)! ctual: O(M+N)! Multiply by N bits at a time using N adders! Example: N=5, terms (P=product, C=multiplicand, M=multiplier)! P = (M[]? (C) : ) + (M[1]? (C<<1) : ) + (M[2]? (C<<2) : ) + (M[3]? (C<<3) : ) +! rrange like a tree to reduce gate delay critical path! Delay? N 2 vs N*log N? Not that simple, depends on adder! pprox 2N versus N + log N, with optimization: O(log N) CI371 (Roth/Martin): rithmetic 35 F T 3 3 B 3 D 3 2 B 2 D 2 1 B 1 D 1 B D! M N-bit Carry elect? F F F F! Delay calculation tricky T 2 T 1 T C B C D! Carry ave dder (C) F F F F! 3-to-2 C tree + adder! Delay: O(log M + log N) CI371 (Roth/Martin): rithmetic 36

10 Hardware!= oftware: Part Deux! Recall: hardware is parallel, software is sequential! Exploit: evaluate independent sub-expressions in parallel! Example I: = + B + C + D! oftware? 3 steps: (1) 1 = +B, (2) 2 = 1+C, (3) = 2+D +! Hardware? 2 steps: (1) 1 = +B, 2=C+D, (2) = 1+2 side: trength Reduction! trength reduction: compilers will do this (sort of) * 4 = << 2 / 8 = >> 3 * 5 = ( << 2) +! Useful for address calculation: all basic data types are 2 M in size int [1]; &[N] = +(N*sizeof(int)) = +N*4 = +N<<2! Example II: = + B + C! oftware? 2 steps: (1) 1 = +B, (2) = 1+C! Hardware? 2 steps: (1) 1 = +B (2) = 1+C +! ctually hardware can do this in 1.2 steps!! ub-expression parallelism exists below 16-bit addition level CI371 (Roth/Martin): rithmetic 37 CI371 (Roth/Martin): rithmetic 38 4th Grade: Decimal Division 9 // quotient 3 29 // divisor dividend // remainder! hift divisor left (multiply by 1) until MB lines up with dividend s! Repeat until remaining dividend (remainder) < divisor! Find largest single digit q such that (q*divisor) < dividend! et LB of quotient to q! ubtract (q*divisor) from dividend! hift quotient left by one digit (multiply by 1)! hift divisor right by one digit (divide by 1) Binary Division 11 = = = = 11-3 = = 1 CI371 (Roth/Martin): rithmetic 39 CI371 (Roth/Martin): rithmetic 4

11 Binary Division Hardware! ame as decimal division, except (again)! More individual steps (base is smaller) +! Each step is simpler! Find largest bit q such that (q*divisor) < dividend! q = or 1! ubtract (q*divisor) from dividend! q = or 1! no actual multiplication, subtract divisor or not! Complication: largest q such that (q*divisor) < dividend! How do you know if (1*divisor) < dividend?! Human can eyeball this! Computer does not have eyeballs! ubtract and see if result is negative oftware Divide lgorithm! Can implement this algorithm in software! Inputs: dividend and divisor for (int i = ; i < 32; i++) {! ""remainder = (remainder << 1) (dividend >> 31);! ""if (remainder >= divisor) {! """"quotient = (quotient << 1) 1;! """"remainder = remainder - divisor;! ""} else {! quotient = quotient << 1! }! ""dividend = dividend << 1;! }! CI371 (Roth/Martin): rithmetic 41 CI371 (Roth/Martin): rithmetic 42 Divide Example! Input: Divisor = 11, Dividend = 1111 Divider Circuit Divisor tep Remainder Quotient Remainder Dividend ! Result: Quotient: 11, Remainder: 1 ub >= Remainder msb hift in or 1 Quotient hift in or 1 Dividend hift in! N cycles for n-bit divide CI371 (Roth/Martin): rithmetic 43 CI371 (Roth/Martin): rithmetic 44

12 rithmetic Latencies! Latency in cycles of common arithmetic operations! ource: oftware Optimization Guide for MD Family 1h Processors, Dec 27! Intel Core 2 chips similar Int 32 Int 64 dd/ubtract 1 1 Multiply 3 5 Divide 14 to 4 23 to 87! Divide is variable latency based on the size of the dividend! Detect number of leading zeros, then divide ummary pp pp pp ystem software Mem CPU I/O! Integer addition! Most timing-critical operation in datapath! Hardware!= software! Exploit sub-addition parallelism! Fast addition! Carry-select: parallelism in sum! Multiplication! Chains and trees of additions! Division! Next up: Floating point CI371 (Roth/Martin): rithmetic 45 CI371 (Roth/Martin): rithmetic 46

This Unit: Arithmetic. CIS 371 Computer Organization and Design. Readings. Pre Class Exercise

This Unit: Arithmetic. CIS 371 Computer Organization and Design. Readings. Pre Class Exercise This Unit: Arithmetic CI 371 Computer Organization and Design Unit 4: Arithmetic Based on slides by Prof. Amir Roth & Prof. Milo Martin App App App ystem software Mem CPU I/O A little review Binary + 2s

More information

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay Two-Level CLA for 4-bit Adder Individual carry equations C 1 = g 0 +p 0, C 2 = g 1 +p 1 C 1,C 3 = g 2 +p 2 C 2, = g 3 +p 3 C 3 Fully expanded (infinite hardware) CLA equations C 1 = g 0 +p 0 C 2 = g 1

More information

Tailoring the 32-Bit ALU to MIPS

Tailoring the 32-Bit ALU to MIPS Tailoring the 32-Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Combinational Logic Martha. Kim Columbia University Spring 6 / Combinational Circuits Combinational circuits are stateless. Their output is a function only of the current

More information

COMP 303 Computer Architecture Lecture 6

COMP 303 Computer Architecture Lecture 6 COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =

More information

9/6/2011. Multiplication. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding

9/6/2011. Multiplication. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding 9/6/2 Multiplication Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 2 2 4 6 8 2 4 6 8 3 3 6 9 2

More information

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division

More information

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

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26) Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: continued 1 Announcements Consulting hours Introduction to Sim Milestone #1 (due 1/26) 2 1 Overview: Integer Operations Internal representation

More information

CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction

More information

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS 2-2. 2-2.2 Learning Outcomes piral 2 2 Arithmetic Components and Their Efficient Implementations I know how to combine overflow and subtraction results to determine comparison results of both signed and

More information

carry in carry 1101 carry carry

carry in carry 1101 carry carry Chapter Binary arithmetic Arithmetic is the process of applying a mathematical operator (such as negation or addition) to one or more operands (the values being operated upon). Binary arithmetic works

More information

Computer Architecture Set Four. Arithmetic

Computer Architecture Set Four. Arithmetic Computer Architecture Set Four Arithmetic Arithmetic Where we ve been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What

More information

Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS

Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS 2-2. 2-2.2 Learning Outcomes piral 2-2 Arithmetic Components and Their Efficient Implementations I understand the control inputs to counters I can design logic to control the inputs of counters to create

More information

Chapter 3 Arithmetic for Computers

Chapter 3 Arithmetic for Computers Chapter 3 Arithmetic for Computers 1 Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing the Architecture operation

More information

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute DIGITAL TECHNIC Dr. Bálint Pődör Óbuda University, Microelectronics and Technology Institute 4. LECTURE: COMBINATIONAL LOGIC DEIGN: ARITHMETIC (THROUGH EXAMPLE) 2nd (Autumn) term 28/29 COMBINATIONAL LOGIC

More information

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS 2-2. 2-2.2 Learning Outcomes piral 2 2 Arithmetic Components and Their Efficient Implementations I know how to combine overflow and subtraction results to determine comparison results of both signed and

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS/COE 0447 Example Problems for Exam 2 Spring 2011 CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product

More information

Week 7: Assignment Solutions

Week 7: Assignment Solutions Week 7: Assignment Solutions 1. In 6-bit 2 s complement representation, when we subtract the decimal number +6 from +3, the result (in binary) will be: a. 111101 b. 000011 c. 100011 d. 111110 Correct answer

More information

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

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture Points ddressed in this Lecture Lecture 6: Signed Numbers rithmetic Circuits Professor Peter Cheung Department of EEE, Imperial College London (Floyd 2.5-2.7, 6.1-6.7) (Tocci 6.1-6.11, 9.1-9.2, 9.4) Representing

More information

Fast Arithmetic. Philipp Koehn. 19 October 2016

Fast Arithmetic. Philipp Koehn. 19 October 2016 Fast Arithmetic Philipp Koehn 19 October 2016 1 arithmetic Addition (Immediate) 2 Load immediately one number (s0 = 2) li $s0, 2 Add 4 ($s1 = $s0 + 4 = 6) addi $s1, $s0, 4 Subtract 3 ($s2 = $s1-3 = 3)

More information

Integer Multiplication and Division

Integer Multiplication and Division Integer Multiplication and Division COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline

More information

Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

More information

Logic Design (Part 2) Combinational Logic Circuits (Chapter 3)

Logic Design (Part 2) Combinational Logic Circuits (Chapter 3) Digital Logic Circuits Logic Design (Part ) Combinational Logic Circuits (Chapter 3) ² We saw how we can build the simple logic gates using transistors ² Use these gates as building blocks to build more

More information

ALU Design. 1-bit Full Adder 4-bit Arithmetic circuits. Arithmetic and Logic Unit Flags. Add/Subtract/Increament/Decrement Circuit

ALU Design. 1-bit Full Adder 4-bit Arithmetic circuits. Arithmetic and Logic Unit Flags. Add/Subtract/Increament/Decrement Circuit LU Design -bit Full dder 4-bit rithmetic circuits dd/subtract/increament/decrement Circuit rithmetic and Logic Unit Flags Carry-Out, Sign, Zero, Overflow Shift and Rotate t Operations COE2 (Fall27) LU

More information

Overview. EECS Components and Design Techniques for Digital Systems. Lec 16 Arithmetic II (Multiplication) Computer Number Systems.

Overview. EECS Components and Design Techniques for Digital Systems. Lec 16 Arithmetic II (Multiplication) Computer Number Systems. Overview EE 15 - omponents and Design Techniques for Digital ystems Lec 16 Arithmetic II (Multiplication) Review of Addition Overflow Multiplication Further adder optimizations for multiplication LA in

More information

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

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B) Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Combinational Logic Stephen. Edwards Columbia University Summer 7 Combinational Circuits Combinational circuits are stateless. Their output is a function only of the current

More information

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Chapter 5: Computer Arithmetic. In this chapter you will learn about: Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction (-) Multiplication

More information

Arithmetic and Logical Operations

Arithmetic and Logical Operations Arithmetic and Logical Operations 2 CMPE2c x +y + sum Or in tabular form Binary Addition Carry Out Sum B A Carry In Binary Addition And as a full adder a b co ci sum 4-bit Ripple-Carry adder: Carry values

More information

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3 EECS15 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3 October 8, 22 John Wawrzynek Fall 22 EECS15 - Lec13-cla3 Page 1 Multiplication a 3 a 2 a 1 a Multiplicand b 3 b 2 b

More information

Arithmetic Logic Unit. Digital Computer Design

Arithmetic Logic Unit. Digital Computer Design Arithmetic Logic Unit Digital Computer Design Arithmetic Circuits Arithmetic circuits are the central building blocks of computers. Computers and digital logic perform many arithmetic functions: addition,

More information

Chapter 3: part 3 Binary Subtraction

Chapter 3: part 3 Binary Subtraction Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering Arithmetic for Computers James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Arithmetic for

More information

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Learning Objectives. Binary over Decimal. In this chapter you will learn about: Ref Page Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction

More information

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

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers

More information

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

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26) Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: The MIPS ISA (P&H 2.1-2.14) 1 Announcements Consulting hours Milestone #1 (due 1/26) Milestone #2 (due 2/2) 2 1 Review: Integer Operations Internal

More information

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures Homework 3 Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) 1 CSCI 402: Computer Architectures Arithmetic for Computers (2) Fengguang Song Department

More information

Chapter 5: Computer Arithmetic

Chapter 5: Computer Arithmetic Slide 1/29 Learning Objectives Computer Fundamentals: Pradeep K. Sinha & Priti Sinha In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations

More information

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization CS/COE0447: Computer Organization and Assembly Language Chapter 3 Sangyeun Cho Dept. of Computer Science Five classic components I am like a control tower I am like a pack of file folders I am like a conveyor

More information

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization Five classic components CS/COE0447: Computer Organization and Assembly Language I am like a control tower I am like a pack of file folders Chapter 3 I am like a conveyor belt + service stations I exchange

More information

Timing for Ripple Carry Adder

Timing for Ripple Carry Adder Timing for Ripple Carry Adder 1 2 3 Look Ahead Method 5 6 7 8 9 Look-Ahead, bits wide 10 11 Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand AND gates 32

More information

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides Chapter 3 Arithmetic for Computers 1 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation

More information

Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 2005

Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 2005 Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 200 Multiply We will start with unsigned multiply and contrast how humans and computers multiply Layout 8-bit 8 Pipelined Multiplier 1 2

More information

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak. Arithmetic Circuits Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak http://www.syssec.ethz.ch/education/digitaltechnik_14 Adapted from Digital Design and Computer Architecture, David Money

More information

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

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah NUMBER OPERATIONS Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 3810: Computer Organization Overview Homework 4 is due tonight Verify your uploaded file before the

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Implementation Today Review representations (252/352 recap) Floating point Addition: Ripple

More information

Chapter 4 Arithmetic Functions

Chapter 4 Arithmetic Functions Logic and Computer Design Fundamentals Chapter 4 Arithmetic Functions Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Overview Iterative combinational

More information

ECE 30 Introduction to Computer Engineering

ECE 30 Introduction to Computer Engineering ECE 30 Introduction to Computer Engineering Study Problems, Set #6 Spring 2015 1. With x = 1111 1111 1111 1111 1011 0011 0101 0011 2 and y = 0000 0000 0000 0000 0000 0010 1101 0111 2 representing two s

More information

Lecture 8: Addition, Multiplication & Division

Lecture 8: Addition, Multiplication & Division Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C

More information

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers Egemen K. Çetinkaya Egemen K. Çetinkaya Department of Electrical & Computer Engineering Missouri University of Science

More information

EEC 483 Computer Organization

EEC 483 Computer Organization EEC 483 Computer Organization Chapter 3. Arithmetic for Computers Chansu Yu Table of Contents Ch.1 Introduction Ch. 2 Instruction: Machine Language Ch. 3-4 CPU Implementation Ch. 5 Cache and VM Ch. 6-7

More information

Microcomputers. Outline. Number Systems and Digital Logic Review

Microcomputers. Outline. Number Systems and Digital Logic Review Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded

More information

Addition and multiplication

Addition and multiplication Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it s not as easy as you might expect! These next few lectures focus on addition, subtraction, multiplication

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 Combinational Logic Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke) Last

More information

CS 64 Week 1 Lecture 1. Kyle Dewey

CS 64 Week 1 Lecture 1. Kyle Dewey CS 64 Week 1 Lecture 1 Kyle Dewey Overview Bitwise operation wrap-up Two s complement Addition Subtraction Multiplication (if time) Bitwise Operation Wrap-up Shift Left Move all the bits N positions to

More information

Arithmetic Processing

Arithmetic Processing CS/EE 5830/6830 VLSI ARCHITECTURE Chapter 1 Basic Number Representations and Arithmetic Algorithms Arithmetic Processing AP = (operands, operation, results, conditions, singularities) Operands are: Set

More information

MIPS Integer ALU Requirements

MIPS Integer ALU Requirements MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

D I G I T A L C I R C U I T S E E

D I G I T A L C I R C U I T S E E D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,

More information

EE292: Fundamentals of ECE

EE292: Fundamentals of ECE EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic

More information

Arithmetic Operations

Arithmetic Operations Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary

More information

CPS 104 Computer Organization and Programming

CPS 104 Computer Organization and Programming CPS 104 Computer Organization and Programming Lecture 9: Integer Arithmetic. Robert Wagner CPS104 IMD.1 RW Fall 2000 Overview of Today s Lecture: Integer Multiplication and Division. Read Appendix B CPS104

More information

Iterative Division Techniques COMPUTER ARITHMETIC: Lecture Notes # 6. University of Illinois at Chicago

Iterative Division Techniques COMPUTER ARITHMETIC: Lecture Notes # 6. University of Illinois at Chicago 1 ECE 368 CAD Based Logic Design Instructor: Shantanu Dutt Department of Electrical and Computer Engineering University of Illinois at Chicago Lecture Notes # 6 COMPUTER ARITHMETIC: Iterative Division

More information

By, Ajinkya Karande Adarsh Yoga

By, Ajinkya Karande Adarsh Yoga By, Ajinkya Karande Adarsh Yoga Introduction Early computer designers believed saving computer time and memory were more important than programmer time. Bug in the divide algorithm used in Intel chips.

More information

Arithmetic Logic Unit

Arithmetic Logic Unit Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

More information

Review: MIPS Organization

Review: MIPS Organization 1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words

More information

Revision: August 31, E Main Suite D Pullman, WA (509) Voice and Fax

Revision: August 31, E Main Suite D Pullman, WA (509) Voice and Fax Exercise 7: Combinational rithmetic Circuits Revision: ugust 3, 29 25 E Main uite D Pullman, W 9963 (59) 334 636 Voice and Fax TUDENT I am submitting my own work, and I understand penalties will be assessed

More information

MULTIPLICATION TECHNIQUES

MULTIPLICATION TECHNIQUES Learning Objectives EE 357 Unit 2a Multiplication Techniques Perform by hand the different methods for unsigned and signed multiplication Understand the various digital implementations of a multiplier

More information

Binary Adders. Ripple-Carry Adder

Binary Adders. Ripple-Carry Adder Ripple-Carry Adder Binary Adders x n y n x y x y c n FA c n - c 2 FA c FA c s n MSB position Longest delay (Critical-path delay): d c(n) = n d carry = 2n gate delays d s(n-) = (n-) d carry +d sum = 2n

More information

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29 CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude

More information

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal. Page < 1 > Math in MIPS Adding and Subtracting Numbers Adding two binary numbers together is very similar to the method used with decimal numbers, except simpler. When you add two binary numbers together,

More information

Integer Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25)

Integer Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25) Back to Arithmetic Before, we did Representation of integers Addition/Subtraction Logical ops Forecast Integer Multiplication Integer Division Floating-point Numbers Floating-point Addition/Multiplication

More information

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6- Binary Addition 6-2 Representing Signed Numbers 6-3 Addition in the 2 s- Complement System 6-4 Subtraction in the 2 s- Complement

More information

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y Arithmetic A basic operation in all digital computers is the addition and subtraction of two numbers They are implemented, along with the basic logic functions such as AND,OR, NOT,EX- OR in the ALU subsystem

More information

Logic, Words, and Integers

Logic, Words, and Integers Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits

More information

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline Today s Outline San Jose State University EE176-SJSU Computer Architecture and Organization Lecture 5 HDL, ALU, Shifter, Booth Algorithm Multiplier & Divider Instructor: Christopher H. Pham Review of Last

More information

University of Illinois at Chicago. Lecture Notes # 13

University of Illinois at Chicago. Lecture Notes # 13 1 ECE 366 Computer Architecture Instructor: Shantanu Dutt Department of Electrical and Computer Engineering University of Illinois at Chicago Lecture Notes # 13 COMPUTER ARITHMETIC: Iterative Division

More information

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 09/15/2002 Chapter corrections (Web) Printing a slide show

More information

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8 Data Representation At its most basic level, all digital information must reduce to 0s and 1s, which can be discussed as binary, octal, or hex data. There s no practical limit on how it can be interpreted

More information

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Computer Organization and Structure. Bing-Yu Chen National Taiwan University Computer Organization and Structure Bing-Yu Chen National Taiwan University Arithmetic for Computers Addition and Subtraction Gate Logic and K-Map Method Constructing a Basic ALU Arithmetic Logic Unit

More information

Chapter 10 Binary Arithmetics

Chapter 10 Binary Arithmetics 27..27 Chapter Binary Arithmetics Dr.-Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: Karnaugh-Veitch-Maps Chapter 4: Combinational

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

Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs

Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs and an arbitrary truth table Analysis Procedure We

More information

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit A.R. Hurson 323 CS Building, Missouri S&T hurson@mst.edu 1 Outline Motivation Design of a simple ALU How to design

More information

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem   ahmadsm AT kfupm Phone: Office: COE 0: Digital Logic Design Number Systems Part Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: -34 Objectives Arithmetic operations: Binary number system Other number systems Base Conversion

More information

Organisasi Sistem Komputer

Organisasi Sistem Komputer LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles

More information

Principles of Computer Architecture. Chapter 3: Arithmetic

Principles of Computer Architecture. Chapter 3: Arithmetic 3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition

More information

COMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

COMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers ARM D COMPUTER ORGANIZATION AND Edition The Hardware/Software Interface Chapter 3 Arithmetic for Computers Modified and extended by R.J. Leduc - 2016 In this chapter, we will investigate: How integer arithmetic

More information

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. Binary Arithmetic Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. MIT 6.004 Fall 2018 Reminder: Encoding Positive Integers Bit i in a binary representation (in right-to-left order)

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 9: Binary Addition & Multiplication Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Pop Quiz! Using 4 bits signed integer notation:

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

At the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state

At the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state Chapter 4 xi yi Carry in ci Sum s i Carry out c i+ At the ith stage: Input: ci is the carry-in Output: si is the sum ci+ carry-out to (i+)st state si = xi yi ci + xi yi ci + xi yi ci + xi yi ci = x i yi

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST III Date : 21/11/2017 Max Marks : 40 Subject & Code : Computer Organization (15CS34) Semester : III (A & B) Name of the faculty: Mrs. Sharmila Banu Time : 11.30 am 1.00 pm Answer

More information

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) (aritmeettis-looginen yksikkö) Does all

More information

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen

More information

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade CSE 141 Computer Architecture Summer Session 1 2004 Lecture 3 ALU Part 2 Single Cycle CPU Part 1 Pramod V. Argade Reading Assignment Announcements Chapter 5: The Processor: Datapath and Control, Sec. 5.3-5.4

More information

Computer Architecture and Organization

Computer Architecture and Organization 3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction

More information

UNIT-III COMPUTER ARTHIMETIC

UNIT-III COMPUTER ARTHIMETIC UNIT-III COMPUTER ARTHIMETIC INTRODUCTION Arithmetic Instructions in digital computers manipulate data to produce results necessary for the of activity solution of computational problems. These instructions

More information