This set of VHDL Multiple Choice Questions & Answers (MCQs) focuses on “Assert Statement”.
1. Assert statement is a _____________ statement.
a) Concurrent and synthesizable
b) Sequential and synthesizable
c) Concurrent and Non-synthesizable
d) Sequential and Non-synthesizable
Explanation: Assert statement is a sequential statement which can appear inside a process, function or procedure. Also, this statement is a non-synthesizable statement which is used to report some textual string to the designer.
2. What is the use of assert statement in VHDL?
a) To print any string
b) To check the consistency and generate a message
c) Cause execution of sequential statements to wait
d) To check if a condition can stop the execution
Explanation: ASSERT statement is used to check the consistency of the program. It checks a condition and generates a message which is printed on the screen depending on the status of the condition whether it is true or false.
3. What is the correct syntax for using ASSERT statement?
a) ASSERT condition [REPORT string] [SEVERITY name];
b) Condition [REPORT string] [SEVERITY name] ASSERT;
c) Condition [SEVERITY name] [REPORT string] ASSERT;
d) ASSERT condition [SEVERITY name] [REPORT string];
Explanation: The ASSERT statement is declared by using a Boolean condition before which a keyword ASSERT is used. After the condition, a keyword called REPORT is used and the string is specified which the user wants to display. The string to be displayed is followed by the severity of the error and its name.
4. The assert statement displays a message when the condition is FALSE.
Explanation: The assert statement does nothing if the condition specified is true. If it is false, only then the message which is specified by the user is displayed on the screen. It is basically used for the status check of the program whether it is running correctly or not.
5. What is the use of REPORT statement?
a) To check the consistency
b) To make the statement wait
c) To print any string or output the string
d) To report the failure
Explanation: The REPORT statement is used to output any message to the screen. It is generally used in conjunction with the ASSERT statement where ASSERT checks the consistency and REPORT outputs the message specified by a user.
6. How many types of severity levels are there for the ASSERT statement?
Explanation: There are four severity levels in the assert statement. There can be four names of SEVERITY which are NOTE, WARNING, ERROR and FAILURE. Depending on these severity levels, the simulator is instructed to halt.
7. Which of the following is default severity name for ASSERT?
Explanation: The default severity level is ERROR. This means if we haven’t specified any severity level then it will be considered as ERROR severity.
8. By using which of the following severity level, the simulator can be halted?
Explanation: In general, the simulator will generate a list of assert failures or the number of assert statements in which the condition was found to be false and shows at the end of the simulation. But, in the case of FAILURE severity, the simulator can stop working or it can come to a halt.
9. What kind of circuit may be described by using following statement?
ASSERT NOT (s=’1’ and r = ‘1’) REPORT ‘’INVALID! S and R both can’t be 1” SEVERITY ERROR
a) Flip flop
Explanation: This can be a code for SR flip flop. Because the inputs S and R can’t be high at the same time in case of SR flip flop. It is invalid. ASSERT statement is used to show the same. When the condition is false then the message will be printed.
10. An ASSERT statement can’t be used as concurrent statement.
Explanation: An ASSERT statement can be used outside a process. But, in that case it will behave as a postponed or passive process. In case of concurrent assertion, the simulator will monitor the condition continuously.
11. NOTE severity level can be used to __________
a) Stop the execution
b) Show the unusual situation
c) Pass a message from simulation
d) To give a warning to simulator
Explanation: The NOTE level has the lowest severity level which can be sued at the time of any small condition violation. This can be used to pass a message from the simulator.
12. Where should one use WARNING severity level?
a) To stop the execution
b) To alert the user about unexpected conditions
c) To pass the message from simulation
d) To give a warning about wrong conditions
Explanation: WARNING has the second lowest severity level and can be used in any unusual but not fatal situation. In the situations, where the simulation can be continued but the results cannot be predicted. For example, if any file is not opened as expected, in that case one may use a WARNING.
13. The use of ERROR severity is _________
a) To alert about unpredictable results
b) To pass information to the simulator
c) To Stop the execution
d) Where the simulation is not feasible
Explanation: In many cases, the simulation is not feasible or works completely incorrectly, there we can use the ERROR level severity. For example, when both inputs of SR flip flop are high, then the ERROR severity will be a good fit.
14. Where should we use FAILURE severity?
a) To identify a fatal error
b) To alert the user about simulation where the results are not correct
c) To ignore the error
d) To show failure of simulation
Explanation: FAILURE is the top most severity and must be used where the assertion violation is a fatal error and it must be stopped at once. So, most catastrophic conditions must be shown by failure. For example if the code of operation is illegal and can affect the whole design, then its better to halt the simulation.
Sanfoundry Global Education & Learning Series – VHDL.
To practice all areas of VHDL, here is complete set of 1000+ Multiple Choice Questions and Answers.