bluespec.com Forum Index bluespec.com
Bluespec Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

$value$plusargs

 
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: BSC (Bluespec Compiler)
View previous topic :: View next topic  
Author Message
patil.nikhil



Joined: 17 Aug 2007
Posts: 69
Location: University of Texas at Austin

PostPosted: Thu May 29, 2008 12:16 am    Post subject: $value$plusargs Reply with quote

Hi,

BSC provides a convenient way to pass arguments to the executable using $test$plusargs, so I can say "$ ./a.out +dump", and $test$plusargs("dump") will return True (wrapped in an ActionValue). However, this is of limited utility because $test$plusargs only tests for presence/absence of the argument, but cannot pass in a value for the argument. So I cannot say for instance, $ ./a.out +dump=10000. Verilog-2001 lets you do that using $value$plusargs, but that does not seem to be supported by the Bluespec compiler.

I want to implement this using a BDPI function, but it does not seem to be possible to access the argv[] in any way from inside bluespec. Even if I could see it as a String, since String is not in Bits#() I would not be able to write a BDPI function to use it. Is there a way around?

Thanks,
Nikhil
Back to top
View user's profile Send private message Visit poster's website
patil.nikhil



Joined: 17 Aug 2007
Posts: 69
Location: University of Texas at Austin

PostPosted: Thu May 29, 2008 4:59 am    Post subject: Re: $value$plusargs Reply with quote

patil.nikhil wrote:
Even if I could see it as a String, since String is not in Bits#() I would not be able to write a BDPI function to use it.

oops!! I thought BDPI did not like String because it's not in Bits. I just looked at the manual, and it looks like String has already been made an exception to the rule. So, if I could get a function that gave me access to the argument string, I can write a BDPI function to do the job.
Back to top
View user's profile Send private message Visit poster's website
jnewbern



Joined: 18 Jul 2007
Posts: 71

PostPosted: Thu May 29, 2008 9:06 am    Post subject: Reply with quote

I think the simplest approach available at the moment, which will work in both Verilog and Bluesim, is to use environment variables to pass options to the simulation. You can access them using getenv() in a BDPI function.

This is more flexible than using $value$plusargs since you can do more parsing and validation of the values.
Back to top
View user's profile Send private message
patil.nikhil



Joined: 17 Aug 2007
Posts: 69
Location: University of Texas at Austin

PostPosted: Thu May 29, 2008 10:53 am    Post subject: Reply with quote

Aah, right! Thanks for the tip! [Smile]
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: BSC (Bluespec Compiler) All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
bluespec.com topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP