Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a procedure named 'display' that takes an integer input.
VHDL
procedure display([1] : in integer) is begin null; end procedure;
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the parameter name blank
Using invalid characters in the parameter name
✗ Incorrect
The procedure parameter name can be any valid identifier. Here, 'value' is used as the parameter name.
2fill in blank
mediumComplete the code to call the procedure 'display' with the integer 10.
VHDL
begin [1](10); end;
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different procedure name
Missing parentheses when calling the procedure
✗ Incorrect
To call the procedure named 'display', use its exact name followed by parentheses with the argument.
3fill in blank
hardFix the error in the procedure declaration by completing the missing keyword.
VHDL
procedure display(value : in integer) [1] begin null; end display;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'begin' instead of 'is' after the parameter list
Omitting the keyword entirely
✗ Incorrect
In VHDL, the procedure declaration uses the keyword 'is' before the body begins.
4fill in blank
hardFill both blanks to declare a procedure 'increment' that takes an integer input and increments it by 1.
VHDL
procedure increment([1] : inout integer) [2] begin [1] := [1] + 1; end procedure;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'in' instead of 'inout' for the parameter mode
Using 'as' instead of 'is' after the parameter list
✗ Incorrect
The parameter name 'num' is used, and the keyword 'is' starts the procedure body.
5fill in blank
hardFill all three blanks to declare and call a procedure 'multiply' that multiplies an integer by 2.
VHDL
procedure multiply([1] : inout integer) [2] begin [1] := [1] * 2; end procedure; begin [1] := 5; multiply([1]); end;
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for parameter and variable
Omitting the 'is' keyword
Not passing the variable correctly to the procedure
✗ Incorrect
The parameter and variable name is 'num', the keyword 'is' starts the procedure body, and 'num' is used in the call and assignment.
