Testbench flow control with TCL

Discussion in 'VHDL' started by glw75, Dec 20, 2011.

  1. glw75

    glw75

    Joined:
    Dec 20, 2011
    Messages:
    2
    I am currently attempting to use the following TCL script to control the simulation flow of my DUT. It basically does the following:
    Reads in a txt file to get individual test names, passes each individual test name to the testbench framework. The idea being that each test is performed under a separate vsim command as opposed to having them concatenated together in one simulation run. I extract the system time at the start and end of each simulation run to pass into a log file. The first system time is passed in as a generic, the final system time is passed in as a force command when I encounter a pre-set breakpoint towards the end of the sim.

    When my testbench eventually completes a simulation, it finishes with the following statement:
    assert not(V_FINISH) report "Test Complete " severity failure;

    The problem that I am having is that when the above line is executed, control is not passed back to the TCL file (which makes sense I guess as I’ve killed the simulation run). Is there a way of cleanly passing control back to the TCL script to get it to continue around the loop?

    while { [gets $infile line] >= 0 } {
    set length [string length $line]
    if {[lsearch $line --* ] == -1} {
    if {$length != 0} {
    #Set the simulation time string
    set str [clock format [clock seconds]]
    #Vsim command and dereferenced tcl variable passed in as generic for time & date & test name
    vsim -onfinish exit -G/uart_tb/u_uart_tb_control/time_string=\"$str" -G/uart_tb/u_uart_tb_control/g_test_name=\"$line" work.uart_tb
    #Set the breakpoints for time insertion
    bp ../testbench/UART_TB_CONTROL.vhd 415
    # Set the commands that get executed when we encounter the breakpoints
    # Capture the system time
    # force the string value set in the design with this value
    # continue the simulation
    onbreak {set str [clock format [clock seconds]]; force -freeze sim:/uart_tb/U_UART_TB_CONTROL/FINAL_TIME $str 0; run -continue }
    do wave.do
    run -all
    }
    }
    }

    Many thanks.
    glw75, Dec 20, 2011
    #1
    1. Advertising

  2. glw75

    glw75

    Joined:
    Dec 20, 2011
    Messages:
    2
    Found the answer if anyone's interested:

    in the 'onbreak' command, if I replace 'run -continue' with 'resume' then control is passed back to the TCL script.
    glw75, Dec 20, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Niv

    ModelSim & tcl testbench

    Niv, Oct 7, 2003, in forum: VHDL
    Replies:
    2
    Views:
    7,525
    Mike Treseler
    Oct 7, 2003
  2. Andrea Moro
    Replies:
    7
    Views:
    2,159
    Karl Seguin
    Jul 13, 2005
  3. pavs

    CONTROL FLOW GRAPH

    pavs, Feb 28, 2005, in forum: Java
    Replies:
    1
    Views:
    720
    bugbear
    Mar 7, 2005
  4. Jack Dowson
    Replies:
    0
    Views:
    448
    Jack Dowson
    May 7, 2007
  5. Mumia W.

    Inline::Tcl vs. Inline::Tcl

    Mumia W., Aug 23, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    131
    Mumia W.
    Aug 23, 2006
Loading...

Share This Page