Passing arguments to simulation run script

Why OSVVM™? Forums OSVVM Passing arguments to simulation run script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2076
    Anna
    Member

    Hi All,

    Does any of you know if there is a way to pass arguments to simulation run scripts .pro? I would like to reproduce a mechanism from modelsim scripting. There it is possible to run script with arguments:

    do run_simulation.do wave_top_wrapper.do 1us

    use them to for example set simulation waveform source or pass them as testbench generics:

    if { $argc == 0 } {
      echo "| Haven't set any simulation parameters                                               |"
      set generics " "
    } elseif { $argc == 1 } {
      echo "| Waveforms files were set:                                                            |"
      set wave_file_list $1
      set generics " "
    } elseif { $argc == 2 } {
      echo "| Simulation time and waveforms files were set:                                    |"
      set wave_file_list $1
      set sim_time $2
      set generics -gSIM_TIME=$sim_time
    }
    vsim {*}$generics -c work.tb_top_wrapper -t ns
    
    # Set waveforms
    echo "Setting waveforms: "
    foreach wave $wave_file_list {
      echo $wave
      do $wave
    }

    Do you know if something like this is possible to achieve with osvvm scripting? Has anyone tried to do this before?

    Thanks!
    Anna

    #2093
    Jim Lewis
    Member

    Hi Anna,
    Sorry, some how while answering your questions on GitHub, I missed your question here.

    For all others, here is a summary of the resolution of Anna’s question.

    With the 2022.10 update, the same actions can be accomplished with the following call to simulate. Note while the items in square brackets are optional, if you use generic and DoWaves, the square brackets are required (they tell TCL to execute the script).

    simulate tb_top_wrapper [generic SIM_TIME 10us] [DoWaves wave1.do wave2.do]

    It should be noted that DoWaves (2022.10) is a direct result of Anna’s question, so please do ask questions.

    If you would like to extend OSVVM scripts, I recommend using TCL procedures rather than the EDA vendor do macro commands. The following TCL run_simulation procedure is closer to the functionality of the “do macro”, but still takes advantage of OSVVM allowing additional commands at the end of simulate, you can add a script such as the following to the file LocalScriptDefaults.tcl. I made one change from the blog post, I put this before the OSVVM context:

      proc run_simulation {LibraryUnit {WaveFiles ""} {SimTimeGeneric ""} args} {
        set SimOptions ""
        if {$SimTimeGeneric ne ""} {
          append SimOptions [generic SIM_TIME $SimTimeGeneric] " "
        }
        if {$WaveFiles ne ""} {
          foreach wave $WaveFiles {
            append SimOptions "-do $wave " 
          }
        }
        if {$args ne ""} {
          append SimOptions {*}$args
        }
        
        simulate $LibraryUnit {*}$SimOptions
      }
    
    namespace eval ::osvvm {
    . . . 
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.