Sequential Logic 2 - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Sequential Logic 2

Description:

Add some new Verilog to describe sequential circuits ... Could think of it as 'statement is run when one of nets in sensitivity list changes value' ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 42
Provided by: anselmo9
Category:

less

Transcript and Presenter's Notes

Title: Sequential Logic 2


1
Sequential Logic 2
  • Anselmo Lastra

2
Administrative
  • Make sure you have access to lab and ModelSim for
    homework
  • I hear there were some ModelSim license problems
  • How are things going?
  • Problems understanding?
  • Too easy / too hard?

3
Verilog
  • Forgot to mention useful for tests
  • stop
  • Stops the simulation
  • So you can hit run all button to run complete
    sim program

4
Topics
  • Flip-Flops

5
Review D-type Latch
  • No illegal state

6
Problem of Transparency
  • As long as C high, state can change
  • Whats problem with that?

7
Effects of Transparency
  • Output of one latch may feedback
  • So more state changes may happen
  • Depends on gate delays
  • Want to change latch state once
  • Depending on inputs at time of clock

8
Flip-Flops
  • Ensure one transition
  • Two major types
  • Master-Slave
  • Two stage
  • Output not changed until clock disabled
  • Edge triggered
  • Change happens when clock level changes

9
Master-Slave Flip-Flop
  • Either R (master) or L (slave) is enabled, not
    both

10
Timing Diagram
  • Trace the behavior
  • Note illegal state

11
Still Have SR Illegal State
  • Can use similar approach as for D

12
JK Master-Slave FF
  • Output gates J K so if JK both high, next Q is
    inverse of current one

13
Have We Fixed Problem?
  • Output no longer transparent
  • Combinational circuit can use last values
  • New inputs appear at latches
  • Not sent to output until clock low
  • But changes at input of FF when clock high
    trigger next state
  • Transient state where S goes high caused by gate
    delays
  • As clock faster, more problems
  • Have to guarantee circuit settles while clock low

14
Edge-Triggered Flip-Flops
  • New state latched on clock transition
  • Low-to-high or high-to-low
  • Changes when clock high are ignored
  • Note Master-Slave also called pulse triggered

15
D-Type Edge Triggered
16
Negative edge D-type
  • From WebPACK

17
Behavioral
18
Flip-Flop Timing
  • Draw on board
  • Setup time time that D must be available before
    clock edge
  • Hold time time that D must be stable after
    clock edge
  • Propagation delay time after edge when output
    is available

19
Edge-Triggered JK
  • Same truth table as other JK flip-flop, but edge
    triggered

20
Standard Symbols Latches
  • Circle at input indicates negation

21
Symbols Master-Slave
  • Inverted L indicates postponed output
  • Circle indicates whether enable is positive or
    negative

22
Symbols Edge-Triggered
  • Arrow indicates edge trigger

23
Characteristic Tables
  • Can describe function of flip flops by
    considering state
  • Current state
  • Next state at clock pulse governed by inputs
  • Concept of state at times useful

24
JK and SR Flip-Flops
25
T Flip-Flop
  • Similar to D, except T input governs whether
    state changes or not
  • Instead of whether Q is 1 or 0

26
Clock Gating
  • Can gate clocks (like to keep any FF from
    changing states)
  • However, can cause clock skew
  • Clock skew also caused by wire lengths over chip

27
Direct Inputs
  • Set/Reset independent of clock
  • Direct set or preset
  • Direct reset or clear
  • Often used for power-up reset

28
Verilog for Sequential
  • Add some new Verilog to describe sequential
    circuits
  • Can use latches and flip-flops from library in
    schem. capture or Verilog
  • And connect them
  • But more productive to write higher-level Verilog
    description

29
Register Data Type
  • Like wire but value is retained over time
  • Often causes latch or FF to be synthesized
  • Examples
  • reg state
  • reg 150 addr

30
Always Block
  • Example
  • always _at_ (Reset or Reset)
  • statement
  • Sensitivity list determines what might affect
    statements
  • Could think of it as statement is run when one
    of nets in sensitivity list changes value
  • Example next

31
Flip-Flop Example
  • module dff_v(CLK, RESET, D, Q, Q_n)
  • input CLK, RESET, D
  • output Q, Q_n
  • reg state
  • assign Q state
  • assign Q_n state
  • always _at_(posedge CLK or posedge RESET)
  • begin
  • if (RESET)
  • state lt 0
  • else
  • state lt D
  • end
  • endmodule

negedge also used
32
This is Not Software
  • Dont assign to same reg in more than one always
    block
  • The always blocks are concurrent
  • Doesnt make sense to set reg from two signals
  • Assignments in always blocks should be
    non-blocking
  • You usually dont mean sequential execution

33
Analysis of Sequential Circuits
  • Earlier we learned how to analyze combinational
    circuits
  • Now extend to synchronous sequential
  • Include time
  • Time will be governed by clock, so discrete
  • Well use state tables and state diagrams

34
Input Equations
  • Can describe inputs to FF with logic equations

35
Another Example
36
Time is Implied
  • If circuit is synchronous, time implied as
    sequence of clock ticks
  • Note that last circuit used
  • Previous state to determine next state
  • State and inputs to determine output

37
State Table
  • For last example
  • Truth table with state added

38
Two Dimensional Table
  • Same thing, different layout

39
Sequential Circuit Types
  • Moore model outputs depend on states
  • Mealy model also depend on inputs

40
Today
  • Flip-Flops
  • Verilog always statement
  • Notion of state and next state

41
Next Time
  • State Diagrams
  • Registers
Write a Comment
User Comments (0)
About PowerShow.com