Week04_1 - Assert statement provides a quick and easy way...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Assert statement – provides a quick and easy way to check expected values and display messages from your test bench. assert condition_expression [ report text_string] [ severity severity_level]; boolean string report statement clause is displayed in your simulator’s transcript (or other) window type severity_level is (NOTE,WARNING,ERROR,FAILURE); The actions that result from the use of these severity levels will depend on the simulator you are using, but you can generally expect the simulator to display a file name and line number associated with the assert statement, keep track of the number of assertion failures, and print a summary at the end of the simulation run. Assert statements that specify FAILURE in their severity statement clauses will normally result in the simulator halting. assert Status = OPEN_OK report "The call to FILE_OPEN was not successful" severity WARNING; Having called the procedure FILE_OPEN, if the status is different from OPEN_OK, it is indicated by the warning message. Assert statement examples assert Operation_Code = "0000" report "Illegal Code of Operation" severity FAILURE; Event like illegal operation code should cause immediate termination of the simulation, which is forced by the severity level FAILURE. assert not (S= '1' and R= '1') report ”Both values of signals S and R are equal to 1" severity ERROR; When the values of the signals S and R are equal to '1', the message is displayed and the simulation is stopped because the severity is set to ERROR.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
assert Q'stable (10 ns) report ”Signal Q has changed during last 10 ns." severity NOTE; Assert statement examples assert NOW < 1000 ns report ”MAX simulation time – 1000 ns. Stopping simulation" severity FAILURE; if condition then assert false report ”No to mamy katastrofe podczas symulacji" severity FAILURE; end if; Assert statement - using “image” attribute base_type image (x) base_type - any scalar type or subtype (enumerated, integer, real, physical) result is string – textual representation of the value x of type
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Week04_1 - Assert statement provides a quick and easy way...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online