Please contact me if you find any errors or other problems (e.g., something is unclearly stated) in this web page
and presents a (very) quick introduction to the use of Quartus to design a system using verilog.
Command | Explanation |
restart -force | Restarts the simulation time. Normally included
in the beginning of the ".do" file. |
destroy .wave | Closes the waveform window. This command is also included in the beginning of the ".do" file. Normally the same simulation file is used several times and this command will destroy all the previous waveforms, instead of manually closing the waveform windows. |
add wave /* or add wave -r /* |
Adds the waveform of interest. * will add all the signals used in the design at the top level. You may also specify a specific signal of interest instead of viewing all the signals. r option is used when several blocks are simulated at the same time and all the signals in each block is needed to be analyzed. |
view wave | Opens the graphical user interface window in Modelsim. |
force RESET_N 0 | The force command sets a specific value of a signal or bus. In this case the signal RESET_N is set to a logically low value, i.e. 0. |
force clk 0 0, 1 50ns -repeat 100ns | The option repeat is an extension to the force command. This will set the signal to behave in a periodic manner. In this case a system clock (clk) or synchronization signal is generated. In this example the signal clk will be set to 0 at 0 ns and to 1 after 50 ns, and this sequence will be repeated every 100 ns. |
#comment | Add comments |
run 100ns | The run command specifies the simulation time.
In this case the simulation will run in 100 ns. |
The following ".do" file creates two clocks on lines key(1) and key(0). The output (on ledy_m) is the xor of the two clocks. The name of the file is "myfirst.do"
restart -force -nowave delete wave * add wave key(1:0) add wave ledy_m force -freeze key(0) 0 0, 1 {10 ns} -r 20 ns force -freeze key(1) 0 0, 1 {20 ns} -r 40 ns run 200 ns
The command "do myfirst.do" is entered in the "Transcript" pane. The output of the waveform window is shown below
If you want to figure out more ".do" commands, you can right-click on signals in the "Wave" pane and set the as clocks, logic levels... The appropriate ".do" commands will appear in the "Transcript" pane and you can copy them to your .do file.
This document takes liberally from http://www.engineering.sdsu.edu/~waheed/compe475/Modelsim/introduction_modelsim.pdf
Please contact me if you find any errors or other problems (e.g., something is unclearly stated) in this web page