FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-17-2008, 11:42 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Command-line interaction via PLI/VPI/DPI

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.
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 08:53 PM
Dwayne Dilbeck
Guest
 
Posts: n/a
Default Re: Command-line interaction via PLI/VPI/DPI

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" <[email protected]> wrote in message
news:[email protected]..
> 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.



Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 09:18 PM
gabor
Guest
 
Posts: n/a
Default Re: 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:[email protected]..
>
> > 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...
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 12:59 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Command-line interaction via PLI/VPI/DPI

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
[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.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing verilog Input File as a command line define SB Verilog 4 01-18-2008 08:25 AM
Modelsim simulation progress in batch/command line mode? Andreas Ehliar Verilog 6 04-26-2007 07:05 PM
ncverilog: command line options Prashanth Verilog 1 03-06-2006 10:55 AM
defining a string macro from ncverilog command line Jason Zheng Verilog 2 03-30-2005 02:28 AM
VirSim command line chainastole Verilog 2 02-14-2005 07:57 PM


All times are GMT +1. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved