Finite State Machines in Verilog - PowerPoint PPT Presentation

About This Presentation
Title:

Finite State Machines in Verilog

Description:

FSM could be implemented structurally, but behavioral is better. 11 Detector - Detects a 11 sequence on input w. reset. A/z=0. B/z=0. C/z=1. w=1. w=0. w=1 ... – PowerPoint PPT presentation

Number of Views:272
Avg rating:3.0/5.0
Slides: 7
Provided by: ianh152
Learn more at: https://ics.uci.edu
Category:

less

Transcript and Presenter's Notes

Title: Finite State Machines in Verilog


1
Finite State Machines in Verilog
CS 153, Spring 2007 Ian G. Harris Department of
Computer Science University of California Irvine
2
FSM Implementations
  • FSM could be implemented structurally, but
    behavioral is better

11 Detector - Detects a 11 sequence on input w
reset
  • Moore machine - Output depends on state, not
    inputs
  • Output is z, inputs are w and reset
  • Z set to 1 when 11 occurs on input w

3
Moore Machine Structure
inputs
outputs
Current state
  • Verilog code will have this structure as well

4
FSM Verilog, Next State Logic
module one_one_det (Clock, Resetn, w, z) input
Clock, Resetn, w output z reg 21 y,
Y parameter 21 A2b00, B2b01,
c2b10 always _at_(w or y) case (y) A
if (w) YB else YA B if (w) YC
else YA C if (w) YC else
YA default Y2bxx endcase
  • Each state is a branch of the case
  • Each transition is a branch of an if

5
Alternative Next State Logic
always _at_(w or y) if (!w) Y A else
case (y) A YB B YC C
YC default Y2bxx endcase
  • Why is this different from the original
    definition?

6
FSM Verilog, State Elements and Output Logic
always _at_(negedge Resetn or posedge Clock) if
(Resetn 0) yltA else yltY assign z
(yC)
Alternative for Output Logic
always _at_(y) if (y C) z 1 else
z 0
Write a Comment
User Comments (0)
About PowerShow.com