Digital Circuits and Logic

Slides:



Advertisements
Similar presentations
Part 4: combinational devices
Advertisements

Control path Recall that the control path is the physical entity in a processor which: fetches instructions, fetches operands, decodes instructions, schedules.
Arithmetic Logic Unit (ALU)
Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Chapter 4 Gates and Circuits.
Computer Processing CSCE 110 J. Michael Moore.
J. Michael Moore Computer Processing CSCE 110. J. Michael Moore ProcessorInputOutput Memory Storage.
16/07/2015CSE1303 Part B lecture notes 1 Hardware Implementation Lecture B17 Lecture notes section B17.
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Chapter 4 Gates and Circuits.
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. 
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
SUPLEMENTARY CHAPTER 1: An Introduction to Digital Logic The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
CPS120: Introduction to Computer Science
School of Computer Science G51CSA 1 Computer Systems Architecture Fundamentals Of Digital Logic.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
1 DIGITAL ELECTRONICS. 2 OVERVIEW –electronic circuits capable of carrying out logical (boolean) and arithmetic operations on information stored as binary.
1 Boolean Algebra & Logic Gates. 2 Objectives Understand the relationship between Boolean logic and digital computer circuits. Learn how to design simple.
Digital Logic Structures MOS transistors logic gates functional units of a computer.
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
CHAPTER-2 Fundamentals of Digital Logic. Digital Logic Digital electronic circuits are used to build computer hardware as well as other products (digital.
CS 1308 – Computer Literacy and the Internet Building the CPU.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
Concepts of Engineering and Technology Copyright © Texas Education Agency, All rights reserved.
Introduction to Computing Systems and Programming Digital Logic Structures.
Logic Gates Dr.Ahmed Bayoumi Dr.Shady Elmashad. Objectives  Identify the basic gates and describe the behavior of each  Combine basic gates into circuits.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Appendix C Basics of Logic Design. Appendix C — Logic Basic — 2 Logic Design Basics §4.2 Logic Design Conventions Objective: To understand how to build.
Week 1: Introduction and Logic gates IT3002 – Computer Architecture
GCSE Computing - The CPU
Invitation to Computer Science, C++ Version, Fourth Edition
Dr.Ahmed Bayoumi Dr.Shady Elmashad
CS 270: Mathematical Foundations of Computer Science
DIGITAL LOGIC CIRCUITS
Instructor:Po-Yu Kuo 教師:郭柏佑
Chap 7. Register Transfers and Datapaths
The Central Processing Unit
THE CPU i Bytes 1.1.
Chapter 4 The Von Neumann Model
Basics of digital systems
DIGITAL LOGIC CIRCUITS
Computer Architecture
Invitation to Computer Science, Java Version, Third Edition
Chapter 4 The Von Neumann Model
Lecture 3 Boolean Algebra and Digital Logic Lecture Duration: 2 Hours
Chapter 4 The Von Neumann Model
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
Chapter 4 Gates and Circuits.
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Fundamentals of Computer Science Part i2
How does the CPU work? CPU’s program counter (PC) register has address i of the first instruction Control circuits “fetch” the contents of the location.
Digital Logic Structures Logic gates & Boolean logic
CS/COE0447 Computer Organization & Assembly Language
Week 7: Gates and Circuits: PART II
Instructor:Po-Yu Kuo 教師:郭柏佑
Levels in Processor Design
The Processor Lecture 3.1: Introduction & Logic Design Conventions
Levels in Processor Design
CS231: Computer Architecture I
Logic Circuits I Lecture 3.
Digital Logic Circuits
Levels in Processor Design
Electronics for Physicists
XOR Function Logic Symbol  Description  Truth Table 
Levels in Processor Design
GCSE Computing - The CPU
Information Representation: Machine Instructions
Chapter 4 The Von Neumann Model
Presentation transcript:

Digital Circuits and Logic Gates Combinatorial logic adder ALU Sequential logic flip-flop memory CPU fetch-decode-execute cycle 17/05/2019 CMPUT 229

How to make a computer Computers are electronic equipment contain many connected electronic components memory Central Processing Unit (CPU) specialized devices (network, video, etc.) components largely made of circuits containing wires and gates 17/05/2019 CMPUT 229

Logic Level one (1) / zero (0) A Boolean logical signal always takes one of two logic levels. on / off high (H) / low (L) one (1) / zero (0) true (T) / false (F) positive / negative Why two levels ? Why not use, say, 4 levels? For example, electrical voltage as 0 v, 5v, 10v, and 20v 17/05/2019 CMPUT 229

Gates Tiny electronic switches made of transistors implement Boolean logic 0/1  low/high voltage digital for given inputs, produce known output according to truth table represented in circuit diagrams by symbols 17/05/2019 CMPUT 229

Gates NOT In Out 1 1 17/05/2019 CMPUT 229

Gates 1 Out In 2 In 1 AND 17/05/2019 CMPUT 229

Gates NAND In 1 In 2 Out 1 1 1 1 1 1 1 17/05/2019 CMPUT 229

Gates OR 1 Out In 2 In 1 17/05/2019 CMPUT 229

Gates 1 Out In 2 In 1 XOR 17/05/2019 CMPUT 229

Implementation of Logic Gates The NAND gate, the basic logic gate easier to manufacture any other logic gate can be made from a combination of NAND gates 17/05/2019 CMPUT 229

17/05/2019 CMPUT 229

Implementation of Logic Gates CMOS The standard, 4000 series (4011) 17/05/2019 CMPUT 229

Implementation of Logic Gates TTL The 4011's TTL counterpart is the 7400 17/05/2019 CMPUT 229

Logic Circuits Combinatorial Logic Sequential logic Output depends solely on the input values Example: arithmetic logic unit (ALU) Sequential logic output depends on the present input, and the history of the input Examle: Flip-flop, Memory 17/05/2019 CMPUT 229

Combinatorial logic What about more complex truth tables? Made by combining many gates together wires connect inputs and outputs each wire can carry only one bit, 0 or 1 17/05/2019 CMPUT 229

Combinatorial logic Circuits made from collections of gates outputs depend only on inputs not on prior state characterized by truth table comparable to Boolean expression 17/05/2019 CMPUT 229

are equivalent; each can be converted to the other two. Combinatorial logic boolean expression X = (A & ~B) | (B & C) truth table logic circuit A B C X 1 A B C X 1 1 1 1 1 1 all three of forms are equivalent; each can be converted to the other two. 17/05/2019 CMPUT 229

DeMorgan’s Law 17/05/2019 CMPUT 229

1 Out In 2 In 1 17/05/2019 CMPUT 229

Combinatorial logic Many parts of a computer are constructed of combinatorial logic adder circuit performs addition arithmetic logic unit (ALU) performs many kinds of arithmetic and bitwise logical operations contains adder circuit multiplexer and decoder direct bit traffic between components 17/05/2019 CMPUT 229

Adder A combinatorial circuit that adds binary values according to this truth table In 1 In 2 Sum Carry 1 Carry is equivalent to AND Sum is equivalent to XOR 17/05/2019 CMPUT 229

This circuit can add two binary digits and is called a half-adder Carry In 1 In 2 Sum This circuit can add two binary digits and is called a half-adder 17/05/2019 CMPUT 229

Adder 5 3 8 1 4 + 9 1 Why “half-adder”. . . ? 1 . . . because to add multi-digit numbers each column requires two additions 17/05/2019 CMPUT 229

Full adder in 1 This circuit is called a full adder and can add three binary digits in 2 half adders carry out carry in This OR gate combines the carries from the two half-adders sum 17/05/2019 CMPUT 229

Ripple-carry adder A3 A2 A1 A0 B3 B2 B1 B0 out3 out2 out1 out0 17/05/2019 CMPUT 229

Ripple-carry adder 0101 + 0110 = 1011 A3 A2 A1 A0 B3 B2 B1 B0 out3 1 1 1 1 1 1 out3 out2 out1 out0 17/05/2019 CMPUT 229

Ripple-carry adder So named because gate results (including carries) propagate (“ripple”) from LSB to MSB right to left corresponds to how humans add numbers with pen and paper More sophisticated, faster, adder circuits exist that can create the higher order carries more quickly 17/05/2019 CMPUT 229

Adder A3-A0 B3-B0 Adders (and other arithmetic circuits) are usually drawn like this in block diagrams inputs + output collections of parallel, related wires like this are known as buses; they carry multi-bit values between components out3-out0 17/05/2019 CMPUT 229

Arithmetic Computers need to do more than just addition logic: & | ~ << >> Need a circuit that can select operation to perform 17/05/2019 CMPUT 229

Multiplexer (Mux) A B A B S S C C 17/05/2019 CMPUT 229

Arithmetic Logic Unit (ALU) B more operations here . . . op 0 op 1 op 2 op 3 + * & << Multiplexer: a combinatorial circuit which selects exactly one input MUX 1 2 3 .. op op selects operation: 0 = add, 1 = multiply, ... out 17/05/2019 CMPUT 229

Arithmetic Logic Unit (ALU) B = 2 for example: compute 15 << 2 more operations here . . . op 0 op 1 op 2 op 3 + * & << other results also computed but ignored by multiplexer MUX 1 2 3 .. op = 3 out = 60 17/05/2019 CMPUT 229

How to design a logic circuit for a given truth table? For each row in the truth table whose output value is 1, construct a logic expression of the conjunction of all input column values Form the disjunction of all conjunctive formulas obtained in step 1 Simplify the disjunction obtained from Step 2 Construct the logic circuit from the simplified logical expression in Step 3 17/05/2019 CMPUT 229

Memory Computers need memory for storage Different kinds of memory distinguished by speed, size, cost and proximity to CPU main memory slowish, huge, cheap, far from CPU typical size 109 bits cache fast, medium-sized, expensive, near to CPU typical size 106 bits registers extremely fast, tiny, very expensive, located on CPU in MIPS (32 GPRs)×32 bits = 1024 bits 17/05/2019 CMPUT 229

Memory The smallest piece of memory is a single binary digit (bit) can hold 0 or 1 only A one-bit memory is called a flip-flop or a data latch because its value can flip and flop between 0 and 1 because it can latch onto a data value and store it 17/05/2019 CMPUT 229

Flip-flop Flip-flop needs two operation modes Also need write: store (memorize) a value read: load (recall) a previously stored value Also need data in for telling flip-flop what value to store (0 or 1) used only when writing data out for finding out what value flip-flop currently contains (0 or 1) used only when reading 17/05/2019 CMPUT 229

Flip-flop Flip-flop can be implemented with gates Not combinatorial logic because current output may depend on previous state Example of sequential logic current output depends on inputs and prior output 17/05/2019 CMPUT 229

Flip-flop NOR gate: OR gate followed by NOT gate data in data out read/write read/write control: 0 = read, 1 = write 17/05/2019 CMPUT 229

Flip-flop: writing Try changing data in to 0 and watch data out 1 1 1 1 1 1 data out = 1 1 when read/write = 1, data out = data in read/write = 1 (write) 17/05/2019 CMPUT 229

Flip-flop: reading data in = ? data out = 1 read/write = 0 (read) when read/write = 0, no signals in box can change, data out holds value regardless of data in 1 ? ? 1 data out = 1 read/write = 0 (read) 17/05/2019 CMPUT 229

Flip-flops are often drawn like this in block diagrams D = data in Q = data out Flip-flops are often drawn like this in block diagrams D Q CK CK is read/write (“clock” because this input is often connected to computer’s processor clock) 17/05/2019 CMPUT 229

Flip-flop using NAND Gates 17/05/2019 CMPUT 229

Flip-flop using NAND Gates Data In Data Out read/write 17/05/2019 CMPUT 229

Memory Memory can store many bits independently many flip-flops Need to identify which bit (flip-flop) to read or write Give each flip-flop a unique number (address) 17/05/2019 CMPUT 229

Memory Decoder: feeds input to selected output, 0 to all others DEC data in D Q address 0 CK D Q data out address 1 rd/wr 1 CK 1 DEC MUX 2 2 3 D Q 3 ... address 2 ... CK D Q address address 3 CK . . . millions more flip-flops . . . 17/05/2019 CMPUT 229

Memory: writing Writing value 1 to flip-flop at address 2 DEC MUX 1 data in ? D Q 1 address 0 CK ? D Q data out address 1 rd/wr 1 CK 1 DEC MUX 2 2 1 3 1 D Q 3 ... 1 address 2 ... 1 CK ? D Q address address 3 CK 2 . . . millions more flip-flops . . . 17/05/2019 CMPUT 229

Memory: reading Reading value from flip-flop at address 2 DEC MUX 1 1 data in D Q address 0 CK D Q data out address 1 rd/wr 1 CK 1 DEC MUX 2 2 1 3 1 D Q 3 ... 1 address 2 ... CK D Q address address 3 CK 2 . . . millions more flip-flops . . . 17/05/2019 CMPUT 229

Memory Memory usually operates in terms of bytes (8 bits), not single bits Repeat memory circuit eight times connect each memory circuit to one of the eight lanes of the data bus reads and writes occur in parallel for each bit in byte 17/05/2019 CMPUT 229

Central Processing Unit (CPU) Coordinates all computer’s components according to program being run Contains registers ALU program counter (PC) address of current instruction instruction register (IR) copy of current instruction control logic Runs programs using fetch-(decode)-execute cycle 17/05/2019 CMPUT 229

CPU out Registers Memory in Control logic rd/wr addr IR ALU PC 17/05/2019 CMPUT 229

Fetch-execute cycle: fetch IR Registers out Stage 1 of fetch-execute cycle: instruction at address pointed to by PC is fetched into IR Memory in Control logic rd/wr addr ALU PC 17/05/2019 CMPUT 229

Fetch-execute cycle: decode IR Registers out Memory Stage 2 of fetch-execute cycle: instruction (now in IR) is decoded by control logic to determine which operation to perform in Control logic rd/wr addr ALU PC 17/05/2019 CMPUT 229

Fetch-execute cycle: execute IR Registers out Stage 3 of fetch-execute cycle: CPU performs the operation (for example, arithmetic on two registers) Memory in Control logic rd/wr addr ALU PC 17/05/2019 CMPUT 229

Fetch-execute cycle: update PC IR Registers out Stage 4 of fetch-execute cycle: PC’s value is updated to point to the next instruction Memory in Control logic rd/wr addr ALU PC 17/05/2019 CMPUT 229