CS 61C: Great Ideas in Computer Architecture

Similar documents
Sequential Elements con t Synchronous Digital Systems

CS3350B Computer Architecture Winter 2015

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

CS61C : Machine Structures

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o. Lecture #14

CS61C : Machine Structures

Go BEARS~ What are Machine Structures? Lecture #15 Intro to Synchronous Digital Systems, State Elements I C

CS61C : Machine Structures

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

More Digital Circuits

CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures

Computer Architecture and Organization

Chapter 3. Boolean Algebra and Digital Logic

EE292: Fundamentals of ECE

COMP2611: Computer Organization. Introduction to Digital Logic

1. Convert the decimal number to binary, octal, and hexadecimal.

MC9211 Computer Organization

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

CHAPTER 4: Logic Circuits

6.3 Sequential Circuits (plus a few Combinational)

A Review of logic design

FE REVIEW LOGIC. The AND gate. The OR gate A B AB A B A B 0 1 1

UNIT 1: DIGITAL LOGICAL CIRCUITS What is Digital Computer? OR Explain the block diagram of digital computers.

Combinational vs Sequential

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

Chapter 5 Sequential Circuits

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

MODULE 3. Combinational & Sequential logic

Analogue Versus Digital [5 M]

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

Department of Computer Science and Engineering Question Bank- Even Semester:

North Shore Community College

CHAPTER 4: Logic Circuits

Chapter 5: Synchronous Sequential Logic

CS8803: Advanced Digital Design for Embedded Hardware

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

Principles of Computer Architecture. Appendix A: Digital Logic

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

BCN1043. By Dr. Mritha Ramalingam. Faculty of Computer Systems & Software Engineering

Find the equivalent decimal value for the given value Other number system to decimal ( Sample)

CPS311 Lecture: Sequential Circuits

Chapter 4. Logic Design

EXPERIMENT: 1. Graphic Symbol: OR: The output of OR gate is true when one of the inputs A and B or both the inputs are true.

IT T35 Digital system desigm y - ii /s - iii

VU Mobile Powered by S NO Group

CHAPTER1: Digital Logic Circuits

Department of CSIT. Class: B.SC Semester: II Year: 2013 Paper Title: Introduction to logics of Computer Max Marks: 30

First Name Last Name November 10, 2009 CS-343 Exam 2

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

ELCT201: DIGITAL LOGIC DESIGN

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

Computer Systems Architecture

211: Computer Architecture Summer 2016

ME 515 Mechatronics. Introduction to Digital Electronics

EECS 270 Final Exam Spring 2012

Using minterms, m-notation / decimal notation Sum = Cout = Using maxterms, M-notation Sum = Cout =

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 3 Logistics

UNIT IV. Sequential circuit

DIGITAL ELECTRONICS MCQs

Logic Design II (17.342) Spring Lecture Outline

REPEAT EXAMINATIONS 2002

Final Exam review: chapter 4 and 5. Supplement 3 and 4

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

CS/ECE 250: Computer Architecture. Basics of Logic Design: ALU, Storage, Tristate. Benjamin Lee

COMP12111: Fundamentals of Computer Engineering

Chapter 3 Unit Combinational

Logic Design. Flip Flops, Registers and Counters

Logic Design II (17.342) Spring Lecture Outline

Where Are We Now? e.g., ADD $S0 $S1 $S2?? Computed by digital circuit. CSCI 402: Computer Architectures. Some basics of Logic Design (Appendix B)

The reduction in the number of flip-flops in a sequential circuit is referred to as the state-reduction problem.

MODU LE DAY. Class-A, B, AB and C amplifiers - basic concepts, power, efficiency Basic concepts of Feedback and Oscillation. Day 1

Chapter 7 Memory and Programmable Logic

WINTER 14 EXAMINATION

Microprocessor Design

Synchronous Sequential Logic

CS302 Digital Logic Design Solved Objective Midterm Papers For Preparation of Midterm Exam

Last time, we saw how latches can be used as memory in a circuit

Chapter Contents. Appendix A: Digital Logic. Some Definitions

(CSC-3501) Lecture 7 (07 Feb 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

1. True/False Questions (10 x 1p each = 10p) (a) I forgot to write down my name and student ID number.

Introduction to Digital Electronics

1.b. Realize a 5-input NOR function using 2-input NOR gates only.

COE 202: Digital Logic Design Sequential Circuits Part 1. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

EECS150 - Digital Design Lecture 3 Synchronous Digital Systems Review. Announcements

THE KENYA POLYTECHNIC

CS6201 UNIT I PART-A. Develop or build the following Boolean function with NAND gate F(x,y,z)=(1,2,3,5,7).

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 2 Logistics

DIGITAL CIRCUIT COMBINATORIAL LOGIC

COE328 Course Outline. Fall 2007

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

For Teacher's Use Only Q Total No. Marks. Q No Q No Q No

Introduction to Sequential Circuits

Synchronous Sequential Logic. Chapter 5

Logic Design ( Part 3) Sequential Logic (Chapter 3)

WINTER 15 EXAMINATION Model Answer

R13 SET - 1 '' ''' '' ' '''' Code No: RT21053

CS8803: Advanced Digital Design for Embedded Hardware

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

Transcription:

CS 6C: Great Ideas in Computer Architecture Combinational and Sequential Logic, Boolean Algebra Instructor: Alan Christopher 7/23/24 Summer 24 -- Lecture #8

Review of Last Lecture OpenMP as simple parallel extension to C During parallel fork, be aware of which variables should be shared vs. private among threads Work-sharing accomplished with for/sections Synchronization accomplished with critical/atomic/reduction Hardware is made up of transistors and wires Transistors are voltage-controlled switches Building blocks of all higher-level blocks 7/23/24 Summer 24 -- Lecture #8 2

Synchronous Digital Systems Hardware of a processor, such as with a MIPS processor, is an example of a Synchronous Digital System Synchronous: All operations coordinated by a central clock Heartbeat of the system! Digital: Represent all values with two discrete values Electrical signals are treated as s and s 7/23/24 and are complements of each other High/Low voltage for True/False, / Summer 24 -- Lecture #8 3

Signals and Waveforms: Clocks Clock period (CPU cycle time) Rising Edge Falling Edge Signals transmitted over wires continuously Transmission is effectively instantaneous Implies that any wire only contains one value at any given time 7/23/24 Summer 24 -- Lecture #8 4

Signals and Waveforms Stack signals on top of each other 7/23/24 All signals change after clock triggers Summer 24 -- Lecture #8 5

Signals and Waveforms: Grouping Clock triggers X A group of wires when interpreted as a bit field is called a bus 7/23/24 Summer 24 -- Lecture #8 6

Hardware Design Hierarchy system control datapath code multiplexer comparator registers register state registers combinational logic logic Today switching networks 7/23/24 Summer 24 -- Lecture #8 7

Agenda Combinational Logic Truth Tables and Logic Gates Administrivia Boolean Algebra Sequential Logic State Elements Bonus: Karnaugh Maps (Optional) 7/23/24 Summer 24 -- Lecture #8 8

Type of Circuits Synchronous Digital Systems consist of two basic types of circuits: Combinational Logic (CL) Sequential Logic (SL) 7/23/24 Output is a function of the inputs only, not the history of its execution e.g. circuits to add A, B (ALUs) Circuits that remember or store information a.k.a. State Elements e.g. memory and registers (Registers) Summer 24 -- Lecture #8 9

Representations of Combinational Logic Circuit Diagram Transistors and wires Logic Gates Truth Table Boolean Expression (Lec 7) (Lec 8) (Lec 8) Right Now! (Lec 8) All are equivalent 7/23/24 Summer 24 -- Lecture #8

Truth Tables Table that relates the inputs to a CL circuit to its output Output only depends on current inputs Use abstraction of / instead of high/low V Shows output for every possible combination of inputs How big? 7/23/24 or for each of N inputs, so 2N rows Summer 24 -- Lecture #8

CL: General Form A B C D F Y If N inputs, how many distinct functions F do we have? Function maps each row to or, so 2^(2N) possible functions 7/23/24 Summer 24 -- Lecture #8 2

CL: Multiple Outputs A B C D X F Y Z For 3 outputs, just three separate functions: X(A,B,C,D), Y(A,B,C,D), and Z(A,B,C,D) Can show functions in separate columns without adding any rows! 7/23/24 Summer 24 -- Lecture #8 3

Logic Gates (/2) Special names and symbols: a c a b c a b c Circle means NOT! NOT AND OR 7/23/24 Summer 24 -- Lecture #8 4

Logic Gates (2/2) Special names and symbols: NAND NOR XOR 7/23/24 Summer 24 -- Lecture #8 a b c a b c a b c 5

More Complicated Truth Tables 3-Input Majority a b c y 2-bit Adder a a b b + A a B a C b b... 7/23/24 c2 c c Summer 24 -- Lecture #8 6 c2 3 separate functions c How many rows? c

Question: Convert the following statements into a Truth Table assuming the output is whether Frank is comfortable () or uncomfortable (). Input X: Frank wears light () or heavy () clothing Input Y: It is cold () or hot () outside Input Z: Frank spends the day indoors () or outdoors () X Y Z (B) (G) (P) (Y) 7

My Hand Hurts Truth tables are huge Write out EVERY combination of inputs and outputs (thorough, but inefficient) Finding a particular combination of inputs involves scanning a large portion of the table There must be a shorter way to represent combinational logic 7/23/24 Boolean Algebra to the rescue! Summer 24 -- Lecture #8 8

Agenda Combinational Logic Truth Tables and Logic Gates Administrivia Boolean Algebra Sequential Logic State Elements Bonus: Karnaugh Maps (Optional) 7/23/24 Summer 24 -- Lecture #8 9

Administrivia Actually, nothing for today 7/23/24 Summer 24 -- Lecture #8 2

Agenda Combinational Logic Truth Tables and Logic Gates Administrivia Boolean Algebra Sequential Logic State Elements Bonus: Karnaugh Maps (Optional) 7/23/24 Summer 24 -- Lecture #8 2

Boolean Algebra Represent inputs and outputs as variables Each variable can only take on the value or Overbar is NOT: logical complement e.g. if A is, then A is and vice-versa Plus (+) is 2-input OR: logical sum Product ( ) is 2-input AND: logical product All other gates and logical expressions can be built from combinations of these (e.g. A XOR B = AB + BA = A B + AB ) 7/23/24 Summer 24 -- Lecture #8 For slides, will also use A for A 22

Truth Table to Boolean Expression Read off of table For, write variable name For, write complement of variable Sum of Products (SoP) Take rows with s in output column, sum products of inputs c = ab + ba Product of Sums (PoS) 7/23/24 a b c We can show that these are equivalent! Take rows with s in output column, product the sum of the complements of the inputs c = ( a + b ) ( a + b ) Summer 24 -- Lecture #8 23

Manipulating Boolean Algebra SoP and PoS expressions can still be long We wanted to have shorter representation than a truth table! Boolean algebra follows a set of rules that allow for simplification 7/23/24 Goal will be to arrive at the simplest equivalent expression Allows us to build simpler (and faster) hardware Summer 24 -- Lecture #8 24

Faster Hardware? Recall: Everything we are dealing with is just an abstraction of transistors and wires Inputs propagating to the outputs are voltage signals passing through transistor networks There is always some delay before a CL s output updates to reflect the inputs Simpler Boolean expressions smaller transistor networks smaller circuit delays faster hardware 7/23/24 Summer 24 -- Lecture #8 25

Combinational Logic Circuit Delay Symbol for a bus (and width) 2 3 4 5 3 5 7/23/24 3 4 6 Summer 24 -- Lecture #8 Combinational Logic delay 26

Laws of Boolean Algebra These laws allow us to perform simplification: 7/23/24 Summer 24 -- Lecture #8 27

Boolean Algebraic Simplification Example 7/23/24 Summer 24 -- Lecture #8 28

Circuit Simplification ) (Transistors and/or Gates) 2) 3) 4) 7/23/24 Summer 24 -- Lecture #8 29

Converting Combinational Logic Try all input combinations or Po S Truth Table So P T co ry a m ll bi in na pu tio t ns s al gn si es e at at g ag gh s op ou te d Pr thr ga a n er R, op, O pr D to A N ts s e T ) pu u O i n t to N ire s W a s ie (e Circuit Diagram This is difficult to do efficiently! Boolean Expression 7/23/24 Summer 24 -- Lecture #8 3

Circuit Simplification Example (/4) Simplify the following circuit: A B D C Options: Test all combinations of the inputs and build the Truth Table, then use SoP or PoS Write out expressions for signals based on gates 7/23/24 Will show this method here Summer 24 -- Lecture #8 3

Circuit Simplification Example (2/4) Simplify the following circuit: A B C A B B C AB (AB) A A+B C D B C Start from left, propagate signals to the right Arrive at D = (AB) (A + B C) 7/23/24 Summer 24 -- Lecture #8 32

Circuit Simplification Example (3/4) Simplify Expression: D = (AB) (A + B C) = (A + B )(A + B C) DeMorgan s = A A + A B C + B A + B B C Distribution = + A B C + B A + B B C Complementarity = A B C + B A + B C Idempotent Law = (A + )B C + AB Distribution = B C + AB Law of s Which of these is simpler? = B (A + C) Distribution 7/23/24 Summer 24 -- Lecture #8 33

Circuit Simplification Example (4/4) Draw out final circuit: How many gates do we need for each? D = B C + AB = B (A + C) 3 4 Simplified Circuit: A B D C 7/23/24 Reduction from 6 gates to 3! Summer 24 -- Lecture #8 34

Karnaugh Maps (Optional) Lots of Boolean Algebra laws for simplification Difficult to memorize and spot applications When do you know if in simplest form? Basically, when you can't reduce it any further Not a great system when you're still new to boolean algebra Karnaugh Maps (K-maps) are an alternate way to simplify Boolean Algebra 7/23/24 This technique is normally taught in CS5 We will never ask you to use a K-map to solve a problem, but you may find it faster/easier if you choose to learn how to use it (see Bonus Slides) Summer 24 -- Lecture #8 35

Question: What is the MOST simplified Boolean Algebra expression for the following circuit? (B) (G) (P) (Y) B (A + C) B + AC AB + B + C A+C 36

Technology Break 7/23/24 Summer 24 -- Lecture #8 37

Agenda Combinational Logic Truth Tables and Logic Gates Administrivia Boolean Algebra Sequential Logic State Elements Bonus: Karnaugh Maps (Optional) 7/23/24 Summer 24 -- Lecture #8 38

Type of Circuits Synchronous Digital Systems consist of two basic types of circuits: Combinational Logic (CL) Sequential Logic (SL) 7/23/24 Output is a function of the inputs only, not the history of its execution e.g. circuits to add A, B (ALUs) Circuits that remember or store information a.k.a. State Elements e.g. memory and registers (Registers) Summer 24 -- Lecture #8 39

Uses for State Elements Place to store values for some amount of time: Register files (like in MIPS) Memory (caches and main memory) Help control flow of information between combinational logic blocks 7/23/24 State elements are used to hold up the movement of information at the inputs to combinational logic blocks and allow for orderly passage Summer 24 -- Lecture #8 4

Accumulator Example An example of why we would need to control the flow of information. Xi SUM S Want: S=; for X,X2,X3 over time... S = S + Xi Assume: Each X value is applied in succession, one per cycle The sum since time (cycle) is present on S 7/23/24 Summer 24 -- Lecture #8 4

First Try: Does this work? X Feedback No! ) How to control the next iteration of the for loop? 2) How do we say: S=? 7/23/24 Summer 24 -- Lecture #8 42

Second Try: How About This? A Register is the state element that is used here to hold up the transfer of data to the adder Delay through Register and Adder Rough timing Time 7/23/24 Summer 24 -- Lecture #8 43

Register Internals n instances of a Flip-Flop Output flips and flops between and Specifically this is a D-type Flip-Flop D is data input, Q is data output In reality, has 2 outputs (Q and Q), but we only care about http://en.wikibooks.org/wiki/practical_electronics/flip-flops 7/23/24 Summer 24 -- Lecture #8 44

Flip-Flop Timing Behavior (/2) Edge-triggered D-type flip-flop This one is positive edge-triggered On the rising edge of the clock, input d is sampled and transferred to the output. At other times, the input d is ignored and the previously sampled value is retained. Example waveforms: 45

Flip-Flop Timing Terminology (/2) Camera Analogy: Taking a photo 7/23/24 Setup time: don t move since about to take picture (open camera shutter) Hold time: need to hold still after shutter opens until camera shutter closes Time to data: time from open shutter until image appears on the output (viewfinder) Summer 24 -- Lecture #8 46

Flip-Flop Timing Terminology (2/2) Now applied to hardware: 7/23/24 Setup Time: how long the input must be stable before the CLK trigger for proper input read Hold Time: how long the input must be stable after the CLK trigger for proper input read CLK-to-Q Delay: how long it takes the output to change, measured from the CLK trigger Summer 24 -- Lecture #8 47

Flip-Flop Timing Behavior (2/2) Edge-triggered d-type flip-flop This one is positive edge-triggered On the rising edge of the clock, input d is sampled and transferred to the output. At other times, the input d is ignored and the previously sampled value is retained. 7/23/24 Summer 24 -- Lecture #8 48

Accumulator Revisited Proper Timing (2/2) reset signal shown Also, in practice Xi might not arrive to the adder at the same time as Si- Si temporarily is wrong, but register always captures correct value In good circuits, instability never happens around rising edge of CLK Undefined (unknown) signal 7/23/24 Summer 24 -- Lecture #8 49

Summary Hardware systems are constructed from Stateless Combinational Logic and Stateful Memory Logic (registers) Voltages are analog, but quantized to represent logical s and s Combinational Logic: equivalent circuit diagrams, truth tables, and Boolean expressions Boolean Algebra allows minimization of gates State registers implemented from Flip-flops 7/23/24 Summer 24 -- Lecture #8 5

Special Bonus Slides: You are NOT responsible for the material contained on the following slides!!! You may, however, find it useful to read anyway. 7/23/24 Summer 24 -- Lecture #8 5

Agenda Combinational Logic Truth Tables and Logic Gates Administrivia Boolean Algebra Sequential Logic State Elements Bonus: Karnaugh Maps (Optional) 7/23/24 Summer 24 -- Lecture #8 52

Karnaugh Maps (Optional) Again, this is completely OPTIONAL material Recommended you use.pptx to view animations Karnaugh Maps (K-maps) are an alternate way to simplify Boolean Algebra This technique is normally taught in CS5 We will never ask you to use a K-map to solve a problem, but you may find it faster/easier if you choose to learn how to use it For more info, see: http://en.wikipedia.org/wiki/karnaugh_map 7/23/24 Summer 24 -- Lecture #8 53

Underlying Idea Using Sum of Products, neighboring input combinations simplify Neighboring : inputs that differ by a single signal e.g. ab + a b = b, a bc + a bc = a b, etc. Recall: Each product only appears where there is a in the output column Idea: Let s write out our Truth Table such that the neighbors become apparent! 7/23/24 Need a Karnaugh map for EACH output Summer 24 -- Lecture #8 54

Reorganizing the Truth Table Split inputs into 2 evenly-sized groups One group will have an extra if an odd # of inputs Write out all combinations of one group horizontally and all combinations of the other group vertically Group of n inputs 2n combinations Successive combinations change only input 2 Inputs: A B 3 Inputs: C AB 7/23/24 Summer 24 -- Lecture #8 55

K-map: Majority Circuit (/2) Filling in the Karnaugh map: a 7/23/24 b c y ab c Each row of truth table corresponds to ONE cell of Karnaugh map Recommended you view the animation on this slide on the Powerpoint (pptx) Note the funny jump when you go from input to (most mistakes made here) Summer 24 -- Lecture #8 56

K-map: Majority Circuit (2/2) Group neighboring s so all are accounted for: ab Each group of c neighbors becomes a product term in output y =bc+ ab + ac Larger groups become smaller terms The single in top row --> abc Vertical group of two s --> ab If entire lower row was s --> c 7/23/24 Summer 24 -- Lecture #8 Single cell can be part of many groups 57

General K-map Rules Only group in powers of 2 Grouping should be of size 2i 2j Applies for both directions Wraps around in all directions Corners case is extreme example Always choose largest groupings possible y= 7/23/24 Avoid single cells whenever possible bd+ b d + acd Summer 24 -- Lecture #8 cd ab ) 2) 3) 4) 5) NOT a valid group IS a valid group IS a valid group Corners case of 2 good choices here (spot the other?) 58