TestBencher Pro and Reactive Test Bench Help

7.5 VHDL: TM fill from a File

7.5 VHDL: TM fill from a File

Previous topic Next topic  

7.5 VHDL: TM fill from a File

Previous topic Next topic  

One method of filling a transaction manager queue is to read in the Post calls from a file. This method allows different test sequence files to be used in a test bench without having to recompile the test bench. Transaction test sequence data files are also easier to create and maintain because they are smaller and contain less repetitive information.

An input file can be created to specify the test sequence used by the Transaction Manager module.Each row contains a transactor instance name, a transactor mode, and the transaction's input parameters.

Transactor Instance Name is the name of the transactor and the relative path from the top-level module to the TLM instance that contains the transactor. Some options are:

transactorName

subProjectInstanceName.transactorName

projectName.transactorName

projectName.subProjectInstanceName.transactorName

CLK_generator 1

arbiter 1

slave0.write 1

slave0.read 1

slave0.disconnect 1

reset 0

master0.write 0 f0000000 f 10

master0.read  0 f0000000 f 10

slave0.write 2

slave0.read 2

slave0.disconnect 2

arbiter 2

CLK_generator 2

Transaction Mode is an integer that specifies how the transaction should be executed. The different types of modes are shown below.

0 => Apply  The transaction will block the transaction manager from executing any more transactions until the transaction completes.

1 => Apply_nowait The transaction will not block the transaction manager: the next transaction call in the queue will immediately execute.

2 => Abort  Aborts the specified transactor if it is currently executing.

Input Parameters  TestBencher will read in the appropriate number and type of parameters based on the transaction type.

Once a test sequence file is created, the file can be passed to a transaction manager queue by calling either the ApplyFile or ApplyFile_nowait method. When ApplyFile is called, it will immediately close the current file that is being used by the transaction manager (if there was one specified earlier) and open the new file. The transaction manager will read a new line from the test sequence file whenever the transaction manager's queue becomes empty.

ApplyFile will not return control to the calling process until all transactions have been read from the file. By contrast, ApplyFile_nowait will return as soon as the file is opened. So, if ApplyFile_nowait is called twice on the same transaction manager without any delay between the calls, the first call will be overridden by the second call, since only one file can be opened at a time by a transaction manager.

Example Test Bench Using ApplyFile calls

There is an example project (VME.hpj) that demonstrates how to use ApplyFile calls in a hierarchal TLM in the Synapticad/Examples/TestBencher/VHDL/VME directory.

Procedures for posting transactions from files (defined in tb_control_types.vhd)

ApplyFile ( signal tb_Control : inout tb_Control_Type;

            fileName : string;

            queuePath : in string ) 

ApplyFile will not return to the calling process until all transactions have been read from the test sequence file and placed into the transaction manager’s queue. If the file only contains concurrent (nowait) transactions, then this function will return in zero simulation time since the transaction manager will start each  transaction without blocking for the previous one.

ApplyFile_nowait ( signal tb_Control : inout tb_Control_Type;

                   fileName : string;

                   queuePath : in string ) 

This procedure will perform the same actions as ApplyFile except that it returns to the calling process immediately regardless of the type of apply calls listed in the file.

Procedures used to handle transaction manager mode (defined in tb_control_types.vhd). Note: At the printing of this manual the following procedures were not supported. Check the online documentation for actual implementation.

SetApplyCallMode( queuePath : in string; 

                  mode : in TStatus ) 

Sets the mode of the transaction manager. By default the mode is set to looping, meaning transactions will be executed when they are available in the queue. The mode can be any of the following:

TB_ONCE - only run the next transaction from queue when ApplyNextTransaction is called.

TB_LOOPING - run the next transaction from the queue whenever there are apply calls in the queue.

TB_SUSPEND - finish running the current transaction and stop reading apply calls from the queue until the apply call mode is changed.

 

ApplyNextTransaction( queuePath : in string )

Applies the next transaction from the queue if the apply call mode is set to TB_ONCE. Otherwise, calling this function has no effect on the transaction manager.