SynaptiCAD Tutorials

(TBench) 2.7 Add a Sample to Verify Data Read from MUT

(TBench) 2.7 Add a Sample to Verify Data Read from MUT

Previous topic Next topic  

(TBench) 2.7 Add a Sample to Verify Data Read from MUT

Previous topic Next topic  

Samples can be used to verify data that is generated by the model under test during simulation. Here we will add a Sample to the Data bus to verify that the read cycle worked correctly.

Add a Sample to verify the read cycle:

Press the Sample button so that right clicks will add delays.

sample_reacttive_button

Left-click on the positive CLK edge at 600ns, then right-click on the DATA segment directly below it (slightly to the right). This will place a Sample that will trigger at that clock edge and verify that the data read from the MUT is what we expect (indicated by the waveform drawn under the Sample).

sample_data_value_plain

Double-click on the Sample name to open the Sample Properties dialog.

Change the sample name to VerifyDataRead

Press the HDL Code button to open the Code Generation Options dialog.

sample_properties_read

The If condition should be set to Sample State Matches, which is the default behavior for a sample.

Set the Then Action, to Display Message so that each time the sample passes it will generate a log messages stating that it passed. And give it a warning level of Note.

The Else Action should be set to Display Message so that each time the sample fails it will generate a log message stating the error.

Press OK to close both dialogs.

sample_code_dlg_read

Here is what the diagram should look like after adding the Sample:

addSampleToVerifyDataRead

To see the generated code, export the test bench and view the code in the Report tab that contains the generated code. Locate the CLK_pos sequence, then search down for VerifyDataRead to see the code generated for the sample.

sample_code_read