%% sdspmax2_generic.tlc %% %% TLC code generation file for DSP Blockset Maximum block (sdspmax2) %% %% Copyright (c) 1995-2000 The MathWorks, Inc. %% $Revision: 1.4 $ $Date: 2000/04/19 19:39:45 $ %% %% Abstract: %% Common utilities for max reset and computation function code generation. %if EXISTS("_SDSPMAX2_GENERIC_") == 0 %assign _SDSPMAX2_GENERIC_ = 1 %% =========================================================================== %% Function: XlatFcnTypeToPrefix ============================================= %% Abstract: %% Translate the FcnType index to a prefix string %% Returns one of the following strings: %% VI, V, I, NFR, FR %% %function XlatFcnTypeToPrefix(block) void %switch MaxIdx %case 0 %case 3 %case 6 %case 9 %assign prefix = "" %break %case 1 %case 4 %case 7 %case 10 %assign prefix = "NF" %break %case 2 %case 5 %case 8 %case 11 %assign prefix = "F" %break %default %error "Unrecognized MaxIdx index." %endswitch %switch FcnType %case 1 %assign suffix = "VI" %break %case 2 %assign suffix = "V" %break %case 3 %assign suffix = "I" %break %case 4 %assign suffix = "R" %break %default %error "Unrecognized FcnType index." %endswitch %return prefix + suffix %endfunction %% XlatFcnTypeToPrefix %% Function: getGenericMaxFcnName ================================================== %% Abstract: %% Produces fcn names according to the following convention: %% %% Function name coding: %% TMWDSP_[fcnStr][Input][Type](...) %% %% Input is one of the following: %% D: Double %% Z: Complex Double %% S: Single %% C: Complex Single %% Type is one of the following: %% V/I/VI = Non-running, value and/or index outputs %% NFR = Non-frame Running %% FR = Frame Running %% %% Examples: %% TMWDSP_[fcnStr]ZVI - Complex double input, value & index output %% TMWDSP_[fcnStr]SFR - Single-prec input, frame-based running output %% %function getGenericMaxFcnName(block, fcnStr) void %switch DTypeId %case tSS_DOUBLE %if InCplx %assign MaxDType = "Z" %else %assign MaxDType = "D" %endif %break %case tSS_SINGLE %if InCplx %assign MaxDType = "C" %else %assign MaxDType = "S" %endif %break %default %error "Data type not handled." %endswitch %assign MaxOp = XlatFcnTypeToPrefix(block) %return "TMWDSP_" + fcnStr + MaxDType + MaxOp %endfunction %% getGenericMaxFcnName %% Function: GenerateGenericMaxFcnComment ======================================== %% Abstract: %% %function GenerateGenericMaxFcnComment(block,fcnName,fcnType) void %% %assign cplx = (InCplx) ? "Complex" : "Real" %% %switch DTypeId %case tSS_DOUBLE %assign slang = "double-precision" %break %case tSS_SINGLE %assign slang = "single-precision" %break %default %error "Unsupported data type encountered: id = %" %endswitch %% %switch MaxIdx %case 0 %case 3 %case 6 %case 9 %assign prefix = "" %break %case 1 %case 4 %case 7 %case 10 %assign prefix = "non-frame" %break %case 2 %case 5 %case 8 %case 11 %assign prefix = "frame-based" %break %default %error "Unrecognized MaxIdx index." %endswitch %switch FcnType %case 1 %assign suffix = "value and index" %break %case 2 %assign suffix = "value" %break %case 3 %assign suffix = "index" %break %case 4 %assign suffix = "running" %break %default %error "Unrecognized FcnType index." %endswitch %openfile buffer /* * Function: % * Abstract: * DSP Blockset % % % function * Input: %, % */ %closefile buffer %return buffer %endfunction %% GenerateGenericMaxFcnComment %% Function: InlineMaxInstance ======================================== %% Abstract: %% %function InlineMaxInstance(block) void %if InCplx %if FcnType < 4 %assign inline_this = inline_cplx_nonrunning %else %assign inline_this = (InFrame) ? inline_cplx_running_frame \ : inline_cplx_running %endif %else %if FcnType < 4 %assign inline_this = inline_real_nonrunning %else %assign inline_this = (InFrame) ? inline_real_running_frame \ : inline_real_running %endif %endif %return inline_this %endfunction %% InlineMaxInstance %endif %% _SDSPMAX2_GENERIC_ %% [EOF] sdspmax2_generic.tlc