Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16650 Discussions

Modelsim: alias to loop a command

Altera_Forum
Honored Contributor II
1,237 Views

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, 

-phil
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
376 Views

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} }
0 Kudos
Reply