CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Similar documents
Let s put together a Manual Processor

ASYNCHRONOUS COUNTERS

Binary Adders: Half Adders and Full Adders

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

Flip-Flops, Registers, Counters, and a Simple Processor

Lesson 12 Sequential Circuits: Flip-Flops

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Lecture 10 Sequential Circuit Design Zhuo Feng. Z. Feng MTU EE4800 CMOS Digital IC Design & Analysis 2010

Lecture 8: Synchronous Digital Systems

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Counters and Decoders

Lecture 7: Clocking of VLSI Systems

Module 3: Floyd, Digital Fundamental

CHAPTER 11: Flip Flops

Lecture 11: Sequential Circuit Design

Memory Elements. Combinational logic cannot remember

DEPARTMENT OF INFORMATION TECHNLOGY

Computer organization

CS311 Lecture: Sequential Circuits

The 104 Duke_ACC Machine

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Lecture 10: Sequential Circuits

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

(Refer Slide Time: 00:01:16 min)

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

Sequential Logic Design Principles.Latches and Flip-Flops

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CSE140: Components and Design Techniques for Digital Systems

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

Counters. Present State Next State A B A B

BINARY CODED DECIMAL: B.C.D.

A New Paradigm for Synchronous State Machine Design in Verilog

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

Chapter 2 Logic Gates and Introduction to Computer Architecture

COMBINATIONAL CIRCUITS

CSE140 Homework #7 - Solution

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

Counters & Shift Registers Chapter 8 of R.P Jain

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

(1) /30 (2) /30 (3) /40 TOTAL /100

Binary full adder. 2-bit ripple-carry adder. CSE 370 Spring 2006 Introduction to Digital Design Lecture 12: Adders

Asynchronous counters, except for the first block, work independently from a system clock.

Latch Timing Parameters. Flip-flop Timing Parameters. Typical Clock System. Clocking Overhead

Chapter 8. Sequential Circuits for Registers and Counters

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Contents COUNTER. Unit III- Counters

Sequential Circuits. Combinational Circuits Outputs depend on the current inputs

Sequential Circuit Design

Wiki Lab Book. This week is practice for wiki usage during the project.

Combinational Logic Design Process

Modeling Latches and Flip-flops

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Asynchronous Counters. Asynchronous Counters

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

CHAPTER 3 Boolean Algebra and Digital Logic

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

EE360: Digital Design I Course Syllabus

Gates, Circuits, and Boolean Algebra

3.Basic Gate Combinations

Sequential Logic: Clocks, Registers, etc.

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Systems I: Computer Organization and Architecture

6.004 Computation Structures Spring 2009

Adder.PPT(10/1/2009) 5.1. Lecture 13. Adder Circuits

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Cascaded Counters. Page 1 BYU

路 論 Chapter 15 System-Level Physical Design

Generating MIF files

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Timing Methodologies (cont d) Registers. Typical timing specifications. Synchronous System Model. Short Paths. System Clock Frequency

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Digital Logic Design Sequential circuits

Getting the Most Out of Synthesis

Decimal Number (base 10) Binary Number (base 2)

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Lecture-3 MEMORY: Development of Memory:

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Understanding Verilog Blocking and Non-blocking Assignments

8254 PROGRAMMABLE INTERVAL TIMER

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

NEW adder cells are useful for designing larger circuits despite increase in transistor count by four per cell.

Chapter 5 Instructor's Manual

Introducción. Diseño de sistemas digitales.1

Lecture 5: Gate Logic Logic Optimization

DM74LS169A Synchronous 4-Bit Up/Down Binary Counter

Understanding Logic Design

Transcription:

CS 61C: Great Ideas in Computer Architecture Finite State Machines Instructors: Krste Asanovic & Vladimir Stojanovic hbp://inst.eecs.berkeley.edu/~cs61c/sp15 1 Levels of RepresentaKon/ InterpretaKon 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 instruckons 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: CombinaKonal Logic (CL) circuits Output is a funckon of the inputs only, not the history of its execukon E.g., circuits to add A, B (ALUs) SequenKal Logic (SL) Circuits that remember or store informakon 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 informakon at input to combinakonal logic blocks to allow for orderly passage 3 4 Accumulator Example First Try: Does this work? Why do we need to control the flow of informakon? 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 Afer n cycles the sum is present on S 5 Feedback No! Reason #1: How to control the next iterakon of the for loop? Reason #2: How do we say: S=0? 6 1

Second Try: How About This? Register is used to hold up the transfer of data to adder Model for Synchronous Systems Square wave clock sets when things change Rough Kming High (1) Low (0) High (1) Low (0) High (1) Low (0) Time Rounded Rectangle per clock means could be 1 or 0 Xi must be ready before clock edge due to adder delay 7 CollecKon of CombinaKonal Logic blocks separated by registers Feedback is opkonal 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 (posikve edge- triggered) or falling edge (negakve edge- triggered) 8 Register Internals 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 9 Flip- Flop OperaKon Edge- triggered d- type flip- flop This one is posikve edge- triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other Kmes, the input d is ignored. Example waveforms: Fall 2010 - - Lecture #23 Flip- Flop Timing Edge- triggered d- type flip- flop This one is posikve edge- triggered On the rising edge of the clock, the input d is sampled and transferred to the output. At all other Kmes, the input d is ignored. Example waveforms (more detail): Camera Analogy Timing Terms Want to take a portrait Kming right before and afer taking picture Set up ;me don t move since about to take picture (open camera shuber) Hold ;me need to hold skll afer shuber opens unkl camera shuber closes Time click to data Kme from open shuber unkl can see image on output (viewscreen) 12 2

Hardware Timing Terms Setup Time: when the input must be stable before the edge of the CLK Hold Time: when the input must be stable a?er the edge of the CLK CLK- to- Q Delay: how long it takes the output to change, measured from the edge of the CLK 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 iterakon. Analyze circuit Kming starkng at the output of the register. 13 Accumulator Timing 2/2 reset signal shown. Also, in prackce X might not arrive to the adder at the same Kme 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. 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 CriKcal 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 afer 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 (posikve edge- triggered) Register - several bits of state that samples on rising edge of CLK or on LOAD (posikve edge- triggered) Clickers/Peer InstrucKon Clock What is maximum clock frequency? A: 5 GHz B: 200 MHz C: 500 MHz D: 1/7 GHz E: 1/6 GHz Clock- >Q 1ns Setup 1ns Hold 1ns AND delay 1ns Administrivia Project 1-1 due 3/01 Midterm is next Thursday 2/26, in class Covers up to and including the previous lecture 1 handwriben, double sided, 8.5 x11 cheat sheet We ll give you MIPS green sheet Review Sessions: TA: Monday 2/23, 7-9pm, 10 Evans HKN: Saturday 2/21, 1-4pm, 100 GeneKcs Plant Biology Finite State Machines (FSM) Intro You have seen FSMs in other classes." Same basic idea." The function can be represented with a state transition diagram." With combinational logic and registers, any FSM can be implemented in hardware." 21 FSM Example: 3 ones FSM to detect the occurrence of 3 consecutive 1 s in the input." Draw the FSM! Hardware ImplementaKon 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.! =!?! 4

FSM CombinaKonal Logic Specify CL using a truth table." 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" Moving between Representations" Use this table and techniques we learned last time to transform between alternative views of same logic function" Building Standard Functional Units" Data multiplexers" Arithmetic and Logic Unit" Adder/Subtractor" Data Multiplexer ( Mux ) (here 2-to-1, n-bit-wide)" N instances of 1-bit-wide mux" How many rows in TT? How do we build a 1-bit-wide mux?" 5

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" In the News: Microsof, Google beat Humans at Image RecogniKon (EE Times) 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" On ImageNet benchmark image database, systems from Microsof and Google performed beber than humans at recognizing images Both companies used deep arkficial neural networks to train on image database 35 6

Adder/Subtractor One-bit adder LSB " Adder/Subtractor One-bit adder (1/2) " 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 " + + + In Conclusion Finite State Machines have clocked state elements plus combinakonal logic to describe transikon between states Standard combinakonal funckonal unit blocks built hierarchically from subcomponents XOR serves as condiconal inverter! x! y! XOR(x,y)! 0! 0! 0! 0! 1! 1! 1! 0! 1! 1! 1! 0! 42 7