I. Computational Logic and the Five Basic Logic Gates 1

Similar documents
Logic Symbols with Truth Tables INVERTER A B NAND A B C NOR C A B A B C XNOR A B C A B Digital Logic 1

Chapter # 1: Introduction

Combinational Circuits DC-IV (Part I) Notes

Logic Gates with Boolean Functions

Spec. Instructor: Center

COMBINATIONAL CIRCUIT

COMPUTER ORGANIZATION & ARCHITECTURE DIGITAL LOGIC CSCD211- DEPARTMENT OF COMPUTER SCIENCE, UNIVERSITY OF GHANA

Digital Electronics. Functions of Combinational Logic

Chapter # 1: Introduction

Positive and Negative Logic

Logic diagram: a graphical representation of a circuit

ANALOGUE AND DIGITAL ELECTRONICS STUDENT S WORKBOOK U3: DIGITAL ELECTRONICS

Combinational Logic Circuits. Combinational Logic

Chapter 1: Digital logic

CHAPTER 5 DESIGN OF COMBINATIONAL LOGIC CIRCUITS IN QCA

Lesson 21: If-Then Moves with Integer Number Cards

In this lecture: Lecture 3: Basic Logic Gates & Boolean Expressions

ELECTRICAL ENGINEERING - TEACHER MODULE 1 LOGIC GATES

Gates and Circuits 1

Satish Chandra, Assistant Professor, P P N College, Kanpur 1

Synthesis of Combinational Logic

Chapter 3 Describing Logic Circuits Dr. Xu

First Optional Homework Problem Set for Engineering 1630, Fall 2014

PREVIEW COPY. Digital Logic Systems. Table of Contents. Digital Logic Fundamentals...3. Logic Building Blocks Medium- and Large-Scale ICs...

Topic Notes: Digital Logic

Digital Electronics Course Objectives

Chapter 4 Logic Functions and Gates

Lab Report: Digital Logic

SYNTHESIS OF COMBINATIONAL CIRCUITS

Module 4: Design and Analysis of Combinational Circuits 1. Module-4. Design and Analysis of Combinational Circuits

A B. 1 (a) (i) Fig shows the symbol for a circuit component. Fig Name this component. ... [1]

UNIT-IV Combinational Logic

EE 330 Lecture 5. Basic Logic Circuits Complete Logic Family Other Logic Styles. complex logic gates

EE 330 Lecture 5. Basic Logic Circuits Complete Logic Family Other Logic Styles. Improved Device Models. complex logic gates pass transistor logic

Introduction to System Block Algebra

Analog, Digital, and Logic

CHAPTER 3 BASIC & COMBINATIONAL LOGIC CIRCUIT

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

DIGITAL ELECTRONICS: LOGIC AND CLOCKS

Chapter 4 Combinational Logic Circuits

Digital Logic Circuits

Chapter 4 Combinational Logic Circuits

Operational amplifiers

(a) (b) (c) (d) (e) (a) (b) (c) (d) (e)

Designing Information Devices and Systems I Spring 2019 Lecture Notes Note Introduction to Electrical Circuit Analysis

2 Logic Gates THE INVERTER. A logic gate is an electronic circuit which makes logic decisions. It has one output and one or more inputs.

Digital Fundamentals

EE 330 Lecture 5. Other Logic Styles Improved Device Models Stick Diagrams

Surreal Numbers and Games. February 2010

Navy Electricity and Electronics Training Series

Data output signals May or may not be same a input signals

Digital Fundamentals 9/4/2017. Summary. Summary. Floyd. Chapter 3. The Inverter

EK307 Lab 3 Spring Lab Assignment 3 Logic Gates

In this lecture: Lecture 8: ROM & Programmable Logic Devices

EE40 Lecture 35. Prof. Chang-Hasnain. 12/5/07 Reading: Ch 7, Supplementary Reader

LOGIC MODULES INTRODUCTION

Digital Circuits Introduction

05/11/2006. Lecture What does a computer do? Logic Manipulation. Data manipulation

Digital Fundamentals

The Problem. Tom Davis December 19, 2016

Gates and and Circuits

UNIT III. Designing Combinatorial Circuits. Adders

Digital Fundamentals 8/29/2016. Summary. Summary. Floyd. Chapter 3 A X. The Inverter

Digital Fundamentals

Structural VHDL Implementation of Wallace Multiplier

An Optimized Wallace Tree Multiplier using Parallel Prefix Han-Carlson Adder for DSP Processors

LogicBlocks & Digital Logic Introduction

Linear & Digital IC Applications (BRIDGE COURSE)

Digital Electronics. A. I can list five basic safety rules for electronics. B. I can properly display large and small numbers in proper notation,

Designing Information Devices and Systems II Fall 2017 Note 1

Function Table of 74LS138, 3-to-8 Decoder +5V 6 G1 4 G2A 5 G2B. 4-to-16 Decoder using two 74LS139, 3-to-8 Decoder

Lecture 14: Datapath Functional Units Adders

Lecture #1. Course Overview

LOGIC GATES AND LOGIC CIRCUITS A logic gate is an elementary building block of a Digital Circuit. Most logic gates have two inputs and one output.

LogicBlocks & Digital Logic Introduction a

5. (Adapted from 3.25)

L_sson 9 Subtracting across zeros

Grade 7/8 Math Circles Game Theory October 27/28, 2015

EECS 150 Homework 4 Solutions Fall 2008

Classwork Example 1: Exploring Subtraction with the Integer Game

Computer Hardware Engineering (IS1200) Computer Organization and Components (IS1500) Fall 2017 Lecture 7: Combinational Logic

Approximate Hybrid Equivalent Circuits. Again, the impedance looking into the output terminals is infinite so that. conductance is zero.

(CSC-3501) Lecture 6 (31 Jan 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

This Figure here illustrates the operation for a 2-input OR gate for all four possible input combinations.

DESIGN OF 4 BIT BINARY ARITHMETIC CIRCUIT USING 1 S COMPLEMENT METHOD

Experiment # 4. Binary Addition & Subtraction. Eng. Waleed Y. Mousa

MANIPULATIVE MATHEMATICS FOR STUDENTS

6.111 Lecture # 19. Controlling Position. Some General Features of Servos: Servomechanisms are of this form:

Analysis procedure. To obtain the output Boolean functions from a logic diagram, proceed as follows:

EE100Su08 Lecture #16 (August 1 st 2008)

CS61c: Introduction to Synchronous Digital Systems

;UsetJand : Llto Record the truth. LAB EXERCISE 6.1 Binary Adders. Materials. Procedure

Experiment 9 : Pulse Width Modulation

Computer Organization and Components

Synthesis of Balanced Quaternary Reversible Logic Circuit

A C E. Answers Investigation 4. Applications. Dimensions of 39 Square Unit Rectangles and Partitions. Small Medium Large

Grade 6/7/8 Math Circles April 1/2, Modular Arithmetic

Design and Implementation of 16-Bit Magnitude Comparator Using Efficient Low Power High Performance Full Adders

Binary Adder and Subtractor circuit

Digital Applications (CETT 1415) Credit: 4 semester credit hours (3 hours lecture, 4 hours lab) Prerequisite: CETT 1403 & CETT 1405

Transcription:

EC312 Lesson 2: Computational Logic Objectives: a) Identify the logic circuit gates and reproduce the truth tables for NOT, ND, NND, OR, and NOR gates. b) Given a schematic of a logic circuit, determine the corresponding oolean expression for the circuit output. c) Identify the functional computing components, such as an adder, that are made of logic gates. d) Define the term cyber-physical system (CPS) and provide two examples. e) Demonstrate the ability to write simple C programs that perform keyboard input, screen output and simple arithmetic.* f) Discuss the role of the operating system in bridging the gap between hardware and user applications and services.* g) Demonstrate the ability to create, edit, compile and execute C programs in a Linux environment.* h) Demonstrate the ability to analyze C programs that employ if-else statements and for loops.* [*Note: objectives (e)-(h) are review objectives that cover material which students have already learned in SI110 and ES200/202. ssigned questions in the first two homework sets will assist students in reviewing this material.] I. Computational Logic and the Five asic Logic Gates 1 Computers work with the binary number system; i.e. everything comes down to 1 s and 0 s. The two digits of the binary number system can be represented by the state or condition of electrical or electronic devices. For example, a binary 1 can be represented by a switch that is closed, a lamp that is lit, or a transistor that is conducting, and a binary 0 would be represented by the same devices in the opposite state: the switch open, the lamp off, or the transistor in cut-off. Of course, a computer doesn t just store data; it manipulates the data and produces desired outcome based on certain programmed logic statements. (Think about the if-else and for statements in C.) nother way to say this is that computers use the TRUE and FLSE logic conditions of a logical statement to make a programmed decision. Kind of convenient, since TRUE and FLSE can be represented as 1 and 0! ut here s the main question: how do you build a circuit (after all, a CPU is just a really, really complex electrical circuit) that can evaluate logical statements? That s what we want to explore. 1. Digital concepts of logic The conditions of a statement can be represented by symbols (variables); for instance, the statement Navy beat rmy this year might be represented by the symbol P. If Navy actually beat rmy, then P is TRUE. If Navy did not beat rmy, then P is FLSE. s you can see, a statement has two conditions. In computers, these two conditions are represented by electronic circuits operating in two LOGIC STTES. These logic states are 0 (zero) and 1 (one). Respectively, 0 and 1 represent the FLSE and TRUE conditions of a statement. When the TRUE and FLSE conditions are converted to electrical signals, they are referred to as LOGIC LEVELS called HIGH and LOW. The 1 state might be represented by the presence of an electrical signal (HIGH), while the 0 state might be represented by the absence of an electrical signal (LOW). If the statement Navy beat rmy this year is FLSE, then the statement Navy did NOT beat rmy this year must be TRUE. This is called the COMPLEMENT of the original statement. In the case of computer 1 Portions of these lesson notes were adapted from the Navy Electricity and Electronics Training Series (NEETS) course notes, Module 13, September 1998. 1

math, complement is defined as the opposite or negative form of the original statement or variable. The complement is shown by placing a bar over the statement symbol (in this case, P). This variable is spoken as NOT P. The following table illustrates this concept and the relationship with logic states and logic levels. Example: ssume Navy beat rmy STTEMENT SYMOL CONDITION LOGIC STTE LOGIC LEVEL Original: NVY ET RMY Complement: NVY DID NOT ET RMY P TRUE 1 HIGH P FLSE 0 LOW In some cases, more than one variable is used in a single expression. For example, the expression CD is spoken " ND ND NOT C ND D." 2. The fundamental logic gates s you study logic circuits, you will see a variety of symbols (variables) used to represent the inputs and outputs. The purpose of these symbols is to let you know what inputs are required for the desired output. logic function produces the correct output based on the given inputs. In this section we ll study the fundamental logic functions that form the basis for all computation: ND, OR, NOT, NND, and NOR. We ll also study the electronic devices used to implement these logic functions, which are known as logic gates (or, more informally, gates). These gates are the foundation for all digital equipment, and they make up the "decision-making" circuits of computers and other types of digital equipment. a. The ND gate Let s hearken back to EE331 (yes, a long long time ago, back to last semester ) and consider the circuit in Figure 1. If we think of the state of switch and switch as our device inputs (0=open, 1=closed) and the state of the LED as our device output, we can apply our finely tuned analysis tools to determine that the LED will only turn on if both and are closed. ll other cases will result in the LED remaining off. The corresponding logic gate is known as the ND gate. Letting denote the state of the LED (0=off, 1=on), we can summarize our results in the truth table shown below on the left. truth table is just a table that depicts the output for every possible combination of inputs. Figure 1: ND Circuit The logic symbol for an ND gate is also shown below, as well as the associated oolean expression (which is just a fancy name for expressions that result in TRUE/FLSE outputs). Truth Table for ND gate Logic Symbol for ND gate oolean expression for ND gate 0 0 0 0 1 0 1 0 0 1 1 1 2 =

Note that an ND gate can have more than two inputs. In this situation, all combinations result in a 0 output except for the case where every input is 1 (i.e. High). (I.e., an ND gate requires a unanimous vote.) b. The OR gate Now let s consider the circuit shown in Figure 2, again viewing our two switches as inputs and the LED as the output. In this case, the LED will light (i.e. =1) if either the first switch or the second switch is closed (or if both are closed). In fact, the only case in which the LED won t light is if both switches are open. The corresponding logic gate is known as the OR gate. The truth table, logic symbol, and oolean expression for the OR gate are shown below. Figure 2: OR Circuit Truth Table for OR gate Logic Symbol for OR gate oolean expression for OR gate 0 0 0 0 1 1 1 0 1 1 1 1 = + c. The NOT gate NOT gate (also known as an INVERTER), is a logic device that has an output opposite of the input. (We encountered this gate already, at the end of the last lesson.) It may be used alone or in conjunction with other gates. The truth table, logic symbol, and oolean expression for the NOT gate are shown below. Truth Table for NOT gate Logic Symbol for NOT gate oolean expression for NOT gate 0 1 1 0 = d. The NND gate The next gate is simply the combination of the NOT gate introduced in Lesson 1 with the ND gate. This is known as a NND gate, which is the exact opposite of the ND gate, i.e., the output is always 1 (i.e. High) except for the case where both inputs are high. The truth table, logic symbol, and oolean expression for the NND gate are shown below. (Note that the logic symbol for the NND gate looks exactly like the ND symbol, except for the small circle at the output. The small circle denotes a NOT gate, i.e. the NND is equivalent to an ND with a NOT.) 3

Truth Table for NND gate Logic Symbol for NND gate oolean expression for NND gate 0 0 1 0 1 1 1 0 1 1 1 0 = e. The NOR gate y now you re probably getting the picture of how this works. The NOR gate, which is equivalent to an OR gate connected in series with a NOT gate. The truth table, logic symbol, and oolean expression for the NOR gate are shown below. Truth Table for NOR gate Logic Symbol for NOR gate oolean expression for NOR gate 0 0 1 0 1 0 1 0 0 1 1 0 = + Practice Problem Fill in the truth table for the logic circuit shown below. 3. Logic gates in combination Most logic circuit diagrams are made up of many combinations of gates, with the outputs of some gates serving as inputs for others. t first it may seem confusing and complex, but if you interpret one gate at a time, you can work your way through any network. Typically, our goal when analyzing a logic circuit is to determine the oolean expression of the output and its corresponding truth table. This is best taught by example, so let s consider the logic circuit shown in Figure 3. 4

C Figure 3: Example Circuit Here the outputs of the ND gate and the NOT gate become the inputs for the OR gate, so that the final output will go High if either C is Low or both ND are High. The best way to tackle analyzing such a circuit is to take it one gate at a time from left to right, writing the oolean expression at each output and working our way to the final output. In this case, we know that the output of the ND gate is, and the output of the NOT gate is C, and therefore the final output is given by = + C, as shown in Figure 4. Figure 4: Example Circuit with Equations It s important to write out the intermediate outputs at each gate, even if you think you can just eye it up. Many logic circuits are much more complex than this one, and it s easy to make a mistake if you don t approach this methodically. To generate the truth table, it s best to simply include additional columns for the intermediate gate outputs, to help you determine the final gate output. For the example shown here, we ll include a column for the quantity as well as the NOT gate output C, and then we can use our OR rules to determine the expression for. The final truth table is shown to the below. C C 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 1 How did we know how many rows to put in our truth table? If we have a total of N inputs to the system (in this case N=3 because we have inputs,, C), then we need 2. rows. You ll note that we filled in the inputs for those rows by simply counting up from 000 to 111 in binary. Then we can determine the quantity by applying the rules of our ND truth table, we get C by inverting C, and we get the output by applying our OR truth table rules to the values in the column and the C column. 5

Practice Problem For the logic circuit given below, determine the oolean expression for the output, and construct the corresponding truth table. C Note that there are other (easier) ways to simplify oolean expressions based on certain laws and identities, but that s beyond the scope of this course. However, if you re interested, you should search online for Simplifying oolean Expressions and see the amazing methods that have been developed! 4. Computing Components Combinational logic can produce many useful circuits. We will examine a basic adder circuit (half adder). half adder takes two single digit binary numbers and adds them together. See the circuit in Figure 5where and are the inputs and S is sum and C is the carryover. Figure 5: Half dder Circuit Practice Problem For the half adder circuit shown in Figure 5, determine the oolean expression for the output C and S. C= S= 6

Practice Problem For the half adder circuit shown in Figure 5, determine the construct the truth table to show that the half adder works properly. Cout S The half adder can be used to add two one bit numbers but when adding multiple bit numbers, you need to be able to carry in a 1 from a previous addition. This is effectively adding three one bit numbers. For example, adding 101 and 11 results in: 111 101 + 011 1000 In this example there are carry ins in the second and third bit additions. To be a fully functional adder, we need to be able to handle a carry in the previous digit. The circuit below adds this feature. Figure 6: Full dder Circuit 7

Practice Problem For the full adder circuit shown in Figure 6, determine the oolean expression for the output Cout and S. Cout= S= Combining many of these circuits you can make a 4-bit adder: 3 3 2 2 1 1 0 0 C in C out Full dder C in C out Full dder C in C out Full dder C in C out Full dder C in C out S 3 S 2 S 1 S 0 Figure 7: Cascaded 4-bit Full dder Similarly, circuits can be made to subtract, multiply, divide, etc. In a modern computer these devices are contained within an arithmetic logic unit (LU) and are used as the building blocks of a computer, which we will be working on programming in the following lessons. II. Cyber-physical Systems (CPS) When you think of computing, you probably think of your issued laptop (which we make you lug to EC312 class) or a desktop computer in one of your classrooms. Most of this course will focus on those types of systems, but it s important that we consider computing (and its vulnerabilities to cyber attack) in other contexts. For instance, consider your car. (Yes, you wish you could park it on the Yard, but at least you can have one!) Did you know that a typical modern automobile may have up to 100 million lines of computer code? 2 s ruce Emaus, the chairman of SE International s embedded software standards committee, puts it in the previously cited article, It would be easy to say the modern car is a computer on wheels, but it s more like 30 or more computers on wheels. Computers and physical systems are increasingly being connected together. The National Science Foundation describes Cyber-physical Systems (CPS) as systems which integrate sensing, computation, control and networking into physical objects and infrastructure, connecting them to the Internet and to each other (http://www.nsf.gov/news/special_reports/cyber-physical/). In other words, this is the tight intertwining of cyber (i.e. software, networks, digital data) with the physical world (e.g. motors, sensors, actuators). Sounds like something that Systems Engineers would be interested in! Examples include bionic limbs, automated damage control systems, self-driving vehicles, etc. Check out http://cyberphysicalsystems.org/ for a big picture Concept Map of CPS and their various applications and research areas. 2 Jim Motavalli. The Dozens of Computers That Make Modern Cars Go (and Stop). The New York Times 24 Feb 2010 (ccessed online). 8