ISSUE 347

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 347
Category enhancement
Synopsis No support for file fd (vs. mcd) in vpi (proposal?)
State open
Class enhancement-ptf
Arrival-DateMay 16 2003
Originator Stephen Williams <steve@icarus.com>
Release 2001b
Environment
Description

It seems that there is no support in VPI for fds opened via the
$fopen(name,type) system function. There are vpi_mcd_* functions
in vpi, but these claim no support for fds with the high bit set.

In fact, there are not even any VPI functions for file input.
Of course, VPI applications typically have the whole of stdio.h
available to it, so this may not be much of a loss, but that
there is not way for system tasks to share $fopened files with
the Verilog code. For example:

integer fd = $fopen("file.txt", "w");

begin ...; $my_fd_strobe(fd, "message", foo, bar); ... end

cannot be implemented. One may overload the existing vpi_mcd
functions for output, and maybe make some new vpi_mcd functions
for input, or one may define a single function to return a FILE*
of the compatible fd:

FILE*fd = vpi_get_file(fd_from_integer);

(But what to do if the vpi application wishes to create an fd
with fopen/fopen64 and pass it to the Verilog as a 32bit fd?)

I propose these functions:

PLI_INT32 vpi_fopen(const char*path, const char*type);
This would be the vpi equivalent of $fopen(path,type).
In returns an integer with bit 31 set and the remaining
bits a small value. The value can be returned to Verilog
and used by the various fileio system tasks there.

FILE* vpi_get_file(PLI_INT32 fd);
Returns the FILE* usable via C stdio.h functions that
is compatible with the fd passed in. The fd must be
a value created by $fopen or vpi_fopen.

With these, the VPI application writer has full and safe access
to the C stdio.h functions when passed a handle opened by $fopen.
--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
steve at picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."


Fix
Audit-Trail

From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: Stephen Williams <steve@icarus.com>
Cc: ptf-bugs@boyd.com
Subject: Re: errata/347: No support for file fd (vs. mcd) in vpi (proposal?)
Date: Sun, 18 May 2003 10:58:26 +0300

The exception is vpi_mcd_name.

> It seems that there is no support in VPI for fds opened via the
> $fopen(name,type) system function. There are vpi_mcd_* functions
> in vpi, but these claim no support for fds with the high bit set.

I believe this issue is more properly classified as an enhancement request.

Shalom

Unformatted




Hosted by Boyd Technology