%% 
%% $Revision: 1.1.6.2 $
%% 
%%
%% Copyright 1994-2003 The MathWorks, Inc.
%%
%% Abstract: Memory block target file.

%implements Memory "C"

%% Function: BlockInstanceSetup ==============================================
%% Abstract:
%%   Set expression folding compliance
%%
%function BlockInstanceSetup(block, system) void
  %<LibBlockSetIsExpressionCompliant(block)>
%endfunction


%% Function: InitializeConditions =============================================
%% Abstract:
%%      DWork.PrevU = X0
%%
%function InitializeConditions(block, system) Output
  /* %<Type> Block: %<Name> */
  %assign inputDataType = LibBlockInputSignalDataTypeId(0)
  %assign rollRegion = [0:%<LibBlockOutputSignalWidth(0)-1>]
  %assign rollVars = ["DWork", "P"]
  %roll idx = rollRegion, lcv = RollThreshold, block, "Roller", rollVars
    %assign x0r = LibBlockParameter(X0,"",lcv,"%<tRealPart>%<idx>")
    %assign lhs = LibBlockDWork(block.DWork,"",lcv,"%<tRealPart>%<idx>")
    %<lhs> = %<x0r>;
    %if LibBlockOutputSignalIsComplex(0)
      %assign lhs = LibBlockDWork(block.DWork,"",lcv,"%<tImagPart>%<idx>")
      %assign x0i = SLibGetFormattedValueFromId(LibBlockParameterDataTypeId(X0), 0)
      %if LibBlockParameterIsComplex(X0)
        %assign x0i = LibBlockParameter(X0,"",lcv,"%<tImagPart>%<idx>")
      %endif
      %<lhs> = %<x0i>;
    %endif
  %endroll

%endfunction %% InitializeConditions


%% Function: Outputs ==========================================================
%% Abstract:
%%      Y = DWork.PrevU
%%
%function Outputs(block, system) Output
  %assign rollVars   = ["Y", "DWork"]
  %assign rollRegion = [0:%<LibBlockOutputSignalWidth(0)-1>]
  %roll idx = rollRegion, lcv = RollThreshold, block, "Roller", rollVars
    %assign dwork = LibBlockDWork(block.DWork,"",lcv,idx)
    %assign y = LibBlockOutputSignal(0, "", lcv, idx)
    %<y> = %<dwork>;
  %endroll

%endfunction


%% Function: Update ===========================================================
%% Abstract:
%%      DWork.PrevU = U
%%
%function Update(block, system) Output
  /* %<Type> Block: %<Name> */
  %assign rollVars = ["U", "DWork"]
  %roll idx = RollRegions, lcv = RollThreshold, block, "Roller", rollVars
    %assign dwork = LibBlockDWork(block.DWork,"",lcv,idx)
    %assign u = LibBlockInputSignal(0,"",lcv,idx)
    %<dwork> = %<u>;
  %endroll

%endfunction


%% [EOF] mem.tlc
