Académique Documents
Professionnel Documents
Culture Documents
1-Installing ModelSim
2- Using ModelSim
www.dkoplabs.com
Page 1
1. INSTALLING ModelSim
Click Next
www.dkoplabs.com
Page 2
At the last step of the installation, make sure that before selecting FINISH the machine is
connected to the internet as the installation needs to aquire the license file from the Mentor
Graphics website and ModelSim wont run without the license file.
DONT change the name of the license file or the file contents!
If the license file isnt in the Inbox, it can be found in the Spam folder, check there.
www.dkoplabs.com
Page 3
The license file is sent to the email id entered in the request form. Download the license file (this will most
probably be named as student_license.dat. Nothings wrong with the extension so use as it is)
Save/Copy the file in the directory Modeltech_pe_edu_10.0c (ModelSim Installation directory). See the
example in the following figure.
Installation part finishes here. Now the tool can be used! The license will last for 3
months.
www.dkoplabs.com
Page 4
2. USING ModelSim
www.dkoplabs.com
Page 5
To open and work with existing design, use Open a Project. Though, mostly, ModelSim keeps last active
project on startup.
The project is named adders. It is located in the directory C:\Modeltech_pe_edu_10.0c\examples.
It is suggested that the designer always organize the directory structure and must know where
the design project has been created.
It is important how the project is organized. It is strongly recommended that the naming is done
sensibly. As a convention, name the Verilog file same as the module name and the variations of
similar module be name with a variation. For instance, if I am to design a 4 bit ripple carry
adder, I may name the adder as adder_4bit_ripl.v, its module name as adder_4bit_ripl.
Typically, a mixed approach is used in designing. In the first step the top design is broken down
to the leaf cells, this is called top down approach. Now the design is built/coded from the very
leaf/child cell (lowest level). Once all the lowest level leaf/child cells are created the upper level
cells are created using these lowest level leaf/child cells. In this way the top level design is
reached.
It is just like building a house. First an architecture is drafted on a paper. Then basic building
blocks like concrete and bricks etc are used to create rooms and bit by bit a house(top level) is
www.dkoplabs.com
Page 6
www.dkoplabs.com
Page 7
Take your time and make yourself familiar with the interface.
www.dkoplabs.com
Page 8
Write the module (design of half adder using any modeling style)
The example uses dataflow modeling style.
www.dkoplabs.com
Page 9
The window below shows the error (carefully analyze the error message):
Correct code:
module half_adder(sum, carry, a, b);
output
input
sum, carry;
a,b;
assign
assign
sum = a ^ b;
carry = a & b;
//correction
endmodule
www.dkoplabs.com
Page 10
2.5. Simulation:
Simulation is very important and appropriate test bench (one with complete coverage) is key to almost bug-free
design. The design is bound to fail if it is not simulated carefully. So, good time should be devoted in writing
the test bench and analyzing the simulation results.
Appendix
Compilation step create some files in the work library. These are important for simulation step. The work
library will have compiled version of design module. The module will have same name as that of the design
module (not the file or project name). Select the module to be simulated and click OK.
www.dkoplabs.com
Page 11
This will open the simulation environment which will look something like this:
www.dkoplabs.com
Page 12
www.dkoplabs.com
Page 13
For this example, for first run the signals are forced values a=1, b=0.
. The simulation will run for 100 ns as by default, the run time selected
www.dkoplabs.com
Page 14
Zoom in
and check.
Further force values and validate the design by using half adders truth table.
a
0
0
1
1
b
0
1
0
1
sum
0
1
1
0
carry
0
0
0
1
Simulation Results:
www.dkoplabs.com
Page 15
www.dkoplabs.com
Page 16
SUMMARY
ISE WINDOW:
1.
2.
3.
IMPACT WINDOW:
Assign appropriate locations to the pins in module and save. Go back to the ISE WINDOW.
ISE WINDOW:
4.
5.
6.
7.
ADEPT WINDOW:
Ajay Sharma ajay@dkoplabs.com
www.dkoplabs.com
Page 17
If the FPGA kit is powered ON, connected to the PC and the Digilents USB cable drivers are installed the Adept
programmer window will auto recognize the connected FPGA kit and will show digilents device name (such as
Nexsys2 or Basys2) under Connect:.
Also, the programming options will be available for: 1. FPGA. 2. PROM.
For FPGA: (make sure the jumper is at USB/PC )
(The programming information will be lost at power OFF and the FPGA has to be re-programmed at every
power ON and OFF so, it is a volatile programming. To retain the programming information so that it is autoloaded at every start-up, choose to program the on-board PROM)
a) Click Browse (the one next to FPGA tab) locate the bit file generated by ISE (will have same
name as the top module and will be located in the project directory). If there is a .bit at the location
it will show.
b) Select the bit file Click Open Program (the one next to FPGA section).
c)
Click Browse (the one next to PROM tab) locate the bit file generated by ISE (will have same
name as the top module and will be located in the project directory). If there is a .bit at the location
it will show.
b) Select the bit file Click Open Program (the one next to PROM section).
c)
FPGA KIT:
a)
b)
Check that a yellow LED on the FPGA kit, glows. This indicates the FPGA has been programmed.
Analyze/Observe the working of the design DU.
www.dkoplabs.com
Page 18