Modelsim Training In Mohali

Preview:

Citation preview

MODELSIM Training in Mohali

E2MATRIXCALL: +91 9056051501,9915525860WEB: WWW.E2MATRIX.COMEMAIL:MOHALI. SUPPORT@E2MATRIX.COM

E2MATRIX

Outline Command Line Simulation

◦ Compile and Simulate◦ Add Signals to Wave◦ Applying Inputs

Interactive Simulation

2

Command Line Simulation Make sure Modelsim exists in the path by doing the following◦Windows:

◦ Start run -> cmd◦ In cmd window:

vsim -version◦Linux:

◦ In any shell: vsim -version

3

Command Line Simulation Create VHDL file

◦ Edit the file my_demo1.vhd◦ Insert the text and save

4

LIBRARY ieee; USE ieee.std_logic_1164.all;

ENTITY andgate IS port (a, b: in std_logic_vector(2 downto 0); c: out std_logic_vector(2 downto 0) ); END ENTITY;

ARCHITECTURE behav OF andgate ISBEGIN c <= a and b; END ARCHITECTURE;

Compile and Simulatevlib work

vcom <VHDL files>

vsim <top level>

5

• vlib: creates a library to compile and simulate the code with

• vcom: compiles VHDL files, the files should be ordered in a hierarchal way [leaf level first then top]

• vsim: starts the simulator to simulate the top level module

Add signals to Wave RMB on any signal in the Objects window Add to Wave signals in Region

Now start applying inputs and monitor outputs

6

Applying Inputs RMB on input port force

7

• In the “value” field, insert an appropriate value OK

• Apply inputs to other inputs

Run Simulation Press run button

Monitor the output

8

Make FilesOn Unix:

If you changed the code you will have to recompile the design files again. A make file is used to do repetitive compilation and simulation tasks; “Make” knows which files have been edited and automatically compiles only changed files.

ModelSim offers a simple way to automatically generate a Makefile for your design hierarchy. vmake work > Makefile

To recompile code at anytime just type make

9

Interactive Simulation File new project Insert project name and location; leave other fields with defaults

10

Interactive Simulation In “Add items to the project” window choose “Create new file”

Insert file name Make sure to select VHDL

11

Interactive Simulation Create VHDL file

◦ Edit the file my_demo1.vhd◦ Insert the text and save

12

LIBRARY ieee; USE ieee.std_logic_1164.all;

ENTITY andgate IS port (a, b: in std_logic_vector(2 downto 0); c: out std_logic_vector(2 downto 0) ); END ENTITY;

ARCHITECTURE behav OF andgate ISBEGIN c <= a and b; END ARCHITECTURE;

Compile VHDL files Select the file RMB compile selected

13

Simulation Simulate menu Start Simulation

Expand work library and select andgate OK

14

Recommended