Samples are used to monitor the signal values coming back from the model under test. Samples can be run at a specific time, triggered from an event, or triggered from another sample. Samples generate checking code within a transaction using either temporal expressions or procedural code that produces the same functionality as a complex temporal expression.
The value that is sampled can be exported to the top-level module. This could be used, for instance, to provide an input value for a state variable in another timing transaction or to determine if a specific timing transaction is to be executed or not. Samples can also be used to trigger a delay based on its success or failure. Below are the terms used to describe the different monitoring times and triggering events of a sample.
Monitoring Time
Samples that monitor a signal at a specific time are called Point Samples. Samples that monitor a signal over an interval of time are called Window Samples. Window samples are useful for testing that the value of a given signal does not change over a specified time frame, or for verifying that the signal goes through a specified sequence of states during a time window. Window samples draw themselves with a box indicating the monitoring interval. If you need to sample over a large window and you do not want to display it graphically, then you can use the Multiplier control in the Code Generation Options dialog described in Section 3.2.
Triggering Process
Point and Window Samples can either be triggered at a specific time in the diagram (Absolute Sample) or they can be triggered by a transition on a signal or another sample (Relative Sample). The point and window samples shown in the above image are both absolute samples. The images below show relative samples that are triggered by a transition on a signal. If the triggering event is on a clocked signal, then at the next clock edge, a level sensitive check will be performed and if it fails the sample will not execute. If the triggering event is on an unclocked signal event, the sample will trigger as soon as the transition occurs. If the triggering event does not occur during a transaction, the sample will not execute.
Sample Variables and Files
Samples generates two diagram-level variables, sampleName_Flag and sampleName, that can be accessed by other graphical elements in the diagram (Section 3.5). For TestBencher, sampled values can also be written out to a file (Section 3.6).