SynaptiCAD Tutorials

(TBench) 4.6 Constrain the Random Data 

(TBench) 4.6 Constrain the Random Data 

Previous topic Next topic  

(TBench) 4.6 Constrain the Random Data 

Previous topic Next topic  

Each time a posted random transaction is executed, the input arguments for the transaction will be randomly generated, taking into account any constraint definitions for the transactor's input variables.

Data into a transaction can also be randomized inside a normal post or apply call by checking the Randomize Input Parameters box in the Insert Diagram Subroutine Call dialog. It is not necessary to do this when using a PostRandomTransactionType call, because the data is automatically randomized into the random transactions. Using either method you will want to constrain the variables using the steps below.

Look at the Diagram Variables:

Double click on the tbread transactor in the project window to open the diagram.

constrain_open_diagram

Constrain_read_diagram

Notice the $$addr and $$data variables on the address and data busses. The $$ means that they are input variables to the diagram. They will be of the same type as the signal they are on. In this case, the variables are on an 8-bit bus of type 4_state, so the variables will have a min/max range of 0-255 and a type of 4_state.

Double click on delay0 to open the Delay Properties dialog.

Notice that Is Apply Subroutine Input is checked, making the delay value an input to the transactor. Each time this diagram is randomly called, a new delay value will be passed to the transactor.

Constrain the Variables:

Double click on the Class Library List under the Component Model branch of the project to open the Classes for Library dialog.

constrain_open_classes_dlg

constraint_classes_dlg

Select a particular diagram in the Class Definitions tab and then press the Constraints button to view and edit the constraints. Each transactor diagram has its own set of input variables.

Variables default to the entire legal range for their data types.

For addr and data, the entire range of an 8-bit value makes sense for our model.

constrain_constraints_dlg

The delay0_min is of type real, so many of the legal real values are larger than the possible running times of a transaction, so we constrained the range to 10-50 ns.

Close all the dialogs when you are done looking at the values.