Introduction to Computer Science Robert Sedgewick and Kevin Wayne Copyright © 2005 Recap: Combinational Circuits Please.

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.
Chapter 7 Henry Hexmoor Registers and RTL
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Chapter 7 – Registers.
التصميم المنطقي Second Course
Circuits require memory to store intermediate data
LOGIC GATES ADDERS FLIP-FLOPS REGISTERS Digital Electronics Mark Neil - Microprocessor Course 1.
Recap: ALU Big combinational logic (16-bit bus)
Chapter 7. Register Transfer and Computer Operations
Memory; Sequential & Clocked Circuits; Finite State Machines COS 116: 3/25/2008 Sanjeev Arora.
SUPLEMENTARY CHAPTER 1: An Introduction to Digital Logic The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Computer ArchitectureFall 2008 © August 20 th, Introduction to Computer Architecture Lecture 2 – Digital Logic Design.
Combinational Logic1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
16/07/2015CSE1303 Part B lecture notes 1 Hardware Implementation Lecture B17 Lecture notes section B17.
CS 105 Digital Logic Design
Sequential Circuits Chapter 4 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S.
Chapter 3: Boolean Algebra
How circuits acquire memory: Sequential & Clocked Circuits. COS 116, Spring 2011 Sanjeev Arora.
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Some Useful Circuits Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
Sequential Logic. Logic Styles Combinational circuits – Output determined solely by inputs – Can draw solely with left-to-right signal paths.
Memory; Sequential & Clocked Circuits; Finite State Machines
Combinational Logic Design
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.
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.
Finite State Machines (FSMs) and RAMs and inner workings of CPUs COS 116, Spring 2010 Guest: Szymon Rusinkiewicz.
1 Boolean Algebra & Logic Gates. 2 Objectives Understand the relationship between Boolean logic and digital computer circuits. Learn how to design simple.
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
Chap 7. Register Transfers and Datapaths. 7.1 Datapaths and Operations Two types of modules of digital systems –Datapath perform data-processing operations.
Finite State Machines (FSMs) and RAMs and CPUs COS 116, Spring 2011 Sanjeev Arora.
מבנה מחשב תרגול 2. 2 Boolean AND Operation Truth Table Equivalent Gate Different notations:
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 7 – Registers and Register Transfers Part.
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.
CS/COE0447 Computer Organization & Assembly Language
Logic Design / Processor and Control Units Tony Diep.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
CO5023 Latches, Flip-Flops and Decoders. Sequential Circuit What does this do? The OUTPUT of a sequential circuit is determined by the current output.
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 Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals.
Arithmetic Logic Unit (ALU) Introduction to Computer Yung-Yu Chuang with slides by Sedgewick & Wayne ( introcs.cs.princeton.edu ), Nisan & Schocken (
CS151 Introduction to Digital Design Chapter 5: Sequential Circuits 5-1 : Sequential Circuit Definition 5-2: Latches 1Created by: Ms.Amany AlSaleh.
Lecture 3 Boolean Algebra and Digital Logic Lecture Duration: 2 Hours.
4–1. BSCS 5 th Semester Introduction Logic diagram: a graphical representation of a circuit –Each type of gate is represented by a specific graphical.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
1 CS/COE0447 Computer Organization & Assembly Language Logic Design Appendix C.
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.
Chap 7. Register Transfers and Datapaths
Basics of digital systems
Lecture 3 Boolean Algebra and Digital Logic Lecture Duration: 2 Hours
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Instructor: Alexander Stoytchev
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
Boolean Algebra and Digital Logic
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.
CS/COE0447 Computer Organization & Assembly Language
CSE 370 – Winter Sequential Logic - 1
CSE 370 – Winter Sequential Logic-2 - 1
Logic Circuits I Lecture 3.
Digital Logic Circuits
Sequential Logic.
Digital Circuits and Logic
Instructor: Michael Greenbaum
Presentation transcript:

Introduction to Computer Science Robert Sedgewick and Kevin Wayne Copyright © Recap: Combinational Circuits Please subscribe mailing list Please do stop me if you have questions Assignment #1 will be announced later tonight

2 Logic Gates: Fundamental Building Blocks

3 Important laws x + 1 = 1 x + 0 = x x + x = 1 x . 1 = x x . 0 = 0 x . x = 0 DeMorgan Law x . y = x + y

4 Sum-of-Products Sum-of-products. Systematic procedure for representing a Boolean function using AND, OR, NOT. Form AND term for each 1 in Boolean function. OR terms together. x'yz expressing MAJ using sum-of-products z xyz'xyzxy'z MAJyx x'yz + xy'z + xyz' + xyz proves that { AND, OR, NOT } are universal

5 Expressing a Boolean Function Using AND, OR, NOT Ingredients. AND gates. OR gates. NOT gates. Wire. Instructions. Step 1: represent input and output signals with Boolean variables. Step 2: construct truth table to carry out computation. Step 3: derive (simplified) Boolean expression using sum-of products. Optional: simplify Boolean expression Step 4: transform Boolean expression into circuit.

6 Translate Boolean Formula to Boolean Circuit Sum-of-products. XOR.

7 Translate Boolean Formula to Boolean Circuit Sum-of-products. Majority.

8 ODD Parity Circuit ODD(x, y, z). 1 if odd number of inputs are 1. 0 otherwise.

9 Let's Make an Adder Circuit Goal. x + y = z for 4-bit integers. We build 4-bit adder: 9 inputs, 4 outputs. Same idea scales to 128-bit adder. Key computer component. Step 1. Represent input and output in binary. x1x1 x2x2 x3x3 x0x0 y1y1 y2y2 y3y3 y0y0 + z1z1 z2z2 z3z3 z0z Cin Cout

10 Let's Make an Adder Circuit Goal. x + y = z for 4-bit integers. Step 2. [first attempt] Build truth table. Q. Why is this a bad idea? A. 128-bit adder: rows >> # electrons in universe! x1x1 x2x2 x3x3 x0x0 y1y1 y2y2 y3y3 y0y0 + z1z1 z2z2 z3z3 z0z0 4-Bit Adder Truth Table y2y2 y3y x0x0 x1x x2x2 x3x y0y0 y1y z2z2 z3z z0z0 z1z = 512 rows! c0c c in c out

11 Let's Make an Adder Circuit Goal. x + y = z for 4-bit integers. Step 3. Derive Boolean expression. MAJ ODD cici c i+1 yiyi xixi cici zizi yiyi xixi Carry BitSummand Bit x1x1 x2x2 x3x3 x0x0 y1y1 y2y2 y3y3 y0y0 + z1z1 z2z2 z3z3 z0z0 c1c1 c2c2 c3c3 c 0 = 0 c out

12 Let's Make an Adder Circuit Goal. x + y = z for 4-bit integers. Step 4. Transform Boolean expression into circuit. Chain together 1-bit adders.

13 Adder: Interface

14 Subtractor Subtractor circuit: z = x – y. One approach: design like adder circuit

15 Subtractor Subtractor circuit: z = x – y. One approach: design like adder circuit Better idea: reuse adder circuit – 2’s complement: to negate an integer, flip bits, then add 1

Introduction to Computer Science Robert Sedgewick and Kevin Wayne Copyright © Sequential Circuits

17 Review of Combinational Circuits Combinational circuits. Basic abstraction = switch. In principle, can build TOY computer with a combinational circuit. – 255  16 = 4,080 inputs  rows in truth table! – no simple pattern – each circuit element used at most once Sequential circuits. Reuse circuit elements by storing bits in "memory." ALU combinational Memory state

18 Combinational vs. Sequential Circuits Combinational circuits. Output determined solely by inputs. Can draw with no loops. Ex: majority, adder, ALU. Sequential circuits. Output determined by inputs and previous outputs. Ex: memory, program counter, CPU.

19 Flip-Flop Flip-flop A small and useful sequential circuit Abstraction that remembers one bit Basis of important computer components for – register – memory – counter There are several flavors

20 S-R flip flop Q=S+RQ Q(t+  )S(t) R(t) Q(t)

21 Relay-based flip-flop Ex. Simplest feedback loop. Two relays A and B, both connected to power, each blocked by the other. State determined by whichever switches first. The state is latched. Stable.

22 SR Flip Flop SR flip flop. Two cross-coupled NOR gates. Q=R(S+Q) RSQ R S Q

23 Flip-Flop Flip-flop. A way to control the feedback loop. Abstraction that "remembers" one bit. Basic building block for memory and registers. Caveat. Need to deal with switching delay.

24 Truth Table and Timing Diagram Truth table. Values vary over time. S(t), R(t), Q(t) denote value at time t. Sample timing diagram for SR flip-flop. Q(t+  ) SR Flip Flop Truth Table S(t) R(t) Q(t) Q R S time 

25 Clock Clock. Fundamental abstraction: regular on-off pulse. – on: fetch phase – off: execute phase External analog device. Synchronizes operations of different circuit elements. Requirement: clock cycle longer than max switching time. cycle time Clock on off

26 How much does it Hert? Frequency is inverse of cycle time. Expressed in hertz. Frequency of 1 Hz means that there is 1 cycle per second. – 1 kilohertz (kHz) means 1000 cycles/sec. – 1 megahertz (MHz) means 1 million cycles/sec. – 1 gigahertz (GHz) means 1 billion cycles/sec. – 1 terahertz (THz) means 1 trillion cycles/sec. Heinrich Rudolf Hertz ( )

27 Clocked S-R flip-flop

28 Clocked D flip-flop

29 Stand-Alone Register

30 Register file interface

31 Register file implementation

32 Multiplexer When s=0, return x; otherwise, return y. Example: (Y  S)  (X   S) Two-input multiplexer

33 4-to-1 multiplexer 4MUX x0x0 x1x1 x2x2 x3x3 z s0s0 s1s1

34 4-to-1 multiplexer 4MUX x0x0 x1x1 x2x2 x3x3 z s0s0 s1s1 2MUX x0x0 x1x1 x2x2 x3x3 z s0s0 s1s1

35 8-to-1 Multiplexer 2 N -to-1 multiplexer N select inputs, 2 N data inputs, 1 output Copies “selected” data input bit to output

36 4-Wide 2-to-1 Multiplexer Goal: select from one of two 4-bit buses

37 4-Wide 2-to-1 Multiplexer Goal: select from one of two 4-bit buses Implemented by layering 4 2-to-1 multiplexer

38 k-Wide n-to-1 Multiplexer Goal: select from one of n k-bit buses Implemented by layering k n-to-1 multiplexer

39 Register file implementation

40 Memory Overview Computers and TOY have several memory components. Program counter. Registers. Main memory. Implementation. Use one flip-flop for each bit of memory. Access. Memory components have different access mechanisms. Organization. Need mechanism to manipulate groups of related bits. TOY has 16 bit words, 8 bit memory addresses, and 4 bit register names.

41 Register Bit Register bit. Extend a flip-flop to allow easy access to values.

42 Register Bit Register bit. Extend a flip-flop to allow easy access to values. XW X W

43 Memory Bit: Interface Memory bit. Extend a flip-flop to allow easy access to values. [ TOY PC, IR ][ TOY main memory ][ TOY registers ]

44 Memory Bit: Switch Level Implementation Memory bit. Extend a flip-flop to allow easy access to values. [ TOY PC, IR ][ TOY main memory ][ TOY registers ]

45 Processor Register Processor register. Stores k bits. Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction.

46 Processor Register Processor register. Stores k bits. Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction.

47 Processor Register Processor register. Stores k bits. Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction.

48 Memory Bank Memory bank. Bank of n registers; each stores k bits. Read and write information to one of n registers. Address inputs specify which one. Addressed bits always appear on output. If write enabled, k input bits are copied into addressed register. Ex 1. TOY main memory. 256-by-16 memory bank. Ex 2. TOY registers. 16-by-16 memory bank. Two output buses. (four 6-bit words) log 2 n address bits needed 2-bit address 6-bit input bus 6-bit output bus

49 Memory: Interface (four 6-bit words)

50 Memory: Component Level Implementation

51 Memory: Switch Level Implementation (four 6-bit words)

52 Summary Sequential circuits add "state" to digital hardware. Flip-flop.[represents 1 bit] TOY word.[16 flip-flops] TOY registers.[16 words] TOY main memory.[256 words] Modern technologies for registers and main memory are different. Few registers, easily accessible, high cost per bit. Huge main memories, less accessible, low cost per bit. Drastic evolution of technology over time. Next. Build a complete TOY computer.