CS101 Lecture 05: Logic Gates and Binary Addition

Similar documents
Gates, Circuits, and Boolean Algebra

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

Binary Adders: Half Adders and Full Adders

Let s put together a Manual Processor

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

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

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

Circuit diagrams and symbols (1)

Lesson Plan for Electric Circuits

Lab 1: Full Adder 0.0

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.

Logic in Computer Science: Logic Gates

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

Two's Complement Adder/Subtractor Lab L03

Lecture 8: Synchronous Digital Systems

COMBINATIONAL CIRCUITS

Systems I: Computer Organization and Architecture

Logic gates. Chapter. 9.1 Logic gates. MIL symbols. Learning Summary. In this chapter you will learn about: Logic gates

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

Upon completion of unit 1.1, students will be able to

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

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

Digital circuits make up all computers and computer systems. The operation of digital circuits is based on

Chapter 2 Logic Gates and Introduction to Computer Architecture

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

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

HOMEWORK # 2 SOLUTIO

Section 1.4 Place Value Systems of Numeration in Other Bases

Lecture #21 April 2, 2004 Relays and Adder/Subtractors

The components. E3: Digital electronics. Goals:

CHAPTER 3 Boolean Algebra and Digital Logic

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Digital Electronics Detailed Outline

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

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

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

Student Exploration: Circuits

Physics. Cambridge IGCSE. Workbook. David Sang. Second edition Cambers & Sibley: IGCSE Physics Cover. C M Y K

Understanding Logic Design

Figure 8-1 Four Possible Results of Adding Two Bits

6.004 Computation Structures Spring 2009

Programming Logic controllers

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

(1) /30 (2) /30 (3) /40 TOTAL /100

Light Bulbs in Parallel Circuits

Gray Code Generator and Decoder by Carsten Kristiansen Napier University. November 2004

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Combinational circuits

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

A New Paradigm for Synchronous State Machine Design in Verilog

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Basic Logic Gates Richard E. Haskell

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

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

Experiment 4 ~ Resistors in Series & Parallel

CS101 Lecture 24: Thinking in Python: Input and Output Variables and Arithmetic. Aaron Stevens 28 March Overview/Questions

Sistemas Digitais I LESI - 2º ano

Parallel DC circuits

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

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

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

ELEC EXPERIMENT 1 Basic Digital Logic Circuits

Mixed Logic A B A B. 1. Ignore all bubbles on logic gates and inverters. This means

Ladder and Functional Block Programming

PHYSICS 111 LABORATORY Experiment #3 Current, Voltage and Resistance in Series and Parallel Circuits

BINARY CODED DECIMAL: B.C.D.

CSE140 Homework #7 - Solution

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

CS311 Lecture: Sequential Circuits

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

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

Systems I: Computer Organization and Architecture

CS101 Lecture 19: Internetworking. What You ll Learn Today

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Uses of Energy. reflect. look out!

Electrical Symbols and Line Diagrams

Chapter 2. Binary Values and Number Systems

Floating Point Fused Add-Subtract and Fused Dot-Product Units

Study Guide for Apprentice Battery Electrician Test

Circuits and the Flow of Electricity

Design and Development of Virtual Instrument (VI) Modules for an Introductory Digital Logic Course

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

Using Logic to Design Computer Components

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

After opening the Programs> Xilinx ISE 8.1i > Project Navigator, you will come to this screen as start-up.

6. BOOLEAN LOGIC DESIGN

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Photoillustration: Harold A. Perry; photos: Jupiter Images

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

CHAPTER 11 LATCHES AND FLIP-FLOPS

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

Series and Parallel Circuits

Electronics Technology

Multiplexers Two Types + Verilog

4-bit binary full adder with fast carry CIN + (A1 + B1) + 2(A2 + B2) + 4(A3 + B3) + 8(A4 + B4) = = S1 + 2S2 + 4S3 + 8S4 + 16COUT

Ohm's Law and Circuits

Circuits and Boolean Expressions

Electricity is such a common part of our lifestyle that we tend to forget the amazing

Transcription:

CS101 Lecture 05: Logic Gates and Binary Addition Logic Gates Binary Number Addition Some images copyright Jones and Bartlett Thanks to Charles Petzold for some diagrams and ideas Aaron Stevens (azs@bu.edu) 28 January 2013 What You ll Learn Today Review: How do we add in binary? Some fundamentals of electric circuitry Using electric circuits to implement logic What is the relationship between binary numbers and electronic computation? Why should you care? This is what a computer actually does! 2 1

Binary: Add with Carry Remember that there are only 2 digits in binary, 0 and 1 1 + 1 is 0 with a carry of 1 Operands! 1 1 0!! 0 1 1 1!! + 0 0 1 0!! 1 0 0 1! Carry Values Sum Hint: work right to left. 3 14 An 8-bit Adder Consider this 8-bit adder: Notice how the carry out from one bit s adder becomes the carry-in to the next adder. http://faculty.mc3.edu/pvetere/applets/applets/binaryadd/applet_frame.htm 4 2

A binary Adding Machine http://www.youtube.com/watch?v=gcdshwmhf4a Anatomy of a Flashlight A flashlight has 3 main components: A battery A bulb A conductor (e.g. wire) 6 3

Anatomy of a Flashlight Here the wires are connected, which forms a sort of circle, called a circuit. The circuit allows electrons to move from a source to a sink. Along the way, the bulb is lit. 7 Edison s First Rule of Electricity You cannot make electricity flow without a plug. or, more precisely: Electric current flows through a closed circuit. If the wire is not connected, the circuit is said to be open, and the electrons don t flow.* *of course, electrons can flow through the air (e.g. lightning, arcs, etc.) but let s keep it simple for now 8 4

Light Switch Circuits We will now consider several examples to demonstrate some techniques for wiring circuits with light switches. This link brings up a great animated/interactive version, but I ve reproduced still pictures on the following slides. http://www.charlespetzold.com/blog/2007/09/logicalswitches.xaml http://www.charlespetzold.com/blog/2007/09/threewayswitch.xaml 9 Switches in Series Consider this arrangement, called wiring in series. (the light is off) 10 5

Switches in Series Now we close one switch (e.g. connect the wire) (the light is still off) 11 Switches in Series Now we close the other switch (e.g. connect the wire) (the light is still off) 12 6

Switches in Series Now we close both switches (e.g. connect the wire) (now the light is on) 13 Switches in Series: Summary Left Switch Right Switch Light Bulb OFF OFF OFF OFF ON OFF ON OFF OFF ON ON ON Light is on if and only if both switches were closed (on). 14 7

Building Blocks These wiring arrangements are the fundamental building blocks of computer circuitry. Each switch has 2 states (on or off) Each light bulb has 2 states (on or off) We can abstractly describe switches and bulbs as each having a 1 bit state. 15 Building Blocks Gates (not Bill) Simple electric circuits which perform like our light switch examples. The input values explicitly determine the output values. We assume the switch is controlled by a electronic input rather than a physical switch. 16 8

Describing Gates and Circuits We describe gates and circuits using: Logic diagrams A graphical representation of a circuit; each gate has its own symbol. Truth tables A table showing all possible input value and the associated output values. 17 AND Gate The AND gate accepts two input signals. The output is 1 if and only if both inputs are 1. Otherwise the output is 0. Just like wiring in series. 18 9

Switches in Parallel Now let s try connecting the switches a little differently. Consider this arrangement, called wiring in parallel. (the light is off) 19 Switches in Parallel Now we close just the top switch. (the light came on!) 20 10

Switches in Parallel Or we just the bottom switch. (the light is still on!) 21 Switches in Parallel Or we close both switches! (the light is still on!) 22 11

Switches in Parallel: Summary Top Switch Bottom Switch Light Bulb OFF OFF OFF OFF ON ON ON OFF ON ON ON ON Light is on if either switch alone, or both switches together are closed (on). 23 OR Gate The OR gate accepts two input signals. The output is 1 if either input is 1. The output is 0 if both inputs are 0. Just like wiring in parallel. 24 12

A 3-Way Switch Consider this arrangement, called wiring a 3-way switch. Both switches are to the left (the light is off). 25 A 3-Way Switch Now we have one switch left, one switch right. (the light is on). 26 13

A 3-Way Switch Now we have one switch right, one switch left. (the light came one) 27 A 3-Way Switch Now we have both switches to the right. (now the light is off again) 28 14

3 Way Switch: Summary Left Switch Right Switch Light Bulb LEFT LEFT OFF LEFT RIGHT ON RIGHT LEFT ON RIGHT RIGHT OFF Light is on if and only if one switch is left and the other switch is right 29 XOR Gate An XOR gate accepts two input signals. When the 2 inputs differ, the output is 1 When both inputs are the same, the output is 0 Just like wiring with a 3-way switch. 30 15

Summary: Logic Gates Recall: gates control the flow of electric current. AND Gate (wiring in series) Output is on if BOTH inputs are on OR Gate (wiring in parallel) Output is on if EITHER input is on XOR Gate (3-way switch) Output is on if switches DIFFER from each other Output is off if switches are SAME as each other 31 What You Learned Today 00000010 + 00000010 = 00000100 Circuits Basic logic gates (AND, OR, XOR) 32 16

Announcements And To Do Readings: Reed chapter 7, pp121-131 Wikipedia: http://en.wikipedia.org/wiki/vlsi (introductory remarks about gates on integrated circuits) HW02 due Wednesday 1/30 Quiz 1 on Friday 2/1 Covers material from lectures 1-4 (i.e., not including today) 33 17