Week #7 Sequential Circuits (Part B)

Slides:



Advertisements
Similar presentations
COE 202: Digital Logic Design Sequential Circuits Part 2
Advertisements

State-machine structure (Mealy)
State Machine Design Procedure
Synchronous Sequential Logic
CS 151 Digital Systems Design Lecture 21 Analyzing Sequential Circuits.
1 Lecture 23 More Sequential Circuits Analysis. 2 Analysis of Combinational Vs. Sequential Circuits °Combinational : Boolean Equations Truth Table Output.
Sequential Design Part II. Output A(t+1) =D A = AX + BX B(t+1) =D B = AX Y = AX + BX.
Sequential Logic Design with Flip-flops
Registers.1. Register  Consists of N Flip-Flops  Stores N bits  Common clock used for all Flip-Flops Shift Register  A register that provides the.
Sequential Circuit Design
1 COMP541 State Machines Montek Singh Feb 6, 2007.
Overview Sequential Circuit Design Specification Formulation
Sequential Circuits Problems(I) Prof. Sin-Min Lee Department of Mathematics and Computer Science Algorithm = Logic + Control.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
Digital Logic Design Lecture 26. Announcements Exams will be returned on Thursday Final small quiz on Monday, 12/8. Final homework will be assigned Thursday,
Digital Computer Design Fundamental
1 Chapter 5 Synchronous Sequential Logic 5-1 Sequential Circuits Every digital system is likely to have combinational circuits, most systems encountered.
Chapter 5 - Part Sequential Circuit Design Design Procedure  Specification  Formulation - Obtain a state diagram or state table  State Assignment.
Rabie A. Ramadan Lecture 2
(Sequential Logic Circuit)
Chap 4. Sequential Circuits
Chap 4. Sequential Circuits
Sequential Circuit Design. Outline  Flip-flop Excitation Tables  Sequential Circuit Design  Design: Example #1  Design: Example #2  Design: Example.
1 Lecture #12 EGR 277 – Digital Logic Synchronous Logic Circuits versus Combinational Logic Circuits A) Combinational Logic Circuits Recall that there.
CPEN Digital System Design Chapter 5 - Sequential Circuits Sequential Circuit Design C. Gerousis © Logic and Computer Design Fundamentals, 4 rd Ed.,
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
1 © 2014 B. Wilkinson Modification date: Dec Sequential Logic Circuits Previously, we described the basic building blocks of sequential circuits,
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Circuits State Reduction and Assignment State Reduction reductions on the number of flip-flops and the number of gates a reduction in the.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Registers; State Machines Analysis Section 7-1 Section 5-4.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
1 State Reduction Goal: reduce the number of states while keeping the external input-output requirements unchanged. State reduction example: a: input 0.
Learning to Design Counters
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
Finite State Machines (part 1)
Registers and Counters
ANALYSIS OF SEQUENTIAL CIRCUITS
Adapted by Dr. Adel Ammar
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
FIGURE 5.1 Block diagram of sequential circuit
CSCE 211: Digital Logic Design
Sequential Circuits Most digital systems like digital watches, digital phones, digital computers, digital traffic light controllers and so on require.
ECE 301 – Digital Electronics
T Flip-Flop A T (toggle) flip-flop is a complementing flip-flop and can be obtained from a JK flip-flop when the two inputs are tied together. When T.
CSCE 211: Digital Logic Design
FINITE STATE MACHINES (FSMs)
Princess Sumaya University
CENG 241 Digital Design 1 Lecture 11
CSCE 211: Digital Logic Design
Sequential circuit design
CSCE 211: Digital Logic Design
Sequential circuit design
Chapter 5 Synchronous Sequential Logic 5-1 Sequential Circuits
Analysis of Synchronous Sequential Circuits
INTRODUCTION TO LOGIC DESIGN Chapter 5 Synchronous Sequential Logic
Sequential circuit design
EE2174: Digital Logic and Lab
Analysis of Synchronous Sequential Circuits
MTE 202, Summer 2016 Digital Circuits Dr.-Ing. Saleh Hussin
DESIGN OF SEQUENTIAL CIRCUITS
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
Chapter5: Synchronous Sequential Logic – Part 4
CSCE 211: Digital Logic Design
EGR 2131 Unit 12 Synchronous Sequential Circuits
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Chapter5: Synchronous Sequential Logic – Part 3
COE 202: Digital Logic Design Sequential Circuits Part 3
Presentation transcript:

Week #7 Sequential Circuits (Part B) ENG241 Digital Design Week #7 Sequential Circuits (Part B) School of Engineering

Week #7 Topics Sequential Circuit Analysis Sequential Circuit Design Designing with D Flip-Flops Designing with JK Flip-Flops Designing with T Flip-Flops VHDL Representations Examples School of Engineering

Resources Chapter #6, Mano Sections 6.4 Sequential Circuit Analysis 6.5 Sequential Circuit Design 6.7 VHDL Representation of Sequential circuits School of Engineering

Analysis of Sequential Circuits Earlier we learned how to analyze combinational circuits We will extend analysis to synchronous sequential We’ll use State tables and State diagrams

Review: Flip Flops

Analysis of Sequential Circuits The behavior of a sequential circuit is determined from: Inputs, Outputs, Present state of the circuit. The analysis of a sequential circuit consists of: Obtaining a suitable description that demonstrates the time sequence of inputs, outputs and states (STATE DIAGRAM).

Step #1: Derive Input Equations Can describe inputs to FF with logic equations

Another Example

Input Equations The input equations Imply the type of flip-flop from the letter symbols, Fully specify the combinational circuit that drives the flip-flops.

Time is Implied Note that previous circuit used the Present state (A, B, ..) to determine next state State and inputs to determine output Synchronous circuit When are transitions?

Step #2: State Table Similar to truth table with state added A sequential circuit with `m’ FFs and `n’ inputs needs 2m+n rows in state table. Next State and output are determined using? (input equations)

Step#3: State Diagram “Mealy Model” Input Output An alternative representation to State Table Input/Output

Sequential Circuit Types Moore model – outputs depend on states only. Mealy model – outputs depend on inputs & states

State Diagram: Moore Alternative representation for state table Inputs State/Output

Moore vs. Mealy Machine Moore Machine: Mealy Machine: Easy to understand and easy to code. Might requires more states (thus more hardware). Mealy Machine: More complex since outputs are a function of both the state and input. Requires less states in most cases, therefore less components. Choice of a model depends on the application and personal preference. You can transform a Mealy Machine to a Moore Machine and vice versa.

State Table vs. Diagram Provides same information Table is perhaps easier to fill in from description Diagram is easier for understanding and writing code Analysis for sequential circuits that employs D flip flops is easy. Why? Because the next state values are obtained directly from the input equations.

Analysis with JK Flip Flops For circuits with other types of flip flops such as JK, the next state values are obtained by following the two step procedure: Obtain the binary values of each flip-flop input equation in terms of the present state and input variables. Use the corresponding flip-flop characteristic table to determine the next state.

Analysis with JK Flip Flops JA = B JB = x’ KA = Bx’ KB = A’x + Ax’ = A  x

JK Analysis: State Table Use the Input equations to determine the FF inputs. Use the FF inputs and Table to determine the next state. Flip Flop Inputs JK Characteristic Table JA = B KA = Bx’ JB = x’ KB = A’x + Ax’ = A  x

JK Analysis State Table Flip Flop Inputs JA = B JB = x’ KA = Bx’ KB = A’x + Ax’ = A  x

JK Analysis: State Diagram 1 1 00 11 01 10 1 1

Analysis vs. Design The analysis of sequential circuits starts from a circuit diagram and culminates in a state table or state diagram. The design of a sequential circuit starts from a set of specifications and we should obtain the state diagram and finally the logic diagram.

Design Procedure Design starts from a specification and results in a logic diagram or a list of Boolean functions. The steps to be followed are: Derive a state diagram Reduce the number of states Assign binary values to the states Obtain the binary coded state table Choose the type of flip flops to be used Use Excitation Tables to derive state table Derive the simplified flip flop input equations and output equations Draw the logic diagram

Sequential Circuit Design Remember that a synchronous sequential circuit is made up of flip flops and combinational gates. Part of the design is to choose the flip-flop type and combinational circuit structure which, together with the flip-flops produce a circuit that fulfills the stated specification. How many FLIP FLOPS? The number of flip-flops is determined from the number of states in the circuit n flip-flops can represent up to 2n binary states. Examples: 2 states requires a single Flip Flop 4 states requires two flip flops 8 states requires three flip flops 7 states requires again three flip flops …

Designing with D Flip-Flops Design a clocked sequential circuit that operates according to the state diagram. Use D Flip Flops

Synthesizing Using D Flip Flops The next step is to create a state table and then select two D flip flops to represent the four states, labeling their outputs as A and B. There is one input, x, and one output, y, representing the input sequence and the output value respectively. Remember that the Excitation Table (characteristic equation) of the D flip flop is Q(t + 1) = DQ This means that the next-state values in the state table specify the D input condition for the flip flop.

Designing with D Flip-Flops Input equations can be obtained directly from the table using minterms: A(t + 1) = DA(A, B, x) = ∑m(2,4,5,6) B(t + 1) = DB(A, B, x) = ∑m(1,3,5,6)

Designing with D Flip-Flops However, we have to minimize the expression in a similar way used for combinational logic design!

Designing with D Flip-Flops

Designing with D Flip-Flops DA = AB’ + BX’ DB= A’X + B’X+ ABX’ Y = B’X

A Sequence Detector Design a circuit that detects a sequence of three ones. Use Moore Machine. Create the state diagram Input Circuit Detects `111’ at input Output Moore Machine

Synthesizing Using D Flip Flops The next step is to create a state table and then select two D flip flops to represent the four states, labeling their outputs as A and B. There is one input, x, and one output, y, representing the input sequence and the output value respectively. The output y is `1’ only when we detect the input sequence of `111’

State Table for Sequence Detector Input equations can be obtained directly from the table using minterms: A(t + 1) = DA(A, B, x) = ∑m(3, 5, 7) B(t + 1) = DB(A, B, x) = ∑m(1, 5, 7) y(A, B, x) = ∑m(6, 7)

Boolean Minimization K-Maps can be used to minimize the input equations, resulting in DA = Ax + Bx DB = Ax + B’x Y = AB

Logic Diagram of Sequence Detector

Sequential Circuits with different Flip Flops (JK, T) The design of sequential circuits other than D type flip flops is complicated by the fact that input equations must be derived indirectly from the state table. It is necessary to derive a functional relationship between the state table and the input equations.

Excitation Table During the design, we usually know the transition from present to next state but we need to find the flip flop input conditions that will cause the required transition. We need a table that lists the required inputs for a given change of state, called an excitation table.

Excitation Tables Characteristic Table Excitation Table

Synthesis Using JK Flip Flops Synthesis of circuits with JK flip flops is the same as with D flip flops Except that the input equations must be evaluated from the present-state to the next-state transition derived from the excitation table.

Example: JK Synthesis Step #1: Obtain State Table Example: No output Example: No output 00 1 1 1 01 11 1 10

JK Synthesis: State Table Present State Next State 1 1

Cont .. Example JK Synthesis Step #2: Use K-Maps

Cont .. Example JK Synthesis Bx 00 01 11 10 A 1 JA = BX’ 1 X X X X

Cont .. Example JK Synthesis

Cont .. JK Synthesis Logic Diagram

Synthesis Using T Flip Flops Synthesis of circuits with T flip flops is the same as with JK flip flops … except that the input equations must be evaluated from the present-state to the next-state transition derived from the T excitation table.

Synthesis Using T Flip Flops Design a counter that counts from “000” to “111” and then back to “000” again. Constraint: Use T Flip-Flops

A Counter using T Flip Flops 000 001 010 011 111 110 101 100 Notice the only input is the clock!

Example: T Flip Flop Synthesis

Cont .. T Flip Flops By using K-maps we can minimize the flip flop input equations. T 1 A0 A1 A2

One Dimensional Tables

Two Dimensional Tables Same thing, different layout

Example – Sequence Recognizer (VHDL) Circuit has input: W and output: Z Recognizes sequence of 11 on W Specifically, if W has been 1 and next bit is 1, make Z high Design a Moore and Mealy Machines Sequence Recognizer W Z 1010110111

Sequence Recognizer (Mealy) Reset w=1/z=0 A B w=0/z=0 w=0/z=0 w=1/z=1 Clk: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 w: 1 z:

Mealy: Implementation B w=1/z=0 w=0/z=0 Reset w=1/z=1 Clk: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 w: 1 z:

Reset w=1/z=0 A B w=0/z=0 w=1/z=1 School of Engineering -- (Mealy Machine of Sequence Recognizer) library IEEE; use IEEE.std_logic_1164.all; entity SeqRec_Mealy is port (reset, clk, w: in std_logic; z: out std_logic); end entity SeqRec_Mealy; architecture behavioral of SeqRec_Mealy is type statetype is (A, B); -- define new type signal present_state, next_state: statetype; Begin clk_process: process(reset,clk) begin if reset = ‘1’ then -- Check for reset and initialize state present_state <= A; Elsif (rising_edge(clk)) then -- wait until the rising edge present_state <= next_state; end if; end process clk_process; end architecture behavioral; next_out_process: process(present_state,w) is begin case present_state is -- depending upon current state when A => -- set output signals and next state if w = '0' then next_state <= A; z <= ‘0'; else next_state <= B; z <= '0'; end if; when B => if w = '1' then z <= ‘1'; end case; end process next_out_process; A B w=1/z=0 w=0/z=0 Reset w=1/z=1 School of Engineering

Sequence Recognizer (Moore) Reset w=1 A/z=0 B/Z=0 w=0 w=0 w=1 w=0 C/z=1 w=1 Clk: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 w: 1 z:

Moore: Implementation A/z=0 B/Z=0 C/z=1 w=1 w=0 Reset Clk: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 w: 1 z:

Reset w=1 w=0 w=0 w=0 w=1 w=1 School of Engineering next_state_process: process( present_state, w) is begin case present_state is -- depending upon current state when A => -- set next state if w = '0' then next_state <= A; else next_state <= B; end if; when B => if w = ‘0' then next_state <= C; when C => if w = ‘0’ then end case; end process next_state_process; -- (Moore Machine of Sequence Recognizer) library IEEE; use IEEE.std_logic_1164.all; entity SeqRec_Moore is port (reset, clk, w: in std_logic; z: out std_logic); end entity SeqRec_Moore; architecture behavioral of SeqRec_Moore is type statetype is (A, B,C); -- define new type signal present_state, next_state: statetype; Begin clk_process: process( reset, clk) begin if reset = ‘1’ then -- Check for reset and initialize state present_state <= A; Elsif (rising_edge(clk)) then -- wait until the rising edge present_state <= next_state; end if; end process clk_process; output_process: process( present_state) is begin case present_state is -- depending upon current state when A => -- set output signals z<= ‘0’; when B => when C => z<= ‘1’; end case; end process output_process; End architecture behavioral, Reset w=1 A/z=0 B/Z=0 w=0 w=0 w=0 w=1 C/z=1 w=1 School of Engineering

End Slides

T Flip Flop Analysis Analysis of a sequential circuit with T flip flops follows the same procedure outlined for JK flip flops. The next state values in the state table can be obtained by using the characteristic table or the characteristic equation Q(t + 1) = T  Q = T’Q + TQ’

T Flip Flop Analysis Example B R x CLK Reset TA = Bx TB = x Y = AB

T Flip Flop Analysis State Table TA = Bx TB = x Y = AB A(t + 1) = TA  A = Bx  A B(t + 1) = TB  B = x  B