1

I want to use $args as a substitution for some of the vsim arguments.

** UI-Msg: (vish-3296) Unknown option '-assertdebug -classdebug'

vlog -sv time_diff_test.sv
vopt time_diff_test +acc -o dbgver
set args "-assertdebug -classdebug"
vsim dbgver $args # error
vsim dbgver -assertdebug -classdebug # runs fine

I think vsim is defined as a proc on the simulator(questasim) side and it recognizes the $args as a single argument. So it throws an error since no such argument is available. Do anybody know a workaround with this issue?

eminakgn
  • 35
  • 3

1 Answers1

2

This might be correct:

vsim dbgver {*}$args

Alex P
  • 96
  • 1
  • 6
  • Agreed. The `{*}` operator will expand $args into individual words before executing the vsim command. – Chris Heithoff Oct 19 '21 at 18:46
  • This worked, thank you! – eminakgn Oct 19 '21 at 19:51
  • For the historically minded, that syntax was added in Tcl 8.5 (it's rule #5 in https://www.tcl-lang.org/man/tcl8.6/TclCmd/Tcl.htm). Prior to then, the answer would have been `eval [linsert $args 0 vsim dbgver]` – glenn jackman Oct 19 '21 at 20:23
  • Or `eval [list vsim dbgver] [lrange $args 0 end]` (or various other options that might not be as efficient). Getting things both correct and fast was _difficult_ and frequently got wrong, so expansion syntax (it sort of looks like an operator, but isn't formally because it is processed by the Tcl language core which doesn't have operators) was added and we promptly used it to fix all sorts of bugs in Tcl itself… – Donal Fellows Oct 19 '21 at 20:28