Modelsim command line: How to pass a generic parameter for my testbench ?

Discussion in 'VHDL' started by tarekeldeeb, Mar 9, 2009.

  1. tarekeldeeb

    tarekeldeeb

    Joined:
    Mar 9, 2009
    Messages:
    5
    Hello all,

    That's my first post .. :)

    I have a testbench.vhd having the following entity:
    Code:
    Entity TestBench is 
    Generic(Mode          :integer:=64); -- valid values are 64/128
    End TestBench;
    Additionally, I wrote a file.do that compiles everything and run the testbench from the command line <linux>:
    Code:
    vsim -c -do file.do
    The file.do looks like:
    Code:
    onerror { exit }
    exec rm -fr Project/;
    exec mkdir Project
    cd Project;
    vlib work;
    vcom ./../*.vhd;
    vsim -novopt -quiet work.testbench;
    run -all;
    quit -sim;
    exit;
    Is there a way to pass the generic parameter "Mode" from the command line?

    Thanks in advance,
    Tarek
     
    Last edited: Mar 9, 2009
    tarekeldeeb, Mar 9, 2009
    #1
    1. Advertising

  2. tarekeldeeb

    cheevu

    Joined:
    Jan 9, 2008
    Messages:
    5
    Location:
    BAngalore
    Vsim command use -g<genericname>=<value>

    vsim -gMode=64 -c -do file.do
     
    cheevu, Mar 9, 2009
    #2
    1. Advertising

  3. tarekeldeeb

    tarekeldeeb

    Joined:
    Mar 9, 2009
    Messages:
    5
    Furthermore, can I specify more options to check for it in the file.do
    as:
    vsim -gMode=64 -c -<more options> showme -do file.do

    and in the file.do:

    if [showme]
    {add signals to wave, and view it}

    Or I'm just daydreaming ?:sleep:

    Thanks in advance,
    Tarek
     
    Last edited: Mar 10, 2009
    tarekeldeeb, Mar 10, 2009
    #3
  4. tarekeldeeb

    tarekeldeeb

    Joined:
    Mar 9, 2009
    Messages:
    5
    OOps ! Sorry, but it did not work!!

    Adding the "-GMode=128" to the command line call did not work.

    But it worked when added to the file.do

    ie: The file.do looks now like:
    Code:
    onerror { exit }
    exec rm -fr Project/;
    exec mkdir Project
    cd Project;
    vlib work;
    vcom ./../*.vhd;
    vsim -novopt -quiet -GMode=128 work.testbench;
    run -all;
    quit -sim;
    exit;

    but I want to pass the generic from the command terminal, not by editing the file.do itself.

    Can this be done ?
     
    Last edited: Mar 10, 2009
    tarekeldeeb, Mar 10, 2009
    #4
  5. tarekeldeeb

    tarekeldeeb

    Joined:
    Mar 9, 2009
    Messages:
    5
    For Allah's sake and the community,

    I found the solution :)

    in the linux terminal:
    Code:
    vsim -c -GMode=128 -do file.do
    and in the file.do, you have to check the $argv

    Code:
    set x [lsearch $argv -GMode=128 ];
    if "$x != -1" { 
    set Mode 128;
    }
    if "$x == -1" { ## Default Mode 
    set Mode 64;
    }
    ..
    ..
    vsim -novopt -quiet -GMode=$Mode work.testbench;
    
    salam
     
    tarekeldeeb, Mar 10, 2009
    #5
    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,604
    Mike Treseler
    Oct 7, 2003
  2. Martin Maurer
    Replies:
    2
    Views:
    2,128
    Charles Bailey
    May 21, 2004
  3. fastgreen2000@yahoo.com
    Replies:
    10
    Views:
    2,641
    Simon Peacock
    Oct 1, 2005
  4. Guido
    Replies:
    3
    Views:
    3,252
    Mike Treseler
    Jan 30, 2006
  5. soren625
    Replies:
    10
    Views:
    245
    Kevin Collins
    Dec 28, 2005
Loading...

Share This Page