manchestercmds.m

来自「Matlab 与 modelsim 协同仿真的例程设置好modelsim运行环境」· M 代码 · 共 45 行

M
45
字号
function tclcmd = manchestercmds
% MANCHESTERCMDS - Creates Tcl commands for Manchester Model
%   The returned cell array can be passed as parameters ('cmd') to
%   VSIMULINK.  This will lauching ModelSim and build the VHDL
%   source files included with the demo.  Also, the model will
%   be loaded for cosimulation with MANCHESTERMODEL.MDL and
%   MANCHESTERMODELCOMMBLKS.MDL
%
% See also VSIM

%   Copyright 2003-2005 The MathWorks, Inc.
%   $Revision: 1.10.6.3.22.1 $ $Date: 2007/01/21 18:21:20 $
%

srcfile1 = fullfile(matlabroot,'toolbox','modelsim','modelsimdemos','vhdl','manchester','statecnt.vhd');
srcfile2 = fullfile(matlabroot,'toolbox','modelsim','modelsimdemos','vhdl','manchester','iqconv.vhd');
srcfile3 = fullfile(matlabroot,'toolbox','modelsim','modelsimdemos','vhdl','manchester','decoder.vhd');
srcfile4 = fullfile(matlabroot,'toolbox','modelsim','modelsimdemos','vhdl','manchester','manchester.vhd');

unixsrcfile1 = ['"' strrep(srcfile1,'\','/') '"']; 
unixsrcfile2 = ['"' strrep(srcfile2,'\','/') '"']; 
unixsrcfile3 = ['"' strrep(srcfile3,'\','/') '"']; 
unixsrcfile4 = ['"' strrep(srcfile4,'\','/') '"']; 

if strcmp(computer,'PCWIN'),
    projdir = tempdir;  % Change to writable directory of your choosing
else
    projdir = tempname;
    mkdir(tempdir,strrep(projdir,tempdir,''));
end
unixprojdir = strrep(projdir,'\','/'); 
tclcmd = { 
            'catch { wm geometry . 500x200+0+0 }',... % Try moving ModelSim out of the way
           ['cd ',unixprojdir],...            
            'vlib work',... %create library (if necessary)
           ['vcom -novopt -performdefaultbinding ' unixsrcfile1],...
           ['vcom -novopt -performdefaultbinding ' unixsrcfile2],...
           ['vcom -novopt -performdefaultbinding ' unixsrcfile3],...
           ['vcom -novopt -performdefaultbinding ' unixsrcfile4],...           
            'vsimulink -novopt work.manchester',...
           % originally done here, but moved to Tcl before 
           % 'force sim:/manchester/enable 1 0',...  
           % 'force sim:/manchester/reset 1 0, 0 1000 ns',...
         };

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?