CS61C : Machine Structures

Similar documents
CS 61C: Great Ideas in Computer Architecture Introduction to Hardware: Representations and State

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Review. Pipeline big-delay CL for faster clock Finite State Machines extremely useful You ll see them again in 150, 152 & 164

QUESTION BANK FOR TEST

Finishing Up CALL & Intro To Digital Circuits

Circuit analysis summary

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

CS429: Computer Organization and Architecture

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1.

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Combinational Circuits

CS 2630 Computer Organization. Meeting 13: Faster arithmetic and more operations Brandon Myers University of Iowa

Chapter 3. Boolean Algebra and Digital Logic

LECTURE 4. Logic Design

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

Digital Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

EECE 321: Computer Organization

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Lecture 3: Binary Subtraction, Switching Algebra, Gates, and Algebraic Expressions

Recitation Session 6

BOOLEAN ALGEBRA. Logic circuit: 1. From logic circuit to Boolean expression. Derive the Boolean expression for the following circuits.

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

LAB #1 BASIC DIGITAL CIRCUIT

EEE130 Digital Electronics I Lecture #4_1

CSE140: Components and Design Techniques for Digital Systems

Topics of this Slideset. CS429: Computer Organization and Architecture. Digital Signals. Truth Tables. Logic Design

CS61C : Machine Structures

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

Mark Redekopp, All rights reserved. EE 352 Unit 8. HW Constructs

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Combinational Logic Circuits

CSE140L: Components and Design Techniques for Digital Systems Lab

Lecture (05) Boolean Algebra and Logic Gates

CSE140L: Components and Design

CS2630: Computer Organization Homework 3 Combinational logic and Logisim Due October 14, 2016, 11:59pm

Boolean Algebra & Digital Logic

Lecture 10: Combinational Circuits

CS61C : Machine Structures

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Truth Table! Review! Use this table and techniques we learned to transform from 1 to another! ! Gate Diagram! Today!

END-TERM EXAMINATION

McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007)

Hours / 100 Marks Seat No.

Microcomputers. Outline. Number Systems and Digital Logic Review

Chapter 2. Boolean Expressions:

Combinational Circuits

ELCT 501: Digital System Design

6: Combinational Circuits

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

WELCOME TO. ENGR 303 Introduction to Logic Design. Hello my name is Dr. Chuck Brown

Computer Organization and Levels of Abstraction

GRE Architecture Session

Levels in Processor Design

Electronic Engineering Part 1 Laboratory Experiment. Digital Circuit Design 1 Combinational Logic. (3 hours)

EECS150 Homework 2 Solutions Fall ) CLD2 problem 2.2. Page 1 of 15

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

ECE260: Fundamentals of Computer Engineering

CS61C : Machine Structures

Topics. Computer Organization CS Exam 2 Review. Infix Notation. Reverse Polish Notation (RPN)

CSC 220: Computer Organization Unit 10 Arithmetic-logic units

CS470: Computer Architecture. AMD Quad Core

CPE300: Digital System Architecture and Design

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences. Spring 2010 May 10, 2010

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Arithmetic-logic units

Lecture 14: Recap. Today s topics: Recap for mid-term No electronic devices in midterm

Chapter 5: The Processor: Datapath and Control

2B 52 AB CA 3E A1 +29 A B C. CS120 Fall 2018 Final Prep and super secret quiz 9

Scheme I. Sample Question Paper

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

1. What is y-chart? ans: The y- chart consists of three domains:- behavioral, structural and geometrical.

Computer Architecture Set Four. Arithmetic

CAD4 The ALU Fall 2009 Assignment. Description

Simplification of Boolean Functions

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

CS 261 Fall Mike Lam, Professor. Combinational Circuits

CS 261 Fall Mike Lam, Professor. Logic Gates

Lecture 5. Chapter 2: Sections 4-7

COMPUTER ORGANIZATION AND DESIGN

Dr. Chuck Cartledge. 10 June 2015

R10. II B. Tech I Semester, Supplementary Examinations, May

Code No: R Set No. 1

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

1. Boolean algebra. [6] 2. Constructing a circuit. [4] 3. Number representation [4] 4. Adders [4] 5. ALU [2] 6. Software [4]

Department of Electrical and Computer Engineering Introduction to Computer Engineering I (ECSE-221) Assignment 3: Sequential Logic

Basic Arithmetic (adding and subtracting)

Hours / 100 Marks Seat No.

Chapter 2. Boolean Algebra and Logic Gates

EECS Components and Design Techniques for Digital Systems. Lec 07 PLAs and FSMs 9/ Big Idea: boolean functions <> gates.

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Chap-2 Boolean Algebra

Parallel logic circuits

HW #5: Digital Logic and Flip Flops

Boolean Analysis of Logic Circuits

Digital Logic Design Exercises. Assignment 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

Transcription:

inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #14: Combinational Logic, Gates, and State 2006-07-20 CS 61C L14 Combinational Logic (1) Andy Carle

What are Machine Structures? Software Hardware Application (Netscape) Compiler Assembler Processor Memory Digital Design Circuit Design transistors Operating System (MacOS X) Datapath & Control I/O system 61C Instruction Set Architecture Coordination of many levels of abstraction We ll investigate lower abstraction layers! (contract between HW & SW) CS 61C L14 Combinational Logic (2)

Below the Program High-level language program (in C) swap int v[], int k){ int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } Assembly language program (for MIPS) swap: sll $2, $5, 2 add $2, $4,$2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31 Machine (object) code (for MIPS) 000000 00000 00101 0001000010000000 000000 00100 00010 0001000000100000... C compiler assembler? CS 61C L14 Combinational Logic (3)

Physical Hardware - PowerPC 750 CS 61C L14 Combinational Logic (4)

Digital Design Basics (1/2) Next 2 weeks: we ll study how a modern processor is built starting with basic logic elements as building blocks. Why study logic design? Understand what processors can do fast and what they can t do fast (avoid slow things if you want your code to run fast!) Background for more detailed hardware courses (CS 150, CS 152) CS 61C L14 Combinational Logic (5)

Digital Design Basics (2/2) ISA is very important abstraction layer Contract between HW and SW Can you peek across abstraction? Can you depend across abstraction? Voltages are analog, quantized to 0/1 Circuit delays are fact of life Two types Stateless Combinational Logic (&,,~) State circuits (e.g., registers) CS 61C L14 Combinational Logic (6)

Outline Truth Tables Transistors Logic Gates Combinational Logic Boolean Algebra CS 61C L14 Combinational Logic (7)

Truth Tables (1/6) 0 CS 61C L14 Combinational Logic (8)

TT (2/6) Ex #1: 1 iff one (not both) a,b=1 a 0 0 1 1 b 0 1 0 1 y 0 1 1 0 CS 61C L14 Combinational Logic (9)

TT (3/6): Example #2: 2-bit adder CS 61C L14 Combinational Logic (10)

TT (4/6): Ex #3: 32-bit unsigned adder CS 61C L14 Combinational Logic (11)

TT (5/6): Conversion: 3-input majority CS 61C L14 Combinational Logic (12)

TT (6/6): Conversion: 3-input majority CS 61C L14 Combinational Logic (13)

Transistors (1/3) CMOSFET Transistors: p: * Physically exist! * Voltages are quantized n: * Only 2 Types: - P-channel: 0 on gate -> pull up (1) - N-channel: 1 on gate -> pull down (0) * Undriven otherwise. CS 61C L14 Combinational Logic (14)

Transistors (2/3) CMOSFET Transistors: * have delay and require power * can be combined to perform logical operations and maintain state. - logical operations will be our starting point for digital design - state tomorrow CS 61C L14 Combinational Logic (15)

Transistors (3/3): CMOS Nand CS 61C L14 Combinational Logic (16) A B C 0 0 1 0 1 1 1 0 1 1 1 0

Logic Gates (1/4) Transistors are too low level Good for measuring performance, power. Bad for logical design / analysis Gates are collections of transistors wired in a certain way Can represent and reason about gates with truth tables and Boolean algebra We will mainly review the concepts of truth tables and Boolean algebra in this class. It is assumed that you ve seen these before. Section B.2 in the textbook has a review CS 61C L14 Combinational Logic (17)

Logic Gates (2/4) CS 61C L14 Combinational Logic (18)

Logic Gates (3/4) Symbol AND Gate Definition A B AN C AB C 0 0 0 0 1 0 1 0 0 1 1 1 CS 61C L14 Combinational Logic (19)

Logic Gates (4/4) CS 61C L14 Combinational Logic (20)

Boolean Algebra (1/7) George Boole, 19 th Century mathematician Developed a mathematical system (algebra) involving logic, later known as Boolean Algebra Primitive functions: AND, OR and NOT The power of BA is there s a one-to-one correspondence between circuits made up of AND, OR and NOT gates and equations in BA + means OR, means AND, x means NOT CS 61C L14 Combinational Logic (21)

BA (2/7): e.g., majority circuit y = a b + a c + b c y = ab + ac + bc CS 61C L14 Combinational Logic (22)

BA (3/7):Laws of Boolean Algebra CS 61C L14 Combinational Logic (23)

BA (4/7): Circuit & Algebraic Simplification CS 61C L14 Combinational Logic (24)

BA (5/7): Simplification Example CS 61C L14 Combinational Logic (25)

BA (6/7): Canonical forms (1/2) Sum-of-products (ORs of ANDs) CS 61C L14 Combinational Logic (26)

BA (7/7): Canonical forms (2/2) CS 61C L14 Combinational Logic (27)

Combinational Logic A combinational logic block is one in which the output is a function only of its current input. Combinational logic cannot have memory. Everything we ve seen so far is CL CL will have delay ( f(transistors) ) CS 61C L14 Combinational Logic (28)

Peer Instruction A. (a+b) (a+b) = b B. N-input gates can be thought of as cascaded 2-input gates. I.e., (a bc d e) = a (bc (d e)) where is one of AND, OR, XOR, NAND C. You can use NOR(s) with clever wiring to simulate AND, OR, & NOT CS 61C L14 Combinational Logic (29)

Administrivia HW 4 due Friday Project 2 due Friday the 28 th If you want to get a little bit ahead (in a moderately fun sort of way), start playing with Logisim: http://ozark.hendrix.edu/~burch/logisim/ CS 61C L14 Combinational Logic (30)

Signals and Waveforms Outputs of CL change over time With what? Change in inputs Can graph changes with waveforms CS 61C L14 Combinational Logic (31)

Signals and Waveforms: Adders CS 61C L14 Combinational Logic (32)

Signals and Waveforms: Grouping CS 61C L14 Combinational Logic (33)

Signals and Waveforms: Circuit Delay CS 61C L14 Combinational Logic (34)

State With CL, output is always a function of CURRENT input With some (variable) propagation delay Clearly, we need a way to introduce state into computation CS 61C L14 Combinational Logic (35)

Accumulator Example Want: S=0; for i from 0 to n-1 S = S + X i CS 61C L14 Combinational Logic (36)

First try Does this work? Feedback! Nope! Reason #1 What is there to control the next iteration of the for loop? Reason #2 How do we say: S=0? Need a way to store partial sums! CS 61C L14 Combinational Logic (37)

Circuits with STATE (e.g., register) Need a Logic Block that will: 1. store output (partial sum) for a while, 2. until we tell it to update with a new value. CS 61C L14 Combinational Logic (38)

Register Details What s in it anyway? n instances of a Flip-Flop, called that because the output flips and flops betw. 0,1 D is data Q is output Also called d-q Flip-Flop, d-type Flip-Flop CS 61C L14 Combinational Logic (39)

What s the timing of a Flip-flop? (1/2) Edge-triggered D-type flip-flop This one is positive edge-triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other times, the input d is ignored. CS 61C L14 Combinational Logic (40)

What s the timing of a Flip-flop? (2/2) Edge-triggered D-type flip-flop This one is positive edge-triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other times, the input d is ignored. CS 61C L14 Combinational Logic (41)

Bus a bunch of D FFs together Register of size N: n instances of D Flip-Flop CS 61C L14 Combinational Logic (42)

Second try How about this? Yep! Rough timing CS 61C L14 Combinational Logic (43)

Accumulator Revisited (proper timing 1/2) CS 61C L14 Combinational Logic (44)

Accumulator Revisited (proper timing 2/2) CS 61C L14 Combinational Logic (45)

Pipelining to improve performance (1/2) Timing CS 61C L14 Combinational Logic (46)

Pipelining to improve performance (2/2) Timing CS 61C L14 Combinational Logic (47)

Peer Instruction 2 Simplify the following Boolean algebra equation: Q =!(A*B) +!(!A * C) Use algebra, individual steps, etc. Don t just look at it and figure it out, or I ll have to start using harder examples. CS 61C L14 Combinational Logic (48)

And In conclusion Use this table and techniques we learned to transform from 1 to another CS 61C L14 Combinational Logic (49)