digital systems - modrpc/info GitHub Wiki

Table of Contents

Courses, Websites

Finite State Machines

  • Moore machines (output dependent only on states) require more states but safer

Specifying FSM's transition behavior

STEP #1: Declare two states

    • state: current state
    • next_state: F(state, inputs) computed in combinational logic; will be updated on the next rising edge

STEP #2: Create state F/F

  • Create physical means of transitioing from curr_state to the next state
always @(posedge clk) begin
  if (rst) state <= init_state;
  else state <= next_state;
end

STEP #3: Compute next state

  • Implement conditional-transitioning mechanism thta will choose what the next state should be and under what conditions a transition should be made
    • Create always @* (combinational) process which will compute next_state
always @* begin
  // to avoid latch inference over next_state, assign default value first
  //   - this also allows to save code (no full if-else blocks)
  next_state = state;
  case (state) 
  s0: ...
  s1: ...
  default: next_state = initial_state;
  endcase
end

STEP #4: Outputs

  • Output values based on current state, either in contasgn or combo logic
assign out0 = FUNC(state)

always @* begin
  out1 = <default_value>;
  case (state) 
  S0: out1 = ...
  S1: out1 = ...
  endcase
end

Design Components

Interfacing

FIFO interface

AXI Interface

Xilinx Tools

⚠️ **GitHub.com Fallback** ⚠️