Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Automating ModelSim

Altera_Forum
Honored Contributor II
2,922 Views

Dear all, 

 

I'm using ModelSim with the NativeLink integration a QuartusII 10.1 Windows Web edition. 

 

After running the ModelSim simulation I need to: 

1) add internal system signals 

2) set up radix format for waveforms 

3) set up analog format for other waveforms 

4) restart and run the simulation again. 

 

Is there a way to write down all these commands in a script file and have Quartus running the script automatically? 

 

Where can I study which commands should be written in the script? 

As example I know the commands "restart -force" "run -all" "add ..." but I don't know how to change signal format through command line in ModelSim. 

 

Thx.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,634 Views

hi! 

you can try to modify the *.do file into /simulation/modelsim directory; if you google "modelsim command reference" there are some pdf that explain commands (sorry I can't post link, I'm a newbie:)) 

 

Ale
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

Hi,  

 

Dofiles are TCL scripts. In VHDL, using GENERICs at the top level of your TB, you can then change parameters through the TCL script.  

 

I tend to not rely on waveforms, but assertions within the testbench (self checking testbench). So I run iterations of the simulation, using generics to modify the simulation characteristics. 

 

Unfortunately I cannot help with NativeLink... but I'll look that up. 

 

Here's a snippet from a dofile I wrote a while back. 

prbs_tester_tb is the testbench. 

This runs 4 simulations, changing the PRBS files and UUT characteristics each time. 

 

puts "******************************************************************" 

puts "Running the NNNNN simulation" 

puts "******************************************************************" 

vsim -gPATTERN_IN=O"1" -gLFSR_SEL=X"F" -gSTIM_FILE="./stim/lfsr_F__trib10.dat" -gTRIB_IN=X"10" prbs_tester_tb 

run 4 ms 

 

vsim -gPATTERN_IN=O"1" -gLFSR_SEL=X"D" -gSTIM_FILE="./stim/lfsr_D__trib12.dat" -gTRIB_IN=X"12" prbs_tester_tb 

run 4 ms 

 

vsim -gPATTERN_IN=O"1" -gLFSR_SEL=X"C" -gSTIM_FILE="./stim/lfsr_C__trib03.dat" -gTRIB_IN=X"03" prbs_tester_tb 

run 4 ms 

 

vsim -gPATTERN_IN=O"1" -gLFSR_SEL=X"E" -gSTIM_FILE="./stim/lfsr_E__trib71.dat" -gTRIB_IN=X"71" prbs_tester_tb 

run 4 ms 

 

Jerry
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

i normally use NativeLink to generate the ModelSim .do file initially. then i edit the generated .do file to add internal signals and/or change the radix 

 

you can then tell Quartus to use the edited .do file instead of generating a new one every time Tools > EDA Simulation > RTL Simulation is run. you can do this in the NativeLink setup by choosing the Script to compile test bench instead of Compile test bench radio button 

 

the downside is you will have to edit the script directly to add/remove any HDL source files to the ModelSim compilation, or else re-run the normal NativeLink flow and copy+paste your additions to the newly generated script
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

Thank you for your answer. 

 

I solved the problem starting from your suggestion and making a sligth change. 

 

Step 1)  

I run a first simulation. 

2) 

I copied the .do file in the directory modelsim/simulation in another .do file with MySim.do name 

3)  

I added the necessary commands in the MySim.do file. 

4) 

I set the Simulation settings enabling the "Compile test bench" radio butto and checking the "Use script to set up simulation" checkbox. 

I also inidcated the simulationMySim.do file as the script to set the simulation. 

In this way the simulation directly comes out as required and reflects all the changes in the testbench. 

 

Further, 

if I want to run the simulation again without restarting ModelSim, 

I simply run the "do MySim.do" command in the "ModelSim -> Transcript " window.
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

pushing up then enter in the ModelSim command window also re-runs the .do file (or previous command)

0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

Hello, 

could you tell me how i can add internal signals to modelsim by editing .do file? 

Which command? 

Thank you very much 

Halba
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

if you add signals in the GUI, the equivalent command to add to the .do will be in the transcript window 

 

paste it into the .do file after the existing add wave command
0 Kudos
Altera_Forum
Honored Contributor II
1,634 Views

I do like this. In my case the signal is named clk_Contr and is in the hierarchy Ptot_tb/UUT/MI/: 

 

add wave {sim:/Ptot_tb/UUT/M1/clk_Contr}
0 Kudos
Reply