COMS 361 Computer Organization

Slides:



Advertisements
Similar presentations
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.
Advertisements

Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)
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.
Arithmetic-Logic Units CPSC 321 Computer Architecture Andreas Klappenecker.
ECE 301 – Digital Electronics
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.
CS 105 Digital Logic Design
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Constructing a Computer Creating a general purpose computing device.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
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.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Chapter 6-1 ALU, Adder and Subtractor
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
1 EGRE 426 Fall 08 Chapter Three. 2 Arithmetic What's up ahead: –Implementing the Architecture 32 operation result a b ALU.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
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.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
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.
Ch3b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University There is logic to it andRd, Rs, RtRd
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
1  2004 Morgan Kaufmann Publishers Performance is specific to a particular program/s –Total execution time is a consistent summary of performance For.
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
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
1 Fundamentals of Computer Science Combinational Circuits.
LECTURE 4 Logic Design. LOGIC DESIGN We already know that the language of the machine is binary – that is, sequences of 1’s and 0’s. But why is this?
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.
1 Arithmetic Where we've been: –Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: –Implementing the Architecture.
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.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
Discrete Systems I Lecture 10 Adder and ALU Profs. Koike and Yukita.
1 The ALU l ALU includes combinational logic. –Combinational logic  a change in inputs directly causes a change in output, after a characteristic delay.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
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
Prof. Sin-Min Lee Department of Computer Science
Lecture 11: Hardware for Arithmetic
Computer Science 210 Computer Organization
Homework Reading Machine Projects Labs
Summary Half-Adder Basic rules of binary addition are performed by a half adder, which has two binary inputs (A and B) and two binary outputs (Carry out.
MIPS ALU.
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
ECE 331 – Digital System Design
Arithmetic Where we've been:
CSE Winter 2001 – Arithmetic Unit - 1
CS/COE0447 Computer Organization & Assembly Language
MIPS ALU.
Digital Logic.
Lecture 11: Hardware for Arithmetic
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COMS 361 Computer Organization
Homework Reading Machine Projects Labs
Digital Logic.
Logic Circuits I Lecture 3.
Multiple function unit design
October 8 Rules for Programming Assignments ASK QUESTIONS!
ECE 352 Digital System Fundamentals
Combinational Circuits
Electronics for Physicists
MIPS ALU.
MIPS ALU.
Presentation transcript:

COMS 361 Computer Organization Title: Logic Design Date: 11/09/2004 Lecture Number: 18

Announcements Homework 8 Due Thursday, 11/11/04

Review Representing numbers in binary Boolean Algebra Boolean Logic Finish overflow Boolean Algebra Boolean Logic

Outline Logic design Decoder Multiplexor PLA Simple ALU

Decoder Basic logic building block n-bit input 2^n outputs Different inputs select different outputs Binary number input One output asserted (true, 1, on) all others are off Decoder L0 L1 out0 out1 out2 out3 out4 out5 out6 out7

Decoder

Decoder 1 2

Decoder 1 2 1 2

Decoder 1 2 1 2 1 2

Decoder 1 2 1 2 1 2 1 2 2

Multiplexor Really a selector Choose one input and connect it to an output Selection is based on a control signal b a c s mux s b a c

Multiplexor Can have more than 2 input multiplexor Need more selector signals as the number of inputs increases b a o s mux c 2

Multiplexor Note: sum-of-products b a o s mux c 2 s0 a s1 b o c

Multiplexor Multiplexors select one channel from a set of channels A channel may contain more than a single bit 32 bits b a o s mux 32

PLA Sum-of-product representation corresponds to a programmable logic array(PLA) Set of inputs Input compliments Two logic blocks Utilizes the structure of the sum-of-products representation and gates or gates inputs outputs product terms

PLA And gates form the sets of products Products consists of any input or complement Or gates form the logical sum of any number of product terms Direct implementation of a truth table Each 1 in the output of the truth table requires a product term Single row in the PLA Each 1 in the output of the truth table corresponds to a row of OR gates

Arithmetic and Logic Unit (ALU) Computers brains Addition Subtraction Logical and Logical or 32-bit words in MIPS 32-bit registers 32-bit ALU All bits are mostly treated the same Make a 1-bit ALU Connect 32, 1-bit ALU’s together to make a 32-bit ALU Bit Slicing Bit Slicing Bit Slicing Bit Slicing Bit Slicing Bit Slicing Bit Slicing

1-bit ALU Many different implementations Difficult to decide the “best” way to build something Don't want too many inputs to a single gate Don’t want to have to go through too many gates For our purposes, ease of comprehension is important

1-bit logical AND and logical OR AND two bits (a, b) OR two bits (a, b) Select desired logical output Operation is set to 0 to select the logical AND Operation is set to 1 to select the logical OR 1 a b result operation

1-Bit Adder (Half Adder) Two one bit numbers are to be added Simple truth table Sum is the exclusive or of a and b Cout is the logical AND of a and b a b Cout Sum 1

1-Bit Adder (Half Adder) Sum Cout

Full Adder More interesting when we add two (or more) bit numbers All bits except the least significant bit (LSB, rightmost) must add 3-bits not 2-bits The carry bit of the previous stage is needed to compute the sum and carry of the next bit Full adder includes the carry bit from the previous stage: 3-bit input to be added sum Cout

Full Adder Build a truth table for full adding a single bit Carry out (Cout) is 1 if Both a and b are 1 or Either a or b is 1, not both and Carry In (Cin) is 1 Sum is 1 if an odd number of the three inputs is on XOR of the 3 inputs

Full Adder half adder a b Cin Sum Cout

2-bit adder Combine the half adder and the full adder Bit 0 does not have a carry in (for now) half adder a0 b0 C0 s0 full adder a1 b1 s2 s1

n-bit adder Adders for any number of bits can be constructed by cascading full adders The carry bit from one stage is computed and enters the next stage Carry bit ripples along The sum of two numbers is not available until the carry bit ripples to the last stage n-bit adder means there are 2n - 1 logic gates the carry bit must traverse Increases the time for addition Add hardware complexity to increase the speed

32-bit ALU ALU for a single bit 32-bit ALU Use a full adder for bit 0

Subtraction Two’s complement representation Clever Subtraction Negate one operand Add Negation in two’s complement Invert the bits Add 1 Clever

Subtraction Two’s complement representation Clever Subtraction Negate one operand Add Negation in two’s complement Invert the bits Add 1 CarryIn a 1 into the first adder a – b = a + b’ + 1 Clever Control Signals 1

slt Hardware support for the set-on-less-than instruction slt is an arithmetic instruction Produces a 1 if rs < rt and 0 otherwise Use subtraction: (a-b) < 0 implies a < b Support test for equality (beq $t5, $t6, $t7) Use subtraction: (a-b) = 0 implies a = b

slt Most of the bits are set to 0