Be the first to rate this file! 20 Downloads (last 30 days) File Size: 23.3 KB File ID: #36989
image thumbnail

Simulink block set for Gtkwave : An alternative of simulink scope.

by

 

04 Jun 2012 (Updated )

Simulink blockset to display the simulation data from simulink on GTKWave

| Watch this File

File Information
Description

What is it?
-----------------------------
GTKWave is a free and open source "wave analyzer tool" generally used
in HDL design. It can display integer and real value data.
There are lots of color and formating option which make it pleasant to
use and also it has many marker and cursor options which makes
waveform analysis simple.
It can read VCD and other dump file formates.

Simulink blockset for GTKWave can be used to display the simulation data
from simulink.
The scope provided by simulink for waveform display is
very uncomfortable for scrolling, zooming and timing analysis. This blockset can be used as alternative of the simulink scope.
Using this blockset, simulink data can be displayed on Gtkawave tool for easy analysis.

How to install?
-----------------------------
(1) Blockset is created and tested on Windows system. So download the windows
    version of GTKWave (available version 3.3.34) from

    http://sourceforge.net/projects/gtkwave/

    Unzip the file in any folder you want(but make sure that, parent directory path
    shouldn't contain space. Otherwise tcl script will not run).
    The root_folder_of_GTKWave_tool should contain following folders
            -- Bin
            -- lib
            -- share

(2) You have below files & folders for GTKWave blockset
            -- gtk_ml_supp (folder contains m-file & a c-file)
            -- InstallGTKWaveBlockSet.m
            -- AutoSigAddn.tcl
            -- MenuConfg.gtkwaverc

    Copy these folders and files in the root_folder_of_GTKWave_tool.

(3) Now open Matlab and set the current directory to "root_folder_of_GTKWave_tool"
    Run the script "InstallGTKWaveBlockSet.m".

(4) Now set current directory to "root_folder_of_GTKWave_tool\gtk_ml_supp".
    Enter command
    >> mex mexGTKWaveWriteVCD.c
    to compile the .c file. It should generate .mex file successfully. Mex file is used for
    making the process of VCD file writing fast.

(5) Blockset is installed and ready to use. Blockset will now appear on simulink
    library browser.

(6) Blockset is created and tested for Fixed-step Descrete models on Matlab R2012a.

How to use?
-----------------------------
Blockset contains two blocks
    -- GTKLogPort
    -- GTKSetup

Connect the GTKLogPort to the signals which you want to log and display in the GTKWave.
Specify the Name, Data type and Data flow properties.

Now drag and connect the GTKSetup block to the "Root level" of the model. Set the
"Launch output on GTKWave" property to "on". Only one GTKSetup block is required for
each model and should be at root level of model.

Now run the simulation. After the simulation, GTKWave will be launced automatically
and it will display the signals which are logged with GTKLogPort.

You can disable the launching of GTKWave after simulation by setting the GTKSetup's
"Launch output on GTKWave" property to "off".

---------------------------
Best of luck.

Feel free to contact on
e.tabrez@gmail.com for reporting any issue, any query
or problem.
---------------------------

Acknowledgements

This file inspired Script To Create Vcd File From Simulink Data.

Required Products Simulink
MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Other requirements GTKWave for windows C compiler supported by matlab.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
08 Jul 2013 TAB

@olivier: Select the signal and press "E" button on your keyboard to zoom-in on Y-axis. To zoom-out select the empty lines (created after zoom-in) in "Signals" list, right click and cut it.

19 Sep 2012 olivier

Nice alternative, but after playing a little while, I still did not get how to set the Y axis of a signal (or doing a vertical zoom)

02 Jul 2012 TAB

Gernot, thanks for your valuable feedback.
I am already working for "named signals", so that GTKLogPort can take signal name automatically when it is connected to a named signal.

Regarding issue with matlab version R2012a, currently i don't have access to R2012a. But as soon as I will get it, I will try to test and fix this issue.

02 Jul 2012 Gernot

another suggestion:
simlog and simPlotter (on FEX) show some alternative signal selection methods.

Regards
Gernot

02 Jul 2012 Gernot

This viewer tool is a good idea.
Some suggestions:
1) named signals could be used as logging names automatically
2) some variables are created directly in MatlabWorkspace (better collect inside one struct or hide in the UserData of the SetupBlock)
3) Unfortunately, it does not work directly in 2012a (of course R2007b is mentioned above). (Simulink misses some 'Open
Fcn' to load the blockset on starting-up: An error occured while parsing "...\slblocks.m". Error Message: Reference to non-existent field 'OpenFcn'..)
The blocks itself works as proposed if the testmodel is created inside the folder 'gtk_ml_supp' (only a Warning of a depricated block parameter occurs).

Regards,

Updates
05 Jun 2012

V1.1 Changes:
- SigName field is enabled its values is used as signal name in GTKWave
- Logging Variable names are now prefix with 'gw' to keep them isolated from other workspace variables.

12 Jun 2012

Changes in v1.2
--------------------------
Modified file GTKWaveCreateVCD.m to:
- Revome the characters $, # from identifier name.
- Modify the resolution calculation to support upto 1 fs resolution.

29 Jun 2012

Updated description.

30 Jul 2012

Updated the "slblock.m" file to remove minor bug and make tool compatible for R2012a.

14 Sep 2012

V2.0 : Made compatible to R2012a.
       Memory leak issue fixed.

Contact us