Sequential Logic. Introduction to Computer Yung-Yu Chuang

Similar documents
Chapter 3: Sequential Logic

6.3 Sequential Circuits (plus a few Combinational)

Sequential Logic. Sequential circuits. Reuse circuit elements by storing bits in "memory." Introduction to Computer Yung-Yu Chuang

6.1 Combinational Circuits

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

COMP2611: Computer Organization. Introduction to Digital Logic

CS 261 Fall Mike Lam, Professor. Sequential Circuits

Combinational vs Sequential

Computer Systems Architecture

Logic Design. Flip Flops, Registers and Counters

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

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

Last time, we saw how latches can be used as memory in a circuit

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

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

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

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

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

Sequential logic circuits

Logic Design ( Part 3) Sequential Logic (Chapter 3)

ELE2120 Digital Circuits and Systems. Tutorial Note 8

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

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

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

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

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

Introduction to Sequential Circuits

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

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

CHAPTER1: Digital Logic Circuits

CS3350B Computer Architecture Winter 2015

Sequential Circuits: Latches & Flip-Flops

CS61C : Machine Structures

3. Sequential Logic 1

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

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

Logic Devices for Interfacing, The 8085 MPU Lecture 4

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

CHAPTER 4: Logic Circuits

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

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

D Latch (Transparent Latch)

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

Chapter 5 Sequential Circuits

VeriLab. An introductory lab for using Verilog in digital design (first draft) VeriLab

CPS311 Lecture: Sequential Circuits

Unit 11. Latches and Flip-Flops

CHAPTER 4: Logic Circuits

211: Computer Architecture Summer 2016

ECE 341. Lecture # 2

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

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

ELCT201: DIGITAL LOGIC DESIGN

Chapter 5 Synchronous Sequential Logic

Sequencing. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall,

cascading flip-flops for proper operation clock skew Hardware description languages and sequential logic

Logic Design II (17.342) Spring Lecture Outline

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

Lecture 10: Sequential Circuits

CS 61C: Great Ideas in Computer Architecture

COMP12111: Fundamentals of Computer Engineering

IS1500 (not part of IS1200) Logic Design Lab (LD-Lab)

MC9211 Computer Organization

Synchronous Sequential Logic

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

COMP sequential logic 1 Jan. 25, 2016

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

More Digital Circuits

CPE300: Digital System Architecture and Design

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

Chapter. Sequential Circuits

VARIABLE FREQUENCY CLOCKING HARDWARE

Microprocessor Design

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

Chapter 4. Logic Design

Latches, Flip-Flops, and Registers. Dr. Ouiem Bchir

BUSES IN COMPUTER ARCHITECTURE

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

Find the equivalent decimal value for the given value Other number system to decimal ( Sample)

Experiment 8 Introduction to Latches and Flip-Flops and registers

SEQUENTIAL CIRCUITS THE RELAY CIRCUIT

11. Sequential Elements

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

Chapter. Synchronous Sequential Circuits

Clock Domain Crossing. Presented by Abramov B. 1

Contents Circuits... 1

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.

COE 202: Digital Logic Design Sequential Circuits Part 1. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

ESE 570 STATIC SEQUENTIAL CMOS LOGIC CELLS. Kenneth R. Laker, University of Pennsylvania, updated 25Mar15

Previous Lecture Sequential Circuits. Slide Summary of contents covered in this lecture. (Refer Slide Time: 01:55)

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

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

ELCT201: DIGITAL LOGIC DESIGN

Introduction to Microprocessor & Digital Logic

L14: Quiz Information and Final Project Kickoff. L14: Spring 2004 Introductory Digital Systems Laboratory

DIGITAL CIRCUIT LOGIC UNIT 11: SEQUENTIAL CIRCUITS (LATCHES AND FLIP-FLOPS)

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

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

Hardware Design I Chap. 5 Memory elements

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

Transcription:

Sequential Logic Introduction to Computer Yung-Yu Chuang with slides by Sedgewick & Wayne (introcs.cs.princeton.edu), Nisan & Schocken (www.nand2tetris.org) and Harris & Harris (DDCA)

Review of Combinational Circuits Combinational circuits. Basic abstraction = switch. In principle, can build TOY computer with a combinational circuit. 255 16 = 4,080 inputs 2 4080 rows in truth table! no simple pattern each circuit element used at most once Sequential circuits. Reuse circuit elements by storing bits in "memory." ALU combinational Memory state 2

Combinational vs. Sequential Circuits Combinational circuits. Output determined solely by inputs. Can draw with no loops. Ex: majority, adder, ALU. Sequential circuits. Output determined by inputs and previous outputs. Ex: memory, program counter, CPU. 3

Flip-flop Flip-Flop A small and useful sequential circuit Abstraction that remembers one bit Basis of important computer components for register memory counter There are several flavors 4

S-R flip flop R S Q 0 0 0 1 1 0 1 1 Q=S+RQ 5

Relay-based flip-flop Ex. Simplest feedback loop. Two relays A and B, both connected to power, each blocked by the other. State determined by whichever switches first. The state is latched. Stable. output1 input2 input1 output2 6

SR Flip Flop SR flip flop. Two cross-coupled NOR gates. R S Q=R(S+Q) Q R S Q 0 0 0 1 1 0 1 1 7

Flip-flop. Flip-Flop A way to control the feedback loop. Abstraction that "remembers" one bit. Basic building block for memory and registers. Caveat. Need to deal with switching delay. 8

Truth Table and Timing Diagram Truth table. Values vary over time. S(t), R(t), Q(t) denote value at time t. Sample timing diagram for SR flip-flop. SR Flip Flop Truth Table S(t) R(t) Q(t) Q(t+ ) 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 Q R S time 1 0 1 0 1 0 9

Clock. Clock Fundamental abstraction: regular on-off pulse. on: fetch phase off: execute phase External analog device. Synchronizes operations of different circuit elements. Requirement: clock cycle longer than max switching time. cycle time on Clock off 10

How much does it Hert? Frequency is inverse of cycle time. Expressed in hertz. Frequency of 1 Hz means that there is 1 cycle per second. 1 kilohertz (khz) means 1000 cycles/sec. 1 megahertz (MHz) means 1 million cycles/sec. 1 gigahertz (GHz) means 1 billion cycles/sec. 1 terahertz (THz) means 1 trillion cycles/sec. Heinrich Rudolf Hertz (1857-1894) 11

Clocked S-R flip-flop 12

Clocked D flip-flop 13

Stand-Alone Register 14

Register file interface 15

Register file implementation 16

Multiplexer When s=0, return x; otherwise, return y. Example: (Y S) (X S) X Y S mux Z Two-input multiplexer 17

4-to-1 multiplexer x 0 x 1 x 2 4MUX z x 3 s 0 s 1 18

4-to-1 multiplexer x 0 x 0 x 1 2MUX x 1 x 2 4MUX z 2MUX z x 3 x 2 x 3 2MUX s 0 s 1 s 0 s 1 19

8-to-1 Multiplexer 2 N -to-1 multiplexer N select inputs, 2 N data inputs, 1 output Copies selected data input bit to output 20

8-to-1 Multiplexer 2 N -to-1 multiplexer N select inputs, 2 N data inputs, 1 output Copies selected data input bit to output 21

4-Wide 2-to-1 Multiplexer Goal: select from one of two 4-bit buses 22

4-Wide 2-to-1 Multiplexer Goal: select from one of two 4-bit buses Implemented by layering 4 2-to-1 multiplexer 23

k-wide n-to-1 Multiplexer Goal: select from one of n k-bit buses Implemented by layering k n-to-1 multiplexer 24

Register file implementation 25

Memory Overview Computers and TOY have several memory components. Program counter. Registers. Main memory. Implementation. Use one flip-flop for each bit of memory. Access. Memory components have different access mechanisms. TOY has 16 bit words, 8 bit memory addresses, and 4 bit register names. Organization. Need mechanism to manipulate groups of related bits. 26

Register Bit Register bit. Extend a flip-flop to allow easy access to values. 27

Register Bit Register bit. Extend a flip-flop to allow easy access to values. D W DW DW 28

Memory Bit: Interface Memory bit. Extend a flip-flop to allow easy access to values. [ TOY PC, IR ] [ TOY main memory ] [ TOY registers ] 29

Memory Bit: Switch Level Implementation Memory bit. Extend a flip-flop to allow easy access to values. [ TOY PC, IR ] [ TOY main memory ] [ TOY registers ] 30

Processor register. Stores k bits. Processor Register Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction. 31

Processor register. Stores k bits. Processor Register Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction. 32

Processor register. Stores k bits. Processor Register Register contents always available on output bus. If enable write is asserted, k input bits get copied into register. Ex 1. TOY program counter (PC) holds 8-bit address. Ex 2. TOY instruction register (IR) holds 16-bit current instruction. 33

Memory bank. Memory Bank Bank of n registers; each stores k bits. Read and write information to one of n registers. Address inputs specify which one. log 2 n address bits needed Addressed bits always appear on output. If write enabled, k input bits are copied into addressed register. Ex 1. TOY main memory. 256-by-16 memory bank. Ex 2. TOY registers. 16-by-16 memory bank. Two output buses. (four 6-bit words) 6-bit input bus 2-bit address 6-bit output bus 34

Memory: Interface (four 6-bit words) 35

Memory: Component Level Implementation 36

Memory: Switch Level Implementation (four 6-bit words) 37

Summary Sequential circuits add "state" to digital hardware. Flip-flop. [represents 1 bit] TOY word. [16 flip-flops] TOY registers. [16 words] TOY main memory. [256 words] Modern technologies for registers and main memory are different. Few registers, easily accessible, high cost per bit. Huge main memories, less accessible, low cost per bit. Drastic evolution of technology over time. Next. Build a complete TOY computer. 38

The Clock tock tock tock tock clock signal tick tick tick tick cycle cycle cycle cycle In our jargon, a clock cycle = tick-phase (low), followed by a tock-phase (high) In real hardware, the clock is implemented by an oscillator In our hardware simulator, clock cycles can be simulated either Manually, by the user, or Automatically, by a test script.

Flip-flop in DFF out out(t) = in(t-1) A fundamental state-keeping device For now, let us not worry about the DFF implementation Memory devices are made from numerous flip-flops, all regulated by the same master clock signal Notational convention: in sequential chip out = (notation) in sequential chip out clock signal

1-bit register (we call it Bit ) Objective: build a storage unit that can: load (a) Change its state to a given input (b) Maintain its state over time (until changed) in Bit out if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) in DFF out in DFF out out(t) = in(t-1) Basic building block out(t) = out(t-1)? out(t) = in(t-1)? Won t work

Bit register (cont.) Interface load Implementation load in Bit out in MUX DFF out if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) o o o Load bit Read logic Write logic

Multi-bit register load load in Bit out in w Bit Bit... Bit w out if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) 1-bit register if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) w-bit register o o o Register s width: a trivial parameter Read logic Write logic

Aside: Hardware Simulation Relevant topics from the HW simulator tutorial: Clocked chips: When a clocked chip is loaded into the simulator, the clock icon is enabled, allowing clock control Built-in chips: feature a standard HDL interface yet a Java implementation Provide behavioral simulation services May feature GUI effects (at the simulator level only).

Random Access Memory (RAM) load register 0 register 1 in (word) register 2. register n-1 out (word) address (0 to n-1) RAM n Direct Access Logic o o Read logic Write logic.

RAM interface load in 16 bits address RAMn out 16 bits log 2 n bits

RAM anatomy RAM 64 RAM8 RAM 8. 8 Register register. register 8 RAM8 Bit Bit... Bit register... Recursive ascent

Counter Needed: a storage device that can: (a) set its state to some base value (b) increment the state in every clock cycle (c) maintain its state (stop incrementing) over clock cycles (d) reset its state inc load reset in w bits PC (counter) w bits out If reset(t-1) then out(t)=0 else if load(t-1) then out(t)=in(t-1) else if inc(t-1) then out(t)=out(t-1)+1 else out(t)=out(t-1) Typical function: program counter Implementation: register chip + some combinational logic.

Recap: Sequential VS combinational logic Combinational chip Sequential chip (optional) time delay (optional) in comb. logic out in comb. logic DFF gate(s) comb. logic out out = some function of (in) out(t) = some function of (in(t-1), out(t-1))

tock Time matters tock tock tock clock signal tick tick tick tick cycle cycle cycle cycle During a tick-tock cycle, the internal states of all the clocked chips are allowed to change, but their outputs are latched At the beginning of the next cycle, the outputs of all the clocked chips in the architecture commit to the new values. a Reg1 Implications: Challenge: propagation delays sel + out Solution: clock synchronization b Reg2 Cycle length and processing speed.

Perspective All the memory units described in this lecture are standard Typical memory hierarchy SRAM ( static ), typically used for the cache Access time Cost DRAM ( dynamic ), typically used for main memory Disk (Elaborate caching / paging algorithms) A Flip-flop can be built from Nand gates But... real memory units are highly optimized, using a great variety of storage technologies.