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

Joined
Mar 9, 2009
Messages
5
Reaction score
0
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:
Joined
Mar 9, 2009
Messages
5
Reaction score
0
cheevu said:
Vsim command use -g<genericname>=<value>

vsim -gMode=64 -c -do file.do

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:
Joined
Mar 9, 2009
Messages
5
Reaction score
0
cheevu said:
Vsim command use -g<genericname>=<value>

vsim -gMode=64 -c -do file.do

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:
Joined
Mar 9, 2009
Messages
5
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top