Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare the AND gate entity name.
VHDL
entity [1] is Port ( A : in STD_LOGIC; B : in STD_LOGIC; Y : out STD_LOGIC); end [1];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different gate name like or_gate or not_gate.
Mismatching entity name and end statement.
✗ Incorrect
The entity name must match the design name. Here, the AND gate is named and_gate.
2fill in blank
mediumComplete the architecture header to define the AND gate behavior.
VHDL
architecture Behavioral of and_gate is begin [1] : process(A, B) begin Y <= A and B; end process [1]; end Behavioral;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using process names that do not match the logic function.
Leaving the process name blank.
✗ Incorrect
The process name should be descriptive. Here, AND_Process fits the AND gate behavior.
3fill in blank
hardFix the error in the signal assignment inside the process.
VHDL
architecture Behavioral of and_gate is
begin
AND_Process : process(A, B)
begin
Y <= [1];
end process AND_Process;
end Behavioral; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'or' or 'xor' instead of 'and'.
Using 'nand' which is the inverse of 'and'.
✗ Incorrect
The AND gate output is the logical AND of inputs A and B, so Y <= A and B; is correct.
4fill in blank
hardFill both blanks to complete the port declaration for inputs and output.
VHDL
entity and_gate is Port ( A : [1] STD_LOGIC; B : [1] STD_LOGIC; Y : [2] STD_LOGIC); end and_gate;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'out' for inputs or 'in' for outputs.
Using 'buffer' or 'inout' incorrectly.
✗ Incorrect
Inputs use in direction and outputs use out direction in VHDL port declarations.
5fill in blank
hardFill all three blanks to complete the architecture with concurrent signal assignment.
VHDL
architecture Behavioral of and_gate is begin [1] <= [2] [3] B; end Behavioral;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'or' instead of 'and'.
Swapping output and input signals.
✗ Incorrect
The concurrent assignment sets output Y to the logical AND of inputs A and B.