Verilog TF 子程序列表
为保证子程序的原汁原味,避免拉跨拙劣的翻译水平,所有子程序列表均保留英文说明。建议使用时再仔细研究对应类型的子程序。这里也没有对所有的子程序都进行验证,由于版本或抄写问题,可能会有所疏漏,欢迎指正。
TF 子程序常用于 Verilog 和用户 C 子程序之间的双向数据传输。当以 tf_ 为前缀的子程序有一个以 tf_i 为前缀的子程序与之对应时,这个以 tf_i 为前缀的对应子程序中发生操作的实例指针必须被当做变量列表最后的附加变量加以传递。
TF 子程序在命名形式上没有明确的分类标志,简单做如下总结。
1. 取任务、函数信息
返回类型 | 调用格式及说明 |
---|
char * | ◆tf_getinstance() |
| Get a pointer to the current instance of a user-defined system task or function. |
char * | ◆tf_mipname()◆tf_imipname(char *instance_p) |
| Get the hierarchical module instance path name as a string. |
char * | ◆tf_spname()◆tf_ispname(char *instance_p) |
| Get scope hierarchical path name as a string. |
2. 取变量列表信息
返回类型 | 调用格式及说明 |
---|
int | ◆tf_nump()◆tf_inump(char *instance_p) |
| Get number of task or function arguments. |
int | ◆tf_typep(int narg)◆tf_itypep(int narg, char *instance_p) |
| Get a system task/function argument type. |
int | ◆tf_sizep(narg)◆tf_isizep(int narg, char *instance_p) |
| Get the bit length of a system task/function argument. |
t_tfexprinfo * | ◆tf_exprinfo(int narg, t_tfexprinfo *exprinfo_p)◆tf_iexprinfo(int narg, t_tfexprinfo *exprinfo_p, char *instance_p) |
| Get system task/function argument expression information.t_tfexprinfo is a data structure, defined in veriuser.h. |
t_tfnodeinfo * | ◆tf_nodeinfo(int narg, t_tfnodeinfo *nodeinfo_p)◆tf_inodeinfo(int narg, t_tfnodeinfo *nodeinfo_p, char *instance_p) |
| Get system task/function argument node information.t_tfnodeinfo is a data structure, defined in veriuser.h. |
3. 取参数值
返回类型 | 调用格式及说明 |
---|
int | ◆tf_getp(int narg)◆tf_igetp(int narg, char *instance_p) |
| Get a system task/function argument value as an integer or character string pointer |
double | ◆tf_getrealp(int narg)◆tf_igetrealp(int narg, char *instance_p) |
| Get a system task/function argument value as a double-precision value. |
int | ◆tf_getlongp(int *aof_highvalue, int narg)◆tf_igetlongp(int *aof_highvalue, int narg, char *instance_p) |
| Get system task/function argument value as a 64-bit integer. |
char * | ◆tf_strgetp(int narg, int format)◆tf_istrgetp(int narg, int format, char *instance_p) |
| Get formatted system task/function argument values. |
char * | ◆tf_getcstringp(int narg)◆tf_igetcstringp(int narg, char *instance_p) |
| Get system task/function argument value as a string. |
int | ◆tf_evaluatep(int narg)◆tf_ievaluatep(int narg, char *instance_p) |
| Evaluate a system task/function argument expression. |
4. 置参数值
返回类型 | 调用格式及说明 |
---|
int | ◆tf_putp(int narg, int value)◆tf_iputp(int narg, int value, char *instance_p) |
| Put an integer value to a system task/function argument or function return. |
int | ◆tf_putrealp(int narg, double value)◆tf_iputrealp(int narg, double value, char *instance_p) |
| Write a real value to a system task/function argument or function return. |
int | ◆tf_putlongp(int narg, int lowvalue, int highvalue)◆tf_iputlongp(int narg, int lowvalue, int highvalue, char *instance_p) |
| Write a 64-bit integer value to a system task/function argument or function return. |
int | ◆tf_propagatep(int narg)◆tf_ipropagatep(int narg, char *instance_p) |
| Propagate a system task/function argument value. |
int | ◆tf_strdelputp(int narg, int bitlength, char format, char *value_p, int delay, int delaytype)◆tf_istrdelputp(int narg, int bitlength, char format, char *value_p, int delay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a 32-bit integer delay. |
int | ◆tf_strrealdelputp(int narg, int bitlength, char format, char *value_p, double realdelay, int delaytype)◆tf_istrrealdelputp(int narg, int bitlength, char format, char *value_p, double realdelay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a real number delay. |
int | ◆tf_strlongdelputp(int narg, int bitlength, char format, char *value_p, int lowdelay, int highdelay, int delaytype)◆tf_istrlongdelputp(int narg, int bitlength, char format, char *value_p, int lowdelay, int highdelay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a 64-bit integer delay. |
5. 监视参数值变化
返回类型 | 调用格式及说明 |
---|
int | ◆tf_asynchon()◆tf_iasynchon(char *instance_p) |
| Enable asynchronous calling of the misctf application for system task/function argument value changes. |
int(always 0) | ◆tf_asynchoff()◆tf_iasynchoff(char *instance_p) |
| Disable asynchronous calling of the misctf application. |
int | ◆tf_synchronize()◆tf_isynchronize(char *instance_p) |
| Synchronize to end of simulation time step. |
int | ◆tf_rosynchronize()◆tf_irosynchronize(char *instance_p) |
| Synchronize to end of simulation time step. |
int | ◆tf_getpchange(int narg)◆tf_igetpchange(int narg, char *instance_p) |
| Get the index number of the next system task/function argument that changed value. |
int | ◆tf_copypvc_flag(int narg)◆tf_icopypvc_flag(int narg, char *instance_p) |
| Copy system task/function argument value change flags. |
int | ◆tf_movepvc_flag(int narg)◆tf_imovepvc_flag(int narg, char *instance_p) |
| Move system task/function argument value change flags. |
int | ◆tf_testpvc_flag(int narg)◆tf_itestpvc_flag(int narg, char *instance_p) |
| Test system task/function argument value change flags. |
6. 任务同步
返回类型 | 调用格式及说明 |
---|
int | ◆tf_gettime()◆tf_igettime(char *instance_p) |
| Get the current simulation time as a 32-bit integer. |
double | ◆tf_getrealtime()◆tf_igetrealtime(char *instance_p) |
| Get the current simulation time in double-precision format. |
int | ◆tf_getlongtime(int *aof_hightime)◆tf_igetlongtime(int *aof_hightime, char *instance_p) |
| Get current simulation time as a 64-bit integer.Return least significant (right-most) 32 bits of simulation time |
char * | ◆tf_strgettime() |
| Get the current simulation time as a string. |
int | ◆tf_getnextlongtime(int *aof_lowtime, int *aof_hightime) |
| Get next time at which a simulation event is scheduled |
int | ◆tf_gettimeprecision()◆tf_igettimeprecision(char *instance_p) |
| Get the timescale precision of a module or a simulation. |
int | ◆tf_gettimeunit()◆tf_igettimeunit(char *instance_p) |
| Get the timescale unit of a module or a simulation. |
int | ◆tf_setdelay(int delay)◆tf_isetdelay(int delay, char *instance_p) |
| Activate the misctf application at a particular simulation time. |
int | ◆tf_setlongdelay(int lowdelay, int highdelay)◆tf_isetlongdelay(int lowdelay, int highdelay, char *instance_p) |
| Activate the misctf application at a particular simulation time. |
int | ◆tf_setrealdelay(double realdelay)◆tf_isetrealdelay(double realdelay, char *instance_p) |
| Activate the misctf application at a particular simulation time. |
void | ◆tf_scale_longdelay(char *instance_p, int delay_lo, int delay_hi, int *aof_delay_lo, int *aof_delay_hi) |
| Convert a 64-bit integer delay to the timescale of the module instance. |
void | ◆tf_scale_realdelay(char *instance_p, double realdelay, double *aof_realdelay) |
| Convert a double-precision floating-point delay to the timescale of the module instance. |
void | ◆tf_unscale_longdelay(char *instance_p, int delay_lo, int delay_hi, int *aof_delay_lo, int *aof_delay_hi) |
| Convert a delay from internal simulation time units to the timescale of a particular module. |
void | ◆tf_unscale_realdelay(char *instance_p, double realdelay, double *aof_realdelay) |
| Convert a delay expressed in internal simulation time units to the timescale of a particular module. |
int | ◆tf_clearalldelays()◆tf_iclearalldelays(char *instance_p) |
| Clear all scheduled reactivations by tf_setdelay() or tf_isetdelay(). |
7. 算术运算
返回类型 | 调用格式及说明 |
---|
int(always 0) | ◆tf_add_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Add two 64-bit integers. |
int(always 0) | ◆tf_subtract_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Subtract two 64-bit integers. |
void | ◆tf_multiply_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Multiply two 64 bit integers. |
void | ◆tf_divide_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Divide two 64-bit integers. |
int | ◆tf_compare_long(int low1, int high1, int low2, int high2) |
| Compare two 64-bit integer values. |
char * | ◆tf_longtime_tostr(int lowtime, int hightime) |
| Convert 64-bit integer time value to a character string. |
void | ◆tf_real_to_long(double realvalue, int *aof_low, int *aof_high) |
| Convert a real number to a 64-bit integer. |
void | ◆tf_long_to_real(int low, int high, double *aof_real) |
| Convert a 64-bit integer to a real number. |
8. 显示信息
返回类型 | 调用格式及说明 |
---|
void | ◆io_printf(char *format, arg1, ..., arg12) |
| Print a formatted message to the output channel of the software product which invoked the PLI appcation and to the log file of the product. |
void | ◆io_mcdprintf(int mcd, char *format, arg1, ..., arg12) |
| Write a formatted message to one or more files. |
int(always 0) | ◆tf_error(char *format, arg1,..., arg5) |
| Report an error message. |
int(always 0) | ◆tf_warning(char *format, arg1, ..., arg5) |
| Report a warning message. |
int(always 0) | ◆tf_message(int level, char *facility, char *code, char *message, arg1,..., arg5) |
| Report an error or warning message with software product interruption control. |
int(always 0) | ◆tf_text(char *message, arg1,..., arg5) |
| Store error message information. |
内部任务维护
返回类型 | 调用格式及说明 |
---|
int(always 0) | ◆tf_setworkarea(char *workarea)◆tf_isetworkarea(char *workarea, char *instance_p) |
| Store user data pointer in work area. |
char * | ◆tf_getworkarea()◆tf_igetworkarea(char *instance_p) |
| Get work area pointer. |
9. 其他子程序
返回类型 | 调用格式及说明 |
---|
int(always 0) | ◆tf_dostop() |
| Cause software product to enter interactive mode. |
int(always 0) | ◆tf_dofinish() |
| Exit software product execution. |
char * | ◆mc_scan_plusargs(char *startarg) |
| Scan software product invocation command line for plus (+) options. |
int | ◆tf_write_save(char *blockptr, int blocklen) |
| Append a block of data to a save file. |
int | ◆tf_read_restart(char *blockptr, int blocklen) |
| Get a block of data from a previously written save file. |
下一章:Verilog ACC 子程序
ACC 子程序主要完成的功能有:从内部数据结构中读取特定对象的相关信息把特定对象的相关信息写入内部数据结构中ACC 子程序可操作的对象类型有:模块实例、模块端口、模块的端到端的路径以及模块之间的路径顶层模块原 ...