- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone! I made a simple tcl script to copy my .sof file to a network-disk folder, then convert the whole PFGA chain to the rbf format.
Is it possible to pass a parameter to the tcl script? I would like to give the name of the rbf file to the script, as a command line argument. The script is executed in the tcl consolle of Quartus II. Up to now, the only way I could find is is to modify the tcl script with an editor. Anyone can help me? byeLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi davide.camerano,
Command line arguments are stored in the list named 'argv'. You can get the first argument with "lindex $argv 0" and the second argument with "lindex $argv 1". For example, assume that hoge.tcl contains the following: puts "1st argument is [lindex $argv 0]" If you execute the script as "quartus_sh -t hoge.tcl xxx", you will get the following output: 1st argument is xxx Also you can use the cmdline package to specify command line arguments like -<option> <value> . For more information on the package, please refer to the page 3-37 in the following document. http://www.altera.com/literature/hb/qts/qts_qii52003.pdf- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help. I tried to insert a parameter in my script, based on your example, and it worked with the quartus_sh command from the windows xp command prompt, but it did not work from the quartus II tcl consolle, by using the "source script_name.tcl" command. Why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The list 'argv' is not set when you source a tcl script.
Instead, you can define a procedure with 'proc', and call it after you source your script. For example, suppose you have the following code in hoge.tcl. The code block defines a procedure named 'argument'. It takes two arguments. proc argument {first second} { puts "first=$first" puts "second=$second" } To call the procedure, you need to source the script first: tcl> source hoge.tcl Then you can call it as follows. This example passes two arguments: aaa and bbb. tcl> argument aaa bbb The following will be output: first=aaa second=bbb Hope this helps.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page