Lecture 21 Overview Counters Sequential logic design.

Slides:



Advertisements
Similar presentations
COUNTERS Counters with Inputs Kinds of Counters Asynchronous vs
Advertisements

Flip-Flops, Registers, Counters, and a Simple Processor
Digital Logic Chapter 5 Presented by Prof Tim Johnson
Announcements Assignment 7 posted, due Friday 18 th All project components ordered Dates –Thursday 12/1 review lecture –Tuesday 12/6 project demonstrations.
1 Sequential Circuits Dr. Pang. 2 Outline Introduction to sequential circuits Basic latch Gated SR latch and gated D latch D flip-flop, T flip-flop, JK.
Chapter 7 Henry Hexmoor Registers and RTL
FSMs 1 Sequential logic implementation  Sequential circuits  primitive sequential elements  combinational logic  Models for representing sequential.
Contemporary Logic Design Sequential Case Studies © R.H. Katz Transparency No Chapter #7: Sequential Logic Case Studies 7.1, 7.2 Counters.
11/16/2004EE 42 fall 2004 lecture 331 Lecture #33: Some example circuits Last lecture: –Edge triggers –Registers This lecture: –Example circuits –shift.
Logic and Computer Design Fundamentals Registers and Counters
David Culler Electrical Engineering and Computer Sciences
11/15/2004EE 42 fall 2004 lecture 321 Lecture #32 Registers, counters etc. Last lecture: –Digital circuits with feedback –Clocks –Flip-Flops This Lecture:
Sequential PLD timing Registers Counters Shift registers
Flip-Flops and Related Devices
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines Sequential circuits  primitive sequential elements.
C.S. Choy1 SEQUENTIAL LOGIC A circuit’s output depends on its previous state (condition) in addition to its current inputs The state of the circuit is.
ECE C03 Lecture 91 Lecture 9 Registers, Counters and Shifters Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
A.Abhari CPS2131 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers:
1 Digital Design: Sequential Logic Blocks Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals.
Sequential Circuit  It is a type of logic circuit whose output depends not only on the present value of its input signals but on the past history of its.
A presentation on Counters
1 Lecture 15 Registers Counters Finite State Machine (FSM) design.
EKT 124 / 3 DIGITAL ELEKTRONIC 1
Chapter 1_4 Part II Counters
1 Sequential Circuits Registers and Counters. 2 Master Slave Flip Flops.
Sequential Circuits Chapter 4 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S.
Registers and Counters
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Registers and Counters
Digital Logic Design Sequential circuits
Rabie A. Ramadan Lecture 3
Sequential Logic Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer Organization and.
Digital Logic Design Review Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office: Ahmad Almulhem, KFUPM 2010.
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines (FSM) Sequential circuits  primitive sequential.
Introduction to Sequential Logic Design Flip-flops FSM Analysis.
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
CE1110: Digital Logic Design Sequential Circuits.
EE365 Adv. Digital Circuit Design Clarkson University Lecture #12 Registers and Counters.
1 CSE370, Lecture 15 Lecture 15 u Logistics n HW5 due this Friday n HW6 out today, due Friday Feb 20 n I will be away Friday, so no office hour n Bruce.
Chap 5. Registers and Counters. Chap Definition of Register and Counter l a clocked sequential circuit o consist of a group of flip-flops & combinational.
Topic: Sequential Circuit Course: Logic Design Slide no. 1 Chapter #6: Sequential Logic Design.
Computer Organization & Programming Chapter 5 Synchronous Components.
2017/4/24 1.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Latches & Flip-Flops.
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Logic Design.
Sequential logic circuits
Digital System Design using VHDL
COUNTERS Why do we need counters?
EE121 John Wakerly Lecture #9
Counters.
Chapter5: Synchronous Sequential Logic – Part 1
Chap 5. Registers and Counters
State Machine Design State Machine Design Digital Electronics
CHAPTER 14 Digital Systems. Figure 14.1 RS flip-flop symbol and truth table Figure
Counters In digital logic and computing, a counter is a device which stores (and sometimes displays) the number of times a particular event or process.
1 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers: parallel and.
Sequential logic circuits First Class 1Dr. AMMAR ABDUL-HAMED KHADER.
Digital Design: Sequential Logic Blocks
Chapter #6: Sequential Logic Design
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Sequential Logic.
Typical Timing Specifications
Asynchronous Inputs of a Flip-Flop
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
14 Digital Systems.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
Presentation transcript:

Lecture 21 Overview Counters Sequential logic design

Shift Register Often, however, the bits will not arrive in parallel but in serial - one bit at a time –Use a shift register –Input is applied to first flip-flop and shifted along one at each clock event –This example is a 4-bit shift register –It accepts serial input, stores the last 4 bits in the sequence and makes them available as parallel output Serial Input Parallel Output

Digital counters: Ripple (Asynchronous) Counters Input Output Counters are sequential logic circuits that proceed through a well- defined sequence of states and then repeat. For a "divide-by-2" counter, simply connect the Q' output to the D input and feed an external clock signal in as the input: Input Output For a "divide-by-4" counter, connect 2 flipflops together in a chain: For a "divide-by-n" : connect 2 n flipflops together. Note that the FF outputs do not change at exactly the same time because of the propagation delay in each FF. These counters are known as ripple or asynchronous counters. +'ve edge-triggered D flipflop

Synchronous Counters Connect all flip-flops to the same clock All flipflops change state at the same time (synchronous) A counter is a device which sequences through a fixed set of patterns in this case, 1000, 0100, 0010, 0001 (if one of these patterns is the initial state, defined by set/reset) Counts to n (n=number of flipflops) before repeating (ring counter) Mobius (or Johnson) Counter in this case, get 1000, 1100, 1110, 1111, 0111, 0011, 0001, 0000 counts to 2*n before repeating

Binary Counter We normally want to count in a more useful fashion: e.g. binary This requires more combinational logic between the flipflops Need a rule for binary counting "The least significant bit always changes" "A bit changes state if all less significant bits are HIGH" Can implement this with an XOR gate Note Xxor1=X' DecimalBinaryHex A B C D E F A D ABCD So A + =Axor1, B + =BxorA, C + =CxorAB, D + =DxorABC

Binary Down Counter How do you modify this circuit to count down? The rule is "The least significant bit always changes" "A bit changes state if all less significant bits are LOW" Note A XOR 1=A' A XNOR 0=A' DecimalBinaryHex A B C D E F A D So A + =Axor1, B + =BxnorA, C + =CxnorAB, D + =DxnorABC ABCD

Pre-packaged Binary Counters Counters can be bought pre-packaged: e.g. a synchronous four-bit binary up/down-counter (e.g. DM74LS169A) Standard component with many applications Typical features: Positive edge-triggered FFs with synchronous LOAD and CLEAR inputs LOAD input allows parallel load of data from D, C, B, A CLEAR input resets outputs to 0000 EN input: must be asserted to enable counting RCO: ripple-carry output used for cascading counters High when counter is in its highest state 1111 Implemented using an AND gate: RCO= QA·QB·QC·QD EN D C B A LOAD CLK CLR RCO QD QC QB QA

Binary Counters For an 8-bit synchronous binary up counter, cascade two 4-bit devices together Connect RCO from the first to EN of the second

Offset Counters Two types; for a "starting offset counter" use the synchronous LOAD input. The counter counts like this: 0110,0111,1000,1001,1010,1011,1100,1101,1111,0110,... For an "ending offset counter" use a pattern recognizer for the ending value The counter counts like this: 0000,0001,0010,..., 1100,1101,0000,.... Load value 0110

Sequential Logic Summary Fundamental building blocks of circuits with memory –latch and flipflop –R-S latch, R-S master-slave flipflop, D master-slave flipflop, edge-triggered D flipflop Timing Methodologies –use of clocks Basic registers –Storage register –Shift registers –pattern detectors –counters

Sequential Logic Design Models for representing sequential circuits –Finite-state machines –Representation of memory (states) –Changes in state (transitions) Design procedure –State diagrams –State transition table –Next state functions

Sequential Circuit Models: Abstraction of Circuit Elements Break the sequential circuit down into all its different elements External Inputs to combinational logic External Outputs from combinational logic Combinational logic Storage elements State Inputs to combinational logic State Outputs from combinational logic Combinational Logic Storage Elements External Outputs State OutputsState Inputs External Inputs

Abstraction of Circuit Elements We often don’t have all of these Special case: No External Inputs E.g. Traffic light with no pedestrian control button Combinational Logic Storage Elements External Outputs State OutputsState Inputs

Abstraction of State Elements Special case: No external outputs Output values correspond to state E.g.: Counters with LD, ENABLE, and CLR inputs Combinational Logic Storage Elements Outputs State Outputs State Inputs Inputs

Abstraction of State Elements Special case: No explicit inputs or outputs E.g.: Counters without LD, ENABLE, and CLR inputs Combinational Logic Storage Elements Outputs State Outputs State Inputs

Two Forms of Sequential Logic Asynchronous sequential logic – state changes occur whenever state inputs change (elements may be simple wires or delay elements) Hard to design due to race conditions, metastability. Rarely used. ignore it from now on. Synchronous sequential logic – state changes occur in step across all storage elements (using a periodic waveform - the clock) Clock Asynchronous Synchronous

In = 0 In = 1 In = 0In = Finite State Machine Representations A finite state machine model consists of: State Nodes (Circles): determined by possible values in sequential storage elements Transitions (Arrows): indicate a change of state; may or may not be associated with an input Clock: controls when state can change by controlling storage elements. Not explicitly shown. Sequential Logic Sequences through a series of states Based on a sequence of values of input signals Clock period defines elements of sequence

Can Any Sequential System be Represented with a State Diagram? What about a Shift Register? Input value shown on transition arcs Output values shown within state node DQDQDQ IN OUT1OUT2OUT3 CLK

Can Any Sequential System be Represented with a State Diagram? What about a Shift Register? Input value shown on transition arcs Output values shown within state node DQDQDQ IN OUT1OUT2OUT3 CLK

bit up-counter Counters are Simple Finite State Machines Counters Simply cycle through a well-defined state sequence. Many types of counters: binary, BCD, Gray-code 3-bit up-counter: 000, 001, 010, 011, 100, 101, 110, 111, 000,... 3-bit down-counter: 111, 110, 101, 100, 011, 010, 001, 000, 111,... No inputs once started, no explicit outputs

How Do We Turn a State Diagram into Logic? For a 3-bit counter: Need three flip-flops to hold state Need combinational logic to compute next state Clock signal controls when flip-flop memory can change Wait long enough for combinational logic to compute new value before providing the next clock event State Storage Logic

FSM Design Procedure Start with counters Simple because the output is just the state Simple because there is no choice of next state based on inputs State diagram to state transition table Tabular form of state diagram Similar to a truth-table State encoding: how do you represent the state in binary? Decide on representation of states (e.g. traffic light green = what in binary?) For counters it is simple: just its value Implementation Flip-flop for each state bit Combinational logic based on state encoding

current state next state FSM Design Procedure: State Diagram to Encoded State Transition Table Transition table is just a tabular form of the state diagram Shows all of the possible transitions Like a truth-table (specify output for all input combinations) Encoding of states: easy for counters – just use output value bit up-counter

bit up-counter current state next state FSM Design Procedure: State Diagram to Encoded State Transition Table Tabular form of state diagram Shows all of the possible transistions Like a truth-table (specify output for all input combinations) Encoding of states: easy for counters – just use output value

C3C2C1N3N2N N1:= C1' N2:= C1C2' + C1'C2 := C1 xor C2 N3:= C1C2C3' + C1'C3 + C2'C3 := C1C2C3' + (C1' + C2')C3 := C1C2C3' + (C1C2)'C3 := (C1C2) xor C3 notation to show function representing input to D-FF Implementation Each state bit requires one D flip-flop Combinational logic is needed to implement transition table C1 C2 C3 N C1 C2 C3 N1 current next Karnaugh maps for each output: C C1 C3 N C3C2 C1

C3C2C1N3N2N N1:= C1' N2:= C1C2' + C1'C2 := C1 xor C2 N3:= C1C2C3' + C1'C3 + C2'C3 := C1C2C3' + (C1' + C2')C3 := (C1C2) xor C3 Implementation currentnext Each state bit requires one D flip-flop Combinational logic is needed to implement transition table

InC1C2C3N1N2N N1:= In N2:= C1 N3:= C2 Another Example Shift Register In the counter, current state (only) determines next state For a shift register Input + current state determines next state Need an extra column in the transition table DQDQDQ IN OUT1OUT2OUT3 CLK N1 N2N3C1C2C3 3-bit shift register. Serial input, parallel output.