Challenge - 5 Problems
VHDL Resource Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of inferred resource for signal assignment
What is the inferred hardware resource for the following VHDL code snippet?
signal a, b, c : std_logic; begin c <= a and b;
VHDL
signal a, b, c : std_logic;
begin
c <= a and b;Attempts:
2 left
💡 Hint
Think about what hardware corresponds to the 'and' operation on signals.
✗ Incorrect
The 'and' operator on std_logic signals infers a 2-input AND gate in hardware.
❓ Predict Output
intermediateResource inferred by a process with clock and reset
What hardware resource is inferred by this VHDL process?
process(clk, rst)
begin
if rst = '1' then
q <= '0';
elsif rising_edge(clk) then
q <= d;
end if;
end process;VHDL
process(clk, rst) begin if rst = '1' then q <= '0'; elsif rising_edge(clk) then q <= d; end if; end process;
Attempts:
2 left
💡 Hint
Check if reset is inside the clock edge condition or outside.
✗ Incorrect
Because reset is in the sensitivity list and checked before the rising_edge(clk), it infers an asynchronous reset flip-flop.
🔧 Debug
advancedIdentify the error causing latch inference
Which option shows the code that will cause a latch to be inferred due to incomplete assignments inside a process?
process(clk)
begin
if rising_edge(clk) then
if enable = '1' then
q <= d;
end if;
end if;
end process;VHDL
process(clk) begin if rising_edge(clk) then if enable = '1' then q <= d; end if; end if; end process;
Attempts:
2 left
💡 Hint
Think about what happens to q when enable is '0'.
✗ Incorrect
Since q is not assigned when enable is '0', the synthesis tool infers a latch to hold the previous value.
🧠 Conceptual
advancedResource inference for case statement with full coverage
Given a VHDL process with a case statement that covers all possible values of a 2-bit signal, what resource is inferred?
process(sel, a, b, c, d)
begin
case sel is
when "00" => y <= a;
when "01" => y <= b;
when "10" => y <= c;
when others => y <= d;
end case;
end process;VHDL
process(sel, a, b, c, d) begin case sel is when "00" => y <= a; when "01" => y <= b; when "10" => y <= c; when others => y <= d; end case; end process;
Attempts:
2 left
💡 Hint
Think about what hardware selects one input based on a selector signal.
✗ Incorrect
The case statement with full coverage and combinational sensitivity infers a multiplexer selecting one input based on sel.
❓ Predict Output
expertOutput of resource inferred by nested if-else in clocked process
What hardware resource is inferred by this VHDL code?
process(clk)
begin
if rising_edge(clk) then
if enable = '1' then
q <= d;
else
q <= q;
end if;
end if;
end process;VHDL
process(clk) begin if rising_edge(clk) then if enable = '1' then q <= d; else q <= q; end if; end if; end process;
Attempts:
2 left
💡 Hint
Assigning q <= q inside clocked process simulates enable behavior.
✗ Incorrect
Assigning q <= q in the else branch prevents latch inference and models a flip-flop with enable control.
