ex
play

ex start small with a 1-bit (half) adder A B Carry out Sum A 0 - PowerPoint PPT Presentation

Addition: ex start small with a 1-bit (half) adder A B Carry out Sum A 0 0 Sum 0 1 B 1 0 1 1 Carry out Carry in ex 1-bit full adder A + Sum B Carry out n-bit addition: Sum i = A i + B i + CarryOut i-1 Need a bigger adder!


  1. Addition: ex start small with a 1-bit (half) adder A B Carry out Sum A 0 0 Sum 0 1 B 1 0 1 1 Carry out

  2. Carry in ex 1-bit full adder A + Sum B Carry out n-bit addition: Sum i = A i + B i + CarryOut i-1 Need a bigger adder! A B Carry in Carry out Sum Carry in 0 0 0 0 0 1 A 0 1 0 Sum 0 1 1 B 1 0 0 1 0 1 Carry out 1 1 0 1 1 1

  3. n-bit ripple-carry adder Carry in A 0 + Sum 0 B 0 A 1 + Sum 1 B 1 A 2 + Sum 2 B 2 … A n-1 + Sum n-1 B n-1 Carry out There are faster, more complicated ways too…

  4. Processor Components 4 2 1 3 Instruction ALU Registers Memory Fetch and Decode

  5. 1 Arithmetic Logic Unit (ALU) a few bits Condition Codes (sign, overflow, carry-out, zero) word Operand A ALU words Result Operand B Operation a few bits Hardware unit for arithmetic and bitwise operations.

  6. ex 1-bit ALU for bitwise operations Build an n-bit ALU from n 1-bit ALUs. Each bit i in the result is computed from the corresponding bit i in the two inputs. Op A B Result 0 0 0 Operation 0 0 1 A 0 1 0 0 MUX 0 1 1 Result 1 0 0 B 1 1 0 1 1 1 0 1 1 1

  7. 1-bit ALU Operation Carry in 2 A 0 MUX Result 1 Sum + 2 B Carry out

  8. Carry in 2 Operation A 0 n-bit ripple carry adder 0 Result 0 MUX 1 Carry in Sum + B 0 2 A 0 + Sum 0 B 0 A 1 0 Result 1 MUX A 1 1 + Sum 1 Sum + B 1 2 B 1 A 2 + .... n-bit ALU … Sum 2 B 2 … A n-1 0 Result n-1 MUX A n-1 + 1 Sum n-1 Sum + B n-1 B n-1 2 Carry out Carry out

  9. Carry in 2 ALU conditions Operation A 0 0 Result 0 MUX 1 Extra ALU outputs Sum + B 0 2 describing properties of result. A 1 Zero Flag: 0 Result 1 MUX 1 if result is 00...0 else 0 1 Sum + Sign Flag: B 1 2 1 if result is negative else 0 .... … Carry Flag: 1 if carry out else 0 (Signed) Overflow Flag: A n-1 0 Result n-1 1 if signed overflow else 0 MUX 1 Sum + B n-1 2 Implement these. Carry out

  10. Operation 2 Add subtraction A 0 0 Result 0 MUX 1 How can we control ALU inputs B 0 + 0 2 or add minimal new logic 1 to compute A-B ? A 1 0 Result 1 MUX 1 + B 1 0 2 1 .... .... … A n-1 0 Result n-1 MUX 1 + B n-1 0 2 1 Carry out

  11. Operation Negate B Invert A A NAND B 2 A 0 0 0 1 Result 0 MUX 1 A NOR B B 0 + 0 2 1 A 1 0 0 1 A<B Result 1 MUX 1 + B 1 0 2 1 A==B .... .... .... … A n-1 0 0 1 Result n-1 MUX How can we control ALU inputs 1 or add minimal new logic + B n-1 0 ex to compute each? 2 1 Carry out

  12. Controlling the ALU Condition Codes ALU control lines Function 0000 AND Operand A 0001 OR ALU Result 0010 add Operand B 0110 subtract 1100 NOR Control Lines

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend