CS 61C: Great Ideas in Computer Architecture Lecture 10: Finite State Machines, Func/onal Units. Machine Interpreta4on

Similar documents
CS 61C: Great Ideas in Computer Architecture Finite State Machines, Functional Units

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

Instructor: Randy H. Katz Fall Lecture #17. Warehouse Scale Computer

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture Synchronous Digital Systems. Anything can be represented as a number, i.e., data or instrucrons

UC Berkeley CS61C : Machine Structures

EECS150 - Digital Design Lecture 2 - Synchronous Digital Systems Review Part 1. Outline

CS61C : Machine Structures

ENGIN 112 Intro to Electrical and Computer Engineering

a b y UC Berkeley CS61C : Machine Structures Hello Helo,world!

Combinatorial Logic Design Multiplexers and ALUs CS 64: Computer Organization and Design Logic Lecture #14

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

COMPUTER ORGANIZATION & ARCHITECTURE DIGITAL LOGIC CSCD211- DEPARTMENT OF COMPUTER SCIENCE, UNIVERSITY OF GHANA

Chapter 3 Digital Logic Structures

CS61c: Introduction to Synchronous Digital Systems

Lecture 3: Logic circuit. Combinational circuit and sequential circuit

7/11/2012. Single Cycle (Review) CSE 2021: Computer Organization. Multi-Cycle Implementation. Single Cycle with Jump. Pipelining Analogy

Dr. Nicola Nicolici COE/EE2DI4 Midterm Test #1 Oct 18, 2006

Digital Logic Circuits

! Sequential Logic. ! Timing Hazards. ! Dynamic Logic. ! Add state elements (registers, latches) ! Compute. " From state elements

Unit 3. Logic Design

6.111 Lecture # 19. Controlling Position. Some General Features of Servos: Servomechanisms are of this form:

Computer Architecture (TT 2012)

EE 457 Homework 5 Redekopp Name: Score: / 100_

Exam #2 EE 209: Fall 2017

EECS150 - Digital Design Lecture 28 Course Wrap Up. Recap 1

IES Digital Mock Test

SRV ENGINEERING COLLEGE SEMBODAI RUKMANI VARATHARAJAN ENGINEERING COLLEGE SEMBODAI

DIGITAL ELECTRONICS QUESTION BANK

LOGIC DIAGRAM: HALF ADDER TRUTH TABLE: A B CARRY SUM. 2012/ODD/III/ECE/DE/LM Page No. 1

CS 110 Computer Architecture Lecture 11: Pipelining

Combinational Logic Circuits. Combinational Logic

You are Here! Processor Design Process. Agenda. Agenda 10/25/12. CS 61C: Great Ideas in Computer Architecture Single Cycle MIPS CPU Part II

Solutions. ICS 151 Final. Q1 Q2 Q3 Q4 Total Credit Score. Instructions: Student ID. (Last Name) (First Name) Signature

IMPLEMENTING THE 10-BIT, 50MS/SEC PIPELINED ADC

ICS 151 Final. (Last Name) (First Name)

EE 42/100 Lecture 24: Latches and Flip Flops. Rev A 4/14/2010 (8:30 PM) Prof. Ali M. Niknejad

Combinational Circuits DC-IV (Part I) Notes

Lecture 02: Digital Logic Review

LIST OF EXPERIMENTS. KCTCET/ /Odd/3rd/ETE/CSE/LM

DIGIT SERIAL PROCESSING ELEMENTS. Bit-Serial Multiplication. Digit-serial arithmetic processes one digit of size d in each time step.

Brought to you by. Priti Srinivas Sajja. PS01CMCA02 Course Content. Tutorial Practice Material. Acknowldgement References. Website pritisajja.

ECE 261 CMOS VLSI Design Methodologies. Final Project Report. Vending Machine. Dec 13, 2007

Chapter 3. H/w s/w interface. hardware software Vijaykumar ECE495K Lecture Notes: Chapter 3 1

In this lecture: Lecture 8: ROM & Programmable Logic Devices

The book has excellent descrip/ons of this topic. Please read the book before watching this lecture. The reading assignment is on the website.

Memory, Latches, & Registers

EECS150 Spring 2007 Lab Lecture #5. Shah Bawany. 2/16/2007 EECS150 Lab Lecture #5 1

CS152 Computer Architecture and Engineering Lecture 3: ReviewTechnology & Delay Modeling. September 3, 1997

Computer Architecture: Part II. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

Computer Architecture and Organization:

Single-Cycle CPU The following exercises are taken from Hennessy and Patterson, CO&D 2 nd, 3 rd, and 4 th Ed.

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING SEMESTER TWO EXAMINATION 2017/2018

! Review: Sequential MOS Logic. " SR Latch. " D-Latch. ! Timing Hazards. ! Dynamic Logic. " Domino Logic. ! Charge Sharing Setup.

Learning Outcomes. Spiral 2 3. DeMorgan Equivalents NEGATIVE (ACTIVE LO) LOGIC. Negative Logic One hot State Assignment System Design Examples

Digital Logic and Design (Course Code: EE222) Lecture 14: Combinational Contd.. Decoders/Encoders

logic system Outputs The addition of feedback means that the state of the circuit may change with time; it is sequential. logic system Outputs

GATE Online Free Material

GOVERNMENT OF KARNATAKA KARNATAKA STATE PRE-UNIVERSITY EDUCATION EXAMINATION BOARD II YEAR PUC EXAMINATION MARCH-2013 SCHEME OF VALUATION

Final Project Report 4-bit ALU Design

Number system: the system used to count discrete units is called number. Decimal system: the number system that contains 10 distinguished

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

Serial Addition. Lecture 29 1

Introduction. BME208 Logic Circuits Yalçın İŞLER

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Digital Logic

Introduction (concepts and definitions)

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

2014 Paper E2.1: Digital Electronics II

Lecture Topics. Announcements. Today: Pipelined Processors (P&H ) Next: continued. Milestone #4 (due 2/23) Milestone #5 (due 3/2)

Gates and Circuits 1

Chapter 4. Pipelining Analogy. The Processor. Pipelined laundry: overlapping execution. Parallelism improves performance. Four loads: Non-stop:

COMPUTER ARCHITECTURE AND ORGANIZATION

Memory, Latches, & Registers

Course Overview. Course Overview

Digital Electronics Course Objectives

EE 280 Introduction to Digital Logic Design

Multiplier and Accumulator Using Csla

On Built-In Self-Test for Adders

5. (Adapted from 3.25)

DIGITAL LOGIC COMPUTER SCIENCE

Course Outline Cover Page

Fan in: The number of inputs of a logic gate can handle.

Chapter 4: FLIP FLOPS. (Sequential Circuits) By: Siti Sabariah Hj. Salihin ELECTRICAL ENGINEERING DEPARTMENT EE 202 : DIGITAL ELECTRONICS 1

FUNCTION OF COMBINATIONAL LOGIC CIRCUIT

Unit 3 Digital Circuits (Logic)

CHAPTER 5 DESIGN OF COMBINATIONAL LOGIC CIRCUITS IN QCA

Winter 14 EXAMINATION Subject Code: Model Answer P a g e 1/28

ENGG1015: lab 3. Sequential Logic

Digital Integrated CircuitDesign

Electronic Circuits EE359A

ELECTRONIC CIRCUITS. Time: Three Hours Maximum Marks: 100

Practical Workbook Logic Design & Switching Theory

Quartus II Simulation with Verilog Designs

Department of Electronics and Communication Engineering

Multiplexer for Capacitive sensors


First Name: Last Name: Lab Cover Page. Teaching Assistant to whom you are submitting

Spec. Instructor: Center

EECS 270: Lab 7. Real-World Interfacing with an Ultrasonic Sensor and a Servo

Transcription:

CS 61C: Great Ideas in Computer Architecture Lecture 10: Finite State Machines, Func/onal Units Instructor: Sagar Karandikar sagark@eecs.berkeley.edu hep://inst.eecs.berkeley.edu/~cs61c 1 Levels of RepresentaJon/ InterpretaJon High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g., MIPS) Machine Interpreta4on Assembler Machine Language Program (MIPS) Hardware Architecture DescripCon (e.g., block diagrams) Architecture Implementa4on Logic Circuit DescripCon (Circuit SchemaCc Diagrams) temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; lw $t0, 0($2) lw $t1, 4($2) sw $t1, 0($2) sw $t0, 4($2) Anything can be represented as a number, i.e., data or instrucjons 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 2 Type of Circuits Synchronous Digital Systems consist of two basic types of circuits: CombinaJonal Logic (CL) circuits Output is a funcjon of the inputs only, not the history of its execujon E.g., circuits to add A, B (ALUs) SequenJal Logic (SL) Circuits that remember or store informajon aka State Elements E.g., memories and registers (Registers) Uses for State Elements Place to store values for later re- use: Register files (like $1- $31 in MIPS) Memory (caches and main memory) Help control flow of informa/on between combina/onal logic blocks State elements hold up the movement of informajon at input to combinajonal logic blocks to allow for orderly passage 3 4 Accumulator Example Why do we need to control the flow of informajon? First Try: Does this work? X i SUM S Want: S=0; for (i=0;i<n;i++) S = S + X i Assume: Each X value is applied in succession, one per cycle Ader n cycles the sum is present on S 5 Feedback No! Reason #1: How to control the next iterajon of the for loop? Reason #2: How do we say: S=0? We ll go through a working version in more detail today 6 1

Model for Synchronous Systems Register Internals CollecJon of CombinaJonal Logic blocks separated by registers Feedback is opjonal Clock signal(s) connects only to clock input of registers Clock (CLK): steady square wave that synchronizes the system Register: several bits of state that samples on rising edge of CLK (posijve edge- triggered) or falling edge (negajve edge- triggered) 7 n instances of a Flip- Flop Flip- flop name because the output flips and flops between 0 and 1 D is data input, Q is data output Also called D- type Flip- Flop 8 Flip- Flop OperaJon Edge- triggered d- type flip- flop This one is posijve edge- triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other Jmes, the input d is ignored. Example waveforms: Flip- Flop Timing Edge- triggered d- type flip- flop This one is posijve edge- triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other Jmes, the input d is ignored. Example waveforms (more detail): Camera Analogy Timing Terms Hardware Timing Terms Want to take a portrait Jming right before and ader taking picture Set up /me don t move since about to take picture (open camera shueer) Hold /me need to hold sjll ader shueer opens unjl camera shueer closes Time click to data Jme from open shueer unjl can see image on output (viewscreen) Setup Time: when the input must be stable before the edge of the CLK Hold Time: when the input must be stable aaer the edge of the CLK CLK- to- Q Delay: how long it takes the output to change, measured from the edge of the CLK 11 12 2

Accumulator Timing 1/2 Reset input to register is used to force it to all zeros (takes priority over D input). S i- 1 holds the result of the i th - 1 iterajon. Analyze circuit Jming starjng at the output of the register. Accumulator Timing 2/2 Reset signal shown Also, in pracjce X might not arrive to the adder at the same Jme as S i- 1 S i temporarily is wrong, but register always captures correct value. In good circuits, instability never happens around rising edge of clk. Accumulator Logisim Demo Maximum Clock Frequency What is the maximum frequency of this circuit? Hint: Frequency = 1/Period Max Delay = CLK- to- Q Delay + CL Delay + Setup Time 16 CriJcal Paths Pipelining to improve performance Timing Timing Note: delay of 1 clock cycle from input to output. Clock period limited by propagation delay of adder/shifter. Insertion of register allows higher clock frequency. More outputs per second (higher bandwidth) But each individual result takes longer (greater latency) 3

Recap of Timing Terms Clock (CLK) - steady square wave that synchronizes system Setup Time - when the input must be stable before the rising edge of the CLK Hold Time - when the input must be stable ader the rising edge of the CLK CLK- to- Q Delay - how long it takes the output to change, measured from the rising edge of the CLK Flip- flop - one bit of state that samples every rising edge of the CLK (posijve edge- triggered) Register - several bits of state that samples on rising edge of CLK or on LOAD (posijve edge- triggered) Clickers/Peer InstrucJon Clock- >Q 1ns Setup 1ns Hold 1ns AND delay 1ns What is maximum clock frequency? (assume all unconnected inputs come from some register) A: 5 GHz B: 200 MHz C: 500 MHz D: 1/7 GHz E: 1/6 GHz Administrivia HW2 out We recommend doing this before the midterm Proj 2-1 out Make sure you test your code on hive machines, that s where we ll grade them Team registrajon problems? Email Jay Administrivia Midterm this Thursday In this room, at this Jme One 8.5 x11 handwrieen cheatsheet We ll provide a MIPS green sheet No electronics Covers up to and including the 07/02 lecture Review session slides posted on Piazza 21 22 Break Finite State Machines (FSM) Intro A convenient way to conceptualize computation over time We start at a state and given an input, we follow some edge to another (or the same) state The function can be represented with a state transition diagram. With combinational logic and registers, any FSM can be implemented in hardware. 23 4

Draw the FSM FSM Example: 3 ones FSM to detect the occurrence of 3 consecutive 1 s in the input. Hardware ImplementaJon of FSM Therefore a register is needed to hold the a representation of which state the machine is in. Use a unique bit pattern for each state. + Assume state transitions are controlled by the clock: on each clock cycle the machine checks the inputs and moves to a new state and produces a new output Combinational logic circuit is used to implement a function maps from present state and input to next state and output. =? FSM CombinaJonal Logic Specify CL using a truth table. Moving between RepresentaJons Use this table and techniques we learned last time (and later in discussion) to transform between alternative views of same logic function Truth table PS Input NS Output 00 0 00 0 00 1 01 0 01 0 00 0 01 1 10 0 10 0 00 0 10 1 00 1 Enumerate Inputs Boolean Expression Truth Table Sum of Products, Product of Sums Methods Use Equivalency between boolean operators and gates Enumerate Inputs Gate Diagram Building Standard Functional Units Data multiplexers Arithmetic and Logic Unit Adder/Subtractor Data Multiplexer ( Mux ) (here 2-to-1, n-bit-wide) 5

N instances of 1-bit-wide mux How many rows in TT? How do we build a 1-bit-wide mux? 4-to-1 multiplexer? How many rows in TT? Another way to build 4-1 mux? Hint: NCAA tourney! Ans: Hierarchically! Arithmetic and Logic Unit Our simple ALU Most processors contain a special logic block called the Arithmetic and Logic Unit (ALU) We ll show you an easy one that does ADD, SUB, bitwise AND, bitwise OR 6

Clicker QuesJon Convert the truth table to a boolean expression using sum of products (no need to simplify): A: F = xy + x(~y) B: F = xy + (~x)y + (~x)(~y) C: F = xy + (~x)y D: F = (~x)y + x(~y) x y F(x,y) 0 0 0 0 1 1 1 0 0 1 1 1 37 In the News: Microsod, Google beat Humans at Image RecogniJon (EE Times) On ImageNet benchmark image database, systems from Microsod and Google performed beeer than humans at recognizing images Both companies used deep arjficial neural networks to train on image database NVIDIA is a sponsor of the annual ImageNet Challenge, and supplies access to arrays of its graphic processing units (GPUs) to all contestants. Microsod did use Nvidia GPUs, but bought and configured their own supercomputer using them to simulate parametric recjfied linear neural units to become the "1st to beat a human" at image classificajon. 38 Break How to design Adder/Subtractor? Truth-table, then determine canonical form, then minimize and implement as we ve seen before Look at breaking the problem down into smaller pieces that we can cascade or hierarchically layer 39 Adder/Subtractor One-bit adder LSB Adder/Subtractor One-bit adder (1/2) 7

Adder/Subtractor One-bit adder (2/2) N 1-bit adders 1 N-bit adder b 0 + + + What about overflow? Overflow = c n? Extremely Clever Subtractor Clicker QuesJon pt. 2 Convert the truth table to a boolean expression using product of sums (no need to simplify): + + + A: F = (x+y)(~x+y) B: F = (x+y)(~x+~y) x y F(x,y) 0 0 0 0 1 1 1 0 0 x y XOR(x,y) C: F = (~x+y)(x+y)(~x+~y) 1 1 1 XOR serves as condiconal inverter! 0 0 0 0 1 1 1 0 1 1 1 0 D: F = (~x+~y)(~x+y)(x+~y)(x+y) 46 In Conclusion Finite State Machines have clocked state elements plus combinajonal logic to describe transijon between states Standard combinajonal funcjonal unit blocks built hierarchically from subcomponents Tomorrow: We ll build a CPU 47 8