CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Constructing a Computer Creating a general purpose computing device.

Slides:



Advertisements
Similar presentations
Modular Combinational Logic
Advertisements

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.
Changes in input values are reflected immediately (subject to the speed of light and electrical delays) on the outputs Each gate has an associated “electrical.
Chapter 1 — Computer Abstractions and Technology — 1 Lecture 7 Carry look ahead adders, Latches, Flip-flops, registers, multiplexors, decoders Digital.
Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.6.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
ECE 331 – Digital System Design
Arithmetic II CPSC 321 E. J. Kim. Today’s Menu Arithmetic-Logic Units Logic Design Revisited Faster Addition Multiplication (if time permits)
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.
Lec 17 Nov 2 Chapter 4 – CPU design data path design control logic design single-cycle CPU performance limitations of single cycle CPU multi-cycle CPU.
CS 61C L15 Blocks (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #15: Combinational Logic Blocks.
Homework Reading Machine Projects Labs
ECE 301 – Digital Electronics
16/07/2015CSE1303 Part B lecture notes 1 Hardware Implementation Lecture B17 Lecture notes section B17.
CS 61C L15 State & Blocks (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #15: State 2 and Blocks.
Chapter 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
More Basics of CPU Design Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
CS 105 Digital Logic Design
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Elementary Digital Logic Apps O/S Arch  Arch Logic Digital Analog.
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.
HCL and ALU תרגול 10. Overview of Logic Design Fundamental Hardware Requirements – Communication: How to get values from one place to another – Computation.
מבנה מחשב תרגול 2. 2 Boolean AND Operation Truth Table Equivalent Gate Different notations:
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
Digital Logic. 2 Abstractions in CS (gates) Basic Gate: Inverter IO IO GNDI O Vcc Resister (limits conductivity) Truth Table.
Computer Organization CS224 Fall 2012 Lesson 22. The Big Picture  The Five Classic Components of a Computer  Chapter 4 Topic: Processor Design Control.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Latches & Flip-Flops.
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.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Computer Science 101 More Devices: Arithmetic. From 1-Bit Equality to N-Bit Equality = A B A = B Two bit strings.
CS 61C L4.1.2 State (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture State and FSMs Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
Logic Design / Processor and Control Units Tony Diep.
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Number Systems and Circuits for Addition – Binary Adders Lecture 6 Section 1.5 Fri, Jan 26, 2007.
Addition, Subtraction, Logic Operations and ALU Design
CEC 220 Digital Circuit Design
1 Fundamentals of Computer Science Combinational Circuits.
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
CPU Overview Computer Organization II 1 February 2009 © McQuain & Ribbens Introduction CPU performance factors – Instruction count n Determined.
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.
Simple ALU  Half adder  Full adder  Constructing 4 bits adder  ALU does several operations  General ALU structure  Timing diagram of adder  Overflow.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
Explain Half Adder and Full Adder with Truth Table.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Appendix C Basics of Logic Design. Appendix C — Logic Basic — 2 Logic Design Basics §4.2 Logic Design Conventions Objective: To understand how to build.
Combinational Circuits
Lecture 11: Hardware for Arithmetic
Homework Reading Machine Projects Labs
ECE 331 – Digital System Design
5. Combinational circuits
Digital Logic.
Lecture 11: Hardware for Arithmetic
Homework Reading Machine Projects Labs
COMS 361 Computer Organization
Logic Circuits I Lecture 3.
Combinational Circuits
Digital Circuits and Logic
Instruction execution and ALU
Presentation transcript:

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Constructing a Computer Creating a general purpose computing device involves a lot of logic Putting together an entire processor at the gate-level isn’t very feasible For the next set of classes, we’ll put together a toolbox of useful logic circuits that we can use in our processor: –Multiplexors –Arithmetic-Logic Unit ( ALU ) –Registers –Memories

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst State Logic – D Flip-Flop A state element that is edge-sensitive –Want changes in output ONLY on the transition of the Clk signal from 0  1 (or from 1  0) D Q Q positive edge-triggered flip-flop

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Timing of Master-Slave D Flip-Flop Changes to Q occur only on the positive edge of the Clock D Clock Q D Q Q positive edge-triggered flip-flop time 

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Changes in input values are reflected immediately (subject to the speed of light and electrical delays) on the outputs Each gate has an associated “electrical delay” Delays are often ignored for the purpose of the logic design (but not for the real implementation!) As soon as inputs change, the outputs change – no memory of what happened before –(at least conceptually) Combinational Logic

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Converting Boolean Algebra into Gates C = SA + SB What does this device do? A steering device: S steers/switches A or B onto the output C

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst C = SA + SB This is a 2x1 MUX “Block box” version is 2 input by 1 bit of data multiplexor (steering device) –2 inputs requires a 1 bit selector S 2x1 MUX (Multiplexor) S B A C 0 1 S B A C 0 1 S B A C 0 1

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst ALU = Arithmetic Logic Unit –A combinational logic device that performs arithmetic and logic operations on a set of inputs (in most cases, 2) –Not clocked – slowed only by electrical delays (combinational logic) For example, if we require 4 operations: –ADD –SUB –AND –OR 1-Bit ALU

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst 1-Bit ALU (AND and OR) AND an OR are simple to implement! Need 1 bit of control to select between the two operations

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst The addition of two 1 bit inputs: What is the logic circuit for this? ABSumCarry out Bit Binary Addition

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst –The combinational logic for Sum (S) is or –The combinational logic for Carry out (C) is –These two portions together is called a “half-adder”: 1 Bit Binary Addition

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Hypothetical How would I add together two 4-bit numbers? String them together –Need some mechanism for carries

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst The addition of another 1 bit input: Carry-in Carry inABSumCarry out Bit Binary Addition

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst S = Cin A B + Cin A B + Cin A B + Cin A B = Cin(A B + A B) + Cin (A B + A B) = Cin (A  B) + Cin (A  B) = Cin  (A  B) = Cin  A  B Cout = Cin A B + Cin A B + Cin A B + Cin A B = A B + B Cin + A Cin(the “majority” function) 1 Bit Binary Addition

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst The combinational logic for Sum (S) is The combinational logic for Carry Out (C) is The result is called a “full-adder”: 1 Bit Binary Addition

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst You can design a full-adder using only 2 half-adders and a minimum of additional gates 1 Bit Binary Addition using HAs Only

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Computing S = A + B where A, B, and S are all 4-bit values Use a “cascade” of full-adders [A3:A0] and [B3:B0] are the 4 bit inputs (A3 is the MSB of A, and A0 is the LSB of A) LSB Cin  0 4-Bit Addition Detecting Overflow?

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Overflow = Cin  Cout of the full adder corresponding to the MSB Detecting Overflow

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Computing C = A - B where A, B, and C are all 4-bit values Note: C = A + (B + 1) Inputs need to be A and B LSB Cin  1 4-Bit Subtraction

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst 4 operations we wanted to implement: –ADD –SUB –AND –OR 4 operations require a 2 bit selector 1-Bit ALU Revisted

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst A 4x1 MUX provides for 4 1-bit inputs (A,B,C,D) and a single 1-bit output 4 inputs requires 2 select bits (S1 and S0) S1:S0 steer one of four inputs onto a single 1-bit output line Function table: S1S0Output 00A 01B 10C 11D 4x1 MUX

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Requires: –4x1 MUX –2x1 MUX –1 FA –1 AND –1 OR –1 NOT Design of a 1-Bit ALU FA A B Cin C1C0 Cout 0 1 C2 4x1MUX

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst C2:C1:C0 are the 3 control bits used to select the desired operation All other “control” combinations are unspecified C2C1C0ALU op 000A and B 001A or B 010A + B 110A – B Function Table for 1-Bit ALU

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst 1-Bit ALU – Black Box 1-BitALU A B Cin C2C1C0 Result Cout

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Points to ponder: –When C2:C1:C0 = 000, what is happening on “ports” 1, 2, and 3 of the 4x1 MUX? –Recall that an ALU is a combinational circuit – what does this really mean? –When C2 = 1 (and the LSB Cin = 1), the FA is subtracting –C2 = 1 for sub only ALU Design Issues

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst How to connect the 4 1-bit ALUs? Cout of previous connects to Cin of next Cin of LSB connected to C2 for for proper add/sub selection Designing a 4-Bit ALU

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst “zero-detect” implemented as “nor” of all result bits: ZD = 1 if result = 0000 ZD is useful for implementing conditional branches (BNE and BEQ) Completed 4-Bit ALU

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Suppose the ALU function table had been defined initially as follows. Try to “fix” the 1- bit ALU using a minimum amount of new hardware. C2C1C0ALU op 110A and B 011A or B 101A – B 111A + B Test Yourself

CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Requires: –4x1 MUX –2x1 MUX –1 FA –1 AND –1 OR –1 NOT Design of a 1-Bit ALU FA A B Cin C1C0 Cout 0 1 C2 4x1MUX