COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.

Slides:



Advertisements
Similar presentations
1 ECE 4436ECE 5367 Computer Arithmetic I-II. 2 ECE 4436ECE 5367 Addition concepts 1 bit adder –2 inputs for the operands. –Third input – carry in from.
Advertisements

1 Lecture 12: Hardware for Arithmetic Today’s topics:  Designing an ALU  Carry-lookahead adder Reminder: Assignment 5 will be posted in a couple of days.
Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
1 CONSTRUCTING AN ARITHMETIC LOGIC UNIT CHAPTER 4: PART II.
1 Lecture 4: Arithmetic for Computers (Part 3) CS 447 Jason Bakos.
Computer Structure - The ALU Goal: Build an ALU  The Arithmetic Logic Unit or ALU is the device that performs arithmetic and logical operations in the.
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Chapter 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See: P&H Chapter 2.4, 3.2, B.2, B.5, B.6.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Binary Arithmetic Stephen Boyd March 14, Two's Complement Most significant bit represents sign. 0 = positive 1 = negative Positive numbers behave.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
CS 1308 – Computer Literacy and the Internet. It’s Not Magic  The goal of the next series of lectures is to show you exactly how a computer works. 
Basic Arithmetic (adding and subtracting)
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Basic Arithmetic (adding and subtracting)
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /19/2013 Lecture 7: 32-bit ALU, Fast Carry Lookahead Instructor: Ashraf Yaseen DEPARTMENT OF MATH &
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Computing Systems Designing a basic ALU.
Arithmetic Logic Unit (ALU) Anna Kurek CS 147 Spring 2008.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
Lecture 18: Hardware for Arithmetic Today’s topic –Intro to Boolean functions (Continued) –Designing an ALU 1.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
The Karnaugh Map.
CS 1308 – Computer Literacy and the Internet Building the CPU.
MIPS ALU. Building from the adder to ALU ALU – Arithmetic Logic Unit, does the major calculations in the computer, including – Add – And – Or – Sub –
CPS3340 Computer Architecture Fall Semester, 2013
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
Addition, Subtraction, Logic Operations and ALU Design
1 Fundamentals of Computer Science Combinational Circuits.
Gates AND, OR, NOT NAND, NOR Combinational logic No memory A set of inputs uniquely and unambiguously specifies.
1 Lecture 11: Hardware for Arithmetic Today’s topics:  Logic for common operations  Designing an ALU  Carry-lookahead adder.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
MIPS ALU. Exercise – Design a selector? I need a circuit that takes two input bits, a and b, and a selector bit s. The function is that if s=0, f=a. if.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
Computer Architecture & Operations I
Invitation to Computer Science, C++ Version, Fourth Edition
Lecture 11: Hardware for Arithmetic
Computer Architecture & Operations I
Computer Architecture & Operations I
MIPS ALU.
5. Combinational circuits
MIPS ALU.
Arithmetic Circuits (Part I) Randy H
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
COMS 361 Computer Organization
Instructor: Mozafar Bag-Mohammadi University of Ilam
A 1-Bit Arithmetic Logic Unit
MIPS ALU.
MIPS ALU.
Presentation transcript:

COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji

Review Last Class Performance Definition, Power Wall, Amdahl’s Law Computer Logic, Boolean Integrated Circuits, Decoder, Multiplexor, PLA, ROM, Bus This Class Representation of Integer Addition Subtraction Design of ALU Assignment 2

Today Session 1 Bit, Byte, Word Binary Representation of Integer Addition Subtraction Overflow

Bit, Byte, and Word 1 Bit – 0 or 1 1 Byte – 8 bits 1 Word – N bytes (in general) 4 bytes in a word (in our book)

Most Significant Bit and Least Significant Bit Most Significant Bit (High-Order Bit) The bit position having the greatest value Usually the left-most bit Least Significant Bit (Low-Order Bit) The bit position having the smallest value Usually the right-most bit

Binary Representation of Decimal Number Binary Decimal 1× ×2 9 +0×2 8 +1×2 7 +0×2 6 +1×2 5 +0×2 4 +1×2 3 +1×2 2 +0×2 1 +1×2 0 =1197 Using a binary number to represent a decimal number Example What is the maximum number a byte can represent?

Binary Representation of Integers Unsigned Integers 0 and positive integers only Signed Integers 0, negative, and positive integers Three ways Sign-Magnitude 1’s Complement 2’s Complement

Unsigned Integers Consider a word = 4 bytes Can represent numbers from 0 to Decimal: 0 to Binary: 0 to Example =

Signed Integer – Sign Magnitude Sign Magnitude Use the most significant bit of the word to represent the sign 0 – Positive 1 – Negative Rest of the number is encoded in magnitude part Example = = Two representations of 0 0 = = Cumbersome in Arithmetic

1’s Complement Negative number is stored as bit-wise complement of corresponding positive number Use the most significant bit of the word to represent the sign 0 – Positive 1 – Negative Example = = Still two representations of zero 0 = =

2’s Complement Positive number represented in the same way as sign-magnitude and 1’s complement Negative number obtained by taking 1’s complement of positive number and adding = ’s comp: = ’s comp: = One version of 0 Convenient in arithmetic

Integer Addition Example: §3.2 Addition and Subtraction

Integer Subtraction Subtraction is actually an addition Example: 7 – 6 = 7 + (-6) 2’s complement

Overflow Overflow if result out of range Adding +value and –value operands, no overflow Adding two +value operands Overflow if result sign is 1 Adding two –value operands Overflow if result sign is 0

Summary Bit, Byte, Word Binary Representation of Integer Addition Subtraction Overflow

Time for a Break (10 mins)

Review Last Session Representation of Integer Addition Subtraction This Session 1-bit ALU Unit Next Session Design of ALU

Arithmetic Logic Unit Arithmetic Logic Unit (ALU) Heart of a CPU Operations Arithmetic operations Addition Subtraction Logical operations NOT AND OR

1-bit Logical Unit for AND and OR 1-bit logical unit for AND and OR

1-bit adder

1-bit adder truth table

Simplifying 1-bit adder If a and b and CarryIn are true, then the three other terms are true as well can be simplified as Values when CarryOut is true

Logic of CarryOut Bit

Logic of Sum Bit

Overall 1-bit ALU

Summary 1-bit Adder Logical Design

Time for a Break (10 mins)

Review Last Session Addition and Subtraction 1-bit ALU This Session 32-bit ALU Fast Carry Lookahead

32-bit ALU

Subtraction Subtraction can be done by adding a and b’s negate and 1

NOR Ainvert =1, Binvert =1, Operation =00

Set on less than Set on less than (slt) For comparison of two integers a and b Least significant bit 1 if a < b 0 otherwise Other bits 0

Set on less than

Handling Overflow

32-bit ALU Bit 0-30: normal 1-bit ALU Bit 31: 1-bit ALU with overflow detection

Final 32-bit ALU Bnegate Every time we want the ALU to subtract, we set both CarryIn and Binvert to 1 Otherwise, both CarryIn and Binvert are set to 0 NOR operation: Binvert is 1, but CarryIn is Don’t Care We can combine CarryIn and Binvert to a single line of Bnegate

Test of Zero We want to quickly test if two integers are equal Design a single signal of Zero

Final 32-bit ALU

ALU Control Signals

Symbol of ALU

Faster Addition Carry Lookahead Speeding up addition Determining the carry in to the high-order bits sooner Key mechanism Hardware executes in parallel

Explanation of Carry Lookahead Try to remember CarryOuti+1=CarryIni Abbreviation of ci for CarryIni Then c2 can be evaluated faster without waiting for c1 How about c30? Grows rapidly with the number of bits Very complex

Fast Carry Using the First Level of Abstraction Consider Generate (gi) and Propagate (pi) Then

Generates and Propagates Why gi is called generate? when gi is 1 ci+1 is “generated” Why pi is called propagate? when gi is 0 and pi is 1 ci+1 is “propagated” from ci

4-bit CarryIn

A Plumbing Analog Wrenches open and close valves ci+1 will be full if the nearest generate value gi is on or pi is on there is water further upstream c0 can result in a carry out without the help of any generates but the help of all propagates

Four 4-bit ALUs with Carry Lookahead to form a 16-bit adder

Summary 1-bit ALU Logic Functions Arithmetic Functions 32-bit ALU Set on less than Test of Zero Fast Carry Look ahead

What I want you to do Review Appendix B Work on your assignment 2 Next Class Computer Clock Register Unit Memory Unit Midterm Review