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

Similar documents
Intro To Digital Logic

Floating Point Representation and Digital Logic. Lecture 11 CS301

Introduction to Computer Engineering ECE 203

E40M. Op Amps. M. Horowitz, J. Plummer, R. Howe 1

Binary addition example worked out

E40M Capacitors. M. Horowitz, J. Plummer, R. Howe

CprE 281: Digital Logic

Advanced Information Storage 02

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

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

Combinational Logic. By : Ali Mustafa

CPE100: Digital Logic Design I

Computer organization

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

Switches: basic element of physical implementations

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

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

Chapter 1 CSCI

Learning Objectives 10/7/2010. CE 411 Digital System Design. Fundamental of Logic Design. Review the basic concepts of logic circuits. Dr.

Cs302 Quiz for MID TERM Exam Solved

Designing Information Devices and Systems II Fall 2017 Miki Lustig and Michel Maharbiz Homework 1. This homework is due September 5, 2017, at 11:59AM.

Systems I: Computer Organization and Architecture

Designing Information Devices and Systems II Spring 2018 J. Roychowdhury and M. Maharbiz Discussion 1A

of Digital Electronics

DC and Transient Responses (i.e. delay) (some comments on power too!)

ECE/CS 250 Computer Architecture

3. Design a stick diagram for the PMOS logic shown below [16] Y = (A + B).C. 4. Design a layout diagram for the CMOS logic shown below [16]

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

Fig. 1 CMOS Transistor Circuits (a) Inverter Out = NOT In, (b) NOR-gate C = NOT (A or B)

CSE 20 DISCRETE MATH. Fall

Digital Integrated Circuits

Lecture 22 Chapters 3 Logic Circuits Part 1

Chapter 1 :: From Zero to One

ECE 342 Electronic Circuits. Lecture 34 CMOS Logic

Introduction to Computer Engineering. CS/ECE 252, Spring 2017 Rahul Nayar Computer Sciences Department University of Wisconsin Madison

Information Storage and Spintronics 02

Numbers and Arithmetic

Numbers and Arithmetic

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

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

CPE100: Digital Logic Design I

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

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

Number Representation and Waveform Quantization

ENG2410 Digital Design Introduction to Digital Systems. Fall 2017 S. Areibi School of Engineering University of Guelph

Implementation of Boolean Logic by Digital Circuits

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)

Combinational Logic Trainer Lab Manual

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

ELEC Digital Logic Circuits Fall 2014 Switching Algebra (Chapter 2)

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

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Lecture 2 Review on Digital Logic (Part 1)

Fundamentals of Digital Design

Lecture 4: Implementing Logic in CMOS

CHAPTER 7. Exercises 17/ / /2 2 0

211: Computer Architecture Summer 2016

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

Schedule. ECEN 301 Discussion #25 Final Review 1. Date Day Class No. 1 Dec Mon 25 Final Review. Title Chapters HW Due date. Lab Due date.

L2: Combinational Logic Design (Construction and Boolean Algebra)

E40M Review - Part 1

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics

Semiconductor Memories

THE LOGIC OF COMPOUND STATEMENTS

Chapter 2 CMOS Transistor Theory. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

CHW 261: Logic Design

Combinational Logic Design Arithmetic Functions and Circuits

Sample Test Paper - I

EE 230 Lecture 31. THE MOS TRANSISTOR Model Simplifcations THE Bipolar Junction TRANSISTOR

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

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

Gates and Logic: From switches to Transistors, Logic Gates and Logic Circuits

hexadecimal-to-decimal conversion

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Digital Circuits, Binary Numbering, and Logic Gates Cornerstone Electronics Technology and Robotics II

ECE260: Fundamentals of Computer Engineering

EE141-Fall 2011 Digital Integrated Circuits

CSC9R6 Computer Design. Practical Digital Logic

CHAPTER 2 NUMBER SYSTEMS

CMSC 313 Lecture 17. Focus Groups. Announcement: in-class lab Thu 10/30 Homework 3 Questions Circuits for Addition Midterm Exam returned

ECE380 Digital Logic. Positional representation

ENGIN 112 Intro to Electrical and Computer Engineering

CPE100: Digital Logic Design I

10/14/2009. Reading: Hambley Chapters

Digital Electronics Part 1: Binary Logic

CMPE12 - Notes chapter 2. Digital Logic. (Textbook Chapters and 2.1)"

THE INVERTER. Inverter

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

MA 3260 Lecture 10 - Boolean Algebras (cont.) Friday, October 19, 2018.

CMOS Inverter. Performance Scaling

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING QUESTION BANK

UNIVERSITY OF CALIFORNIA, BERKELEY College of Engineering Department of Electrical Engineering and Computer Sciences

Design of Digital Circuits Reading: Binary Numbers. Required Reading for Week February 2017 Spring 2017

CS 226: Digital Logic Design

L2: Combinational Logic Design (Construction and Boolean Algebra)

Introduction to CMOS VLSI Design Lecture 1: Introduction

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

Transcription:

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

Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2

Useless Box Lab Project #2 Adding a computer to the Useless Box alows us to write a program to control the motor (and hence the box). To control the motor we need to study and use MOS transistors since our computer cannot drive the motor directly. The computer (Arduino) uses Boolean logic and CMOS logic gates to implement software we write for it. The MOS transistors amplify the Arduino output to control the motor. M. Horowitz, J. Plummer, R. Howe 3

Last Lecture: MOSFETs nmos It is a switch which connects source to drain If the gate-to-source voltage is greater than V th (around 1 V) Positive gate-to-source voltages turn the device on. pmos It is a switch which connects source to drain If the gate-to-source voltage is less than V th (around -1 V) Negative gate-to-source voltages turn the device on and there s zero current into the gate! M. Horowitz, J. Plummer, R. Howe 4

Last Lecture: MOSFET models Are very interesting devices Come in two flavors pmos and nmos Symbols and equivalent circuits shown below Gate terminal takes no current (at least no DC current) The gate voltage * controls whether the switch is ON or OFF gate R on gate pmos nmos ON when V G is LOW ON when V G is HIGH * actually, the gate to source voltage, V GS M. Horowitz, J. Plummer, R. Howe 5

CMOS NOR = NOT-OR Gate V DD V B V A V O V A V B A, V A B, V B V OUT, OUT 0, 0 V 0, 0 V 0, 0 V 1, 5 V 1, 5 V 0, 0 V 1, 5 V 1, 5 V OUT =!(A B) M. Horowitz, J. Plummer, R. Howe 6

Last Lecture: Logic Gates V DD V A V Out V DD V Out V A V B M. Horowitz, J. Plummer, R. Howe 7

Logic Gates Deal With Binary Signals Wires can have only two values Binary values, 0, 1; or True and False Generally transmitted as: Vdd = 1 V; Gnd = 0 Vdd is the power supply, 1V to 5 V Gnd is the reference level, about 0V A B AND 0 0 0 0 1 0 1 0 0 1 1 1 (A && B) <-> AND So how do we represent: Numbers, letters, colors, etc.? M. Horowitz, J. Plummer, R. Howe 8

Logic Gates Deal With Binary Signals Wires can have only two values Binary values, 0, 1; or True and False Generally transmitted as: Vdd <-> 1; Gnd <-> 0 Vdd is the power supply, 1V to 5 V Gnd is the reference level, about 0V A B OR 0 0 0 0 1 1 1 0 1 1 1 1 (A B) = OR So how do we represent: Numbers, letters, colors, etc.? M. Horowitz, J. Plummer, R. Howe 9

Binary Numbers To represent anything other than true and false You are going to need more then one bit Group bits together to form more complex objects 8 bits are a byte, and can represent a character (ASCII) 24 bits are grouped together to represent color 8 bits for R, G, B. 16 or 32 or 64 bits are grouped together and can represent an integer M. Horowitz, J. Plummer, R. Howe 10

Binary Numbers For decimal numbers Each place is 10 n 1, 10, 100, 1000 Since there are 10 possible values of digits 10 2 10 1 10 0 1 4 5 Decimal = 145 For binary numbers Each digit is only 0, 1 (only two possible digits) The place values are then 2 n 1, 2, 4, 8, 16, It is useful to remember that 2 10 = 1024 2 2 2 1 2 0 1 0 1 Decimal = 2 2 + 2 0 = 5 M. Horowitz, J. Plummer, R. Howe 11

Binary Numbers Operation Output Remainder 23/2 7 0 23 23/2 6 0 23 23/2 5 0 23 23/2 4 1 7 23/2 3 0 7 23/2 2 1 3 23/2 1 1 1 23/2 0 1 0 23 in binary is 00010111 Carry 1 1 11 1 0 1 1 3 0 0 1 1 Addition (14) 1 1 1 0 Add by carrying 1s Subtract by borrowing 2s. See class reader M. Horowitz, J. Plummer, R. Howe 12

Binary Numbers One can think of binary numbers as a kind of code: In communications and information processing, code is a system of rules to convert information such as a letter, word, sound, image, or gesture into another form or representation, sometimes shortened or secret, for communication through a channel or storage in a medium. https://en.wikipedia.org/wiki/code M. Horowitz, J. Plummer, R. Howe 13

Many Different Types of Codes Figuring out good codes is a big part of EE Security Error correction Compression.mp3,.mp4,.jpeg,.avi, etc. Are all a code of the source.zip Whole theory of information (Information theory) guides codes Sets what is possible and not possible (Claude Shannon) M. Horowitz, J. Plummer, R. Howe 14

Binary Code Advantages Uses a small number of bits, log2(n), to represent a number Easy to generate and decode Easy to do math on this representation Disadvantages The value is in the clear (the data is not encrypted) If any bit is in error, the number is lost If you use more bits, can recover from single bit error Can only represent one number per value Let s say we would like to drive a display with 64 lights M. Horowitz, J. Plummer, R. Howe 15

How To Represent Negative Numbers? Could create sign / magnitude code Add one bit to be the sign bit 7 00000111-7 10000111 But that is not what works out best To add two numbers, you first need to look at the sign bits If they are the same, add If they are different, subtract M. Horowitz, J. Plummer, R. Howe 16

Two s Complement Numbers Positive numbers are normal binary Negative numbers are defined so when we add them to Num, a normal adder will give zero So -1 = 1111111111111111-2 = 1111111111111110 Carry 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1-3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 Addition 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 M. Horowitz, J. Plummer, R. Howe 17

Generating Two s Complement Numbers Take your number Invert all the bits of the number Make all 0 s 1 s and all 1 s 0 s And then add 1 to the result Lets look at an example: 42 0 0 1 0 1 0 1 0 Flip 1 and 0 1 1 0 1 0 1 0 1 Add 1 1 1 0 1 0 1 1 0 So -42 in two s complement is 11010110 M. Horowitz, J. Plummer, R. Howe 18

The Way This Works M. Horowitz, J. Plummer, R. Howe 19

Funny Things Happen With Finite Numbers Your homework looks at some problems with numbers having only have a finite number of bits Computers generally have two types of numbers Signed numbers, and unsigned numbers It interprets the MSB differently Can get interesting results if you mistake A signed number as unsigned and vice versa Also overflows have an interesting effect Can add two positive numbers and get a negative result! M. Horowitz, J. Plummer, R. Howe 20

Overflow Situations M. Horowitz, J. Plummer, R. Howe 21

Time Multiplexing In the LED cube we will have 64 LEDs but they are wired so we can access rows and columns of the matrix. We ll explore a different type of coding later that will allow us to control each LED individually, even though we do not have a separate connection to each of them! M. Horowitz, J. Plummer, R. Howe 22

Learning Objectives Understand how binary numbers work And be able to convert from decimal to binary numbers Understand what Electrical Engineers mean by a code It is a set of rules to represent information How to use two s complement codes To represent positive and negative numbers And what happens when an overflow occurs M. Horowitz, J. Plummer, R. Howe 23