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
[email protected]
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.