2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: sys_fileio.c,v 1.10 2007/03/14 04:05:51 steve Exp $"
23 # include "vpi_user.h"
24 # include "sys_priv.h"
30 #define IS_MCD(mcd) !((mcd)>>31&1)
34 * Implement the $fopen system function.
36 static PLI_INT32
sys_fopen_compiletf(PLI_BYTE8
*name
)
38 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
39 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
43 vpi_printf("%s: file name argument missing.\n", name
);
44 vpi_control(vpiFinish
, 1);
48 item
= vpi_scan(argv
);
50 vpi_printf("%s: file name argument missing.\n", name
);
51 vpi_control(vpiFinish
, 1);
55 item
= vpi_scan(argv
);
57 /* The mode argument is optional. It is OK for it
58 to be missing. In this case, there are no more
59 arguments, and we're done. */
63 if (! is_constant(item
)) {
64 vpi_printf("ERROR: %s mode argument must be a constant\n", name
);
65 vpi_control(vpiFinish
, 1);
68 if (vpi_get(vpiConstType
, item
) != vpiStringConst
) {
69 vpi_printf("ERROR: %s mode argument must be a string.\n", name
);
70 vpi_control(vpiFinish
, 1);
73 item
= vpi_scan(argv
);
75 /* There should be no more arguments. */
79 vpi_free_object(argv
);
80 vpi_printf("%s: Too many arguments to system function.\n", name
);
84 static PLI_INT32
sys_fopen_calltf(PLI_BYTE8
*name
)
87 char *mode_string
= 0;
89 vpiHandle call_handle
= vpi_handle(vpiSysTfCall
, 0);
90 vpiHandle argv
= vpi_iterate(vpiArgument
, call_handle
);
91 vpiHandle item
= vpi_scan(argv
);
92 vpiHandle mode
= vpi_scan(argv
);
97 value
.format
= vpiStringVal
;
98 vpi_get_value(mode
, &value
);
99 mode_string
= strdup(value
.value
.str
);
101 vpi_free_object(argv
);
104 /* Get the string form of the file name from the file name
106 value
.format
= vpiStringVal
;
107 vpi_get_value(item
, &value
);
109 if ((value
.format
!= vpiStringVal
) || !value
.value
.str
) {
110 vpi_printf("ERROR: %s: File name argument (type=%d)"
111 " does not have a string value\n",
112 name
, vpi_get(vpiType
, item
));
113 if (mode
) free(mode_string
);
117 value
.format
= vpiIntVal
;
119 value
.value
.integer
= vpi_fopen(value
.value
.str
, mode_string
);
122 value
.value
.integer
= vpi_mcd_open(value
.value
.str
);
124 vpi_put_value(call_handle
, &value
, 0, vpiNoDelay
);
130 * Implement the $fopenr(), $fopenw() and $fopena() system functions
131 * from Chris Spear's File I/O for Verilog.
133 static PLI_INT32
sys_fopenrwa_compiletf(PLI_BYTE8
*name
)
135 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
136 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
139 /* Check that there are arguments. */
141 vpi_printf("ERROR: %s requires a single argument.\n", name
);
142 vpi_control(vpiFinish
, 1);
146 file
= vpi_scan(argv
); /* This should never be zero. */
148 /* These functions take at most one argument. */
149 file
= vpi_scan(argv
);
151 vpi_printf("ERROR: %s takes only a single argument.\n", name
);
152 vpi_control(vpiFinish
, 1);
156 /* vpi_scan returning 0 (NULL) has already freed argv. */
160 static PLI_INT32
sys_fopenrwa_calltf(PLI_BYTE8
*name
)
164 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
165 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
166 vpiHandle file
= vpi_scan(argv
);
167 vpi_free_object(argv
);
170 mode
= name
+ strlen(name
) - 1;
172 /* Get the filename. */
173 val
.format
= vpiStringVal
;
174 vpi_get_value(file
, &val
);
175 if ((val
.format
!= vpiStringVal
) || !val
.value
.str
) {
176 vpi_printf("ERROR: %s's file name argument must be a string.\n",
178 vpi_control(vpiFinish
, 1);
182 /* Open the file and return the result. */
183 val
.format
= vpiIntVal
;
184 val
.value
.integer
= vpi_fopen(val
.value
.str
, mode
);
185 vpi_put_value(callh
, &val
, 0, vpiNoDelay
);
190 * Implement $fclose system function
192 static PLI_INT32
sys_fclose_calltf(PLI_BYTE8
*name
)
198 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
199 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
200 vpiHandle item
= vpi_scan(argv
);
203 vpi_printf("%s: mcd parameter missing.\n", name
);
206 type
= vpi_get(vpiType
, item
);
213 vpi_printf("ERROR: %s mcd parameter must be of integral type",
215 vpi_printf(", got vpiType=%d\n", type
);
216 vpi_free_object(argv
);
220 value
.format
= vpiIntVal
;
221 vpi_get_value(item
, &value
);
222 mcd
= value
.value
.integer
;
228 static PLI_INT32
sys_fflush_compiletf(PLI_BYTE8
*ud
)
230 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
231 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
235 /* The argument is optional. */
239 /* Check that the file/MC descriptor is the right type. */
240 item
= vpi_scan(argv
);
241 type
= vpi_get(vpiType
, item
);
248 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
249 vpi_printf(", got vpiType=%d\n", type
);
250 vpi_control(vpiFinish
, 1);
254 /* Check that there is at most one argument. */
255 item
= vpi_scan(argv
);
257 vpi_printf("ERROR: %s takes at most a single argument.\n", ud
);
258 vpi_control(vpiFinish
, 1);
262 /* vpi_scan returning 0 (NULL) has already freed argv. */
266 static PLI_INT32
sys_fflush_calltf(PLI_BYTE8
*name
)
268 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
269 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
275 /* If we have no argument then flush all the streams. */
281 /* Get the file/MC descriptor. */
282 item
= vpi_scan(argv
);
283 vpi_free_object(argv
);
284 val
.format
= vpiIntVal
;
285 vpi_get_value(item
, &val
);
286 fd_mcd
= val
.value
.integer
;
288 if (IS_MCD(fd_mcd
)) {
289 vpi_mcd_flush(fd_mcd
);
291 /* If we have a valid file descriptor flush the file. */
292 fp
= vpi_get_file(fd_mcd
);
300 static PLI_INT32
sys_fputc_calltf(PLI_BYTE8
*name
)
305 s_vpi_value value
, xvalue
;
306 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
307 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
308 vpiHandle item
= vpi_scan(argv
);
312 vpi_printf("%s: mcd parameter missing.\n", name
);
316 type
= vpi_get(vpiType
, item
);
323 vpi_printf("ERROR: %s mcd parameter must be of integral", name
);
324 vpi_printf(", got vpiType=%d\n", type
);
325 vpi_free_object(argv
);
329 value
.format
= vpiIntVal
;
330 vpi_get_value(item
, &value
);
331 mcd
= value
.value
.integer
;
333 if (IS_MCD(mcd
)) return EOF
;
335 item
= vpi_scan(argv
);
337 xvalue
.format
= vpiIntVal
;
338 vpi_get_value(item
, &xvalue
);
339 x
= xvalue
.value
.integer
;
341 fp
= vpi_get_file(mcd
);
347 static PLI_INT32
sys_fgetc_calltf(PLI_BYTE8
*name
)
351 s_vpi_value value
, rval
;
352 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
353 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
354 vpiHandle item
= vpi_scan(argv
);
358 vpi_printf("%s: mcd parameter missing.\n", name
);
362 type
= vpi_get(vpiType
, item
);
369 vpi_printf("ERROR: %s mcd parameter must be of integral", name
);
370 vpi_printf(", got vpiType=%d\n", type
);
371 vpi_free_object(argv
);
375 value
.format
= vpiIntVal
;
376 vpi_get_value(item
, &value
);
377 mcd
= value
.value
.integer
;
379 rval
.format
= vpiIntVal
;
381 fp
= vpi_get_file(mcd
);
382 if (!fp
|| IS_MCD(mcd
))
383 rval
.value
.integer
= EOF
;
385 rval
.value
.integer
= fgetc(fp
);
387 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
392 static PLI_INT32
sys_fgets_compiletf(PLI_BYTE8
*name
)
394 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
395 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
396 vpiHandle item
= vpi_scan(argv
);
400 vpi_printf("%s: string parameter missing.\n", name
);
404 type
= vpi_get(vpiType
, item
);
406 if (type
!= vpiReg
) {
407 vpi_printf("%s: string parameter must be a reg.\n", name
);
408 vpi_free_object(argv
);
412 item
= vpi_scan(argv
);
414 vpi_printf("%s: mcd parameter missing.\n", name
);
418 /* That should be all the arguments. */
419 item
= vpi_scan(argv
);
425 static PLI_INT32
sys_fgets_calltf(PLI_BYTE8
*name
)
429 s_vpi_value value
, rval
;
434 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
435 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
436 vpiHandle str
= vpi_scan(argv
);
437 vpiHandle mch
= vpi_scan(argv
);
439 value
.format
= vpiIntVal
;
440 vpi_get_value(mch
, &value
);
441 mcd
= value
.value
.integer
;
443 fd
= vpi_get_file(mcd
);
444 if (!fd
|| IS_MCD(mcd
)) {
445 rval
.format
= vpiIntVal
;
446 rval
.value
.integer
= 0;
447 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
451 txt_len
= vpi_get(vpiSize
, str
) / 8;
452 txt
= malloc(txt_len
+ 1);
454 if (fgets(txt
, txt_len
+1, fd
) == 0) {
455 rval
.format
= vpiIntVal
;
456 rval
.value
.integer
= 0;
457 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
462 rval
.format
= vpiIntVal
;
463 rval
.value
.integer
= strlen(txt
);
464 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
466 value
.format
= vpiStringVal
;
467 value
.value
.str
= txt
;
468 vpi_put_value(str
, &value
, 0, vpiNoDelay
);
475 static PLI_INT32
sys_ungetc_compiletf(PLI_BYTE8
*name
)
478 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
479 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
480 vpiHandle item
= vpi_scan(argv
);
483 vpi_printf("%s: mcd parameter missing.\n", name
);
487 type
= vpi_get(vpiType
, item
);
494 vpi_printf("ERROR: %s mcd parameter must be of integral", name
);
495 vpi_printf(", got vpiType=%d\n", type
);
496 vpi_free_object(argv
);
503 static PLI_INT32
sys_ungetc_calltf(PLI_BYTE8
*name
)
507 s_vpi_value value
, xvalue
, rval
;
508 vpiHandle sys
= vpi_handle(vpiSysTfCall
, 0);
509 vpiHandle argv
= vpi_iterate(vpiArgument
, sys
);
510 vpiHandle item
= vpi_scan(argv
);
513 rval
.format
= vpiIntVal
;
517 value
.format
= vpiIntVal
;
518 vpi_get_value(item
, &value
);
519 mcd
= value
.value
.integer
;
522 rval
.value
.integer
= EOF
;
523 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
527 item
= vpi_scan(argv
);
529 xvalue
.format
= vpiIntVal
;
530 vpi_get_value(item
, &xvalue
);
531 x
= xvalue
.value
.integer
;
533 fp
= vpi_get_file(mcd
);
535 rval
.value
.integer
= EOF
;
536 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
542 rval
.value
.integer
= 0;
543 vpi_put_value(sys
, &rval
, 0, vpiNoDelay
);
547 static PLI_INT32
sys_check_fd_compiletf(PLI_BYTE8
*ud
)
549 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
550 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
554 /* Check that there is an argument. */
556 vpi_printf("ERROR: %s requires an argument.\n", ud
);
557 vpi_control(vpiFinish
, 1);
560 /* Check that the file descriptor is the right type. */
561 item
= vpi_scan(argv
);
562 type
= vpi_get(vpiType
, item
);
569 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
570 vpi_printf(", got vpiType=%d\n", type
);
571 vpi_control(vpiFinish
, 1);
575 /* Check that there is at most one argument. */
576 item
= vpi_scan(argv
);
578 vpi_printf("ERROR: %s takes a single argument.\n", ud
);
579 vpi_control(vpiFinish
, 1);
583 /* vpi_scan returning 0 (NULL) has already freed argv. */
587 static PLI_INT32
sys_rewind_calltf(PLI_BYTE8
*ud
)
589 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
590 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
591 vpiHandle item
= vpi_scan(argv
);
596 /* Get the file pointer. */
597 vpi_free_object(argv
);
598 val
.format
= vpiIntVal
;
599 vpi_get_value(item
, &val
);
600 fd
= val
.value
.integer
;
602 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
603 vpi_control(vpiFinish
, 1);
606 fp
= vpi_get_file(fd
);
608 /* If we have a valid file descriptor rewind the file. */
610 val
.value
.integer
= EOF
;
613 val
.value
.integer
= 0;
615 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
620 /* $feof() is from 1364-2005. */
621 static PLI_INT32
sys_ftell_feof_calltf(PLI_BYTE8
*ud
)
623 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
624 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
625 vpiHandle item
= vpi_scan(argv
);
630 /* Get the file pointer. */
631 vpi_free_object(argv
);
632 val
.format
= vpiIntVal
;
633 vpi_get_value(item
, &val
);
634 fd
= val
.value
.integer
;
636 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
637 vpi_control(vpiFinish
, 1);
640 fp
= vpi_get_file(fd
);
642 /* If we do not have a valid file descriptor return EOF, otherwise
643 * return that value. */
645 val
.value
.integer
= EOF
;
648 val
.value
.integer
= feof(fp
);
650 val
.value
.integer
= ftell(fp
);
653 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
658 static PLI_INT32
sys_fseek_compiletf(PLI_BYTE8
*ud
)
660 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
661 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
665 /* Check that there is an argument. */
667 vpi_printf("ERROR: %s requires three arguments.\n", ud
);
668 vpi_control(vpiFinish
, 1);
671 /* Check that the file descriptor is the right type. */
672 item
= vpi_scan(argv
);
673 type
= vpi_get(vpiType
, item
);
680 vpi_printf("ERROR: %s fd parameter must be integral", ud
);
681 vpi_printf(", got vpiType=%d\n", type
);
682 vpi_control(vpiFinish
, 1);
686 /* Check that there is an offset argument. */
687 item
= vpi_scan(argv
);
689 vpi_printf("ERROR: %s is missing an offset and operation "
691 vpi_control(vpiFinish
, 1);
695 /* Check that there is an operation argument. */
696 item
= vpi_scan(argv
);
698 vpi_printf("ERROR: %s is missing an operation argument.\n", ud
);
699 vpi_control(vpiFinish
, 1);
703 /* Check that there is at most one argument. */
704 item
= vpi_scan(argv
);
706 vpi_printf("ERROR: %s takes at most three argument.\n", ud
);
707 vpi_control(vpiFinish
, 1);
711 /* vpi_scan returning 0 (NULL) has already freed argv. */
716 static PLI_INT32
sys_fseek_calltf(PLI_BYTE8
*ud
)
718 vpiHandle callh
= vpi_handle(vpiSysTfCall
, 0);
719 vpiHandle argv
= vpi_iterate(vpiArgument
, callh
);
722 PLI_INT32 fd
, offset
, oper
;
725 val
.format
= vpiIntVal
;
727 /* Get the file pointer. */
728 item
= vpi_scan(argv
);
729 vpi_get_value(item
, &val
);
730 fd
= val
.value
.integer
;
732 vpi_printf("ERROR: %s cannot be used with a MCD.\n", ud
);
733 vpi_control(vpiFinish
, 1);
736 fp
= vpi_get_file(fd
);
738 /* Get the offset. */
739 item
= vpi_scan(argv
);
740 vpi_get_value(item
, &val
);
741 offset
= val
.value
.integer
;
743 /* Get the operation. */
744 item
= vpi_scan(argv
);
745 vpi_get_value(item
, &val
);
746 oper
= val
.value
.integer
;
747 /* Should this translate to the SEEK_??? codes? */
748 /* What about verifying offset value vs operation ($fseek(fd, -1, 0))? */
749 if ((oper
< 0) || (oper
> 2)) {
750 vpi_printf("ERROR: %s's operation must be 0, 1 or 2 given %d.\n",
752 vpi_control(vpiFinish
, 1);
756 /* If we do not have a valid file descriptor return EOF, otherwise
757 * return that value. */
759 val
.value
.integer
= EOF
;
761 fseek(fp
, offset
, oper
);
762 val
.value
.integer
= 0;
764 vpi_put_value(callh
, &val
, 0 , vpiNoDelay
);
766 vpi_free_object(argv
);
770 static PLI_INT32
sys_integer_sizetf(PLI_BYTE8
*ud
)
775 void sys_fileio_register()
777 s_vpi_systf_data tf_data
;
779 //============================== fopen
780 tf_data
.type
= vpiSysFunc
;
781 tf_data
.tfname
= "$fopen";
782 tf_data
.calltf
= sys_fopen_calltf
;
783 tf_data
.compiletf
= sys_fopen_compiletf
;
784 tf_data
.sizetf
= sys_integer_sizetf
;
785 tf_data
.user_data
= "$fopen";
786 vpi_register_systf(&tf_data
);
788 //============================== fopenr
789 tf_data
.type
= vpiSysFunc
;
790 tf_data
.tfname
= "$fopenr";
791 tf_data
.calltf
= sys_fopenrwa_calltf
;
792 tf_data
.compiletf
= sys_fopenrwa_compiletf
;
793 tf_data
.sizetf
= sys_integer_sizetf
;
794 tf_data
.user_data
= "$fopenr";
795 vpi_register_systf(&tf_data
);
797 //============================== fopenw
798 tf_data
.tfname
= "$fopenw";
799 tf_data
.user_data
= "$fopenw";
800 vpi_register_systf(&tf_data
);
802 //============================== fopena
803 tf_data
.tfname
= "$fopena";
804 tf_data
.user_data
= "$fopena";
805 vpi_register_systf(&tf_data
);
807 //============================== fclose
808 tf_data
.type
= vpiSysTask
;
809 tf_data
.tfname
= "$fclose";
810 tf_data
.calltf
= sys_fclose_calltf
;
811 tf_data
.compiletf
= 0;
813 tf_data
.user_data
= "$fclose";
814 vpi_register_systf(&tf_data
);
816 //============================== fflush
817 tf_data
.type
= vpiSysTask
;
818 tf_data
.tfname
= "$fflush";
819 tf_data
.calltf
= sys_fflush_calltf
;
820 tf_data
.compiletf
= sys_fflush_compiletf
;
822 tf_data
.user_data
= "$fflush";
823 vpi_register_systf(&tf_data
);
825 //============================== fputc
826 tf_data
.type
= vpiSysTask
;
827 tf_data
.tfname
= "$fputc";
828 tf_data
.calltf
= sys_fputc_calltf
;
829 tf_data
.compiletf
= 0;
831 tf_data
.user_data
= "$fputc";
832 vpi_register_systf(&tf_data
);
834 //============================== fgetc
835 tf_data
.type
= vpiSysFunc
;
836 tf_data
.sysfunctype
= vpiSysFuncInt
;
837 tf_data
.tfname
= "$fgetc";
838 tf_data
.calltf
= sys_fgetc_calltf
;
839 tf_data
.compiletf
= 0;
840 tf_data
.sizetf
= sys_integer_sizetf
;
841 tf_data
.user_data
= "$fgetc";
842 vpi_register_systf(&tf_data
);
844 //============================== fgets
845 tf_data
.type
= vpiSysFunc
;
846 tf_data
.sysfunctype
= vpiSysFuncInt
;
847 tf_data
.tfname
= "$fgets";
848 tf_data
.calltf
= sys_fgets_calltf
;
849 tf_data
.compiletf
= sys_fgets_compiletf
;
851 tf_data
.user_data
= "$fgets";
852 vpi_register_systf(&tf_data
);
854 //============================== ungetc
855 tf_data
.type
= vpiSysFunc
;
856 tf_data
.sysfunctype
= vpiSysFuncInt
;
857 tf_data
.tfname
= "$ungetc";
858 tf_data
.calltf
= sys_ungetc_calltf
;
859 tf_data
.compiletf
= sys_ungetc_compiletf
;
860 tf_data
.sizetf
= sys_integer_sizetf
;
861 tf_data
.user_data
= "$ungetc";
862 vpi_register_systf(&tf_data
);
864 //============================== ftell
865 tf_data
.type
= vpiSysFunc
;
866 tf_data
.sysfunctype
= vpiSysFuncInt
;
867 tf_data
.tfname
= "$ftell";
868 tf_data
.calltf
= sys_ftell_feof_calltf
;
869 tf_data
.compiletf
= sys_check_fd_compiletf
;
870 tf_data
.sizetf
= sys_integer_sizetf
;
871 tf_data
.user_data
= "$ftell";
872 vpi_register_systf(&tf_data
);
874 //============================== fseek
875 tf_data
.type
= vpiSysFunc
;
876 tf_data
.sysfunctype
= vpiSysFuncInt
;
877 tf_data
.tfname
= "$fseek";
878 tf_data
.calltf
= sys_fseek_calltf
;
879 tf_data
.compiletf
= sys_fseek_compiletf
;
880 tf_data
.sizetf
= sys_integer_sizetf
;
881 tf_data
.user_data
= "$fseek";
882 vpi_register_systf(&tf_data
);
884 //============================== rewind
885 tf_data
.type
= vpiSysFunc
;
886 tf_data
.sysfunctype
= vpiSysFuncInt
;
887 tf_data
.tfname
= "$rewind";
888 tf_data
.calltf
= sys_rewind_calltf
;
889 tf_data
.compiletf
= sys_check_fd_compiletf
;
890 tf_data
.sizetf
= sys_integer_sizetf
;
891 tf_data
.user_data
= "$rewind";
892 vpi_register_systf(&tf_data
);
894 /* $feof() is from 1364-2005. */
895 //============================== feof
896 tf_data
.type
= vpiSysFunc
;
897 tf_data
.sysfunctype
= vpiSysFuncInt
;
898 tf_data
.tfname
= "$feof";
899 tf_data
.calltf
= sys_ftell_feof_calltf
;
900 tf_data
.compiletf
= sys_check_fd_compiletf
;
901 tf_data
.sizetf
= sys_integer_sizetf
;
902 tf_data
.user_data
= "$feof";
903 vpi_register_systf(&tf_data
);