⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sb2sllgc.m

📁 数字通信第四版原书的例程
💻 M
字号:
function lo=sb2sllgc(x,y,blkname);
%SB2SLLGC converts logic blocks to SIMULINK.
%       SB2SLLGC(X,Y,BLKNAME) converts SystemBuild blocks to SIMULINK
%	blocks.  X specifies the logical operator of the block (e.g.,
%	OR, AND, XOR).  Y specifies the number of inputs in the block.
%	BLKNAME is a string containing the name of the block.

% Wes Wang 10/2/92 -- 10/6/92
% Copyright (c) 1990-93 by The MathWorks, Inc.
% $Revision: 1.12 $  $Date: 1993/08/15 20:17:56 $

if strcmp(x,'AND')
  temp = 'AND';
  temp2 = 'tmp=2^@1;lo=zeros(tmp,1);lo(tmp)=1;';
elseif strcmp(x,'NOR')
  temp = 'NOR';
  temp2 = 'tmp=2^@1;lo=zeros(tmp,1);lo(1)=1;';
  if y == 1
    temp = 'NOT';
  end;     
elseif strcmp(x,'EQ')
  temp = 'EQ';
  temp2 = 'tmp=2^@1;lo=zeros(tmp,1);lo(1)=1;lo(tmp)=1;';
elseif strcmp(x,'NAND')
  temp = 'NAND';
  temp2 = 'tmp=2^@1;lo=ones(tmp,1);lo(tmp)=0;';
elseif strcmp(x,'OR')
  temp = 'OR';
  temp2 = 'tmp=2^@1;lo=ones(tmp,1);lo(1)=0;';
elseif strcmp(x,'NEQ')
  temp = 'NEQ';
  temp2 = 'tmp=2^@1;lo=ones(tmp,1);lo(1)=0;lo(tmp)=0;';
elseif strcmp(x,'NOT')
  temp = 'NOT';
  temp2 = 'tmp=2^@1;lo=zeros(tmp,1);lo(1)=1;';
end;
set_param(blkname,'Mask Display',temp);
set_param(blkname,...
		'Truth Table','lo',...
		'Mask Display',temp,...
		'Mask Type',[temp ' Logic'],...
		'Mask Dialogue',['Vector input scale output ' temp '|Input vector size']);
set_param(blkname,...
		'Mask Translate',temp2,...
		'Mask Help',['Multi-Input/Single-Output ' temp ' logic operation.'],...
		'Mask Entries',[num2str(y) '\/']);

%set_param(blkname,...
%   'Truth Table','lo',...
%   'Mask Display','Logical\nOperator',...
%   'Mask Type','Logical Operator',...
%   'Mask Dialogue','logic|operator AND/NAND/OR/NOR/EQ/NEQ|number of input')
%set_param(blkname,...
%   'Mask Translate','lo=logic_mf(@1,@2);',...
%   'Mask Help','',...
%   'Mask Entries',['''' x '''\/' num2str(y) '\/']);


⌨️ 快捷键说明

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