Bird
Raised Fist0
VHDLprogramming~20 mins

Three-process FSM coding style in VHDL - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Three-process FSM Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
Output of a three-process FSM with synchronous reset

Consider this VHDL snippet of a three-process FSM with synchronous reset. What will be the value of state after the first rising clock edge when reset is '1'?

VHDL
architecture Behavioral of fsm is
  type state_type is (IDLE, WORK, DONE);
  signal state, next_state: state_type := IDLE;
begin
  -- State register process
  process(clk)
  begin
    if rising_edge(clk) then
      if reset = '1' then
        state <= IDLE;
      else
        state <= next_state;
      end if;
    end if;
  end process;

  -- Next state logic process
  process(state, start)
  begin
    case state is
      when IDLE =>
        if start = '1' then
          next_state <= WORK;
        else
          next_state <= IDLE;
        end if;
      when WORK =>
        next_state <= DONE;
      when DONE =>
        next_state <= IDLE;
    end case;
  end process;

  -- Output logic process
  process(state)
  begin
    done <= '0';
    case state is
      when DONE =>
        done <= '1';
      when others =>
        done <= '0';
    end case;
  end process;
end Behavioral;
Astate = IDLE
Bstate = WORK
Cstate = DONE
Dstate is undefined
Attempts:
2 left
💡 Hint

Remember that synchronous reset sets the state at the clock edge.

❓ Predict Output
intermediate
2:00remaining
Next state after start signal in three-process FSM

Given the same FSM as above, if reset is '0' and start is '1' at the rising clock edge, what will be the value of next_state immediately after the clock edge?

VHDL
Same as challenge c1
Anext_state is undefined
Bnext_state = IDLE
Cnext_state = DONE
Dnext_state = WORK
Attempts:
2 left
💡 Hint

Check the next state logic process for the IDLE state when start is '1'.

🔧 Debug
advanced
2:00remaining
Identify the error in the state register process

Which option contains an error that will cause the state register process to not work as intended in a three-process FSM?

VHDL
process(clk)
begin
  if rising_edge(clk) then
    if reset = '1' then
      state <= IDLE;
    else
      state <= next_state;
    end if;
  end if;
end process;
A
process(clk)
begin
  if rising_edge(clk) then
    if reset = '1' then
      next_state &lt;= IDLE;
    else
      state &lt;= next_state;
    end if;
  end if;
end process;
B
process(clk)
begin
  if clk'event and clk = '1' then
    if reset = '1' then
      state &lt;= IDLE;
    else
      state &lt;= next_state;
    end if;
  end if;
end process;
C
process(clk)
begin
  if rising_edge(clk) then
    if reset = '1' then
      state &lt;= IDLE;
    else
      state &lt;= next_state;
    end if;
  end if;
end process;
D
process(clk)
begin
  if rising_edge(clk) then
    if reset = '1' then
      state &lt;= IDLE;
    else
      state &lt;= state;
    end if;
  end if;
end process;
Attempts:
2 left
💡 Hint

Check which signal is assigned inside the state register process.

📝 Syntax
advanced
2:00remaining
Syntax error in output logic process

Which option contains a syntax error in the output logic process of a three-process FSM?

VHDL
process(state)
begin
  done <= '0';
  case state is
    when DONE =>
      done <= '1';
    when others =>
      done <= '0';
  end case;
end process;
A
;ssecorp dne
;esac dne  
;'0' =&lt; enod      
&gt;= srehto nehw    
;'1' =&lt; enod      
&gt;= ENOD nehw    
si etats esac  
;'0' =&lt; enod  
nigeb
)etats(ssecorp
B
process(state)
begin
  done &lt;= '0';
  case state is
    when DONE =&gt;
      done &lt;= '1';
    when others =&gt;
      done &lt;= '0';
  end case;
end process;
C
process(state)
begin
  done &lt;= '0';
  case state is
    when DONE =&gt;
      done &lt;= '1';
    when others =&gt;
      done &lt;= '0';
  end case
end process;
D
rocess(state)
begin
  done &lt;= '0';
  case state is
    when DONE =&gt;
      done &lt;= '1';
    when others =&gt;
      done &lt;= '0';
  end case;
end process;
Attempts:
2 left
💡 Hint

Check for missing semicolons and correct case syntax.

🚀 Application
expert
2:00remaining
Number of states and outputs in a three-process FSM

A three-process FSM has the states IDLE, WORK, and DONE. The output done is '1' only in the DONE state. How many unique output values and states does this FSM have?

A2 states, 1 unique output value
B3 states, 2 unique output values
C2 states, 2 unique output values
D3 states, 3 unique output values
Attempts:
2 left
💡 Hint

Count the states and distinct output values based on the output logic.

Practice

(1/5)
1. In the three-process FSM coding style in VHDL, which process is responsible for storing the current state?
easy
A. The next state logic process
B. The state register process
C. The output logic process
D. The clock generation process

Solution

  1. Step 1: Understand the role of each process

    The three-process FSM style divides the FSM into state register, next state logic, and output logic processes.
  2. Step 2: Identify which process stores the current state

    The state register process updates and stores the current state on clock edges.
  3. Final Answer:

    The state register process -> Option B
  4. Quick Check:

    State storage = state register process [OK]
Hint: State storage always happens in the state register process [OK]
Common Mistakes:
  • Confusing next state logic with state storage
  • Thinking output logic stores the state
  • Assuming clock generation is part of FSM
2. Which of the following is the correct sensitivity list for the next state logic process in a three-process FSM?
easy
A. clk, reset
B. clk
C. outputs
D. current_state, inputs

Solution

  1. Step 1: Recall what next state logic depends on

    The next state logic calculates the next state based on the current state and inputs.
  2. Step 2: Determine the sensitivity list

    It must react to changes in current_state and inputs, so these go in the sensitivity list.
  3. Final Answer:

    current_state, inputs -> Option D
  4. Quick Check:

    Next state logic sensitivity = current_state, inputs [OK]
Hint: Next state logic sensitive to current state and inputs only [OK]
Common Mistakes:
  • Including clk in next state logic sensitivity list
  • Using outputs in sensitivity list
  • Leaving sensitivity list empty
3. Given the following partial FSM code snippet, what will be the output value of output_signal when current_state is S1 and input_signal is '1'?
process(current_state, input_signal)
begin
  case current_state is
    when S0 => output_signal <= '0';
    when S1 =>
      if input_signal = '1' then
        output_signal <= '1';
      else
        output_signal <= '0';
      end if;
    when others => output_signal <= '0';
  end case;
end process;
medium
A. Undefined
B. '0'
C. '1'
D. Signal retains previous value

Solution

  1. Step 1: Analyze the output logic for state S1

    When current_state is S1, output_signal is '1' if input_signal is '1', else '0'.
  2. Step 2: Apply given inputs

    current_state = S1 and input_signal = '1' means output_signal <= '1'.
  3. Final Answer:

    '1' -> Option C
  4. Quick Check:

    Output for S1 with input '1' = '1' [OK]
Hint: Check state and input conditions carefully for output logic [OK]
Common Mistakes:
  • Ignoring input condition inside S1
  • Assuming output is always '0' in S1
  • Confusing output logic with next state logic
4. Identify the error in this state register process code snippet for a three-process FSM:
process(clk, reset)
begin
  if reset = '1' then
    current_state <= S0;
  elsif rising_edge(clk) then
    next_state <= current_state;
  end if;
end process;
medium
A. Using next_state instead of current_state on clock edge
B. Missing sensitivity to next_state signal
C. Reset condition should be inside rising_edge(clk)
D. No error, code is correct

Solution

  1. Step 1: Understand state register role

    The state register updates current_state with next_state on clock edge.
  2. Step 2: Check assignment inside clock edge

    The code assigns next_state <= current_state, which is reversed and wrong.
  3. Final Answer:

    Using next_state instead of current_state on clock edge -> Option A
  4. Quick Check:

    State register updates current_state, not next_state [OK]
Hint: State register updates current_state from next_state [OK]
Common Mistakes:
  • Assigning next_state inside state register process
  • Placing reset inside clock edge condition
  • Confusing current_state and next_state signals
5. You want to design a three-process FSM with states IDLE, BUSY, and DONE. Which of the following correctly describes the responsibilities of the three processes?
hard
A. Process 1: Store current state; Process 2: Compute next state from current state and inputs; Process 3: Generate outputs based on current state
B. Process 1: Generate outputs; Process 2: Store current state; Process 3: Compute next state
C. Process 1: Compute next state; Process 2: Generate outputs; Process 3: Store current state
D. Process 1: Store current state and outputs; Process 2: Compute next state; Process 3: Reset FSM

Solution

  1. Step 1: Recall three-process FSM roles

    The three processes are: state register (store current state), next state logic (compute next state), output logic (generate outputs).
  2. Step 2: Match roles to options

    Process 1: Store current state; Process 2: Compute next state from current state and inputs; Process 3: Generate outputs based on current state correctly assigns these roles in order.
  3. Final Answer:

    Process 1: Store current state; Process 2: Compute next state from current state and inputs; Process 3: Generate outputs based on current state -> Option A
  4. Quick Check:

    Three-process FSM roles = B [OK]
Hint: Remember: register stores state, logic computes next, output drives signals [OK]
Common Mistakes:
  • Mixing output generation with state storage
  • Assigning reset to a separate process
  • Combining multiple roles in one process
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard