Docsity

Sequential circuits analysis., Exercises of Digital Logic Design and Programming

Toggle sidebar
bg1
1
1Elec 326 Sequential Circuit Analysis
Sequential Circuit Analysis
Objectives
This section introduces synchronous sequential circuits with
the following goals:
Give a precise definition of synchronous sequential circuits.
Introduce several structural and behavioral models for synchronous
sequential circuits.
Demonstrate by example how to analyze synchronous sequential
circuits by deriving their behavior from a structural description.
Demonstrate how to represent the behavior of a synchronous
sequential circuit with Verilog.
Reading assignment
Section 3.4
Sections 4.4, 4,5, and 4.6
2Elec 326 Sequential Circuit Analysis
Topics
Sequential Circuit Models
Mealy and Moore Models
Blocking and Non-blocking Assignment statements
Verilog representation of sequential circuits
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Sequential circuits analysis. and more Exercises Digital Logic Design and Programming in PDF only on Docsity!

Elec 326 1 Sequential Circuit Analysis

Sequential Circuit Analysis

†Objectives

„ This section introduces synchronous sequential circuits with

the following goals:

‹Give a precise definition of synchronous sequential circuits.

‹Introduce several structural and behavioral models for synchronous

sequential circuits.

‹Demonstrate by example how to analyze synchronous sequential

circuits by deriving their behavior from a structural description.

‹Demonstrate how to represent the behavior of a synchronous

sequential circuit with Verilog.

†Reading assignment

„ Section 3.

„ Sections 4.4, 4,5, and 4.

Elec 326 2 Sequential Circuit Analysis

†Topics

„ Sequential Circuit Models

„ Mealy and Moore Models

„ Blocking and Non-blocking Assignment statements

„ Verilog representation of sequential circuits

Elec 326 3 Sequential Circuit Analysis

10.1. Synchronous Sequential Circuits

†Definition. A sequential circuit is said to be a

synchronous sequential circuit if it satisfies the

following conditions:

„ There is at least one flip-flop in every loop

„ All flip-flops have the same type of dynamic clock

„ All clock inputs of all the flip-flops are driven by the same clock signal.

Elec 326 4 Sequential Circuit Analysis

†Sequential Circuit Canonical Form

„ Any synchronous sequential circuit can be drawn in this form by pulling the flip-flops to the bottom of the figure (think of the lines as elastic). Since all loops have a flip- flop in them, this will leave the remaining circuit without loops, and hence combinational.

  • ••
  • •• •••
  • •• •••

Input Signals

Output Signals

Next State Signals

Current State Signals

FF

FF

Combinational Logic Network

CLK

Elec 326 5 Sequential Circuit Analysis

„ There are two versions of this model called the Mealy Model and the Moore model. The only difference is in the way the output signals are generated.

‹Mealy Model: Outputs depend on current state and inputs

‹Moore Model: Outputs only depend on current state.

Mealy Model Moore Model

Elec 326 6 Sequential Circuit Analysis

2. Synchronous Sequential Circuit Models

†Structural

„ Logic diagram

„ Excitation Equations

„ Output equations

†Behavioral

„ Transition and output equations

„ Transition table

„ State table

„ State diagram (graph)

†SSC Analysis: Derive one of the behavioral models

from an instance of a structural model

†SSC Synthesis: Derive a structural model from one of

the behavioral models

Elec 326 7 Sequential Circuit Analysis

10.3. Analysis Examples

† Example # 1

„ Derive the excitation and output equations:

J Q

K Q

J Q

1 K Q

X

CK

Q

Q

Y

J0 = K0 =

J1 = K1 =

Y =

X' + Q1'

Q

1

X + Q

X•Q0'•Q1 + X'•Q0•Q

Elec 326 8 Sequential Circuit Analysis

„ Derive the transition equations from the excitation equations:

‹Use the characteristic equation for JK flip-flops:

Q* = JQ' + K'Q

‹The resulting transition equations are:

„ Construct the transition table from the transition equations:

Q0* = J0•Q0' + K0'•Q0 = (X'+ Q1')•Q0' + 0•Q

= X'•Q0' + Q0'•Q1'

Q1* = J1•Q1' + K1'•Q1 = Q0•Q1' + (X+ Q0)'•Q

= Q0•Q1' + X'•Q0'•Q

Q1, Q0 X=0 X=1 X=0 X=

Q1* Q0* Y

Elec 326 11 Sequential Circuit Analysis

„ Construct the excitation/transition table from the excitation/transition equations:

‹Note that since D flip-flops are used, the sets of excitation and

transition equations are the same. Therefore the transition table is

obtained by plotting the excitation equations.

Q2* = Y = X⊕Q2 ⊕Q0; Q1* = Q2; Q0* = Q1;

Q2 Q1 Q0 X=0 X=1 X=0 X=

0 0 0 000 100 0 1 0 0 1 100 000 1 0 0 1 0 001 101 0 1 0 1 1 101 001 1 0 1 0 0 110 010 1 0 1 0 1 010 110 0 1 1 1 0 111 011 1 0 1 1 1 011 111 0 1

Q2* Q1* Q0* Y

Elec 326 12 Sequential Circuit Analysis

„ Construct the state table from the transition table

‹Let 000 = A, 001 = B, 010 = C, 011 = D, 100 = E, 101 = F,

110 = G, 111 = H

Q X=0 X=1 X=0 X=

A A E 0 1

B E A 1 0

C B F 0 1

D F B 1 0

E G C 0 1

F C G 1 0

G H D 1 0

H D H 0 1

Q* Y

Q2 Q1 Q0 X=0 X=1 X=0 X= 0 0 0 000 100 0 1 0 0 1 100 000 1 0 0 1 0 001 101 0 1 0 1 1 101 001 1 0 1 0 0 110 010 1 0 1 0 1 010 110 0 1 1 1 0 111 011 1 0 1 1 1 011 111 0 1 Q2* Q1* Q0* Y

Transition Table:

State Table:

Elec 326 13 Sequential Circuit Analysis

„ Construct the state diagram from the state table

Q X=0 X=1 X=0 X= A A E 0 1 B E A 1 0 C B F 0 1 D F B 1 0 E G C 0 1 F C G 1 0 G H D 1 0 H D H 0 1 Q* Y

State Table:

State Diagram:

Elec 326 14 Sequential Circuit Analysis

† Example #3 (Problem 7.18)

„ Derive the excitation and output equations:

J0 = K0 =

J1 = K1 =

MAX =

„ Derive the transition equations from the excitation equations:

Q0* = J0•Q0' + K0'•Q0 =

Q1* = J1•Q1' + K1'•Q1 =

EN MAX Q0 (^) Q

J Q

K Q

J Q

K Q CLK

EN

EN•Q

EN•Q0•Q

EN•Q0' + EN'•Q

EN•Q0•Q1' +(EN•Q0)'•Q

Elec 326 17 Sequential Circuit Analysis

†Example #

„ Logic Diagram

„ Derive the excitation equations

X

J QQ0 Q1 Z

K Q

J Q

K Q

CLK

J0 =

J1 =

K0 =

K1 =

X•Q1'•Q0'

X•Q

X•Q

X•Q1•Q0'

Elec 326 18 Sequential Circuit Analysis

„ Derive the transition equations from the excitation equations:

„ Derive the transition table from the transition equations:

Q0* = J0•Q0' + K0'•Q = (X•Q1'•Q0')•Q0' + (X•Q1)'•Q = X•Q1'•Q0' + X'•Q0 + Q1'•Q

Q1* = J1•Q1' + K1'•Q = (X•Q0)•Q1' + (X•Q1•Q0')'•Q = (X•Q0•Q1' + (X' + Q1' + Q0)•Q = X•Q0•Q1' + X'•Q1 + Q0•Q

Q1 Q0 X=0 X= 0 0 0 0 0 1 0 0 1 0 1 1 1 0

1 0 1 0 0 0 1 1 1 1 1 1 0 1

Q1* Q0* Z

Elec 326 19 Sequential Circuit Analysis

„ Derive the state table from the transition table:

‹Where 00 = A, 01 = B, 10 = C, 11 = D

„ Derive the state diagram from the state table:

Q X=0 X=

A A B 0

B B D 0

C C A 1

D D C 1

Q* Z

Elec 326 20 Sequential Circuit Analysis

4. Synchronous Sequential Circuits & Verilog

† Blocking vs. non-blocking assignment statements

„ Write code for the following circuit (a 2-bit shift register)

„ First try

module bexample (D, Ck, Q1, Q2); input D, Ck; output Q1, Q2; reg Q1, Q2;

always @(posedge Ck) begin Q1 = D; Q2 = Q1; end

endmodule

D Q Q

D Q Q

D

Ck

Q1 Q

D Q Q

D Q Q

D Ck

Q

Q

Elec 326 23 Sequential Circuit Analysis

†Verilog description of example #

module example1 (Ck, X, Q, Y); input Ck, X; output Y; output [1:0] Q; reg [1:0] Q;

always @(posedge Ck) case (Q) 0: Q <= 1; 1: Q <= 2; 2: if (X) Q <= 0; else Q <= 3; 3: Q <= 0; default: Q <= 2'bxx; endcase

assign Y = ((Q == 2) & X) | ((Q == 3) & ~X);

endmodule

Elec 326 24 Sequential Circuit Analysis

† Alternate description of example 1

module example1a (Ck, X, Q, Y); input Ck, X; output Y; output [1:0] Q; reg [1:0] Q, NXST; reg Y;

always @(posedge Ck) Q <= NXST;

always @(Q or X) case (Q) 0: begin NXST = 2'b01; Y = 0; end 1: begin NXST = 2; Y = 0; end 2: if (~X) begin NXST = 3; Y = 0; end else begin NXST = 0; Y = 1; end 3: begin NXST = 0; if (~X) Y = 1; else Y = 0; end endcase

endmodule

Elec 326 25 Sequential Circuit Analysis

†Another Example

module simple (Clock, Resetn, w, z); input Clock, Resetn, w; output z; reg [2:1] y, Y; parameter [2:1] A = 2'b00, B = 2'b01, C = 2'b10;

always @(w or y) // Define the next state combinational logic case (y) A: if (w) Y = B; else Y = A; B: if (w) Y = C; else Y = A; C: if (w) Y = C; else Y = A; default : Y = 2'bxx; endcase

always @( negedge Resetn or posedge Clock) // Define the flip-flops if (Resetn == 0) y <= A; else y <= Y;

assign z = (y == C); // Define output logic

endmodule

Elec 326 26 Sequential Circuit Analysis

† Alternate description of previous example:

module simple (Clock, Resetn, w, z); input Clock, Resetn, w; output z; reg [2:1] y; parameter [2:1] A = 2'b00, B = 2'b01, C = 2'b10;

always @( negedge Resetn or posedge Clock) // Define the sequential block if (Resetn == 0) y <= A; else case (y) A: if (w) y <= B; else y <= A; B: if (w) y <= C; else y <= A; C: if (w) y <= C; else y <= A; default : y <= 2'bxx; endcase

assign z = (y == C); // Define output

endmodule