Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Modelsim redirect output stream of a macro

In Modelsim Altera Starter Edition,

Is there a way to redirect output stream of a macro file to a file ?

I use "mymacro.do" to display what_i_want_in_the_console.

I would like to parse the ouput stream to a file.

My searches in document, alteraforum and web didn't give anything.

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Using the command-line version of vsim, you can redirect the output to a file. Eg., something like

    
    vsim -c testbench -do "run -a; q" &> testbench.log
    

    Cheers

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, thanks for answer,

    vsim -c myentity -do mymacro.do &> mymacro.log

    But vsim command doesn't like &> mymacro.log. It would like to take this as an entity.

    So solution not found yet...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I found a workaround : write the transcript window to a file

    write transcript myfile.log
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    vsim -c myentity -do mymacro.do &> mymacro.log
    But vsim command doesn't like &> mymacro.log. It would like to take this as an entity.

    --- Quote End ---

    Were you trying this from a bash shell? I commented that this format was for the command-line version of vsim, not the GUI version.

    I use this method in Makefiles to generate logfiles from failing testbenches.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Here's the Makefile section:

    #  -----------------------------------------------------------------#  Check target#  -----------------------------------------------------------------# #  Change into the control_test build directory so that the#  exitstatus and log files are generated in the control_test#  directory. 'make clean' will then remove that directory.# #  The logic to test the exit code could be transformed into#  a bash script that takes the executable as the argument.#  Eg. check_exit_status $testbench# #  Each testbench should have the generic makecheck, with a default#  of 0. The makefile sets the parameter to 1. The exitstatus file#  will not be created when makecheck = 0.# 
    .PHONY: check
    check: $(CONTROL_TEST_LIB_DONE)
        @cd $(CONTROL_TEST_DIR); 
        rm -f exitstatus; 
        for check in $(control_test_CHECKS); do 
            echo -n "TEST: $$check"; 
            $(VSIM) $(VSIM_ARGS) -c control_test.$$check -gmakecheck=1 
            -do "run -a; q" &> $$check.log; 
            if ; then 
                if ; then 
                    echo -e "\rFAIL: $$check (see $$check.log)"; 
                    rm exitstatus; 
                    exit 1; 
                else 
                    echo -e "\rPASS: $$check"; 
                    rm exitstatus; 
                fi; 
            else 
                echo -e "\rFAIL: $$check. `pwd`/exitstatus file not found. Check the testbench."; 
                exit 1; 
            fi; 
        done