Sequential Logic Design CS 64: Computer Organization and Design Logic Lecture #14

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

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

Module 4:FLIP-FLOP. Quote of the day. Never think you are nothing, never think you are everything, but think you are something and achieve anything.

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

CPS311 Lecture: Sequential Circuits

Lecture 8: Sequential Logic

Registers and Counters

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

Registers and Counters

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

hochschule fu r angewandte wissenschaften hamburg Prof. Dr. B. Schwarz FB Elektrotechnik/Informatik

CHAPTER1: Digital Logic Circuits

CHAPTER 4: Logic Circuits

RS flip-flop using NOR gate

Why do we need to debounce the clock input on counter or state machine design? What happens if we don t?

Rangkaian Sekuensial. Flip-flop

EET2411 DIGITAL ELECTRONICS

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

CprE 281: Digital Logic

Logic Design II (17.342) Spring Lecture Outline

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

More Digital Circuits

CHAPTER 4: Logic Circuits

L5 Sequential Circuit Design

LSN 12 Shift Registers

Flip Flop. S-R Flip Flop. Sequential Circuits. Block diagram. Prepared by:- Anwar Bari

Experiment 8 Introduction to Latches and Flip-Flops and registers

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Course Administration

Digital Circuits ECS 371

CprE 281: Digital Logic

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

Digital Circuits 4: Sequential Circuits

CS 261 Fall Mike Lam, Professor. Sequential Circuits

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

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

Chapter 3 Unit Combinational

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 3 Logistics

Asynchronous (Ripple) Counters

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

Chapter 5 Synchronous Sequential Logic

Principles of Computer Architecture. Appendix A: Digital Logic

Sequential Logic and Clocked Circuits

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

Sequential Design Basics

RS flip-flop using NOR gate

UNIVERSITI TEKNOLOGI MALAYSIA

LAB 7. Latches & Flip Flops

6.3 Sequential Circuits (plus a few Combinational)

DIGITAL CIRCUIT COMBINATORIAL LOGIC

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

ECE 545 Digital System Design with VHDL Lecture 1B. Digital Logic Refresher Part B Sequential Logic Building Blocks

Chapter 2. Digital Circuits

Logic Design II (17.342) Spring Lecture Outline

North Shore Community College

Counter dan Register

Registers. Unit 12 Registers and Counters. Registers (D Flip-Flop based) Register Transfers (example not out of text) Accumulator Registers

ELE2120 Digital Circuits and Systems. Tutorial Note 8

Registers and Counters

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Other Flip-Flops. Lecture 27 1

Sequential Digital Design. Laboratory Manual. Experiment #7. Counters

EECS150 - Digital Design Lecture 3 - Timing

ECE 263 Digital Systems, Fall 2015

Logic Design. Flip Flops, Registers and Counters

Solution to Digital Logic )What is the magnitude comparator? Design a logic circuit for 4 bit magnitude comparator and explain it,

CHAPTER 6 COUNTERS & REGISTERS

Flip-Flops and Sequential Circuit Design

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

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

Administrative issues. Sequential logic

Flip-flop and Registers

Combinational vs Sequential

Sequential logic circuits

Review of digital electronics. Storage units Sequential circuits Counters Shifters

Computer Architecture and Organization

EECS150 - Digital Design Lecture 3 - Timing

cs281: Introduction to Computer Systems Lab07 - Sequential Circuits II: Ant Brain

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

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part B Sequential Logic Building Blocks

Registers & Counters. Logic and Digital System Design - CS 303 Erkay Savaş Sabanci University

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

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

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Registers

ELCT201: DIGITAL LOGIC DESIGN

COMP sequential logic 1 Jan. 25, 2016

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Lab Assignment 5 I. THE 4-BIT CPU AND CONTROL

ECE 545 Digital System Design with VHDL Lecture 2. Digital Logic Refresher Part B Sequential Logic Building Blocks

Multiplexor (aka MUX) An example, yet VERY useful circuit!

Advanced Digital Logic Design EECS 303

CSE140L: Components and Design Techniques for Digital Systems Lab. CPU design and PLDs. Tajana Simunic Rosing. Source: Vahid, Katz

BCN1043. By Dr. Mritha Ramalingam. Faculty of Computer Systems & Software Engineering

COE328 Course Outline. Fall 2007

COMP12111: Fundamentals of Computer Engineering

EE292: Fundamentals of ECE

Outcomes. Spiral 1 / Unit 6. Flip-Flops FLIP FLOPS AND REGISTERS. Flip-flops and Registers. Outputs only change once per clock period

EECS 270 Midterm 2 Exam Closed book portion Fall 2014

Unit-5 Sequential Circuits - 1

CSE 352 Laboratory Assignment 3

Transcription:

Sequential Logic Design CS 64: Computer Organization and Design Logic Lecture #14 Ziad Matni Dept. of Computer Science, UCSB

Administrative Only 2.5 weeks left!!!!!!!! OMG!!!!! Th. 5/24 Sequential Logic Lab# 7 Combinatorial Logic Tu. 5/29 More Sequential Logic! Th. 5/31 Finite State Machines Lab# 8 Sequential Logic and CPU Design Tu. 6/4 Th. 6/8 More Finite State Machines! CS Ethics and Societal Impact of CS Lab# 9 Finite State Machines Lab# 10 Ethics/Societal Impact (short; online) 5/24/18 Matni, CS64, Sp18 2

Lecture Outline Sequential Logic S-R Latch D-Latch D-Flip Flop Reviewing what s needed for Lab 8 (next week s lab) 5/24/18 Matni, CS64, Sp18 3

Sequential Logic Combinatorial Logic Combining multiple logic blocks The output is a function only of the present inputs There is no memory of past states Sequential Logic Combining multiple logic blocks The output is a function of both present and past inputs There exists a memory of past states 5/24/18 Matni, CS64, Sp18 4

Only involves 2 NORs The S-R Latch The outputs are fed-back to the inputs The result is that the output state (either a 1 or a 0) is maintained even if the input changes! 5/24/18 Matni, CS64, Sp18 5

How a S-R Latch Works Note that if one NOR input is 0, the output becomes the inverse of the other input So, if output Q already exists and if S = 0, R = 0, then Q will remain at whatever it was before! (hold output state) S R Q 0 Comment 0 0 Q* Hold output 0 1 0 Reset output 1 0 1 Set output 1 1 X Undetermined If S = 0, R = 1, then Q becomes 0 (reset output) If S = 1, R = 0, then Q becomes 1 (set output) Making S = 1, R = 1 is not allowed 5/24/18 (undetermined output) 6

Consequences? As long as S = 0 and R = 0, the circuit output holds memory of its prior value (state) S R Q 0 Comment 0 0 Q* Hold output 0 1 0 Reset output 1 0 1 Set output 1 1 X Undetermined To change the output, just make S = 1 (but also R = 0) to make the output 1 (set) OR S = 0 (but also R = 1) to make the output 0 (reset) Just avoid S = 1, R = 1 5/24/18 Matni, CS64, Sp18 7

About that S = 1, R = 1 Case S R Q 0 Comment 0 0 Q* Hold output 0 1 0 Reset output 1 0 1 Set output 1 1 X Undetermined What if we avoided it on purpose by making R = NOT (S)? Where s the problem? S/R This, by itself, precludes a case when R = S = 0 You d need that if you want to preserve the previous output state! Solution: the clocked latch and the flip-flop 5/24/18 Matni, CS64, Sp18 8

Adding an Enable Input: The Gated S-R Latch Create a way to gate the inputs R/S inputs go through only if an enable input (E) is 1 If E is 0, then the S-R latch gets SR = 00 and it hold the state of previous outputs So, the truth table would look like: S R Q 0 Comment 0 0 Q* Hold output 0 1 0 Reset output 1 0 1 Set output 1 1 X Undetermined S R E Q 0 Comment X X 0 Q* Hold output 0 1 1 0 Reset output 1 0 1 1 Set output 5/24/18 Matni, CS64, Sp18 9

Combining R and S inputs into One: The Gated D Latch Force S and R inputs to always be opposite of each other Make them the same as an input D, where D = R and!d = S. D E S R Q Q Create a way to gate the D input D input goes through only if an enable input (E) is 1 If E is 0, then hold the state of the previous outputs D E Q 0 Comment X 0 Q* Hold output 0 1 0 Reset output 1 1 1 Set output 5/24/18 Matni, CS64, Sp18 10

Enabling the Latch Synchronously: The Clocked D Latch If you apply a clock on input E, you get a clocked D latch. A clock is an input that goes 1 then 0, then 1 again in a set time period D CLK S R When CLK is 0, both S and R inputs to the latch are 0 too, so the Q holds its value (Q = Q 0 ) When CLK is 1, then if D = 1, then Q =1, but if D = 0, then Q = 0 5/24/18 Matni, CS64, Sp18 11

Clocked D Latch as Digital Sampler This clocked latch can be used as a programmable memory device that samples an input on a regular basis D Q CLK Q 5/24/18 Matni, CS64, Sp18 12

The Clocked D Latch By Any Other Name D S D Q CLK R CLK D Clocked Latch Q Observing input and output waveforms 5/24/18 Matni, CS64, Sp18 13

The Joys of Sampling Sampling data in a periodic way is advantageous I can start designing more complex circuits that can help me do synchronous logical functions Synchronous: in-time Very useful in pipelining designs used in CPUs Pipelining: a technique that allows CPUs to execute instructions more efficiently in parallel Instruction fetch, decode, execute, memory access, register write 5/24/18 Matni, CS64, Sp18 14

The Most Efficient Way to Sample Inputs Instead of sampling the input to the latch using a level of the clock That is, when the clock is 1 (or 0 ) sample the input at the edge of the clock That is, when the clock is transitioning from 0à1, called a rising or positive edge (or it could be done from 1à0, the falling edge a.k.a negative edge) Why?? 5/24/18 Matni, CS64, Sp18 15

The D-FF When the input clock edge is rising, the input (D) is captured and placed on the output (Q) Rising edge a.k.a positive edge FF Some FF are negative edge FF (capture on the falling edge) 5/24/18 Matni, CS64, Sp18 16

Latches vs. FFs Latches capture data on an entire 1 or 0 of the clock FFs capture data on the edge of the clock This example shows the positive (0à1) edge used Latch out FF out FFs give out less glitchy outputs 5/24/18 Matni, CS64, Sp18 17

An Improvement on the Latch: The D Flip-Flop Don t worry about the circuit implementation details, but understand the use! D D Flip-Flop (D-FF) > CLK Q Q The D Flip-Flop only changes the output (Q) into the input (D) at the positive edge (the 0 à 1 transition) of the clock As opposed to: D Q D Gated Latch CLK Q Note the (slight) difference in the 2 symbols 5/24/18 Matni, CS64, Sp18 18

Counter Again, don t worry about the circuit implementation details, but understand the uses! Popular Uses for D-FFs Serial-to-Parallel converter Digital delay line 5/24/18 Matni, CS64, Sp18 19

Lab 8 5/24/18 Matni, CS64, Sp18 20

Note When Everything is Due Next Monday (5/28) is a University Holiday So no lab on Monday BUT! You still have a new Lab (#8) that week!!! Issued to you over the weekend Get started on it early it s long-ish Go see TAs during their office hours (We. & Fr.) for help Lab#8 will be due on MONDAY 6/4 Not the usual Friday! Lab#9 will be ISSUED ON MONDAY 6/4 & BE DUE ON FRIDAY 6/8 Lab#10 will be ISSUED ON THURSDAY 6/7 & BE DUE ON FRIDAY 6/8 Here s Why 5/24/18 Matni, CS64, Sp18 21

What s Lab8 About? Design a simple ALU (Task 1) Design a simple register block using D-FFs (Task 2) Be given a specification for a simple CPU that uses: 1 Simple Register Block 1 Simple ALU 1 Abstract Computer Memory Interface As many ANDs, ORs, NOTs, XORs, Muxes that you need Design this CPU! (Task 3) You will draw all of these (BE NEAT!) Take pictures or (better yet) scan them, then turnin 5/24/18 Matni, CS64, Sp18 22

Abstract Schematic of the MIPS CPU 5/24/18 Matni, CS64, Sp18 23

Register Object for Lab 8 (Task 2) This will be made from D-FFs or D-Latches and Combinatorial Logic I/O Name I/O Description 5/24/18 Matni, CS64, Sp18 24 R0 R1 WR W WE O1 O2 The first register to read, as a single bit. If 0, then reg0 should be read. If 1, then reg1 should be read. The second register to read, as a single bit. If 0, then reg0 should be read. If 1, then reg1 should be read. Write Register. Specifies which register to write to. If 0, then reg0 should be written to. If 1, then reg1 should be written to. The data that should be written to the register specified by WR. This is a single bit. Write Enable. If 1, then we will write to a register. If 0, then we will not write to a register. Note that if WE = 0, then the inputs to WR and W are effectively ignored. Value of the first register read. As described previously, this depends on which register was selected to be read, via R0. Value of the second register read. As described previously, this depends on which register was selected to be read, via R1.

Memory Interface Object for Lab 8 I/O Name A0 I/O Description Bit 0 of the address (LSB) A1 OE Bit 1 of the address (MSB) Output Enable. If 1, then the value at the address specified by A0 and A1 will be read, and sent to the output line O. If 0, then the memory will not be accessed, and the value sent to the output line is unspecified (could be either 0 or 1, in an unpredictable fashion). W The value to write to memory. WE O Write Enable. If 1, then the value sent into W will be written to memory at the address specified by A0 and A1. If 0, then no memory write occurs (the value sent to W will be ignored). The value read from memory (or unspecified if OE = 0). 5/24/18 Matni, CS64, Sp18 25

Task 3: Build a Mock-CPU! Actually, just a small instruction decoder and executor OP1 OP0 B0 B1 B2 Human-readable Encoding Description 0 0 0 0 0 xor reg0, reg0, reg0 Compute the XOR of the contents of reg0 with the contents of reg0, storing the result in reg0. 0 1 1 0 1 nor reg1, reg0, reg1 Compute the NOR of the contents of reg0 with the contents of reg1, storing the result in reg1. 1 0 1 0 1 load reg1, 01 Copy the bit stored at address 01 (decimal 1) into register reg1. 1 1 0 1 0 store reg0, 10 Store the contents of reg0 at address 10 (decimal 2) 1 1 1 1 1 store reg1, 11 Store the contents of reg1 at address 11 (decimal 3) These say something about which registers are used These say something about which operation is being done 5/24/18 Matni, CS64, Sp18 26

Hints for Task 3 Design the final circuit in pieces: One piece for each of the 3 types of instruction: load, store, XOR/NOR For example, the store task: If an output isn t used, tie it to a permanent 0 (i.e. ground) What registers am I using? Which instruction bits go where? What controls should I use? What values should they be? If an input isn t used, then you can use X (don t care) on it How do I best connect the registers to the memory interface? Again, ask yourself if some of the inputs here should be op-code bits. Is the output even used in this store task? 5/24/18 Matni, CS64, Sp18 27

Tying In All The Pieces (Task 3) Now see how they can all fit together You will have 1 register block + 1 memory interface You won t need to use any additional latches here You will need to use muxes and regular logic (and the simple ALU you designed earlier see lab instructions for more details) REQUIREMENT: Use ONLY 1 register block, 1 ALU, and 1 memory interface 5/24/18 Matni, CS64, Sp18 28

Your To Dos Lab #7 is due end of day Friday Lab #8 will be issued this weekend Due Monday 6/4 Lab #9 will be issued weekend after next Due Friday 6/8 (last day of classes) Lab #10 will be issued in the last week Due Friday 6/8 (last day of classes) 5/24/18 Matni, CS64, Sp18 29

5/24/18 Matni, CS64, Sp18 30