(Note) perform simulation under Quartus II and Modelsim to set the initial count values (Modelsim) (Quartus II) (OpenGL)

Source: Internet
Author: User
Abstract

Use Quartus II and Modelsim to separate a simple frequencyProgramDuring the simulation, we found a question about the initial setup value.

Intrduction

Environment: Quartus II 7.2 SP3 + UP-SOPC2000 (Cyclone IIEp2c35f627c8) + Modelsim se plus 6.2b

I used to use the policy tool provided by Quartus II for program function and timing simulation. Today I tried to use Modelsim for simulation.
A simple crossover program, however, is a simple program with different results under Quartus II and ModelSim. The reason is that
Initial Value of a count variable CNT

Simulation in Quartus II ENVIRONMENT
Step 1
Source code to be simulated clk_div.v

PS: note that I did not add this sentence to line 1 during the Quartus II simulation.

Step 2
After compilation is successful, function simulation is performed after the logical network table is generated.

The above is the result of functional simulation on Quartus II, which is consistent with the expectation.

Simulation in Modelsim se plus 6.2b
The files to be simulated are the same as those in Q2.
Test incentive File

The result is that under the incentive file to be tested and tested, both iclk and RST have waveforms, that is, the oclk output is always 0.
ModelSim failed. The same program started to joke with each other in two different environments. After thinking about it, I tried it again and again, but there was no result. Finally, I put the whole
The document was sent to the "count of Christchurch" netizen, or he helped me solve the problem:
The reason is that the source file contains 17th rows.

I didn't have this section.CodeAfter this code is added, you can perform functional simulation.The simulation results are as follows:

Download
Modelsim_count4.rar

CONclusion
In Modelsim, there are two situations for reference:
Scenario 1: If CNT <= 19 'd0 is added to the program, however, when writing the test incentive file, the RST waveform is not described (or the RST is always '0' or '1' in the incentive ).
Simulation results will not appear, because CNT is not properly initialized
Case 2: The Code <= 19 'd0 is not written in this article. Even if the RST waveform is described in the test incentive fileNoNormalInitial
Correct Simulation
In Modelsim, the default value of CNT is not 0. In quatus II simulation, the default value of CNT is 0. Therefore, you must pay attention to this in Modelsim simulation,
This sentence should be added even in Q2. A large part involves programming.Habits, so we must develop good habits when writing programs, so that we can carefully consider it!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.