Command-line interaction via PLI/VPI/DPI

On Feb 19, 2:53 pm, "Dwayne Dilbeck" <ddilb...@yahoo.com> wrote:
I would suggest filing a bug to the tool vendor.

I would have expected vpi_flush to occomplish what you want to have happen.

If you file a bug against it. Thier developers can give you a workaround.
You may be able to use the workaroun as a robust method in the future.
Before you mentioned this problem I would have said using vpi_flush was the
robust method.

"Jonathan Bromley" <jonathan.brom...@MYCOMPANY.com> wrote in message

news:lddhr3l5il3n6adbm936rthh3eav2s5fv7@4ax.com...

I'm stumped. Ideas welcomed.

I'm trying to write a SystemVerilog DPI application that
interacts with the simulator console and, in just one of
the simulators I use, I can't get a prompt to appear on
the same line as user input at the console. Here's a
sketch of the DPI import function written in C:

void called_from_Verilog() {
char s[200];
io_printf("This line is displayed OK\n");
io_printf("This prompt doesn't appear correctly: ");
gets(s);
io_printf("You typed :%s:", s);
}

One major simulator doesn't flush the console's output buffer
on a gets() call, so I don't see the prompt correctly. If
I use printf() instead of io_printf(), things go even worse;
but that's perhaps not too surprising.

On two other simulators it works as I would hope, with the
prompt being flushed to stdout before the user starts typing.

Adding a fflush() or vpi_flush() call just before the gets()
has no effect that I can discern.

Does anyone know a really robust way to do this?

Thanks in advance
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.brom...@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
If this were C, the gets call should force a flush. I'd tend to agree
it's a bug...
 
I would suggest filing a bug to the tool vendor.

I would have expected vpi_flush to occomplish what you want to have happen.

If you file a bug against it. Thier developers can give you a workaround.
You may be able to use the workaroun as a robust method in the future.
Before you mentioned this problem I would have said using vpi_flush was the
robust method.

"Jonathan Bromley" <jonathan.bromley@MYCOMPANY.com> wrote in message
news:lddhr3l5il3n6adbm936rthh3eav2s5fv7@4ax.com...
I'm stumped. Ideas welcomed.

I'm trying to write a SystemVerilog DPI application that
interacts with the simulator console and, in just one of
the simulators I use, I can't get a prompt to appear on
the same line as user input at the console. Here's a
sketch of the DPI import function written in C:

void called_from_Verilog() {
char s[200];
io_printf("This line is displayed OK\n");
io_printf("This prompt doesn't appear correctly: ");
gets(s);
io_printf("You typed :%s:", s);
}

One major simulator doesn't flush the console's output buffer
on a gets() call, so I don't see the prompt correctly. If
I use printf() instead of io_printf(), things go even worse;
but that's perhaps not too surprising.

On two other simulators it works as I would hope, with the
prompt being flushed to stdout before the user starts typing.

Adding a fflush() or vpi_flush() call just before the gets()
has no effect that I can discern.

Does anyone know a really robust way to do this?

Thanks in advance
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
J

Jonathan Bromley

Guest
I'm stumped. Ideas welcomed.

I'm trying to write a SystemVerilog DPI application that
interacts with the simulator console and, in just one of
the simulators I use, I can't get a prompt to appear on
the same line as user input at the console. Here's a
sketch of the DPI import function written in C:

void called_from_Verilog() {
char s[200];
io_printf("This line is displayed OK\n");
io_printf("This prompt doesn't appear correctly: ");
gets(s);
io_printf("You typed :%s:", s);
}

One major simulator doesn't flush the console's output buffer
on a gets() call, so I don't see the prompt correctly. If
I use printf() instead of io_printf(), things go even worse;
but that's perhaps not too surprising.

On two other simulators it works as I would hope, with the
prompt being flushed to stdout before the user starts typing.

Adding a fflush() or vpi_flush() call just before the gets()
has no effect that I can discern.

Does anyone know a really robust way to do this?

Thanks in advance
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
On Sun, 17 Feb 2008 22:42:36 +0000, Jonathan Bromley wrote:

I'm stumped. Ideas welcomed.
Thanks for the suggestions, guys; I'll see what the
tool vendor has to say.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top