Race conditions / buffer issues in console output

Why OSVVM™? Forums OSVVM Race conditions / buffer issues in console output

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1977
    Markus
    Member

    I had troubles concerning the order of console output, esp. in combination with ModelSim/Questasim.

    Problem Description:
    Assume the following proc in VendorScript_Mentor.tcl (pseudocode):

    proc analyze {FileName} {
      puts Starting VCOM
      vcom ... $FileName
      puts VCOM Done
    }

    I got the following output:
    Starting VCOM
    VCOM Done

    <actual output from vcom>

    So there seems to be a problem concerning output buffering or something similar. The actual output from the vcom command is displayed AFTER the command has long finished and the tcl script has already proceeded.

    I narrowed it down to the usage of puts (built-in tcl command to write to console) vs. echo (ModelSim/QuestaSim specific command that writes to transcript and console). It seems those two have “race conditions”.

    #1978
    Markus
    Member

    It seems the problem was on my end after all
    When I call
    vsim -batch -do "build project.pro"
    the output is fine. However, when I call it with a pipeline operator to postprocess the output
    vsim -batch -do "build project.pro" | cat
    the output is somehow mixed up.

    This is a buffering problem which can be solved with unbuffer:
    unbuffer -p vsim -batch -do "build project.pro" | cat

    See also the respective github isse:
    Issue on Github

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.