0
0
VHDLprogramming~10 mins

Relational 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 compare if signal A is equal to signal B.

VHDL
if A [1] B then
    -- do something
end if;
Drag options to blanks, or click blank then click option'
A<
B/=
C=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using /= which means 'not equal'.
Using < or > which are for less or greater comparisons.
2fill in blank
medium

Complete the code to check if signal X is not equal to signal Y.

VHDL
if X [1] Y then
    -- do something
end if;
Drag options to blanks, or click blank then click option'
A/=
B=
C<=
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using = which checks equality instead.
Using relational operators like <= or >= which check order.
3fill in blank
hard

Fix the error in the code to check if signal M is less than signal N.

VHDL
if M [1] N then
    -- do something
end if;
Drag options to blanks, or click blank then click option'
A>
B<
C=
D/=
Attempts:
3 left
💡 Hint
Common Mistakes
Using > which means 'greater than'.
Using = or /= which check equality or inequality.
4fill in blank
hard

Fill both blanks to check if signal P is greater than or equal to signal Q.

VHDL
if P [1] Q [2] then
    -- do something
end if;
Drag options to blanks, or click blank then click option'
A>=
B<=
Cthen
Delse
Attempts:
3 left
💡 Hint
Common Mistakes
Using <= instead of >=.
Using else instead of then.
5fill in blank
hard

Fill all three blanks to create a condition that checks if signal R is less than signal S and signal T is not equal to signal U.

VHDL
if R [1] S and T [2] U [3] then
    -- do something
end if;
Drag options to blanks, or click blank then click option'
A<
B/=
Cthen
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using = instead of /= for inequality.
Forgetting the then keyword.