What is the main idea behind the two-process FSM coding style in VHDL?
It separates the FSM into two parts: one process for state transitions (sequential logic) and another for output logic (combinational logic). This improves clarity and avoids combinational loops.
Click to reveal answer
beginner
In a two-process FSM, what does the state register process typically include?
It includes a clock and reset sensitivity, updates the current state on clock edges, and handles asynchronous or synchronous reset.
Click to reveal answer
intermediate
Why is the output logic separated into its own process in two-process FSM style?
Separating output logic into a combinational process ensures outputs update immediately based on the current state and inputs, avoiding unintended latches or delays.
Click to reveal answer
intermediate
What is a common sensitivity list for the output logic process in a two-process FSM?
It usually includes the current state signal and any inputs that affect outputs, ensuring outputs update whenever these change.
Click to reveal answer
beginner
Show a simple example of the two-process FSM coding style in VHDL for a state machine with two states.
process(clk, reset) is
begin
if reset = '1' then
current_state <= IDLE;
elsif rising_edge(clk) then
current_state <= next_state;
end if;
end process;
process(current_state, input_signal) is
begin
case current_state is
when IDLE =>
if input_signal = '1' then
next_state <= ACTIVE;
else
next_state <= IDLE;
end if;
output_signal <= '0';
when ACTIVE =>
next_state <= IDLE;
output_signal <= '1';
when others =>
next_state <= IDLE;
output_signal <= '0';
end case;
end process;
Click to reveal answer
What does the first process in a two-process FSM usually handle?
AInput signal sampling asynchronously
BOutput logic combinationally
CState transitions on clock edges
DReset signal generation
✗ Incorrect
The first process handles state transitions triggered by clock edges, updating the current state.
Why separate output logic into a different process in two-process FSM style?
ATo avoid combinational loops and ensure outputs update immediately
BTo reduce the number of states
CTo make the code run faster on hardware
DTo combine reset and clock signals
✗ Incorrect
Separating output logic avoids combinational loops and ensures outputs respond immediately to state changes.
Which signals are typically in the sensitivity list of the output logic process?
ANext state and clock
BOnly the clock signal
COnly the reset signal
DCurrent state and inputs affecting outputs
✗ Incorrect
The output logic process is sensitive to current state and inputs that affect outputs to update outputs correctly.
In two-process FSM style, what happens if you put output logic inside the state register process?
AIt improves code readability
BIt can cause unintended latches or timing issues
CIt reduces hardware resource usage
DIt makes the FSM asynchronous
✗ Incorrect
Combining output logic with state register can cause latches or timing problems due to mixing combinational and sequential logic.
What is the typical reset behavior in the state register process of a two-process FSM?
ASet current state to initial state on reset
BSet outputs to zero on reset
CDisable clock on reset
DChange next state on reset
✗ Incorrect
On reset, the current state is set to a known initial state to start the FSM properly.
Explain the two-process FSM coding style and why it is preferred in VHDL design.
Think about how separating sequential and combinational parts helps hardware design.
You got /5 concepts.
Describe the sensitivity lists for both processes in a two-process FSM and their importance.
Consider what triggers each process to run and update signals.
You got /4 concepts.
Practice
(1/5)
1. In a two-process FSM coding style in VHDL, what is the main role of the first process?
easy
A. To update the current state on clock and reset signals
B. To decide the next state based on inputs
C. To generate output signals directly
D. To initialize variables outside the FSM
Solution
Step 1: Understand the two-process FSM structure
The first process in a two-process FSM handles synchronous operations like updating the current state on clock edges and reset.
Step 2: Identify the role of the first process
This process updates the current state register based on clock and reset signals, ensuring state changes happen synchronously.
Final Answer:
To update the current state on clock and reset signals -> Option A
Quick Check:
First process updates state [OK]
Hint: First process updates state on clock/reset [OK]
Common Mistakes:
Confusing output logic with state update
Thinking next state logic is in first process
Assuming initialization happens in first process
2. Which of the following is the correct sensitivity list for the second process in a two-process FSM that decides next state and outputs?
easy
A. clk, reset
B. clk only
C. reset only
D. current_state, inputs
Solution
Step 1: Identify what triggers next state and output logic
The second process is combinational and depends on current state and inputs to decide next state and outputs.
Step 2: Determine the sensitivity list
It must include all signals that affect next state and outputs, which are current_state and inputs, not clock or reset.
Final Answer:
current_state, inputs -> Option D
Quick Check:
Second process sensitivity = current_state, inputs [OK]
Hint: Second process sensitive to state and inputs only [OK]
Common Mistakes:
Including clock in second process sensitivity
Using reset in sensitivity list incorrectly
Leaving sensitivity list empty
3. Given the following VHDL code snippet for a two-process FSM, what will be the value of current_state after the rising edge of clk if reset is '0' and next_state is S1?
process(clk, reset)
begin
if reset = '1' then
current_state <= S0;
elsif rising_edge(clk) then
current_state <= next_state;
end if;
end process;
medium
A. S0
B. S1
C. Undefined
D. Remains previous state
Solution
Step 1: Analyze reset condition
Reset is '0', so the reset block is skipped; no forced reset to S0.
Step 2: Analyze clock rising edge behavior
On rising edge of clk, current_state is assigned next_state, which is S1.
Hint: Reset '0' means state updates to next_state on clock [OK]
Common Mistakes:
Assuming reset '0' resets state to S0
Confusing next_state with current_state immediately
Ignoring rising_edge condition
4. Identify the error in this two-process FSM snippet where the next state logic is incorrect:
process(current_state, input_signal)
begin
case current_state is
when S0 =>
if input_signal = '1' then
next_state <= S1;
else
next_state <= S0;
end if;
when S1 =>
next_state <= S0;
end case;
end process;
process(clk, reset)
begin
if reset = '1' then
current_state <= S0;
elsif rising_edge(clk) then
current_state <= next_state;
end if;
end process;
medium
A. Sensitivity list missing clk and reset
B. Next state logic should be in clocked process
C. Missing default case in case statement
D. Using '<=' in combinational process instead of ':='
Solution
Step 1: Check the case statement coverage
The case(current_state is) only specifies when S0 and when S1, but omits a catch-all 'when others' clause.
Step 2: Understand the consequence
In a combinational process, incomplete case coverage infers latches on next_state, which is undesirable; it should be fully combinational logic. A default like 'when others => next_state <= current_state;' is needed.
Final Answer:
Missing default case in case statement -> Option C
Quick Check:
Missing when others => latch inferred [OK]
Hint: Case statements in combo processes need 'when others' [OK]
Common Mistakes:
Omitting 'when others' in case statement
Ignoring sensitivity list completeness
Placing next state logic in clocked process
5. You want to design a two-process FSM in VHDL that has three states (IDLE, BUSY, DONE). The FSM should reset to IDLE, move to BUSY when start='1', and then to DONE after one clock cycle. Which of the following next state process code snippets correctly implements this behavior?
hard
A. process(current_state, start)
begin
case current_state is
when IDLE =>
if start = '1' then
next_state <= BUSY;
else
next_state <= IDLE;
end if;
when BUSY =>
next_state <= DONE;
when DONE =>
next_state <= IDLE;
end case;
end process;
B. process(clk, reset)
begin
if reset = '1' then
next_state <= IDLE;
elsif rising_edge(clk) then
if start = '1' then
next_state <= BUSY;
else
next_state <= DONE;
end if;
end if;
end process;
C. process(current_state)
begin
if start = '1' then
next_state <= BUSY;
else
next_state <= IDLE;
end if;
end process;
D. process(current_state, start)
begin
if current_state = IDLE and start = '1' then
next_state <= BUSY;
elsif current_state = BUSY then
next_state <= DONE;
end if;
end process;
Solution
Step 1: Check reset and state transitions
The FSM resets to IDLE (handled in clocked process), so next_state logic must handle transitions from IDLE to BUSY on start='1', BUSY to DONE, and DONE to IDLE.
Step 2: Analyze next state logic options
The correct code uses a combinational process with sensitivity to current_state and start, employing a case statement that fully covers all states with proper transitions: IDLE stays or goes to BUSY based on start, BUSY to DONE, DONE to IDLE. Other codes fail by using clocked process for next_state, missing inputs in sensitivity, incomplete state handling, or unassigned paths in conditional logic leading to latches.
Final Answer:
The case statement with IDLE, BUSY, DONE transitions -> Option A
Quick Check:
Case statement with all states and transitions [OK]
Hint: Use case statement covering all states for next state logic [OK]
Common Mistakes:
Placing next state logic in clocked process
Missing transitions for all states
Ignoring start signal conditions
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.