Easy Tutorial
❮ Macro Definition Android Tutorial Udp Socket ❯

8.3 Verilog TF Subroutine List

Classification Verilog Tutorial Advanced Chapter

To ensure the authenticity of the subroutines and to avoid the poor translation quality, all subroutine lists are kept in English for explanation. It is recommended to carefully study the corresponding type of subroutine when using it. Not all subroutines have been verified here, and there may be omissions due to version or transcription issues; corrections are welcome.

TF subroutines are commonly used for bidirectional data transfer between Verilog and user C subroutines. When a subroutine prefixed with tf_ has a corresponding subroutine prefixed with tf_i, the instance pointer of the operations occurring in the corresponding subroutine prefixed with tf_i must be passed as an additional variable at the end of the variable list.

There is no clear classification mark for TF subroutines in naming form, a simple summary is as follows.

Retrieve Task, Function Information

Return Type Calling Format and Description
char * ◆tf_getinstance()
Get a pointer to the current instance of a user-defined system task or function.
char * ◆tf_mipname() <br> ◆tf_imipname(char *instance_p)
Get the hierarchical module instance path name as a string.
char * ◆tf_spname() <br> ◆tf_ispname(char *instance_p)
Get scope hierarchical path name as a string.

Retrieve Variable List Information

Return Type Calling Format and Description
int ◆tf_nump() <br> ◆tf_inump(char *instance_p)
Get the number of task or function arguments.
int ◆tf_typep(int narg) <br> ◆tf_itypep(int narg, char *instance_p)
Get a system task/function argument type.
int ◆tf_sizep(narg) <br> ◆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) <br> ◆tf_iexprinfo(int narg, t_tfexprinfo *exprinfo_p, char *instance_p)
Get system task/function argument expression information. <br> t_tfexprinfo is a data structure, defined in veriuser.h.
t_tfnodeinfo * ◆tf_nodeinfo(int narg, t_tfnodeinfo *nodeinfo_p) <br> ◆tf_inodeinfo(int narg, t_tfnodeinfo *nodeinfo_p, char *instance_p)
Get system task/function argument node information. <br> t_tfnodeinfo is a data structure, defined in veriuser.h.

Retrieve Parameter Values

Return Type Calling Format and Description
int ◆tf_getp(int narg) <br> ◆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) <br> ◆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) <br> ◆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) <br> ◆tf_istrgetp(int narg, int format, char *instance_p)
Get formatted system task/function argument values.
char * ◆tf_getcstringp(int narg) <br> ◆tf_igetcstringp(int narg, char *instance_p)
Get system task/function argument value as a string.
int ◆tf_evaluatep(int narg) <br> ◆tf_ievaluatep(int narg, char *instance_p)
Evaluate a system task/function argument expression.

Set Parameter Values

Return Type Calling Format and Description
int ◆tf_putp(int narg, int value) <br> ◆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,
int ◆tf_rosynchronize() <br> ◆tf_irosynchronize(char *instance_p)
Synchronize to the end of the simulation time step.
int ◆tf_getpchange(int narg) <br> ◆tf_igetpchange(int narg, char *instance_p)
Get the index number of the next system task/function argument that has changed in value.
int ◆tf_copypvc_flag(int narg) <br> ◆tf_icopypvc_flag(int narg, char *instance_p)
Copy the value change flags of system task/function arguments.
int ◆tf_movepvc_flag(int narg) <br> ◆tf_imovepvc_flag(int narg, char *instance_p)
Move the value change flags of system task/function arguments.
int ◆tf_testpvc_flag(int narg) <br> ◆tf_itestpvc_flag(int narg, char *instance_p)
Test the value change flags of system task/function arguments.

Task Synchronization

Return Type Call Format and Description
int ◆tf_gettime() <br> ◆tf_igettime(char *instance_p)
Get the current simulation time as a 32-bit integer.
double ◆tf_getrealtime() <br> ◆tf_igetrealtime(char *instance_p)
Get the current simulation time in double-precision format.
int ◆tf_getlongtime(int *aof_hightime) <br> ◆tf_igetlongtime(int *aof_hightime, char *instance_p)
Get the current simulation time as a 64-bit integer. <br> Return the 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 the next time at which a simulation event is scheduled.
int ◆tf_gettimeprecision() <br> ◆tf_igettimeprecision(char *instance_p)
Get the timescale precision of a module or a simulation.
int ◆tf_gettimeunit() <br> ◆tf_igettimeunit(char *instance_p)
Get the timescale unit of a module or a simulation.
int ◆tf_setdelay(int delay) <br> ◆tf_isetdelay(int delay, char *instance_p)
Activate the misctf application at a specific simulation time.
int ◆tf_setlongdelay(int lowdelay, int highdelay) <br> ◆tf_isetlongdelay(int lowdelay, int highdelay, char *instance_p)
Activate the misctf application at a specific simulation time.
int ◆tf_setrealdelay(double realdelay) <br> ◆tf_isetrealdelay(double realdelay, char *instance_p)
Activate the misctf application at a specific 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 specific 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 specific module.
int ◆tf_clearalldelays() <br> ◆tf_iclearalldelays(char *instance_p)
Clear all scheduled reactivations by tf_setdelay() or tf_isetdelay().

Arithmetic Operations

Return Type Call Format and Description
int <br> (always 0) ◆tf_add_long(int *aof_low1, int *aof_high1, int low2, int high2)
Add two 64-bit integers.
int <br> (always 0) ◆tf_subtract

Store error message information.

Internal Task Maintenance

Return Type Calling Format and Description
int <br> (always 0) ◆tf_setworkarea(char *workarea) <br> ◆tf_isetworkarea(char *workarea, char *instance_p)
Store user data pointer in work area.
char * ◆tf_getworkarea() <br> ◆tf_igetworkarea(char *instance_p)
Get work area pointer.

Other Subprograms

Return Type Calling Format and Description
int <br> (always 0) ◆tf_dostop()
Cause software product to enter interactive mode.
int <br> (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.
❮ Macro Definition Android Tutorial Udp Socket ❯