function openModelSimDemoModel(demoName)
% Helper function for ModelSim demos
    
% 
% 
% Copyright 2006-2011 The MathWorks, Inc.

    baseDir = fullfile(matlabroot,'toolbox','edalink','extensions','modelsim','modelsimdemos');
    
    switch(demoName)     
        % ---------- CosimAlgInSystemC ----------            
        case 'sl_streaming_alg'
            addpath(fullfile(baseDir,'CosimAlgInSystemC'));
            open_system('sl_streaming_alg_MQ');
        case 'sl_buffered_alg'
            addpath(fullfile(baseDir,'CosimAlgInSystemC'));
            open_system('sl_buffered_alg_MQ');
        % ---------- CosimTbInSystemC ----------  
        case 'sl_tb'
            addpath(fullfile(baseDir,'CosimTbInSystemC'));
            open_system('sl_tb_MQ');
        % ---------- Other demos ---------------
        case 'manchester_batch'
            mdlname = fullfile(baseDir,'Manchester_batch','manchester_batch.mdl');
            open_system(mdlname);
        case 'mixedmanchester'
            mdlname = fullfile(baseDir,'mixedmanchester.mdl');
            open_system(mdlname);
        case 'gainx2'
            addpath(fullfile(baseDir,'Gainx2'));
            open_system('gainx2_mq');
        case 'echo_filter_batch'
            addpath(fullfile(baseDir,'Filter_batch'));
            echodemo('filter_batch_modelsim.m');
        case 'run_filter_batch'
            addpath(fullfile(baseDir,'Filter_batch'));
            filter_batch_modelsim;
        case 'timescales_pane'
            addpath(fullfile(baseDir,'Timescales_pane'));
            open_system('parity_check');
        case 'timescales_clock1'
            addpath(fullfile(baseDir,'Timescales_clock'));
            open_system('parity_check_clk');
        case 'timescales_clock2'
            addpath(fullfile(baseDir,'Timescales_clock'));
            open_system('parity_check_convclk');
        case 'timescales_clock3'
            addpath(fullfile(baseDir,'Timescales_clock'));
            open_system('parity_check_reset');
        % -----------------------------------------
        otherwise
            error(message('HDLLink:DemoSupport:BadDemoName', demoName));
    end
    
end
