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

Slides:



Advertisements
Similar presentations
Penn ESE370 Fall DeHon 1 ESE370: Circuit-Level Modeling, Design, and Optimization for Digital Systems Day 24: November 4, 2011 Synchronous Circuits.
Advertisements

1 Lecture 28 Timing Analysis. 2 Overview °Circuits do not respond instantaneously to input changes °Predictable delay in transferring inputs to outputs.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 2: Overview of Computer Organization Partially adapted from Computer Organization and.
CS61C L15 Representations of Combinatorial Logic Circuits (1) Garcia, Fall 2005 © UCB Lecturer PSOE, new dad Dan Garcia
CS 61C L29 Combinational Logic Blocks (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS61C L23 Combinational Logic Blocks (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L23 Combinational Logic Blocks (1) Garcia, Spring 2007 © UCB Salamander robot!  Swiss scientists have built a robot that can both swim and walk.
CS61C L21 State Elements: CircuitsThat Remember (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 61C L14 State (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #14: State and FSMs Andy.
CS 61C L14 Combinational Logic (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #14: Combinational.
CS 300 – Lecture 3 Intro to Computer Architecture / Assembly Language Sequential Circuits.
CS61C L21 State Elements : Circuits that Remember (1) Spring 2007 © UCB 161 Exabytes In 2006  In 2006 we created, captured, and replicated 161 exabytes.
CS61C L22 Representations of Combinatorial Logic Circuits (1) Garcia, Spring 2008 © UCB 100 MPG Car contest!  The X Prize Foundation has put up two prizes;
CS61C L21 State Elements : Circuits that Remember (1) Garcia, Fall 2006 © UCB One Laptop per Child  The OLPC project has been making news recently with.
Sequential Logic 1  Combinational logic:  Compute a function all at one time  Fast/expensive  e.g. combinational multiplier  Sequential logic:  Compute.
CS61C L17 Combinatorial Logic Blocks (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
CS61C L14 Introduction to Synchronous Digital Systems (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L22 Representations of Combinatorial Logic Circuits (1) Eric, Spring 2010 © UCB Cal Alumni Wins 2009 Turing Award! Charles P. Thacker was named.
CS61C L18 Combinational Logic Blocks, Latches (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
CS61C L14 Synchronous Digital Systems & State Elements I (1) Pearce, Summer 2010 © UCB inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
CS61C L23 Combinational Logic Blocks (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c UC.
CS 61C L23 Combinational Logic Blocks (1) Garcia, Fall 2004 © UCB slashdot.org/article.pl?sid=04/10/21/ &tid=126&tid=216 Lecturer PSOE Dan Garcia.
CS 61C L15 Blocks (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #15: Combinational Logic Blocks.
CS 61C L21 State Elements: CircuitsThat Remember (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS61C L17 Combinational Logic (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #17.
CS61C L14 Introduction to Synchronous Digital Systems (1) Garcia, Fall 2005 © UCB Lecturer PSOE, new dad Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS61C L15 Synchronous Digital Systems (1) Beamer, Summer 2007 © UCB Scott Beamer, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
CS 61C L15 State & Blocks (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #15: State 2 and Blocks.
Instructor: Justin Hsia
CS3350B Computer Architecture Winter 2015 Lecture 5.2: State Circuits: Circuits that Remember Marc Moreno Maza [Adapted.
CS 61C: Great Ideas in Computer Architecture Lecture 10: Finite State Machines, Functional Units Instructor: Sagar Karandikar
1 COMP541 State Machines Montek Singh Feb 8, 2012.
CS 61C: Great Ideas in Computer Architecture Lecture 9: Synchronous Digital Systems Instructor: Sagar Karandikar
CS61C L26 Combinational Logic Blocks (1) Garcia, Spring 2014 © UCB Very fast 3D Micro Printer  A new company called Nanoscribe has developed a fabrication.
CS 61C: Great Ideas in Computer Architecture Synchronous Digital Systems 1 Instructors: John Wawrzynek & Vladimir Stojanovic
Computer Organization and Design Lecture 16 – Combinational Logic Blocks Close call!   Cal squeaked by Washington in Overtime We win, and then.
CS3350B Computer Architecture Winter 2015 Lecture 5.4: Combinational Logic Blocks Marc Moreno Maza [Adapted from lectures.
DLD Lecture 26 Finite State Machine Design Procedure.
CS 61C: Great Ideas in Computer Architecture Finite State Machines, Functional Units 1 Instructors: John Wawrzynek & Vladimir Stojanovic
MicroComputer Engineering DigitalCircuits slide 1 Combinational circuits Changes at inputs propagate at logic speed to outputs Not clocked No internal.
CS 61C L4.1.2 State (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture State and FSMs Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
Instructor: Justin Hsia 7/24/2013Summer Lecture #181 CS 61C: Great Ideas in Computer Architecture Combinational and Sequential Logic, Boolean Algebra.
CS61C L24 State Elements : Circuits that Remember (1) Garcia, Fall 2014 © UCB Senior Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 61C: Great Ideas in Computer Architecture Sequential Elements, Synchronous Digital Systems 1 Instructors: Vladimir Stojanovic & Nicholas Weaver
CS 61C: Great Ideas in Computer Architecture Finite State Machines, Functional Units 1 Instructors: Vladimir Stojanovic and Nicholas Weaver
CS 110 Computer Architecture Lecture 9: Finite State Machines, Functional Units Instructor: Sören Schwertfeger School of.
CS 61C: Great Ideas in Computer Architecture MIPS Datapath 1 Instructors: Nicholas Weaver & Vladimir Stojanovic
Revisão de Circuitos Lógicos PARTE I. What are “Machine Structures”? Coordination of many levels of abstraction I/O systemProcesso r Compiler Operating.
Revisão de Circuitos Lógicos PARTE III. Review Use this table and techniques we learned to transform from 1 to another.
Flip Flops Lecture 10 CAP
6. Sequential circuits Rocky K. C. Chang 17 October 2017.
6. Sequential circuits (v2)
State Circuits : Circuits that Remember
Instructor: Alexander Stoytchev
Inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #21 State Elements: Circuits that Remember Hello to James Muerle in the.
Instructors: Randy H. Katz David A. Patterson
Instructor: Justin Hsia
Guerilla Section #4 10/05 SDS & MIPS Datapath
minecraft.gamepedia.com/Tutorials/Basic_Logic_Gates
Instructor Paul Pearce
Senior Lecturer SOE Dan Garcia
Lecturer SOE Dan Garcia
Hello to Casey Holgado listening from Oklahoma State!
robosavvy.com/forum/viewtopic.php?p=32542
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Inst.eecs.berkeley.edu/~cs61c CS61CL : Machine Structures Lecture #8 – State Elements, Combinational Logic Greet class James Tu, TA.
Instructor Paul Pearce
TA David “The Punner” Eitan Poll
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Instructor: Michael Greenbaum
Presentation transcript:

CS 61C: Great Ideas in Computer Architecture Finite State Machines Instructors: Krste Asanovic & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/sp15

Levels of Representation/Interpretation temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; High Level Language Program (e.g., C) Compiler 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 instructions Assembly Language Program (e.g., MIPS) Assembler 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 Machine Language Program (MIPS) Machine Interpretation Hardware Architecture Description (e.g., block diagrams) Architecture Implementation Logic Circuit Description (Circuit Schematic Diagrams)

Type of Circuits Synchronous Digital Systems consist of two basic types of circuits: Combinational Logic (CL) circuits Output is a function of the inputs only, not the history of its execution E.g., circuits to add A, B (ALUs) Sequential Logic (SL) Circuits that “remember” or store information 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 information between combinational logic blocks State elements hold up the movement of information at input to combinational logic blocks to allow for orderly passage

Accumulator Example Want: S=0; for (i=0;i<n;i++) S = S + Xi Assume: Why do we need to control the flow of information? SUM Xi S Want: S=0; for (i=0;i<n;i++) S = S + Xi Assume: Each X value is applied in succession, one per cycle After n cycles the sum is present on S

First Try: Does this work? Feedback No! Reason #1: How to control the next iteration of the ‘for’ loop? Reason #2: How do we say: ‘S=0’?

Second Try: How About This? Register is used to hold up the transfer of data to adder Square wave clock sets when things change High (1) Low (0) Rough timing … Rounded Rectangle per clock means could be 1 or 0 High (1) Low (0) Xi must be ready before clock edge due to adder delay High (1) Low (0) Time

Model for Synchronous Systems Collection of Combinational Logic blocks separated by registers Feedback is optional 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 (positive edge-triggered) or falling edge (negative edge-triggered)

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”

Flip-Flop Operation 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.” Example waveforms: Fall 2010 -- Lecture #23

Flip-Flop Timing 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.” Example waveforms (more detail):

Camera Analogy Timing Terms Want to take a portrait – timing right before and after taking picture Set up 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 click to data – time from open shutter until can see image on output (viewscreen)

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 after 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). Si-1 holds the result of the ith-1 iteration. Analyze circuit timing starting at the output of the register.

Accumulator Timing 2/2 reset signal shown. Also, in practice X might not arrive to the adder at the same time as Si-1 Si 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

Critical Paths Timing… Note: delay of 1 clock cycle from input to output. Clock period limited by propagation delay of adder/shifter.

Pipelining to improve performance Timing… Insertion of register allows higher clock frequency. More outputs per second (higher bandwidth) But each individual result takes longer (greater latency)

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 after 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 (positive edge-triggered) Register - several bits of state that samples on rising edge of CLK or on LOAD (positive edge-triggered)

Clickers/Peer Instruction Clock Clock->Q 1ns Setup 1ns Hold 1ns AND delay 1ns What is maximum clock frequency? A: 5 GHz B: 200 MHz C: 500 MHz D: 1/7 GHz E: 1/6 GHz

Administrivia Project 1-1 due 3/01 Midterm is next Thursday 2/26, in class Covers up to and including the previous lecture 1 handwritten, 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 Genetics 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.

FSM Example: 3 ones… Draw the FSM… FSM to detect the occurrence of 3 consecutive 1’s in the input. Draw the FSM… 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…

Hardware Implementation 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. + ? = Combinational logic circuit is used to implement a function maps from present state and input to next state and output.

FSM Combinational Logic Specify CL using a truth table. Truth table… 1 00 10 01 Output NS Input PS

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?

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 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

Our simple ALU

In the News: Microsoft, Google beat Humans at Image Recognition (EE Times) On ImageNet benchmark image database, systems from Microsoft and Google performed better than humans at recognizing images Both companies used deep artificial neural networks to train on image database

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

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 + What about overflow? Overflow = cn?

Extremely Clever Subtractor + x y XOR(x,y) 1 XOR serves as conditional inverter!

In Conclusion Finite State Machines have clocked state elements plus combinational logic to describe transition between states Standard combinational functional unit blocks built hierarchically from subcomponents