0
0
VHDLprogramming~10 mins

Arithmetic operators in VHDL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add two signals a and b.

VHDL
result <= a [1] b;
Drag options to blanks, or click blank then click option'
A*
B-
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' will subtract instead of add.
Using '*' or '/' will multiply or divide, not add.
2fill in blank
medium

Complete the code to subtract signal b from a.

VHDL
result <= a [1] b;
Drag options to blanks, or click blank then click option'
A+
B/
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will add instead of subtract.
Using '*' or '/' will multiply or divide, not subtract.
3fill in blank
hard

Fix the error in the code to multiply a and b.

VHDL
result <= a [1] b;
Drag options to blanks, or click blank then click option'
A*
B-
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '-' will add or subtract instead of multiply.
Using '/' will divide instead of multiply.
4fill in blank
hard

Fill both blanks to divide a by b and assign to result.

VHDL
result <= a [1] b [2] 2;
Drag options to blanks, or click blank then click option'
A/
B*
C+
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '-' instead of '*' for multiplication.
Using '*' or '+' instead of '/' for division.
5fill in blank
hard

Fill all three blanks to compute (a + b) * (c - d) and assign to result.

VHDL
result <= (a [1] b) [2] (c [3] d);
Drag options to blanks, or click blank then click option'
A+
B-
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up '+' and '-' operators.
Using '/' instead of '*' for multiplication.