Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

3.7.10.2.2. Run the Simulation

  1. Start the ModelSim software.
  2. Click File > Change Directory, browse to the \simulation_tutorial directory, and then click OK.
  3. Click Compile > Compile Options.
  4. Click the Verilog & SystemVerilog tab, select Use SystemVerilog, and then click OK.
  5. Click File > Load
    Ensure you activate the ModelSim Transcript window, otherwise the Load function is disabled.
  6. Select the load_sim.tcl script, and then click Open.
    The warning messages relate to unused connections in an ALTSYNCRAM megafunction. Because these ports are not used, you can ignore the warning messages.
  7. Run the simulation for 40us. To run the simulation, in the ModelSim Transcript window type the following command: run 40us.
    You can run the h command to show the available options for the msim_setup.tcl script.
  8. Observe the results.
    INFO: top.tb.reset_source.reset_deassert: Reset deasserted
    INFO: top.pgm: Starting test walking_ones.hex
    INFO: top.pgm.read_file: Read file walking_ones.hex success
    INFO: top.pgm.read_file: Read file walking_ones_rev.hex success
    INFO: top.pgm: Test walking_ones.hex passed
  9. To run the low frequency test, modify \simulation_tutorial\test_include.svh according to Table 12.
    Table 12.  Values for Low Frequency Pattern Test
    Macro New Value
    PATTERN_POSITION 0
    NUM_OF_PATTERN 2
    NUM_OF_PAYLOAD_BYTES 256
    FILENAME low_freq.hex
    FILENAME_REV low_freq_rev.hex
  10. Reload the load_sim.tcl script, run the simulation for 40us, and observe the result in the Transcript window.
    INFO: top.pgm: Starting test low_freq.hex
    INFO: top.pgm.read_file: Read file low_freq.hex success
    INFO: top.pgm.read_file: Read file walking_ones_rev.hex success
    INFO: top.pgm: Test low_freq.hex passed
  11. To run the random number pattern test, modify \simulation_tutorial\test_include.svh according to Table 13.
    Table 13.  Values for Random Number Pattern Test
    Macro New Value
    PATTERN_POSITION 32
    NUM_OF_PATTERN 64
    NUM_OF_PAYLOAD_BYTES 1024
    FILENAME random_num.hex
    FILENAME_REV random_num_rev.hex
  12. Reload the load_sim.tcl script, and run the simulation for 40us to observe the following results.
    INFO: top.pgm: Starting test random_num.hex
    INFO: top.pgm.read_file: Read file random_num.hex success
    INFO: top.pgm.read_file: Read file random_num_rev.hex success
    INFO: top.pgm: Test random_num.hex passed