Search code examples
command-linetclmodelsim

Getting status from Modelsim


I am running Modelsim by command line:

catch { exec vsim -c -do run.do } rcode
  1. Some simulations are taking pretty long. How can I get status information, i.e. every 10 minutes?

  2. I have seen many examples like:

    vsim -c test_bench -do "run -all"
    

    I suppose all necessary files need to be compiled before this command, like

    vcom -quiet -93 -work work name.vhd
    vcom -quiet -93 -work work name2.vhd
    ...
    vsim -c test_bench -do "run -all"
    

    Is this correct?


Solution

  • To get information out of a subprocess, you usually get the subprocess to write to its standard output channel from time to time. You can then read from that (via a pipeline).

    set pipe [open |[list exec vsim -c -do run.do]]
    while {[gets $pipe line] >= 0} {
        puts "I've just read '$line' from vsim"
    }
    catch { close $pipe } rcode
    

    As long as the program does actually write lines out from time to time, you'll receive them (modulo OS and subprocess library buffering) when they arrive. The above code is synchronous; we have asynchronous versions too (allowing your code to do things other than waiting for the subprocess at the same time, such as running a GUI) but the code for them is usually a bit longer.