diff --git a/libveriuser/veriusertfs.c b/libveriuser/veriusertfs.c index 3c455b800..8807f6649 100644 --- a/libveriuser/veriusertfs.c +++ b/libveriuser/veriusertfs.c @@ -44,6 +44,7 @@ typedef struct t_pli_data { static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8 *); static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8 *); +static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8 *); static PLI_INT32 callback(p_cb_data); /* @@ -150,7 +151,7 @@ void veriusertfs_register_table(p_tfcell vtable) tf_data.tfname = tf->tfname; tf_data.compiletf = compiletf; tf_data.calltf = calltf; - tf_data.sizetf = (PLI_INT32 (*)(ICARUS_VPI_CONST PLI_BYTE8 *))tf->sizetf; + tf_data.sizetf = sizetf; tf_data.user_data = (char *)data; if (pli_trace) { @@ -283,6 +284,32 @@ static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8*data) return rc; } +/* + * This function is the wrapper for the veriusertfs sizetf routine. + */ +static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8*data) +{ + int rc = 32; + p_pli_data pli; + p_tfcell tf; + + /* cast back from opaque */ + pli = (p_pli_data)data; + tf = pli->tf; + + /* execute sizetf */ + if (tf->sizetf) { + if (pli_trace) { + fprintf(pli_trace, "Call %s->sizetf(%d, %d)\n", + tf->tfname, tf->data, reason_sizetf); + } + + rc = tf->sizetf(tf->data, reason_sizetf); + } + + return rc; +} + /* * This function is the wrapper for all the misctf callbacks */ diff --git a/veriuser.h b/veriuser.h index 7e061c16f..7614673db 100644 --- a/veriuser.h +++ b/veriuser.h @@ -1,7 +1,7 @@ #ifndef VERIUSER_H #define VERIUSER_H /* - * Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -159,6 +159,7 @@ extern void veriusertfs_register_table(p_tfcell vtable); /* callback reasons */ #define reason_checktf 1 +#define reason_sizetf 2 #define reason_calltf 3 #define reason_paramvc 7 #define reason_synch 8