Systems Architecture I

Slides:



Advertisements
Similar presentations
Lec 12Systems Architecture1 Systems Architecture Lecture 12: Design of the MIPS ALU Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some or all.
Advertisements

Arithmetic for Computers
Lecture 19: Hardware for Arithmetic Today’s topic –Designing an ALU –Carry Look-Ahead Adder 1.
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 Representing Numbers Using Bases Numbers in base 10 are called decimal numbers, they are composed of 10 numerals ( ספרות ) = 9* * *10.
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.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 6: Logic/Shift Instructions Partially adapted from Computer Organization and Design, 4.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
Lec 13Systems Architecture1 Systems Architecture Lecture 13: Integer Multiplication and Division Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
Computing Systems Designing a basic ALU.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
1 Lecture 12 Time/space trade offs Adders. 2 Time vs. speed: Linear chain 8-input OR function with 2-input gates Gates: 7 Max delay: 7.
Ch3b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University There is logic to it andRd, Rs, RtRd
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
MIPS ALU. Building from the adder to ALU ALU – Arithmetic Logic Unit, does the major calculations in the computer, including – Add – And – Or – Sub –
CPE 232 MIPS Arithmetic1 CPE 232 Computer Organization MIPS Arithmetic – Part I Dr. Gheith Abandah [Adapted from the slides of Professor Mary Irwin (
1  2004 Morgan Kaufmann Publishers Performance is specific to a particular program/s –Total execution time is a consistent summary of performance For.
1  2004 Morgan Kaufmann Publishers Lets Build a Processor Almost ready to move into chapter 5 and start building a processor First, let’s review Boolean.
Addition, Subtraction, Logic Operations and ALU Design
ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes partially based on set created by Mark Hill.
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.
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
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.
Csci136 Computer Architecture II Lab#5 Arithmetic Review ALU Design Ripple Carry Adder & Carry lookahead HW #4: Due on Feb 22, before class Feb.16, 2005.
May 2, 2001System Architecture I1 Systems Architecture I (CS ) Lecture 11: Arithmetic for Computers * Jeremy R. Johnson May 2, 2001 *This lecture.
May 22, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 14: A Simple Implementation of MIPS * Jeremy R. Johnson Mon. May 17, 2000.
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
Computer Arthmetic Chapter Four P&H.
Combinational Circuits
Single Bit ALU 3 R e s u l t O p r a i o n 1 C y I B v b 2 L S f w d O
Systems Architecture I
MIPS ALU.
ECE/CS 552: Arithmetic and Logic
Systems Architecture I
5. Combinational circuits
CSE Winter 2001 – Arithmetic Unit - 1
Topic 3b Computer Arithmetic: ALU Design
Systems Architecture I (CS ) Lecture 16: Exceptions
Systems Architecture I
MIPS ALU.
Arithmetic Circuits (Part I) Randy H
Systems Architecture II
The University of Adelaide, School of Computer Science
Rocky K. C. Chang 6 November 2017
Lecture 11: Hardware for Arithmetic
Systems Architecture I
Topic 3b Computer Arithmetic: ALU Design
CS 140 Lecture 14 Standard Combinational Modules
Systems Architecture I
CSE 140 Lecture 14 Standard Combinational Modules
Instructor: Mozafar Bag-Mohammadi University of Ilam
A 1-Bit Arithmetic Logic Unit
Combinational Circuits
Logical instructions And rd rs rt Nor rd rs rt Or rd rs rt
Systems Architecture I (CS ) Lecture 17: Exceptions
Systems Architecture I
Systems Architecture II
Systems Architecture I
Logical Instructions And rd rs rt Nor rd rs rt Or rd rs rt
MIPS ALU.
MIPS ALU.
Presentation transcript:

Systems Architecture I September 4, 1997 Systems Architecture I (CS 281-001) Lecture 12: Design of the MIPS ALU* Jeremy R. Johnson Mon. Nov. 13, 2000 *This lecture was derived from material in the text (sec. 4.4-4.5). All figures from Computer Organization and Design: The Hardware/Software Approach, Second Edition, by David Patterson and John Hennessy, are copyrighted material (COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED). Nov. 13, 2000 Systems Architecture I

Systems Architecture I September 4, 1997 Introduction Objective: To learn what operations are performed by the Arithmetic Logic Unit (ALU) and to learn how the MIPS ALU is implemented. Topics MIPS logical operations Full Adder 1-But ALU The design of the MIPS 32-Bit ALU Overflow and Overflow Detection Carry Lookahead Nov. 13, 2000 Systems Architecture I

Addition and Subtraction Carry-ripple adder 0000 0111 + 0000 0110 0000 1101 0000 0111 0000 0111 0000 0110 0000 0110 - 0000 0110 +1111 1010 - 0000 0111 + 1111 1001 0000 0001 0000 0001 1111 1111 1111 1111 Nov. 13, 2000 Systems Architecture I

Systems Architecture I Overflow Detection Overflow occurs in the following situations Nov. 13, 2000 Systems Architecture I

Systems Architecture I Logical Operations Shift left << sll Shift right >> srl Shift right arithmetic sra Bitwise and & and, andi Bitwise or | or, ori Bitwise complement (not) ~ not (pseudo) Exclusive or ^ xor, xori Nov. 13, 2000 Systems Architecture I

Representation of Shift Instruction September 4, 1997 Representation of Shift Instruction Example sll $t2, $s0, 8 # $t2 = $s0 << 8 $t2 = $8, $s0 = $16 000000 00000 10000 01010 01000 000000 op rs rt rd shamt func Nov. 13, 2000 Systems Architecture I

Example use of Logical Operations Int data; struct { unsigned int ready: 1; unsigned int enable: 1; unsigned int receivedByte: 8; } receiver; … data = receiver.receivedByte; receiver.ready = 0; receiver.enable = 1; Assume data in $s0 receiver in $s1 sll $s0, $s1, 22 srl $s0, $s0, 24 andi $s1, $s1, 0xfffe ori $s1, $s1, 0x0002 9 2 1 0 | receivedByte | enable | ready Nov. 13, 2000 Systems Architecture I

Systems Architecture I Building Blocks Nov. 13, 2000 Systems Architecture I

Systems Architecture I Full Adder Sum = parity(a,b,CarryIn) a xor b xor c + abc  a xor b xor c CarryOut = majority(a,b,CarryIn) bCarryIn + aCarryIn + ab + abCarryIn  bCarryIn + aCarryIn + ab b a CarryIn Sum Nov. 13, 2000 Systems Architecture I

Systems Architecture I One-Bit ALU Nov. 13, 2000 Systems Architecture I

Systems Architecture I Building a 32-Bit ALU Chain 32 1-Bit ALUs Nov. 13, 2000 Systems Architecture I

Supporting Subtraction Subtraction is equivalent to adding the inverse In two’s complement a + b + 1 Nov. 13, 2000 Systems Architecture I

Systems Architecture I Overflow and SLT Modify last 1-Bit ALU SLT set if (a < b)  a - b < 0 Check sign bit after subtraction Check overflow in last 1-Bit ALU Need to take overflow into account for SLT Nov. 13, 2000 Systems Architecture I

32-Bit ALU with Sub and Slt Nov. 13, 2000 Systems Architecture I

Systems Architecture I Support Beq a = b  a - b = 0 Zero = (Result31 +    + Result0) Nov. 13, 2000 Systems Architecture I

Systems Architecture I Final 32-Bit ALU Nov. 13, 2000 Systems Architecture I

Systems Architecture I Carry Lookahead Adder if (ai-1 = bi-1) then ci = 0 “kill” if (ai-1 = bi-1) then ci = 1 “generate” if (ai-1  bi-1) then ci = ci-1 “propagate” + ai-1 bi-1 ci-1 ci Nov. 13, 2000 Systems Architecture I

Systems Architecture I Combined Carry Status xi = kill if (ai-1 = bi-1) xi = generate if (ai-1 = bi-1) xi = propagate if (ai-1  bi-1) yi = yi-1  xi = x1    xi FAi-1 FAi Nov. 13, 2000 Systems Architecture I

Calculating Carry from Carry Status Lemma: yi = kill  ci = 0 yi = generate  ci = 1 yi = propagate does not occur Proof: yi = kill  xi = kill  ci = 0 or xi = propagate and yi-1 = kill and ci = majority(ci-1, ai, bi) = ci-1 = kill (by induction) yi = generate  xi = generate  ci = 1 or xi = propagate and yi-1 = generate and ci = majority(ci-1, ai, bi) = 1 (by induction) yi = propagate  xi = propagate and yi-1 = propagate, which by induction leads to a contradiction Nov. 13, 2000 Systems Architecture I

Systems Architecture I Parallel Prefix Fast (parallel computation of yi in log time) x0 x1 x2 x3 x4 x5 x6 x7 [0,1] [1,2] [2,3] [3,4] [4,5] [5,6] [6,7] [0,2] [0,3] [1,4] [2,5] [3,6] [4,7] [0,0] [0,1] [0,2] [0,3] [0,4] [0,5] [0,6] [0,7] Nov. 13, 2000 Systems Architecture I

Systems Architecture I Parallel Prefix Nov. 13, 2000 Systems Architecture I