0
0
VHDLprogramming~20 mins

Entity-Architecture model in VHDL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
VHDL Entity-Architecture Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of a simple AND gate entity-architecture
What is the output of the following VHDL code when inputs A=1 and B=0?
VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity AndGate is
    Port ( A : in STD_LOGIC;
           B : in STD_LOGIC;
           Y : out STD_LOGIC);
end AndGate;

architecture Behavioral of AndGate is
begin
    Y <= A and B;
end Behavioral;
AY = 'Z' (high impedance)
BY = '1'
CY = '0'
DY = 'X' (unknown)
Attempts:
2 left
💡 Hint
AND gate outputs '1' only if both inputs are '1'.
🧠 Conceptual
intermediate
1:30remaining
Purpose of the architecture block in VHDL
What is the main purpose of the architecture block in a VHDL entity-architecture model?
ATo define the internal behavior or structure of the entity
BTo specify the target hardware device
CTo declare the input and output ports of the design
DTo initialize simulation parameters
Attempts:
2 left
💡 Hint
Think about where the logic or circuit details are described.
🔧 Debug
advanced
2:30remaining
Identify the error in this entity-architecture code
What error will this VHDL code produce when compiled?
VHDL
entity OrGate is
    Port ( A : in STD_LOGIC;
           B : in STD_LOGIC;
           Y : out STD_LOGIC);
end OrGate;

architecture Behavioral of OrGate is
begin
    Y <= A or B;
end Behavioral;
ANo error, code compiles successfully
BSyntaxError: Missing semicolon after entity declaration
CTypeError: Cannot use 'or' operator on STD_LOGIC
DSyntaxError: Missing semicolon after end OrGate
Attempts:
2 left
💡 Hint
Check the entity declaration ending line carefully.
📝 Syntax
advanced
2:00remaining
Correct architecture declaration syntax
Which option shows the correct syntax to declare an architecture named 'DataPath' for an entity 'Processor'?
Aarchitecture DataPath of Processor is begin end DataPath;
Barchitecture DataPath is of Processor begin end;
Carchitecture DataPath of Processor begin end DataPath;
Darchitecture DataPath of Processor is begin end;
Attempts:
2 left
💡 Hint
Remember the order: architecture name, of entity name, is, begin ... end;
🚀 Application
expert
3:00remaining
Number of signals in architecture after elaboration
Given this VHDL entity-architecture, how many signals are present inside the architecture after elaboration?
VHDL
entity Counter is
    Port ( clk : in STD_LOGIC;
           reset : in STD_LOGIC;
           count_out : out INTEGER range 0 to 15);
end Counter;

architecture Behavioral of Counter is
    signal count : INTEGER range 0 to 15 := 0;
begin
    process(clk, reset)
    begin
        if reset = '1' then
            count <= 0;
        elsif rising_edge(clk) then
            count <= count + 1;
        end if;
    end process;
    count_out <= count;
end Behavioral;
A0
B1
C3
D2
Attempts:
2 left
💡 Hint
Count only signals declared inside the architecture block.