- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to create a modelsim alias command which loops another command a specific number of times.
From the command line I can use a Tcl for loop such as this to execute the command A (yet another alias) five times: for {set x 0} {$x < 5} {incr x} A If I create an alias called ten defined to the above command such as this: alias ten "for {set x 0} {$x < 5} {incr x} A" it appears that the variable x is being evaluated rather than used as a variable. So if I issue the command "alias ten" from the command line, what is echoed is: ten=for {set x 0} {0 < 5} {incr x} A Is there some trick to maintain variables in an alias? Or, is there a better way to loop a command via alias? Thanks, -philLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can't you define a procedure instead of an alias? It could take the command name as a parameter and evaluate it. I haven't tested it, but I'm thinking about something like that:
proc ten { A } { for {set x 0} {$x < 5 } { incr x} {eval $A} }
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