Forum Discussion
Altera_Forum
Honored Contributor
18 years agoI typically setup up a script like below and run it from the command line using:
%> vsim -gui -do "source example.tcl" Where example.tcl might look something like: set DESIGN_NAME "pipe" set WAVE_FILE wave.do set FORCE_LIB_RECOMPILE 0 # Quit the simulation environment if you are running one quit -sim # Create and open a project if {[file exists ${DESIGN_NAME}_sim.mpf]} { project open ${DESIGN_NAME}_sim } else { project new . ${DESIGN_NAME}_sim } # Compile Altera libraries if {![file exists altera_primitives] || $FORCE_LIB_RECOMPILE} { vlib altera_primitives vmap altera_primitives altera_primitives vcom -work altera_primitives $env(QUARTUS_ROOTDIR)/eda/sim_lib/altera_primitives_components.vhd vcom -work altera_primitives $env(QUARTUS_ROOTDIR)/eda/sim_lib/altera_primitives.vhd } if {![file exists altera_mf] || $FORCE_LIB_RECOMPILE} { vlib altera_mf vmap altera_mf altera_mf vcom -work altera_mf $env(QUARTUS_ROOTDIR)/eda/sim_lib/altera_mf_components.vhd vcom -work altera_mf $env(QUARTUS_ROOTDIR)/eda/sim_lib/altera_mf.vhd } if {![file exists lpm] || $FORCE_LIB_RECOMPILE} { vlib lpm vmap lpm lpm vcom -work lpm $env(QUARTUS_ROOTDIR)/eda/sim_lib/220pack.vhd vcom -work lpm $env(QUARTUS_ROOTDIR)/eda/sim_lib/220model.vhd } if {![file exists sgate] || $FORCE_LIB_RECOMPILE} { vlib sgate vmap sgate sgate vcom -work sgate $env(QUARTUS_ROOTDIR)/eda/sim_lib/sgate_pack.vhd vcom -work sgate $env(QUARTUS_ROOTDIR)/eda/sim_lib/sgate.vhd } # Compile project source code vlog -incr -sv ../src/${DESIGN_NAME}.v vlog -incr -sv ./${DESIGN_NAME}_tb.v # Quit without asking set PrefMain(forceQuit) 1 # Compile the simulation vsim -gui -novopt +transport_int_delays +transport_path_delays +notimingchecks work.${DESIGN_NAME}_tb # Open the waveform viewer and set the title of the window view wave -title "${DESIGN_NAME} simulation vectors" # Open the signals viewer view signals # Run the .do file to load the signals to be viewed do $WAVE_FILE # Run the simulation run -all puts "QUARTUS_ROOTDIR is $env(QUARTUS_ROOTDIR)"