CS140 Lecture 03: The Machinery of Computation: Combinational Logic

Slides:



Advertisements
Similar presentations
Chapter 4 Gates and Circuits.
Advertisements

Chapter 4 Gates and Circuits Nell Dale • John Lewis.
Part 4: combinational devices
Chapter 4 Gates and Circuits.
Gates and Circuits Nell Dale & John Lewis (adaptation by Erin Chambers and Michael Goldwasser)
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Chapter 4 Gates and Circuits.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
Chapter 4 Gates and Circuits.
9/19/06 Hofstra University – Overview of Computer Science, CSC005 1 Chapter 4 Gates and Circuits.
Lecture 3. Boolean Algebra, Logic Gates
Any logic circuits can be transformed to an implementation where only NAND gates (and inverters) are used. The general approach to finding a NAND-gate.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Lecture 3. Boolean Algebra, Logic Gates Prof. Sin-Min Lee Department of Computer Science 2x.
Chapter 4 Gates and Circuits. 4–2 Chapter Goals Identify the basic gates and describe the behavior of each Describe how gates are implemented using transistors.
Chapter 4 Gates and Circuits.
CS231: Computer Architecture I Laxmikant Kale Fall 2004.
Quiz # 2 Chapters 4, 5, & 6.
CS 1308 – Computer Literacy and the Internet. It’s Not Magic  The goal of the next series of lectures is to show you exactly how a computer works. 
Chapter 4 Gates and Circuits. Integrated Circuits aka CHIPS What’s in this thing???? 4–2.
Chapter 4 Gates and Circuits.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Chapter 2: Binary Logic.
Binary Addition CSC 103 September 17, 2007.
CSCI-235 Micro-Computers in Science Hardware Design Part I.
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
CPS120: Introduction to Computer Science
Digital Components and Combinational Circuits Sachin Kharady.
CSC321 Where We’ve Been Binary representations Boolean logic Logic gates – combinational circuits Flip-flops – sequential circuits Complex gates – modules.
Multiplexers 1 The output is equal to one of several input signals to the circuit The multiplexer selects which input signal to use as an output signal.
Adders Half-adder  Adds two bits Produces a sum and carry  Problem: Cannot use it to build larger inputs Full-adder  Adds three 1-bit values Like half-adder,
CSCI-100 Introduction to Computing Hardware Design Part I.
Arithmetic Logic Unit (ALU) Anna Kurek CS 147 Spring 2008.
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
Digital Logic. 2 Abstractions in CS (gates) Basic Gate: Inverter IO IO GNDI O Vcc Resister (limits conductivity) Truth Table.
1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition.
CS 1308 – Computer Literacy and the Internet Building the CPU.
Digital Logic Structures: Chapter 3 COMP 2610 Dr. James Money COMP
Magnitude Comparator Dr. Ahmed Telba.
COMBINATIONAL LOGIC.
Introduction to Computing Systems and Programming Digital Logic Structures.
Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit.
Logic Gates Dr.Ahmed Bayoumi Dr.Shady Elmashad. Objectives  Identify the basic gates and describe the behavior of each  Combine basic gates into circuits.
1 Review of Boolean algebra Not is a horizontal bar above the number –0 = 1 –1 = 0 Or is a plus –0+0 = 0 –0+1 = 1 –1+0 = 1 –1+1 = 1 And is multiplication.
Week 1: Introduction and Logic gates IT3002 – Computer Architecture
Logic Gates Unit 16.
Basics of Logic gates - Part 2
Dr.Ahmed Bayoumi Dr.Shady Elmashad
Dr.Ahmed Bayoumi Dr.Shady Elmashad
CS 270: Mathematical Foundations of Computer Science
CS231: Computer Architecture I
Combinational Circuits
Instructor: Alexander Stoytchev
NAND-ONLY LOGIC CIRCUITS
Chapter 4 Gates and Circuits.
CS140 Lecture 02a: The Machinery of Computation: Circuits and Gates
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Fundamentals of Computer Science Part i2
CISC101 Reminders Your group name in onQ is your grader’s name.
Week 7: Gates and Circuits: PART II
Digital Logic.
Number Systems and Circuits for Addition
Logic Gates.
Logic Gates.
Digital Logic.
CS231: Computer Architecture I
CS231: Computer Architecture I
XOR Function Logic Symbol  Description  Truth Table 
Half & Full Subtractor Half Subtractor Full Subtractor.
Half & Full Subtractor Half Subtractor Full Subtractor.
Presentation transcript:

CS140 Lecture 03: The Machinery of Computation: Combinational Logic John Magee 25 January 2017 Some material copyright Jones and Bartlett Some slides credit Aaron Stevens

Overview/Questions What did we do last time? Can we relate this circuit stuff to something we know something about? How can we combine these elements to do more complicated tasks? By combining several gates, we create logic-computing circuits. Logic-computing circuits can do binary number addition.

What did we talk about last time? Circuits control the flow of electricity. Gates are simple logical systems.

Integrated Circuits Integrated circuit (also called a chip) A piece of silicon on which multiple (many) gates have been embedded. Silicon pieces are mounted on a plastic or ceramic package with pins along the edges that can be soldered onto circuit boards or inserted into appropriate sockets

Integrated Circuits

Central Processor Units The most important integrated circuit in any computer is the Central Processing Unit, or CPU. The Intel Duo Core 2 ® processor has more than 1.9 billion (1.9 * 109) gate transistors on one chip. The CPU combines many gates, to enable a small number of instructions. Examples: Add/subtract 2 binary inputs Load a value from memory Store a value into memory

Combinational Circuits Combines some basic gates (AND, OR, XOR, NOT) into a more complex circuit. Outputs from one circuit flow into the inputs of another circuit. The input values explicitly determine the output values.

Combinational Circuits Three inputs require eight rows to describe all possible input combinations (23 = 8): This same circuit using a Boolean expression is (AB + AC)

Recall Binary Number Addition Adding two 1-bit numbers together produces A sum bit A carry bit

Binary Number Addition Look closely at the values for Sum and Carry… Do they look like any of the gates we’ve seen?

A Circuit for Binary Addition Sum = A XOR B Carry = A AND B This circuit is called a half-adder. (It doesn’t take a carry-in.)

Full Adder Circuit The full adder takes 3 inputs: A, B, and a carry-in value Figure 4.10 A full adder

Recall Binary Number Addition Adding two 1-bit numbers together produces A sum bit A carry bit http://www.cs.bu.edu/courses/cs101/labs/ECS_2e/Applets/APPLETS/BINARYADD/applet_frame.htm

The Full Adder Here is the Full Adder, with its internal details hidden (an abstraction). What matters now are: inputs are A, B, and CI. outputs are S and CO

An 8-bit Adder To add two 8-bit numbers together, we need an 8-bit adder: Notice how the carry out from one bit’s adder becomes the carry-in to the next adder.

An 8-bit Adder We can abstract away the 1-bit adders, And summarize with this diagram: Notice the inputs and outputs.

Output from the Adder The adder produces 2 outputs: Sum (multi-bit), Carry Out (1-bit) Where does the output go from here? Accumulator A circuit connected to an adder, which stores the adder’s result.

Putting it Together The accumulator is a memory circuit, and is wired as both an output from the adder and an input back into the adder.

Accumulator Example Suppose we want to add 3 numbers: Clear the accumulator (set to all 0s) Load the first input into the adder Compute the sum of accumulator + input Result flows back into accumulator Go to step 2 with next input

Input to the Adder The adder takes inputs A, B are two binary numbers (Carry-in should be 0) Our nand2tetris adder will be slightly different How do we feed numbers into the adder? Random Access Memory A large memory unit which stores data before/after processing.

What about Subtraction? 2s complement Recall that binary subtraction is accomplished by adding the 2s complement of a number. Inverter A circuit built using NOT gates, which inverts all bits – turning 1s into 0s and 0s into 1s. The inverter creates a 1s complement of its input. Adding 1 to this gives a 2s complement number, suitable for doing subtraction. (How could we add 1 to the inverted number?)

What about Subtraction? In nand2tetris world: Note that x – y = –(-x + y) Since we don’t need to store intermediate results, this can be done in 1’s complement: Flip the bits of x (this computes –x in 1’s complement) Add y Flip the bits of the result

From Adding Machine… What we’ve got is an machine that can do addition/subtraction in circuitry. It can read data from memory, and write data back to memory. We haven’t dealt with how to: Specify from which address memory to read. Specify which operation to perform (add/subtract). Specify to which address to write.

Take-Away Points Combination gates Half-Adder Full Adder Adder Inverter Accumulator The adder is the fundamental circuit of a computer used in every operation. An combination of the adder, inverter, accumulator circuits can add/subtract. Instructions are required to control which operation to do, and on which data. The von Neumann Architecture reads instructions from memory, just like data; enabled programmability of digital computer.