Design of the ALU Adder, Logic, and the Control Unit

Similar documents
Binary Adders: Half Adders and Full Adders

Let s put together a Manual Processor

(Refer Slide Time: 00:01:16 min)

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Systems I: Computer Organization and Architecture

CSE140 Homework #7 - Solution

Lecture 8: Synchronous Digital Systems

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

CHAPTER 3 Boolean Algebra and Digital Logic

Module 3: Floyd, Digital Fundamental

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

exclusive-or and Binary Adder R eouven Elbaz reouven@uwaterloo.ca Office room: DC3576

3.Basic Gate Combinations

A New Paradigm for Synchronous State Machine Design in Verilog

Adder.PPT(10/1/2009) 5.1. Lecture 13. Adder Circuits

Asynchronous counters, except for the first block, work independently from a system clock.

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

Understanding Logic Design

Sistemas Digitais I LESI - 2º ano

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Logic Gates and Introduction to Computer Architecture

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Programming Logic controllers

Systems I: Computer Organization and Architecture

Microprocessor & Assembly Language

FORDHAM UNIVERSITY CISC Dept. of Computer and Info. Science Spring, Lab 2. The Full-Adder

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Two's Complement Adder/Subtractor Lab L03

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Counters and Decoders

Chapter 5 Instructor's Manual

An Efficient RNS to Binary Converter Using the Moduli Set {2n + 1, 2n, 2n 1}

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

Digital Electronics Detailed Outline

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Lab 1: Full Adder 0.0

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

NEW adder cells are useful for designing larger circuits despite increase in transistor count by four per cell.

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

Counters. Present State Next State A B A B

Basic Logic Gates Richard E. Haskell

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Lecture 5: Gate Logic Logic Optimization

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Gates & Boolean Algebra. Boolean Operators. Combinational Logic. Introduction

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

TYPES OF COMPUTERS AND THEIR PARTS MULTIPLE CHOICE QUESTIONS

Figure 8-1 Four Possible Results of Adding Two Bits

Gates, Circuits, and Boolean Algebra

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

MICROPROCESSOR AND MICROCOMPUTER BASICS

CMOS Binary Full Adder

VHDL Test Bench Tutorial

LSN 2 Computer Processors

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

Flip-Flops, Registers, Counters, and a Simple Processor

Binary full adder. 2-bit ripple-carry adder. CSE 370 Spring 2006 Introduction to Digital Design Lecture 12: Adders

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring I-Before-E, Continued

Logic in Computer Science: Logic Gates

Base Conversion written by Cathy Saxton

Traditional IBM Mainframe Operating Principles

CPU Organisation and Operation

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

CHAPTER 7: The CPU and Memory

Odyssey of the Mind Technology Fair. Simple Electronics

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

Implementation of Modified Booth Algorithm (Radix 4) and its Comparison with Booth Algorithm (Radix-2)

(Refer Slide Time: 2:03)

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

Lecture 8: Binary Multiplication & Division

BOOLEAN ALGEBRA & LOGIC GATES

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Chapter 11 Number Theory

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

Decimal Number (base 10) Binary Number (base 2)

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

Section 1.4 Place Value Systems of Numeration in Other Bases

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

Circuits and Boolean Expressions

The string of digits in the binary number system represents the quantity

1.6 The Order of Operations

COMBINATIONAL CIRCUITS

Design: a mod-8 Counter

DEPARTMENT OF INFORMATION TECHNLOGY

Step Response of RC Circuits

Student Outcomes. Lesson Notes. Classwork. Discussion (10 minutes)

Objective. Materials. TI-73 Calculator

47 Numerator Denominator

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

İSTANBUL AYDIN UNIVERSITY

=

Transcription:

Design of the ALU Adder, Logic, and the Control Unit This lecture will finish our look at the CPU and ALU of the computer. Remember: 1. The ALU performs the arithmetic and logic operations. 2. The control unit causes the CPU to do what the program says to do. We begin by reviewing the binary adder, and discussing ways to speed it up. Page 1 of 23

The Binary Adder Here is a diagram of the full adder we discussed in the previous lecture. Note the timings on the output. After the input is valid, the carry out is valid two gate delays later. the sum is valid three gate delays later. Page 2 of 23

Another Full Adder Implementation Here is an implementation in Rob Williams s book. Note the timings. The sum is faster, but the carry out is slower. The carry out timing is more important. Page 3 of 23

A Four Bit Ripple Carry Adder Here is the symbol we often use for a full adder. It has three inputs and two outputs. Here is a four bit adder built from these elements. It has the timings added. Note that the correct value of the carry ripples from right to left. The sum bit is valid only after nine gate delays. NOTE: It is the time to propagate the carry values that makes this slow. If it were not for this problem with the carry, all values would be valid at T = 3. For that reason, we favor designs that produce the carry bit more quickly. Page 4 of 23

The Four Bit Adder as a Building Block Here is a block diagram of the four bit adder with its timings. Here is a 16 bit adder built from four of these building blocks. Note its timings. Consider an N bit adder. The high order sum bit is S N 1, produced in 2 (N 1) + 3 gate delays. In general, a ripple carry adder produces a valid N bit sum after 2 N + 1 gate delays. Page 5 of 23

A 32 bit sum requires 65 gate delays, about 65 to 130 nanoseconds. Much too slow! The Carry Look Ahead Adder Modern adders achieve greater speed by generating the carry in to higher bits more quickly. The standard design is a variant of the carry look ahead adder. Here is a taste of what that design does. In our ripple carry adder, the carry bits are generated independently and propagate. This takes time. Here: C 1 = A 0 B 0 + A 0 C 0 + B 0 C 0 = A 0 B 0 + (A 0 + B 0 ) C 0 Likewise: C 2 = A 1 B 1 + (A 1 + B 1 ) C 1 // Wait 2 gate delays to get C 1 right. Why not C 2 = A 1 B 1 + (A 1 + B 1 ) [A 0 B 0 + (A 0 + B 0 ) C 0 ] = A 1 B 1 + (A 1 + B 1 ) A 0 B 0 C 0 + (A 1 + B 1 ) (A 0 + B 0 ) C 0 This is messy, but it is achievable in three gate delays, not the four listed above. Page 6 of 23

The Carry Look Ahead Adder (Part 2) We can extend these equations to any carry bit, but let s focus on four bits. The notation is much simpler if we adopt standard notation: G k = A k B k P k = A k + B k We can now write the above two equations (and the two others) as C 1 = G 0 + P 0 C 0 C 2 = G 1 + P 1 G 0 + P 1 P 0 C 0 C 3 = G 2 + P 2 G 1 + P 2 P 1 G 0 + P 2 P 1 P 0 C 0 C 4 = G 3 + P 3 G 2 + P 3 P 2 G 1 + P 3 P 2 P 1 G 1 + P 3 P 2 P 1 P 0 C 0 This may look messy, but note the following 1. Each value of G k and P k can be computed independently, at the same time, in only one gate delay. 2. Each of C 1, C 2, C 3, and C 4 can be calculated in two more gate delays, for a total of three gate delays for each. Page 7 of 23

3. Using Rob Williams s circuit S k = [A k B k ] C k, the sum can be computed two gate delays after the carry is valid. Each sum in 5 gate delays. Comparison of Ripple Carry and Carry Look Ahead This slide shows the relative timings of the two designs for a four bit adder. The timings are identical for a circuit that both adds and subtracts. The ripple carry adder The carry look ahead adder. Page 8 of 23

This illustrates a classic design trick, used constantly in the development of modern computers. Adding more hardware enables tricks to speed up the circuitry. Page 9 of 23

A More Realistic Design Theoretically, the carry look ahead adder can compute a 16 bit sum in 5 gate delays. Such a design would require a few hundred basic gates. It would be hard to farbricate. A more realistic design would be based on connecting four bit adders. Here is the comparison. The ripple carry design. The carry look ahead design. Page 10 of 23

This is about 2.4 times as fast as the original. Standard design tricks can be applied to make it again twice as fast, thus five times as fast as the ripple carry adder. Controlling the ALU The Control Unit (CU) is the part of the CPU that issues signals to cause the computer to do what the program instructs it to do. In the next few slides, we shall investigate how control signals are applied to the Arithmetic Logic Unit (ALU). In each of the next few slides, the ALU will be considered to have two inputs (A and B) and one output (C). The figure below uses the standard symbol for an ALU. We begin with a very simple three function ALU and develop the design from there. 1. C = A B 2. C = A + B Page 11 of 23

3. C = A B A real ALU must do more than this, but we just want to get an idea of its control. Three Control Signals for Three Functions A control signal is a binary signal with two values: asserted and not asserted. These control signals are asserted high; TRUE (1) = Asserted and FALSE (0) = Not asserted. A control signal is often labeled by the action it enables: here and, not, and xor. Page 12 of 23

If one of these signals is asserted, the corresponding function is placed on line C. If more than one signal is asserted, the circuit malfunctions. Encoding the Control Signals One way to insure that two or more control signals are not asserted at the same time is to specify a binary code for every action. Page 13 of 23

The codes are 00 Do nothing 01 Exclusive OR 10 AND 11 OR The Do Nothing Option Note that output 0 of the decoder is not attached to anything. Page 14 of 23

When the function code is 00, the ALU does not place anything on its output. Why not specify another useful function, such as the logical NOT? In order to see the answer, we must remember that the ALU must function in context. Here, there are a number of devices that can put output onto the common bus. When another device is called on to assert data on the bus, the ALU must not assert anything. Page 15 of 23

The Shift Unit The shift unit is part of the ALU. Its function is to shift data. There are three types of shifts: Logical shifts Arithmetic shifts Circular shifts The shift operations are very useful, though they may seem a bit strange at first. Shift operations do not correspond to any logical operators. Shift operations do not directly correspond to any arithmetic operators, though the arithmetic shifts can be made to be equivalent to multiplication and division by powers of two. The shift operations just move bits within a register. Double shift operations move bits within a pair of registers. Page 16 of 23

NOTE: For simplicity, we use 8 bit examples. We assume that bit 7 is the sign bit if the 8 bit example illustrates signed integers. Page 17 of 23

Simple Logical Shifts Here are some examples of simple logical shifts, in which a 0 is shifted into the vacated spot. The original value in binary: 1001 0110 The original value right shifted one place: 0100 1011 The original value right shifted two places 0010 0101 The original value in binary: 1001 0110 The original value left shifted one place: 0010 1100 The original value left shifted two places 0101 1000 Here are two single bit logical shifts. Logical Left Shift Logical Right Shift Page 18 of 23

Note that the sign bit can be changed by a logical shift Arithmetic Shifts Arithmetic shifts are similar to logical, except that the sign bit is preserved. Here are two illustrations of a sequence of arithmetic shifts on positive and negative numbers. Right Arithmetic Shift Left Arithmetic Shift The right shift does resemble division by 2 until one gets to either 1 or 1. Page 19 of 23

The left shift occasionally resembles multiplication by 2. Note 2 104 = 208 = 128 + 80. If the value goes outside of the range [ 128, 127], shifting is not equivalent to multiplication. Circular Shifts Here the bits are wrapped around; nothing is lost. In this example, a left circular shift by N bits is the same as a right circular shift by (8 N). For 32 bits, the equivalence is N and (32 N). Page 20 of 23

Double Shifts Here is an arithmetic right double shift as might be implemented on the IBM Mainframe. In this architecture 1. Integer registers are numbered 0 through 15, and identified by number. 2. Double register shifts are applied to even odd pairs, such as (8, 9) or (10, 11). If the pair below were (4, 5), the instruction might be SRDA 4, 1. Most architectures support six types of double shifts: three double left shifts and three double right shifts. Each of left and right can be logical, arithmetic, or circular. Page 21 of 23

A Four Bit Circular Barrel Shifter A barrel shifter can do all of the shifting in one step. An N bit barrel shifter is implemented with N 2 tri state buffers. For this reason, it is hard to draw large barrel shifters. Here is the example, with 3 options: no shift, circular left by 1, and circular right by 1. Page 22 of 23

Page 23 of 23