📄 cast_c6xx.m
字号:
function dummy = cast_C6xx(rr,datatype)
% Private. Casting for C6xx register symbols.
% Copyright 2002 The MathWorks, Inc.
% $Revision: 1.3 $ $Date: 2002/05/13 18:31:55 $
if (rr.bitsperstorageunit ~=32)
error('A register unit must contain 32 bits for C6xx register objects');
end
% Initialize (pre/post)pad
rr.prepad = 0; % Modified later, if necessary
rr.postpad = 0;
switch datatype
case {'double','long double'},
totalbits = 64;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'float';
case {'single','float'}
totalbits = 32;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'float';
case {'long','signed long'}
totalbits = 64;
rr.postpad = 24; % c6000 specific!
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case {'int','signed int'}
totalbits = 32;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'short'
totalbits = 32;
rr.postpad = 16;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case {'char','signed char'}
totalbits = 32;
rr.postpad = 24;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'unsigned long',
totalbits = 64;
rr.postpad = 24;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'unsigned int'
totalbits = 32;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'unsigned short'
totalbits = 32;
rr.postpad = 16;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'unsigned char'
totalbits = 32;
rr.postpad = 24;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'int64'
rr.storageunitspervalue = round(64/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'uint64'
rr.storageunitspervalue = round(64/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'int32'
rr.storageunitspervalue = round(32/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'uint32'
rr.storageunitspervalue = round(32/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'int16'
totalbits = 32;
rr.postpad = 16;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'uint16'
totalbits = 32;
rr.postpad = 16;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
case 'int8'
totalbits = 32;
rr.postpad = 24;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'signed';
case 'uint8'
totalbits = 32;
rr.postpad = 24;
rr.storageunitspervalue = round(totalbits/rr.bitsperstorageunit);
rr.represent = 'unsigned';
%==========================================================================
% Special TI types
case 'Q0.15',
%rr.storageunitspervalue = round(16/rr.bitsperstorageunit);
rr.storageunitspervalue = 1;
rr.postpad = 16;
rr.represent = 'fract';
rr.binarypt = 15; % future expansion?
case 'Q0.31',
%rr.storageunitspervalue = round(32/rr.bitsperstorageunit);
rr.storageunitspervalue = 1;
rr.represent = 'fract';
rr.binarypt = 31; % future expansion?
otherwise,
error(['DATATYPE:' datatype ' is not recognized']);
end
% [EOF] cast_C6xx.m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -