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

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

CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures

CS3350B Computer Architecture Winter 2015

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

Sequential Elements con t Synchronous Digital Systems

CS61C : Machine Structures

More Digital Circuits

CS 61C: Great Ideas in Computer Architecture

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

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

COMP2611: Computer Organization. Introduction to Digital Logic

Logic Design II (17.342) Spring Lecture Outline

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Chapter 5 Synchronous Sequential Logic

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

11. Sequential Elements

Combinational vs Sequential

D Latch (Transparent Latch)

Digital Integrated Circuits EECS 312

ECEN454 Digital Integrated Circuit Design. Sequential Circuits. Sequencing. Output depends on current inputs

Logic Design. Flip Flops, Registers and Counters

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

Synchronous Sequential Logic

EECS150 - Digital Design Lecture 2 - CMOS

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

Computer Systems Architecture

CS8803: Advanced Digital Design for Embedded Hardware

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

Digital Integrated Circuits EECS 312

The NOR latch is similar to the NAND latch

EECS150 - Digital Design Lecture 9 - CPU Microarchitecture. CMOS Devices

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

Chapter 5 Synchronous Sequential Logic

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

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

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

EE 367 Lab Part 1: Sequential Logic

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

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

Advanced Digital Logic Design EECS 303

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

Digital Integrated Circuits EECS 312. Review. Remember the ENIAC? IC ENIAC. Trend for one company. First microprocessor

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

CHAPTER 4: Logic Circuits

Design and Simulation of a Digital CMOS Synchronous 4-bit Up-Counter with Set and Reset

EE 447/547 VLSI Design. Lecture 9: Sequential Circuits. VLSI Design EE 447/547 Sequential circuits 1

CHAPTER1: Digital Logic Circuits

EE292: Fundamentals of ECE

Asynchronous (Ripple) Counters

Sequential Circuit Design: Part 1

Sequential Logic. Introduction to Computer Yung-Yu Chuang

Outline. EECS150 - Digital Design Lecture 27 - Asynchronous Sequential Circuits. Cross-coupled NOR gates. Asynchronous State Transition Diagram

MC9211 Computer Organization

Sequential Logic Circuits

COMP sequential logic 1 Jan. 25, 2016

CSE140: Components and Design Techniques for Digital Systems. More D-Flip-Flops. Tajana Simunic Rosing. Sources: TSR, Katz, Boriello & Vahid

Sequential Circuit Design: Part 1

EECS 373 Design of Microprocessor-Based Systems

Lecture 7: Sequential Networks

Logic Design II (17.342) Spring Lecture Outline

Lecture 11: Sequential Circuit Design

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

Contents Slide Set 6. Introduction to Chapter 7 of the textbook. Outline of Slide Set 6. An outline of the first part of Chapter 7

Lecture 10: Sequential Circuits

CHAPTER 4: Logic Circuits

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

EECS150 - Digital Design Lecture 3 - Timing

Switching Circuits & Logic Design

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

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

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

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

EECS150 - Digital Design Lecture 10 - Interfacing. Recap and Topics

Chapter 5: Synchronous Sequential Logic

Name Of The Experiment: Sequential circuit design Latch, Flip-flop and Registers

Introduction to Microprocessor & Digital Logic

Experiment 8 Introduction to Latches and Flip-Flops and registers

Chapter 3 Unit Combinational

CPE/EE 427, CPE 527 VLSI Design I Sequential Circuits. Sequencing

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

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

Chapter 5 Flip-Flops and Related Devices

ELCT201: DIGITAL LOGIC DESIGN

Lecture 8: Sequential Logic

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

Analogue Versus Digital [5 M]

Logic Design Viva Question Bank Compiled By Channveer Patil

BUSES IN COMPUTER ARCHITECTURE

Chapter 5 Synchronous Sequential Logic

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Chapter 5 Sequential Circuits

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Decade Counters Mod-5 counter: Decade Counter:

Transcription:

CS6C L5 Intro to SDS, State Elements I () inst.eecs.berkeley.edu/~cs6c CS6C : Machine Structures Lecture #5 Intro to Synchronous Digital Systems, State Elements I 28-7-6 Go BEARS~ Albert Chae, Instructor What are Machine Structures? Software Hardware Application (Netscape) Compiler Assembler Operating System (MacOS X) Processor Memory I/O system Datapath & Control Digital Design Circuit Design transistors 6C Instruction Set Architecture Coordination of many levels of abstraction ISA is an important abstraction level: contract between HW & SW CS6C L5 Intro to SDS, State Elements I (2) Below the Program High-level language program (in C) swap int v[], int k){ int temp; temp = v[k]; v[k] = v[k+]; v[k+] = temp; } Assembly language program (for MIPS) swap: sll $2, $5, 2 add $2, $4,$2 lw $5, ($2) lw $6, 4($2) sw $6, ($2) sw $5, 4($2) jr $3 Machine (object) code (for MIPS)... C compiler assembler 6C Levels of Representation High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g.,mips) Assembler Machine Language Program (MIPS) Machine Interpretation Hardware Architecture Description (Logic, Logisim, etc.) Architecture Implementation Logic Circuit Description (Logisim, etc.) temp = v[k]; v[k] = v[k+]; v[k+] = temp; lw $t, ($2) lw $t, 4($2) sw $t, ($2) sw $t, 4($2) CS6C L5 Intro to SDS, State Elements I (3) CS6C L5 Intro to SDS, State Elements I (4) Synchronous Digital Systems Logic Design The hardware of a processor, such as the MIPS, is an example of a Synchronous Digital System Synchronous: Means all operations are coordinated by a central clock. - It keeps the heartbeat of the system! Digital: Mean all values are represented by discrete values Electrical signals are treated as s and s and grouped together to form words. CS6C L5 Intro to SDS, State Elements I (5) Next 4 weeks: we ll study how a modern processor is built; starting with basic elements as building blocks. Why study hardware design? Understand capabilities and limitations of hardware in general and processors in particular. 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 5, CS 52, EE 92) There is just so much you can do with processors. At some point you may need to design your own custom hardware. CS6C L5 Intro to SDS, State Elements I (6)

PowerPC Die Photograph Transistors Metal-Oxide-Semiconductor Field-Effect Transistor G Come in two types: - n-type NMOSFET p-type PMOSFET For n-type (p-type opposite) G S n-type If voltage not enough between G & S, transistor turns off (cut-off) and Drain-Source NOT connected If the G & S voltage is high enough, transistor turns on (saturation) and Drain-Source ARE connected Let s look closer S D MOSFET D p-type Side view www.wikipedia.org/wiki/mosfet CS6C L5 Intro to SD S, State Elements I (7) Chae, Summer 28 U CB Transistor Circuit Rep. vs. Block diagram CS6C L5 Intro to SD S, State Elements I (8) Chae, Summer 28 U CB Signals and Waveforms: Clocks Chips is composed of nothing but transistors and wires. Small groups of transistors form useful building blocks. (voltage source) a b c (ground) Block are organized in a hierarchy to build higher-level blocks: ex: adders. CS6C L5 Intro to SD S, State Elements I (9) Chae, Summer 28 U CB Signals and Waveforms CS6C L5 Intro to SD S, State Elements I () Signals When digital is only treated as or Is transmitted over wires continuously Transmission is effectively instant - Implies that any wire only contains value at a time CS6C L5 Intro to SD S, State Elements I () Chae, Summer 28 U CB Signals and Waveforms: Grouping Chae, Summer 28 U CB CS6C L5 Intro to SD S, State Elements I (2) Chae, Summer 28 U CB

CS6C L5 Intro to SDS, State Elements I (3) Signals and Waveforms: Circuit Delay Type of Circuits Synchronous Digital Systems are made up of two basic types of circuits: 2 3 4 5 3 4 5 6 5 7 9 Combinational Logic (CL) circuits Our previous adder circuit is an example. Output is a function of the inputs only. Similar to a pure function in mathematics, y = f(x). (No way to store information from one invocation to the next. No side effects) State Elements: circuits that store information. CS6C L5 Intro to SDS, State Elements I (4) Circuits with STATE (e.g., register) Peer Instruction A. SW can peek at HW (past ISA abstraction boundary) for optimizations B. SW can depend on particular HW implementation of ISA AB : FF : FT 2: TF 3: TT C. Timing diagrams serve as a critical debugging tool in the EE toolkit White is true C: T F CS6C L5 Intro to SDS, State Elements I (5) CS6C L5 Intro to SDS, State Elements I (6) Sample Debugging Waveform Administrivia Hw3 is due today Proj2 is due Friday Faux midterm today 6-9 Review session Thursday in lecture Extra MT OH? Midterm 7/2 7-p in 55 Dwinelle CS6C L5 Intro to SDS, State Elements I (7) CS6C L5 Intro to SDS, State Elements I (8)

CS6C L5 Intro to SDS, State Elements I (9) Uses for State Elements. As a place to store values for some indeterminate amount of time: Register files (like $-$3 on the MIPS) Memory (caches, and main memory) 2. Help control the flow of information between combinational logic blocks. State elements are used to hold up the movement of information at the inputs to combinational logic blocks and allow for orderly passage. Accumulator Example Why do we need to control the flow of information? Want: S=; for (i=;i<n;i++) S = S + X i Assume: Each X value is applied in succession, one per cycle. After n cycles the sum is present on S. CS6C L5 Intro to SDS, State Elements I (2) First try Does this work? Second try How about this? Feedback Nope! Reason # What is there to control the next iteration of the for loop? Reason #2 How do we say: S=? Rough timing Register is used to hold up the transfer of data to adder. CS6C L5 Intro to SDS, State Elements I (2) CS6C L5 Intro to SDS, State Elements I (22) Register Details What s inside? n instances of a Flip-Flop Flip-flop name because the output flips and flops between and, D is data, Q is output Also called d-type Flip-Flop What s the timing of a Flip-flop? (/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. Example waveforms: CS6C L5 Intro to SDS, State Elements I (23) CS6C L5 Intro to SDS, State Elements I (24)

CS6C L5 Intro to SDS, State Elements I (25) 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. Example waveforms (more detail): Accumulator Revisited (proper timing /2) Reset input to register is used to force it to all zeros (takes priority over D input). S i- holds the result of the i th - iteration. Analyze circuit timing starting at the output of the register. CS6C L5 Intro to SDS, State Elements I (26) Accumulator Revisited (proper timing 2/2) reset signal shown. Also, in practice X might not arrive to the adder at the same time as S i- S i temporarily is wrong, but register always captures correct value. In good circuits, instability never happens around rising edge of clk. 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 Flip-flop - one bit of state that samples every rising edge of the CLK Register - several bits of state that samples on rising edge of CLK or on LOAD CS6C L5 Intro to SDS, State Elements I (27) CS6C L5 Intro to SDS, State Elements I (28) Finite State Machines (FSM) Introduction 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. CS6C L5 Intro to SDS, State Elements I (29) Finite State Machine Example: 3 ones FSM to detect the occurrence of 3 consecutive 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 CS6C L5 Intro to SDS, State Elements I (3)

CS6C L5 Intro to SDS, State Elements I (3) 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. + =? Hardware for FSM: Combinational Logic Next lecture we will discuss the detailed implementation, but for now can look at its functional specification, truth table form. CS6C L5 Intro to SDS, State Elements I (32) Truth table PS Input NS Output Peer Instruction A. HW feedback akin to SW recursion B. The minimum period of a usable synchronous circuit is at least the CLK-to-Q delay AB : FF : FT 2: TF 3: TT Peer Instruction A. It Answer needs base case (reg reset), way to step from i to i+ (use register + clock).true! B. If not, will loose data!true! C. How many states would it have? Say it s n. How does it know when n+ bits have been seen? False! C. You can build a FSM to signal when an equal number of s and s has appeared in the input. CS6C L5 Intro to SDS, State Elements I (33) White is true C: T F A. HW feedback akin to SW recursion A. HW feedback akin to SW recursion B. The minimum period of a usable B. We synchronous can implement circuit a is D-Q at flipflop least the as CLK-to-Q simple delay CL (And, Or, Not gates) C. You can build a FSM to signal when an equal number of s and s has appeared in the input. CS6C L5 Intro to SDS, State Elements I (34) ABC : FFF 2: FFT 3: FTF 4: FTT 5: TFF 6: TFT 7: TTF 8: TTT Conclusion ISA is very important abstraction layer Contract between HW and SW Clocks control pulse of our circuits Voltages are analog, quantized to / Circuit delays are fact of life Two types of circuits: Stateless Combinational Logic (&,,~) State circuits (e.g., registers) And In conclusion State elements are used to: Build memories Control the flow of information between other state elements and combinational logic D-flip-flops used to build registers Clocks tell us when D-flip-flops change Setup and Hold times important Finite State Machines extremely useful You ll see them again (5,52), 64, 72, 74, etc CS6C L5 Intro to SDS, State Elements I (35) CS6C L5 Intro to SDS, State Elements I (36)