Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

Similar documents
Introduction to Digital Logic Missouri S&T University CPE 2210 Registers

Introduction to Digital Logic Missouri S&T University CPE 2210 Hardware Implementations

Tailoring the 32-Bit ALU to MIPS

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

Microcomputers. Outline. Number Systems and Digital Logic Review

Arithmetic Logic Unit. Digital Computer Design

COMP 303 Computer Architecture Lecture 6

Binary Adders. Ripple-Carry Adder

VARUN AGGARWAL

REGISTER TRANSFER LANGUAGE

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CPS 104 Computer Organization and Programming

An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit

carry in carry 1101 carry carry

EE292: Fundamentals of ECE

END-TERM EXAMINATION

Week 7: Assignment Solutions

Integer Multiplication and Division

Experiment 7 Arithmetic Circuits Design and Implementation

Arithmetic Logic Unit

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

CS222: Processor Design

Timing for Ripple Carry Adder

Code No: R Set No. 1

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR

Let s put together a Manual Processor

9 Multiplication and Division

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

Number Systems and Computer Arithmetic

Review from last time. CS152 Computer Architecture and Engineering Lecture 6. Verilog (finish) Multiply, Divide, Shift

Injntu.com Injntu.com Injntu.com R16

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

Basic Arithmetic (adding and subtracting)

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

CPE300: Digital System Architecture and Design

D I G I T A L C I R C U I T S E E

Computer Organization

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Computer Architecture and Organization: L04: Micro-operations

Prachi Sharma 1, Rama Laxmi 2, Arun Kumar Mishra 3 1 Student, 2,3 Assistant Professor, EC Department, Bhabha College of Engineering

Computer Architecture Set Four. Arithmetic

Digital Logic Design Exercises. Assignment 1

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Recitation Session 6

Chapter 3 Arithmetic for Computers

This tutorial gives a complete understanding on Computer Logical Organization starting from basic computer overview till its advanced architecture.

By, Ajinkya Karande Adarsh Yoga

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

Chapter 5: Computer Arithmetic

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Week 6: Processor Components

ELCT 501: Digital System Design

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Addition and multiplication

R10. II B. Tech I Semester, Supplementary Examinations, May

Chapter 10 Binary Arithmetics

Combinational Circuits

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

Chapter 4 Arithmetic Functions

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

Digital Design with FPGAs. By Neeraj Kulkarni

Computer Logical Organization Tutorial

Combinational Logic Circuits

SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

UPY14602-DIGITAL ELECTRONICS AND MICROPROCESSORS Lesson Plan

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

Code No: R Set No. 1

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

Module 2: Computer Arithmetic

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8

BINARY SYSTEM. Binary system is used in digital systems because it is:

CONTENTS CHAPTER 1: NUMBER SYSTEM. Foreword...(vii) Preface... (ix) Acknowledgement... (xi) About the Author...(xxiii)

Lecture 8: Addition, Multiplication & Division

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Embedded Systems Entry Test

Parallel logic circuits

CHW 261: Logic Design

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

ECE 341. Lecture # 6

Systems Programming. Lecture 2 Review of Computer Architecture I

WELCOME TO. ENGR 303 Introduction to Logic Design. Hello my name is Dr. Chuck Brown

UNIT - V MEMORY P.VIDYA SAGAR ( ASSOCIATE PROFESSOR) Department of Electronics and Communication Engineering, VBIT

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

Transcription:

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers Egemen K. Çetinkaya Egemen K. Çetinkaya Department of Electrical & Computer Engineering Missouri University of Science and Technology cetinkayae@mst.edu http://web.mst.edu/~cetinkayae/teaching/cpe2210fall2016 11 November 2016 rev. 16.0 2014 2016 Egemen K. Çetinkaya

Introduction Multipliers Dividers ALUs Summary Multipliers/Dividers Outline 2

Digital Logic Systems Overview Combinatorial logic circuits for no memory systems Boolean algebra to mathematically design/analyze logic gates are building blocks Sequential logic circuits for memory systems Finite State Machines to mathematically design/analyze flip-flops and latches store memory flip-flops and latches are building blocks of sequential logic Sequential logic circuits (aka controllers) combine combinatorial circuits storage elements (e.g. registers) 3

Digital Systems Components analog phenomena electric signal A2D digital data digital data sensors and other inputs Digital System D2A electric signal actuators and other outputs digital data digital data Transducer: sensor + actuator Not all sensors/actuators require A2D/D2A conversion Digital system can be implemented: microprocessor readily available, cheap, easy to program, easy to reprogram custom circuit smaller, faster, consume less power 4

Digital Systems Paths Digital systems have two paths: datapath circuit control circuit Datapath circuit store data manipulate data transfer data from one part to another Control circuit controls the operation of datapath circuit 5

Datapath Components Building Block examples Registers Shifters Counters/timers Multiplexer/demultiplexers Decoders/encoders Adders Comparators Subtractors Multipliers/dividers ALUs: Arithmetic Logic Units 6

Adders Half-Adder Adds two bits, generates sum bit and carry-out bit Lets try to design the circuit: Next steps? Implement as a circuit co = ab, s = a b a b A: 1 1 1 1 + B: 0 1 1 b a ci c o s 0 1 1 b a ci c o s 1 0 1 b a ci c o s 0 0 b a c o s 1 SUM a b Half-adder (HA) co s co s 7

Adders Full-Adder Adds three bits, generates sum bit and carry-out bit Lets try to design the circuit: Next steps? Implement as a circuit co = ab + ac + bc s = a b c a b Full-adder (FA) co s ci a b Full adder (FA) c o ci s 8

Adders Carry-Ripple Adder Carry-ripple adder: Uses half- and full-adders E.g.: 4-bit carry-ripple adder can build any size adder based on full- and half-adders a3 b3 a2 b2 a1 b1 a0 b0 a b ci a b ci a b ci a b F A F A F A HA a3 a2 a1 a0 b3 b2 b1 b0 c o s c o s c o s c o s 4-bit adder c o s3 s2 s1 s0 c o s3 s2 s1 s0 9

Adders Carry-Ripple Adder Carry-ripple adder: Can also use only full-adders E.g.: 4-bit carry-ripple adder a3 b3 a2 b2 a1 b1 a0 b0 ci a b ci a b ci a b ci a b ci a3 a2 a1 a0 b3 b2 b1 b0 F A F A F A F A 4-bit adder ci c o s c o s c o s c o s c o s3 s2 s1 s0 c o s3 s2 s1 s0 10

Comparison Half-Adder vs. Half-Subtractor HA operation: a+b s = a b co = ab HS operation: b a D = a b B = b a a b a b a b a b Half-adder (HA) co s Halfsubtractor B D co s B D 11

Comparison Full-Adder vs. Full-Subtractor FA operation: a+b+c s = a b c co = ab + ac + bc FS operation: b a Bi D = b a Bi Bo = b (a Bi) + abi a b ci a b Bi Full adder (FA) (FS) c o s B o D 12

Subtractors Subtraction via 2 s Complements Subtraction via adding 2 s complement A B = A + ( B) A B = A + (2 s complement of B) A B = A + (inverted B + 1) A B N-bit A Adder B cin 1 S 13

Lets shift left one Shift Register Shift Left Operation Example Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 14

Lets shift left one Shift Register Shift Left Operation Example Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 After moving one bit to left? 15

Lets shift left one Shift Register Shift Left Operation Example Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 After moving one bit to left 1 1 0 1 1 0 1 0 dropped the MSB added 0 for LSB 16

Lets shift left 2-bits Shift Register Shift Left Operation Example 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift left After second shift left 17

Lets shift left 2-bits Shift Register Shift Left Operation Example 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift left 1 1 0 1 1 0 1 0 After second shift left 18

Lets shift left 2-bits Shift Register Shift Left Operation Example 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift left 1 1 0 1 1 0 1 0 After second shift left 1 0 1 1 0 1 0 0 19

Shift Register Shift Left Operation Example What was the arithmetic operation we just did? Egemen K. Çetinkaya 20

Shift Register Shift Left Operation Example Shift left n-bits will multiply by 2 n Egemen K. Çetinkaya 21

Shift Register Shift Right Operation Example Lets shift right one Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 22

Shift Register Shift Right Operation Example Lets shift right one Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 After moving one bit to right? 23

Shift Register Shift Right Operation Example Lets shift right one Egemen K. Çetinkaya 0 1 1 0 1 1 0 1 After moving one bit to right 0 0 1 1 0 1 1 0 Added 0 for MSB dropped the LSB 24

Shift Register Shift Right Operation Example Lets shift right 2-bits 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift right After second shift right 25

Shift Register Shift Right Operation Example Lets shift right 2-bits 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift right 0 0 1 1 0 1 1 0 After second shift right 26

Shift Register Shift Right Operation Example Lets shift right 2-bits 0 1 1 0 1 1 0 1 Egemen K. Çetinkaya After first shift right 0 0 1 1 0 1 1 0 After second shift right 0 0 0 1 1 0 1 1 27

Shift Register Shift Right Operation Example What was the arithmetic operation we just did? Egemen K. Çetinkaya 28

Shift Register Shift Right Operation Example Shift right n-bits will divide by 2 n Egemen K. Çetinkaya 29

Division via Shift Signed Number Example Previous examples were unsigned numbers Need to preserve the sign for signed numbers Consider A = 24 = 011000 A/2 = 24/2 = 12 = 001100 A/4 = 24/4 = 6 = 000110 Consider A = 24 = 101000 A/2 = 24/2 = 12 = 110100 A/4 = 24/4 = 6 = 111010 30

Multipliers Multiplication Operation Multiplication product via multiplicand and multiplier Multiplicand M Multiplier Q (14) (11) 1 1 1 0 1 0 1 1 Product P (154) 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1 0 1 0 0 1 1 0 1 0 31

Multipliers Multiplication Operation Multiplication results in partial products Multiplicand M Multiplier Q (14) (11) 1 1 1 0 1 0 1 1 Partial product 1 + 1 1 1 0 1 1 1 0 Partial product 2 + 1 0 1 0 1 0 0 0 0 Partial product 3 + 0 1 0 1 0 1 1 1 0 Product P (154) 1 0 0 1 1 0 1 0 32

Multiplier Circuit Array Style Multiplier Multiplication by hand can be mimicked 33

Multiplier Circuit Array Style Multiplier Generalized representation of multiplication by hand 34

pp4 pp3 pp2 pp1 Egemen K. Çetinkaya Multiplier Circuit Array Style Multiplier a3 a2 a1 a0 b0 b1 0 0 b2 + (5-bit) 0 0 b3 0 0 0 + (6-bit) A P B + (7-bit) p7..p0 Block symbol 35

Dividers Division Operation Dividend divided by divisor resulting in Q and R 00001111 15 Divisor 1001 10001100 9 140 1001 9 10001 50 1001 45 10000 5 1001 1110 1001 101 Quotient Dividend Remainder 36

A/B produces Q and R Divider Circuit Array Style Divider The most significant bit of the dividend A then becomes the least significant bit of R. The divisor B is repeatedly subtracted from this partial remainder to determine whether it fits. More info [HH2013] [EL2004] 37

ALUs Arithmetic Logic Units Arithmetic Logic Unit (ALU) ALUs performs Boolean and arithmetic functions Performs operations on n-bit operands e.g. 4-bit addition, subtraction e.g. 8-bit addition, subtraction Functions include on TI 74S381 ALU chip: Clear, A B, A+B, XOR, OR, AND, Preset 38

Multipliers/Dividers Summary Many multipliers design exists Division is a slow and expensive operation Need to preserve the sign for signed numbers when doing multiplication/division via shifting ALUs performs Boolean and arithmetic functions 39

References and Further Reading [V2011] Frank Vahid, Digital Design with RTL Design, VHDL, and Verilog, 2nd edition, Wiley, 2011. [BV2009] Stephen Brown and Zvonko Vranesic, Fundamentals of Digital Logic with VHDL Design, 3rd edition, McGraw-Hill, 2009. [G2003] Donald D. Givone, Digital Principles and Design, McGraw-Hill, 2003. [HH2013] David Harris and Sarah Harris, Digital Design and Computer Architecture, 2nd edition, Morgan Kaufmann, 2013. [EL2004] Miloš D. Ercegovac and Tomás Lang, Digital Arithmetic, 1st edition, Morgan Kaufmann, 2004. 40

End of Foils 41