Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
102
Добавлен:
05.06.2015
Размер:
137.92 Кб
Скачать

Using the Value Change Link (VCL)

Using the Value Change Link (VCL)

Using VCL to Monitor Value Changes

The VCL is a PLI mechanism you can use to dynamically monitor and extract strength and value change information from Verilog-XL for your application. You can use the VCL in any application that needs to monitor value change data, such as customized monitor facilities, graphics facilities, and analysis tools.

The VCL supports monitoring for the vector and scalar forms of the following data types:

Register data types (reg, integer, time, real)

Net data types (wire, tri, wor, wand, trior, triand, tri1, tri0, trireg, supply1, supply0)

Event data type (event)

The VCL does not support monitoring for the following forms:

Bit-selects of unexpanded vector nets or registers

Part-selects

Memories

Expressions (such as a+b)

Designing a VCL Application

A VCL application consists of the following components:

PLI interface

VCL interface

VCL routines and data structure

This section describes these components as well as providing suggestions for ways to write more efficient VCL application code.

The PLI Interface

A VCL application is a type of PLI application. Like any other PLI application, a VCL application consists of the C routines that you write to create a new Verilog system task. A

PLI task must contain a calltf routine and, optionally, a checktf routine and a misctf routine. Refer to the following table for descriptions of these routines.

January 2001

6

Product Version 3.2

Using the Value Change Link (VCL)

Using the Value Change Link (VCL)

PLI routines

Routine

When is it called?

What is its purpose?

 

 

 

checktf

When Verilog-XL encounters the

Checks the arguments passed to the

 

PLI task name during

user-defined PLI task

 

compilation

 

calltf

When Verilog-XL encounters the

 

PLI task name during simulation

misctf

At various times, such as

 

termination of Verilog-XL

 

simulation, or when $save or

 

$restart is executed

Performs most of the processing for the user-defined PLI task

Performs processing that is necessary when certain system tasks are called or certain events take place—for example, this routine might restore the state of the application when $restart is called

You define your PLI task to Verilog-XL by creating an entry in an array of structures. This array of structures is named veriusertfs, which resides in the file veriuser.c provided in your release directory. The veriusertfs structure is a cross-reference that tells Verilog-XL which of the routines that you write correspond to the checktf, calltf, and misctf routines for the system task.

For further information on the above routines and veriusertfs, refer to the PLI 1.0 User Guide and Reference.

The VCL Interface

A VCL application has the following interface requirements in addition to those of the standard

PLI application:

Additions to the calltf routine

A new consumer routine

The calltf routine in a VCL application will typically call the routine acc_vcl_add and pass it a handle to the object to be monitored and a pointer to the consumer routine.

Verilog-XL attaches a trigger to the object. When the object changes value, the trigger is activated, causing Verilog-XL to call the consumer routine. Verilog-XL passes the consumer routine the pointer to a value change record, which contains information about the value change. The consumer routine processes the value change record.

January 2001

7

Product Version 3.2

Using the Value Change Link (VCL)

Using the Value Change Link (VCL)

The following figure shows the interface between a VCL application and Verilog-XL.

The VCL interface

 

PLI

PLI

Application

Verilog-XL

 

 

 

 

VCL

 

calltf routine

 

 

 

object

 

 

 

trigger

Value change record

 

consumer

 

routine

 

 

 

The VCL Components

The Value Change Link facility consists of the following components:

acc_vcl_add

acc_vcl_delete

the value change record

The header file acc_user.h contains the declarations for these components. To access these components, include acc_user.h in your C routines.

acc_vcl_add

You typically call acc_vcl_add in your calltf routine to tell Verilog-XL to start reporting value changes for the specified object to your consumer routine. You can only specify one object per call.

acc_vcl_add takes the following input arguments:

A handle to the object that the application monitors

January 2001

8

Product Version 3.2

Using the Value Change Link (VCL)

Using the Value Change Link (VCL)

A pointer to the consumer routine that Verilog-XL calls when that object’s value changes

A pointer to user-defined data to be passed to the consumer routine when the monitored object changes value

A flag that specifies whether to monitor logic values, or logic and strength values

acc_vcl_delete

You call acc_vcl_delete within your VCL application to tell Verilog-XL to stop reporting value changes for the specified object. You can only specify one object per call.

acc_vcl_delete takes the following input arguments:

A handle to the object that the application monitors

A pointer to the consumer routine that Verilog-XL calls when that object’s value changes

A pointer to user-defined data to be passed to the consumer routine when the monitored object changes value

A flag that specifies to stop monitoring value changes

The Value Change Record

The value change record, t_vc_record, is a data structure that is declared in acc_user.h. Verilog-XL uses the value change record to pass logic value and strength changes—and any user data you may have specified in your call to acc_vcl_add—to your consumer routine.

There is only one value change record and it is overwritten every time there is a value change to an object that is being monitored.

Writing Efficient VCL Application Code

The rules you must follow to write efficient code vary somewhat with each VCL application, but the following rules apply to all applications:

Use the user_data argument to make data access in the consumer routine more efficient.

Monitor only essential nets.

Do not use acc_routines in a consumer routine.

In addition, most VCL applications should buffer data. Refer to “Data Buffering” on page 23 for further information.

January 2001

9

Product Version 3.2

Соседние файлы в папке dsd-07=Verilog