Physics 310 Lecture 10 Microprocessors

Similar documents
Chapter 1 CSCI

ENGIN 112 Intro to Electrical and Computer Engineering

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

COMBINATIONAL LOGIC FUNCTIONS

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

CHAPTER 2 NUMBER SYSTEMS

Why digital? Overview. Number Systems. Binary to Decimal conversion

ENGIN 112 Intro to Electrical and Computer Engineering

Information Storage and Spintronics 02

CprE 281: Digital Logic

of Digital Electronics

Logic. Combinational. inputs. outputs. the result. system can

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Chapter 1. Binary Systems 1-1. Outline. ! Introductions. ! Number Base Conversions. ! Binary Arithmetic. ! Binary Codes. ! Binary Elements 1-2

Combinational Logic. By : Ali Mustafa

Advanced Information Storage 02

Binary addition example worked out

E40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1

Digital Systems and Information Part II

Building a Computer Adder

Numbers and Arithmetic

CS1800: Hex & Logic. Professor Kevin Gold

Systems I: Computer Organization and Architecture

CSE 241 Digital Systems Spring 2013

convert a two s complement number back into a recognizable magnitude.

Numbers and Arithmetic

Logic and Computer Design Fundamentals. Chapter 5 Arithmetic Functions and Circuits

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

Combinational Logic Design Arithmetic Functions and Circuits

Negative Bit Representation Outline

Looking at a two binary digit sum shows what we need to extend addition to multiple binary digits.

DESIGN AND IMPLEMENTATION OF ENCODERS AND DECODERS. To design and implement encoders and decoders using logic gates.

UNIVERSITI TENAGA NASIONAL. College of Information Technology

CprE 281: Digital Logic

Adders - Subtractors

211: Computer Architecture Summer 2016

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Sequential Logic (3.1 and is a long difficult section you really should read!)

UNSIGNED BINARY NUMBERS DIGITAL ELECTRONICS SYSTEM DESIGN WHAT ABOUT NEGATIVE NUMBERS? BINARY ADDITION 11/9/2018

Physics 2020 Lab 5 Intro to Circuits

You separate binary numbers into columns in a similar fashion. 2 5 = 32

THE LOGIC OF COMPOUND STATEMENTS

Hakim Weatherspoon CS 3410 Computer Science Cornell University

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Combinational Logic Trainer Lab Manual

Math 31 Lesson Plan. Day 5: Intro to Groups. Elizabeth Gillaspy. September 28, 2011

CPE100: Digital Logic Design I

Counting in Different Number Systems

Addition and Subtraction

CONTENTS Page Rounding 3 Addition 4 Subtraction 6 Multiplication 7 Division 10 Order of operations (BODMAS)

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

Intro To Digital Logic

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

CPE100: Digital Logic Design I

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

ECE/CS 250 Computer Architecture

Combinational Logic. Course Instructor Mohammed Abdul kader

CPSC 121 Midterm 1 Tuesday, October 11th, 2011

UNIT II COMBINATIONAL CIRCUITS:

Read this before starting!

CHAPTER 12 Boolean Algebra

Chapter 2. Digital Logic Basics

Class Website:

Menu. Binary Adder EEL3701 EEL3701. Add, Subtract, Compare, ALU

University of Florida EEL 3701 Fall 1996 Dr. Eric M. Schwartz

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

EE 209 Logic Cumulative Exam Name:

Trinity Web Site Design. Today we will learn about the technology of numbering systems.

Introduction to digital systems. Juan P Bello

Chapter 1 :: From Zero to One

Arithmetic Circuits How to add and subtract using combinational logic Setting flags Adding faster

From Physics to Logic

Please read carefully. Good luck & Go Gators!!!

Chapter 3 Ctd: Combinational Functions and Circuits

E&CE 223 Digital Circuits & Systems. Winter Lecture Transparencies (Introduction) M. Sachdev

ECE 2300 Digital Logic & Computer Organization

Designing Information Devices and Systems II Fall 2018 Elad Alon and Miki Lustig Homework 9

Course Staff. Textbook

CHAPTER 7. Exercises 17/ / /2 2 0

hexadecimal-to-decimal conversion

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Read this before starting!

What s the Deal? MULTIPLICATION. Time to multiply

Algebra Terminology Part 1

Latches. October 13, 2003 Latches 1

for Digital Systems Simplification of logic functions Tajana Simunic Rosing Sources: TSR, Katz, Boriello & Vahid

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

Read this before starting!

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

Digital Electronics Part 1: Binary Logic

Eby, MATH 0310 Spring 2017 Page 53. Parentheses are IMPORTANT!! Exponents only change what they! So if a is not inside parentheses, then it

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T

Section 001. Read this before starting! You may use one sheet of scrap paper that you will turn in with your test.

Digital Design for Multiplication

Review: Additional Boolean operations

Parking Study MAIN ST

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course

Transcription:

Mon. 3/29 Wed. 3/31 Thurs. 4/1 Fri. 4/2 Mon. 4/5 Wed. 4/7 Thurs. 4/8 Fri. 4/9 Mon. 4/12 Wed. 4/14 Thurs. 4/15 Fri. 4/16 Project: Component Shopping Ch 13: Microprocessor Basics Intro to More Ch 13 Review Project Progress Report (due at the beginning of class) Mon. 4/19 Demonstrate Project Report & Notebook Final Exam: Thursday pril 22 nd 3:00 p.m. or Saturday pril 24 th 9:00 a.m. / 12:00 noon (we ll choose as a class) nnouncements: Parts have been ordered; they should be in later this week. Most of you didn t actually turn in your project progress reports. Please do so (I ll make photo copies and return them). 13.1 Intro: The microprocessesor is the natural conclusion of our study of digital circuitry. This is where all the thinking or processing happens inside a computer or other common electronic devices. t the time that the text was written, mircroprocessors were finding their way into our daily lives, off the desktop and into our cars, ovens, etc. Today, they ve found their way into our constant companions phones and mp3 players. 13.2 Computer rithmetic The book mentions Hexadecimal representation and bits (one data line) bytes (eight data lines) and nibbles (four data lines) as well as KB (2 10 ) and MB (2 20 ). For our purposes though, it s probably not worth focusing much on these. Computers were originally for computing / calculating, and they still do a lot of this. So a natural bridge from logic gates to computers (and microprocessors) is considering how these gates can be used to perform common computational tasks: addition, subtraction, and multiplication. Binary ddition You may recall that I d introduced the simple half adder just after we d met binary (to suggest that studying binary wasn t such a non-sequeter after studying logic gates). Now I ll use the text s notation

Inputs Outputs s 2 0 ugend B s 2 0 ddend C s 2 0 Sum ugend ddend Sum Carry + B = C 2 0 C 2 1 C s Carry to 2 1 0 + 0 = 0 0 0 + 1 = 1 0 1 + 0 = 1 0 1 + 1 = 0 1 lone, this is of fairly limited use it can at most add two one-bit numbers and thus add one plus one to get two. Before we consider how we d use gates to add two-bit binary numbers, lets first consider how we add two-bit decimal numbers. It s probably been a long time since you ve actually thought through the words you were taught in your early days of addition: six plus five 1 two plus one 1 three plus 1 equals eleven, equals three the carried 1 6 1 6 1 6 1 6 carry the one one equals +2 5 -> +2 5 -> +2 5 four +2 5 1 3 1 3 1 We essentially do the same thing when adding a two-bit binary number: we first add the lowest bits 2 0, in the process we generate the answer s lowest bit, and the carry which we carry over to add to the sum of the next lowest bit, and so on until we don t have any more bits to add. 4 1 s 2 0 ugend B s 2 0 ddend C s 2 0 Sum C s 2 0 s 2 1 ugend B s 2 1 ddend s 2 2 ugend B s 2 2 ddend C s Carry to 2 1 C s 2 1 Sum C s 2 2 Sum C s 2 1 Sum O C s 2 2 Sum C s 2 1 C s 2 2 O C So, we add the 2 0 bits and carry to the 2 1 ; we add the 2 1 bits and then add the carry in and

determine the carry out, then we add the 2 2 bit, add the carry in and determine the carry out, s for determining the carry out, the OR gate is because two additions determine the answer s 2 1 place value and either one of those (but not both) can be responsible for generating a carry to the 2 2 addition. The same thing happens when we add familiar decimal numbers. Consider these two examples, again, spelled out as if we were in third grade, Note: the carry to the 100 s place is generated now 1 1 1 1 1 1 6 9 1 6 9 1 6 9 1 6 9 +2 5 3 -> +2 5 3 -> +2 5 3 +2 5 3 2 1 2 1 2 lternatively, if we d added 149 + 253, then we wouldn t be carrying to the 100 s place until we added in the carry from the 1 s place. So, the carry to the next place can happen during either addition operation, but not during both (you only ever carry the one never carry the two.) 2 2 s 2 1 Minuend B s 2 1 Subtrahend In figure 13.4B, the book shows the inner workings of a 4-bit adder. The exact logic used is a little different from that illustrated here, but it gets the job done. With the help of some of the binary logic identities in chapter 11, one may be able to translate between the two; alternatively, the logic tables can be generated and compared. Binary Subtraction First think about how you do subtraction with multi- bit decimal numbers. Borrow 1 from 3 to make 14 Borrow 1 from 7 to make 12 7 3 4 7 2 (14) 7 2 (14) 6 (12) (14) -6 4 8-6 4 8-6 4 8-6 4 8 6 6 So, we need a borrowing mechanism for our subtraction. That has to essentially accomplish four things: a) subtract the value from the 2 n+1 bit of the Minuend, b) add it to the next 2 n bit of the Minuend, c) only do this if the 2 n bit of the Minuend is less than that of the Subtrahend, and d) actually subtract the bits. Here s the circuitry that accomplishes these tasks for one bit. Difference = {(2 1 ) b(2 1 )} B(2 1 ) b: lready Borrowed from s 2 1 by s 2 0 Borrow= What s 2 1 needed to borrow from s 2 2

Note: what the book confusingly labeled Bin, I ve labeled b: what the previous bit of already borrowed from this one. Let s see if we can reason out the truth table: Minuend s 2 1 Subtrahend B s 2 1 Borrowed from s 2 1 by s 2 0 Difference Borrowed by s 2 1 from s 2 2 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 Two s-complement rithmetic From the perspective of minimizing the amount of hardware necessary, it would be nice to be able to handle subtraction with the exact same circuitry as we use for addition. Of course, subtracting a positive number is the same as adding a negative number, so the real question is, how can we represent a negative number in binary such that when we use our adding circuitry we get the appropriate result. How do we need to represent a negative number? 1. First off, we give up the Most Significant Bit as denoting a number, instead it tells us the sign of the number, in that way we can represent both positive and negative numbers. The price we pay is that we have smaller range of numbers that we can represent. Okay, that sounds reasonable enough. Now, given that, 2. We complement all the bits replace 1 s with 0 s and vice versa (easily done with inverters on the bit s lines.) 3. We add 1 to the last bit (easily done with our addition circuitry.) First, let s perform this operation a few times, and then see that the resulting representation of a negative number adds to give the right answer. Represent -63: Represent -28: 63 = 0011 1111 28 = 0001 1100 63 = 1100 0000 28 =1110 0011 +1 +1-63=1100 0001-28=1110 0100 Now, let s add a negative number to a positive one: 63 = 0011 1111 +(-28) = 1110 0100 35 = (1) 0010 0011 (we just ditch the extra carried 1)

Chips like the 7483 can perform this task, they have preconditioning input line that tells them whether or not to form the 2 s-complement (and thus whether or not to subtract). LU rithmetic Logic Unit. popular single chip has the basic logic and mathematical operations wired in, so depending on the setting inputs, it can be set to perform one of the basic logic operations (say, NND two 4- bit inputs) or mathematical operations (say, subtract them.) Multiplication Think about how you do long multiplication that s how it s done in binary. 1 11 11 11 11 1 11 11 11 11 11 11 11 11 65 65 6 5 65 65 65 65 65 65 65 23 23 23 23 23 23 23 23 23 23 5 85 85 85 85 85 85 85 85 +110 +110 +110 +110 +110 +110 +110 195 195 195 195 195 195 00 200 +200 +200 +200 395 395 395 1100 +1100 1495 Okay, so we take the lowest bit of the one number and multiply all bits of the other number, then do the same for the next higher bit with an offset, and then add them. We do the exact same thing in binary 65 = 01000001 23 = 00010111 01000001 010000010 0100000100 00000000000 +010000010000 1495 = 10111010111 Just looking at a simple two-bit multiplier, this could be performed like this: Note that the individual multiplications are simply ND s: 1*1=1, 1*0=0 whether * means ND or Times. s 2 0 C s 2 0 s 2 1 B s 2 0 C s 2 1 C s 2 2 B s 2 2 C s 2 3