Wednesday, February 20, 2013

Tips for running a successful simulation in Xilinx ISim.


        This article covers some basics about running your simulation in Xilinx ISim. It will point out some basic mistakes people do when simulating their code in ISim.
Let’s go step by step, see the images for easier understanding of the steps. Open the images in a new tab in your browser if they are not clear enough.

1) Once the coding is done (both the test bench and the design to be tested) make sure you select the top entity (test bench code) in the Xilinx window as shown below. Many people just select any other file and click the compilation button.
Note down the red markings in the image below. Points to be noted are:

·                     Choose View as simulation.
·                     Select the top entity i.e. the test bench. If the wrong file is selected for simulation then the waveform in ISim will be blank and you will see no waveform.
·                     Double click on the Behavioral check syntax for compiling the design or for finding out any syntax errors.
·                     If the above step is successful then double click on Simulate Behavioral Model. If there are syntax errors in step 3 then you may have to check your code.


2) Now ISim will open in a new window with waveforms. Note down the toolbar at the bottom. Check the below image for knowing what each button does. You can also hover your mouse over the button and they will display the function of that button.

3) Mostly the signals in the waveforms will be displayed as binary numbers or integers. But you can change this basic setting. See the image below. 


Click on the signal which you want to change the display format. Go to radix and then select the format. Some options available are Binary, Hexadecimal, octal etc. Note that depending on your code, you have to change the display format.

4) Another interesting thing you can do is adding the internal signals to the waveform which is not displayed by default. By default ISim displays only the signals which are declared in the test bench code. But if there are many sub entities then you may need to see them for debugging purpose. See the image below for how to do it.

·                     Go to the Instance and process names on the left side of the ISim window. 
·                     Select the Instance name whose internal signals you want to observe. 
·                     All the signals declared in that particular instance will be displayed on the immediate right tab now, under simulation objects.
·                     Now select the signals you want to display. You can use keyboard short cuts like shift  and Ctrl for selecting multiple signal names.
·                     Now drag and drop these select signals into the immediate right tab under signal Name in waveform window.
·                     For updating these signal values you have to restart the simulation and run it again. 


5) You may have noticed that in ISim, all the additional signals you added in step (4) are reset when you close the ISim window. This is little bit annoying since you have to add all the internal signals again. But you need not worry about it. Follow the steps:
·                     Add the required signals into the waveform as described in step 4.
·                     Save the waveform file by clicking, Ctrl S. Give an appropriate name to the wave file.
·                      Now close ISim and go back to the Xilinx ISE window.
·                     Right click on simulate behavioral model. 
·                     Choose the option Process properties.
·                     A new window will open as shown below in the image.
·                     Select the check box, Use custom waveform configuration file. 
·                     Choose the waveform file you just saved in the custom waveform configuration file.






That’s it for now. Hope these explain the things better.

No comments: