CS61C : Machine Structures

Similar documents
Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o. Lecture #14

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

CS61C : Machine Structures

CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures

CS3350B Computer Architecture Winter 2015

Sequential Elements con t Synchronous Digital Systems

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

CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture

More Digital Circuits

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

COMP2611: Computer Organization. Introduction to Digital Logic

Computer Systems Architecture

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

Combinational vs Sequential

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

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

CprE 281: Digital Logic

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

11. Sequential Elements

CprE 281: Digital Logic

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

Logic Design II (17.342) Spring Lecture Outline

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

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

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

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

Digital Integrated Circuits EECS 312

Lecture 1: Introduction to Digital Logic Design. CK Cheng CSE Dept. UC San Diego

Logic Design. Flip Flops, Registers and Counters

EECS150 - Digital Design Lecture 2 - CMOS

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

Sequential Logic. Introduction to Computer Yung-Yu Chuang

The NOR latch is similar to the NAND latch

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

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

First Name Last Name November 10, 2009 CS-343 Exam 2

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

DEDICATED TO EMBEDDED SOLUTIONS

CprE 281: Digital Logic

D Latch (Transparent Latch)

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

Slide Set 7. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

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

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

CS Part 1 1 Dr. Rajesh Subramanyan, 2005

Introduction to Microprocessor & Digital Logic

Digital Integrated Circuits EECS 312

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

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

EE 367 Lab Part 1: Sequential Logic

COE328 Course Outline. Fall 2007

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

A clock is a free-running signal with a cycle time. A clock may be either high or low, and alternates between the two states.

CS8803: Advanced Digital Design for Embedded Hardware

LATCHES & FLIP-FLOP. Chapter 7

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

Slide Set 6. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

Lecture 10: Sequential Circuits

Microprocessor Design

COMP sequential logic 1 Jan. 25, 2016

Lecture 11: Sequential Circuit Design

CprE 281: Digital Logic

Logic Design II (17.342) Spring Lecture Outline

WELCOME. ECE 2030: Introduction to Computer Engineering* Richard M. Dansereau Copyright by R.M. Dansereau,

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

Logic. Andrew Mark Allen March 4, 2012

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

CHAPTER 4: Logic Circuits

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

Chapter 5 Sequential Circuits

EECS 373 Design of Microprocessor-Based Systems

Laboratory 9 Digital Circuits: Flip Flops, One-Shot, Shift Register, Ripple Counter

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

CprE 281: Digital Logic

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

55:131 Introduction to VLSI Design Project #1 -- Fall 2009 Counter built from NAND gates, timing Due Date: Friday October 9, 2009.

Asynchronous (Ripple) Counters

PRE J. Figure 25.1a J-K flip-flop with Asynchronous Preset and Clear inputs

EE292: Fundamentals of ECE

Synchronous Sequential Logic

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

Chapter 3 Unit Combinational

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

Flip-Flops A) Synchronization: Clocks and Latches B) Two Stage Latch C) Memory Requires Feedback D) Simple Flip-Flop Gate

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

Experiment 8 Introduction to Latches and Flip-Flops and registers

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design ALU and Storage Elements

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1

Administrative issues. Sequential logic

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

PHY 351/651 LABORATORY 9 Digital Electronics The Basics

Chapter 3. Boolean Algebra and Digital Logic

Unit 11. Latches and Flip-Flops

CS/EE 6710 Digital VLSI Design CAD Assignment #3 Due Thursday September 21 st, 5:00pm

EECS150 - Digital Design Lecture 3 - Timing

DIGITAL CIRCUIT COMBINATORIAL LOGIC

Chapter Contents. Appendix A: Digital Logic. Some Definitions

PESIT Bangalore South Campus

Transcription:

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #14 Introduction to Synchronous Digital Systems 2007-7-18 Scott Beamer, Instructor CS61C L14 Introduction to Synchronous Digital Systems (1)

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o Linker lib.o Executable(mach lang pgm): a.out Loader Memory CS61C L14 Introduction to Synchronous Digital Systems (2)

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) CS61C L14 Introduction to Synchronous Digital Systems (3)

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? CS61C L14 Introduction to Synchronous Digital Systems (4)

Synchronous Digital Systems 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. Digital: - It keeps the heartbeat of the system! Mean all values are represented by discrete values Electrical signals are treated as 1 s and 0 s and grouped together to form words. CS61C L14 Introduction to Synchronous Digital Systems (5)

Logic Design Next 2 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 150, CS 152) There is just so much you can do with processors. At some point you may need to design your own custom hardware. CS61C L14 Introduction to Synchronous Digital Systems (6)

Logic Gates Basic building blocks are logic gates. In the beginning, did ad hoc designs, and then saw patterns repeated, gave names Can build gates with transistors and resistors Then found theoretical basis for design Can represent and reason about gates with truth tables and Boolean algebra Assume know some truth tables and Boolean algebra from a math or circuits course. Section B.2 in the textbook has a review CS61C L14 Introduction to Synchronous Digital Systems (7)

Physical Hardware Let s look closer CS61C L14 Introduction to Synchronous Digital Systems (8) PowerPC

Transistors 101 MOSFET Metal-Oxide-Semiconductor Field-Effect Transistor Come in two types: - n-type NMOSFET - p-type PMOSFET For n-type (p-type opposite) 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 www.wikipedia.org/wiki/mosfet CS61C L14 Introduction to Synchronous Digital Systems (9) G D G S n-type D S p-type Side view

Transistor Circuit Rep. vs. Block diagram Chips is composed of nothing but transistors and wires. Small groups of transistors form useful building blocks. 1 (voltage source) a b c 0 0 1 0 1 1 1 0 1 1 1 0 0 (ground) Block are organized in a hierarchy to build higher-level blocks: ex: adders. CS61C L14 Introduction to Synchronous Digital Systems (10)

Signals and Waveforms: Clocks CS61C L14 Introduction to Synchronous Digital Systems (11)

Signals and Waveforms: Adders CS61C L14 Introduction to Synchronous Digital Systems (12)

Signals and Waveforms: Grouping Bus - more than one signal treated as a unit CS61C L14 Introduction to Synchronous Digital Systems (13)

Signals and Waveforms: Circuit Delay CS61C L14 Introduction to Synchronous Digital Systems (14)

Type of Circuits Synchronous Digital Systems are made up of two basic types of circuits: 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. CS61C L14 Introduction to Synchronous Digital Systems (15)

Circuits with STATE (e.g., register) CS61C L14 Introduction to Synchronous Digital Systems (16)

Peer Instruction A. SW can peek at HW (past ISA abstraction boundary) for optimizations B. SW can depend on particular HW implementation of ISA C. Timing diagrams serve as a critical debugging tool in the EE toolkit ABC 1: FFF 2: FFT 3: FTF 4: FTT 5: TFF 6: TFT 7: TTF 8: TTT CS61C L14 Introduction to Synchronous Digital Systems (17)

Sample Debugging Waveform CS61C L14 Introduction to Synchronous Digital Systems (18)

And in semi conclusion ISA is very important abstraction layer Contract between HW and SW Basic building blocks are logic gates Clocks control pulse of our circuits Voltages are analog, quantized to 0/1 Circuit delays are fact of life Two types Stateless Combinational Logic (&,,~) State circuits (e.g., registers) CS61C L14 Introduction to Synchronous Digital Systems (19)

Administrivia Proj2 due Friday Midterm 7-10p on Monday in 10 Evans Midterm Review 11-2 on Friday, probably in 10 or 60 Evans Scott is not holding OH on Monday, but is holding extra OH on Friday 3-5 CS61C L14 Introduction to Synchronous Digital Systems (20)

Accumulator Example Why do we need to control the flow of information? Want: S=0; for (i=0;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. CS61C L14 Introduction to Synchronous Digital Systems (21)

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? CS61C L14 Introduction to Synchronous Digital Systems (22)

Second try How about this? Rough timing Register is used to hold up the transfer of data to adder. CS61C L14 Introduction to Synchronous Digital Systems (23)

Register Details What s inside? n instances of a Flip-Flop Flip-flop name because the output flips and flops between and 0,1 D is data, Q is output Also called d-type Flip-Flop CS61C L14 Introduction to Synchronous Digital Systems (24)

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. Example waveforms: CS61C L14 Introduction to Synchronous Digital Systems (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. CS61C L14 Introduction to Synchronous Digital Systems (26)

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 CS61C L14 Introduction to Synchronous Digital Systems (27)

Accumulator Revisited (proper 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 iteration. Analyze circuit timing starting at the output of the register. CS61C L14 Introduction to Synchronous Digital Systems (28)

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-1 S i temporarily is wrong, but register always captures correct value. In good circuits, instability never happens around rising edge of clk. CS61C L14 Introduction to Synchronous Digital Systems (29)

Peer Instruction A. CLK-to-Q delays propagate in a synchronized circuit B. The hold time should be less than the CLK-to- Q delay C. The minimum period of a usable synchronous circuit is at least the CLK-to-Q delay ABC 1: FFF 2: FFT 3: FTF 4: FTT 5: TFF 6: TFT 7: TTF 8: TTT CS61C L14 Introduction to Synchronous Digital Systems (30)

And In conclusion We use feedback to maintain state Register files used to build memories D Flip-Flops used to build Register files Clocks tell us when D Flip-Flops change Setup and Hold times important CS61C L14 Introduction to Synchronous Digital Systems (31)