%%
%%
%%
%%
%%Thisfilecontainstlccodeforgenerationoffixedpoint
%%lookuptables
%%
%%Copyright1994-2018TheMathWorks,Inc.
%%
 
%%
%%createvariabletoindicatethatthisfilehasalreadybeenloaded
%%
%if EXISTS("_FIXPTLOOK2D_") == 0
%assign _FIXPTLOOK2D_ = 1
 
 
%include "fixptlook.tlc"
%include "fixptlook_support.tlc"
%include "fixptlook_search.tlc"
 
%%Function:fxpLookup2DTrivTriv==========================
%%
%function fxpLookup2DTrivTriv(...
           y0Label, y0DT,...
           u0Label, u0DT, u0BreakPointInfo,...
           u1Label, u1DT, u1BreakPointInfo,...
           y0Data, y0DataDT, y0DataCategory,...
           roundMode,satMode) Output
  %%
  %assign u0IndexExpr = FixPt_IndexSearchTrivial(u0Label,u0DT,u0BreakPointInfo)
  %%
  %assign u1IndexExpr = FixPt_IndexSearchTrivial(u1Label,u1DT,u1BreakPointInfo)
  %%
  %%assign indexExpr = "(%<u0IndexExpr> + ( % * %<u1IndexExpr> ))"
  %assign indexExpr = "idxU0 + % * idxU1"
  %%
  %assign y0DataIsComplex = FixPt_HelperVarIsComplex(y0Data, y0DataCategory)
  %%
  %%
  %assign y0DataAddr = FixPt_HelperGetRValuePtr("","",0,"",y0Data,y0DataCategory)
  %%
  {
    %<FixPt_uint_label> idxY;
 
    idxY = %<u1IndexExpr>;
    idxY *= %;
    idxY += %<u0IndexExpr>;
       
    %if y0DataIsComplex
      %<FixPt_HelperInterpolateOutputEqualsDataPoint(...
        "idxY",...
        y0Label,y0DT,"variable",...
        "((%<y0DataDT.NativeType> *)(%<y0DataAddr>))", y0DataDT, "real pointer to complex",...
        roundMode,satMode)>/
    %else
      %<FixPt_HelperInterpolateOutputEqualsDataPoint(...
        "idxY",...
        y0Label,y0DT,"variable",...
        y0DataAddr, y0DataDT, "pointer",...
        roundMode,satMode)>/
    %endif
  }
%endfunction %% fxpLookup2DTrivTriv
 
     
%%Function:fxpLookup2DUnevenUneven============================
%%
%%
%function fxpLookup2DUnevenUneven(...
           y0Label, y0DT,...
           u0Label, u0DT,...
           u1Label, u1DT,...
           y0Data, y0DataDT, y0DataCategory,...
           u0Data, u0DataDT, u0DataCategory,...
           u1Data, u1DataDT, u1DataCategory,...
           roundMode,satMode) Output
  %%
  %assign yDataIsComplex = FixPt_HelperVarIsComplex(y0Data, y0DataCategory)
  %%
  %% Create a string to represent the utility
  %%
  %assign utilityName = FixPt_UtilityMakeName("Look2D")
  %%
  %if yDataIsComplex
    %assign utilityName = utilityName + "Cx"
  %endif
  %%
  %% identify current storage types
  %%
  %assign utilityName = FixPt_UtilityNameAppendDTPair(utilityName,y0DT,y0DataDT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendDTPair(utilityName,u0DT,u0DataDT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendDTPair(utilityName,u1DT,u1DataDT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendMode(utilityName,roundMode,satMode)
  %%
  %% END: Create a string to represent the utility
   
  %% Register utility name in the Shared Code Manager
  %if SLibInBlockScope()
    %assign block = SLibGetCurrentBlock()
  %else
    %assign block = ""
  %endif
  %assign utilityName = SLibRegisterSharedUtility(block, utilityName)
   
  %%
  %% Output a call to the utility function
  %%
  %assign y0DataAddr = FixPt_HelperGetRValuePtr("","",0,"",y0Data,y0DataCategory)
  %%
  %assign u0DataAddr = FixPt_HelperGetRValuePtr("","",0,"",u0Data,u0DataCategory)
  %%
  %assign u1DataAddr = FixPt_HelperGetRValuePtr("","",0,"",u1Data,u1DataCategory)
  %%
  %assign iHiU0 = FixPt_HelperVarHiIndex(u0Data, u0DataCategory)
  %%
  %assign iHiU1 = FixPt_HelperVarHiIndex(u1Data, u1DataCategory)
  %%
  %if yDataIsComplex
    %assign y0Arg = "(%<y0DT.NativeType> *)(&(%<y0Label>))"
    %assign y0DataArg = "(%<y0DataDT.NativeType> *)(%<y0DataAddr>)"
  %else
    %assign y0Arg = "&(%<y0Label>)"
    %assign y0DataArg = y0DataAddr
  %endif
  %%
  %<FcnTrackSharedUtilHeaderFileUsage(utilityName + ".h", TLC_FALSE)>
  %<utilityName>( %<y0Arg>, %<y0DataArg>, %<u0Label>, %<u0DataAddr>, %<iHiU0>, %<u1Label>, %<u1DataAddr>, %<iHiU1>);
  %%
  %% determine if the required utility has already been defined
  %% If it has not, then create the definition.
  %%
  %if !(ISFIELD(FixPtUtils,utilityName))
    %%
    %% register that utility is being defined
    %%
    %assign tmpRet = SETFIELD(FixPtUtils,utilityName,1)
    %<LibPushEmptyStackSharedUtils()>/
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %% open a buffer to hold the utility definition
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %openfile utilityDef
    %assign local_pY = "pY"
    %assign local_pYData = "pYData"
    %assign local_u0Label = "u0"
    %assign local_u1Label = "u1"
    %assign local_pU0Data = "pU0Data"
    %assign local_pU1Data = "pU1Data"
    %assign local_iHiU0Label = "iHiU0"
    %assign local_iHiU1Label = "iHiU1"
    %%
    %% create first line of utility macro or function
    %%
    %assign fcnAbstract = "Lookup 2D Lookup Utility " + utilityName
    %assign fcnName = utilityName
    %assign fcnReturns = "void"
    %assign fcnParams = "%<y0DT.NativeType> *%<local_pY>, " + ...
      "const %<y0DataDT.NativeType> *%<local_pYData>, " + ...
      ...
      "%<u0DT.NativeType> %<local_u0Label>, " + ...
      "const %<u0DataDT.NativeType> *%<local_pU0Data>, " + ...
      "%<FixPt_uint_label> %<local_iHiU0Label>, " + ...
      ...
      "%<u1DT.NativeType> %<local_u1Label>, " + ...
      "const %<u1DataDT.NativeType> *%<local_pU1Data>, " + ...
      "%<FixPt_uint_label> %<local_iHiU1Label>"
     
    %assign staticSpecifier = LibGetStaticStorageSpecifierIfNeeded()
    %assign funcDecRoot = staticSpecifier + fcnReturns + " " + fcnName + "(" + fcnParams + ")"
    %%
    %openfile funcProto
    %<funcDecRoot>;
    %closefile funcProto
    %%
    %selectfile utilityDef
    %createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; ...
      Abstract fcnAbstract; Category "utility"; GeneratedBy "fixptlook2D.tlc"}
    %<SLibDumpFunctionBanner(fcnRec)>
    %undef fcnRec
    %<funcDecRoot>
    %%
    %if yDataIsComplex
      %assign y0FcnCategory = "real pointer to complex"
      %assign y0FcnDataCategory = "real pointer to complex"
    %else
      %assign y0FcnCategory = "pointer"
      %assign y0FcnDataCategory = "pointer"
    %endif
    %%
    %assign xDataCategory = "pointer"
    {
      %<FixPt_uint_label> iLeftU0, iRghtU0, iLeftU1, iRghtU1;
       
      %%
      %% find u0 indices
      %%
      %<FixPt_IndexSearchUneven("iLeftU0","iRghtU0",...
        local_u0Label, u0DT,...
        local_pU0Data, u0DataDT,...
        local_iHiU0Label,...
        "Below")>
      %%
      %% find u1 indices
      %%
      %<FixPt_IndexSearchUneven("iLeftU1","iRghtU1",...
        local_u1Label, u1DT,...
        local_pU1Data, u1DataDT,...
        local_iHiU1Label,...
        "Below")>
      %%
      %% do interpolation calculations
      %%
      %<fxpInterpolate2DUnevenUneven(...
        local_pY, y0DT, yDataIsComplex, ...
        local_u0Label, u0DT, ...
        local_u1Label, u1DT, ...
        local_pYData, y0DataDT, ...
        local_pU0Data, u0DataDT, ...
        local_pU1Data, u1DataDT, ...
        "iLeftU0","iRghtU0",...
        "iLeftU1","iRghtU1",...
        local_iHiU0Label,...
        roundMode,satMode)>/
      %%
    }
    %closefile utilityDef
    %%
    %<SLibAddMathIncludeForUtilsSourceCode(utilityDef)>
    %<SLibDumpUtilsSourceCodeAndCacheFunctionPrototype(utilityName,funcProto,utilityDef)>/
    %%
    %assign GSUStackBuf = LibPopStackSharedUtilsIncludes()
  %endif %% definition of utility
%endfunction %% fxpLookup2DUnevenUneven
 
 
 
%%Function:fxpLookup2DEvenEven============================
%%
%%
%function fxpLookup2DEvenEven(...
           y0Label, y0DT,...
           u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
           u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
           y0Data, y0DataDT, y0DataCategory,...
           roundMode,satMode) Output
  %%
  %if !u0BreakPointInfo.evenlySpaced
    %%START_ASSERT
    %<LibReportFatalError("u0 must be evenly spaced.")>
    %%END_ASSERT
  %endif
  %%
  %if !u1BreakPointInfo.evenlySpaced
    %%START_ASSERT
    %<LibReportFatalError("u1 must be evenly spaced.")>
    %%END_ASSERT
  %endif
  %%
  %assign yDataIsComplex = FixPt_HelperVarIsComplex(y0Data, y0DataCategory)
  %%
  %% Create a string to represent the utility
  %%
  %assign utilityName = FixPt_UtilityMakeName("Look2D")
  %%
  %if u0SearchMethod == searchEven
    %%
    %assign utilityName = utilityName + "Even"
  %else
    %assign utilityName = utilityName + "2e%<u0BreakPointInfo.spacingPow2Exp>"
  %endif
  %%
  %if u1SearchMethod == searchEven
    %%
    %assign utilityName = utilityName + "Even"
  %else
    %assign utilityName = utilityName + "2e%<u1BreakPointInfo.spacingPow2Exp>"
  %endif
  %%
  %if yDataIsComplex
    %assign utilityName = utilityName + "_Cplx"
  %endif
  %%
  %% identify current storage types
  %%
  %assign utilityName = FixPt_UtilityNameAppendDTPair(utilityName,y0DT,y0DataDT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendDT(utilityName,u0DT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendDT(utilityName,u1DT)
  %%
  %assign utilityName = FixPt_UtilityNameAppendMode(utilityName,roundMode,satMode)
  %%
  %% END: Create a string to represent the utility
   
  %% Register utility name in the Shared Code Manager
  %if SLibInBlockScope()
    %assign block = SLibGetCurrentBlock()
  %else
    %assign block = ""
  %endif
  %assign utilityName = SLibRegisterSharedUtility(block, utilityName)
   
  %%
  %% Output a call to the utility function
  %%
  %assign y0DataAddr = FixPt_HelperGetRValuePtr("","",0,"",y0Data,y0DataCategory)
  %%
  %assign iHiU0 = u0BreakPointInfo.indexHi
  %%
  %assign iHiU1 = u1BreakPointInfo.indexHi
  %%
  %if yDataIsComplex
    %assign y0Arg = "(%<y0DT.NativeType> *)(&(%<y0Label>))"
    %assign y0DataArg = "(%<y0DataDT.NativeType> *)(%<y0DataAddr>)"
  %else
    %assign y0Arg = "&(%<y0Label>)"
    %assign y0DataArg = y0DataAddr
  %endif
  %%
  %<FcnTrackSharedUtilHeaderFileUsage(utilityName + ".h", TLC_FALSE)>
  %assign funcCall = "%<utilityName>( %<y0Arg>, %<y0DataArg>, %<u0Label>, %<u0BreakPointInfo.valueLo>, %<iHiU0>"
  %%
  %if u0SearchMethod == searchEven
    %%
    %assign funcCall = funcCall + ", %<u0BreakPointInfo.spacingValue>"
  %endif
  %%
  %assign funcCall = funcCall + ", %<u1Label>, %<u1BreakPointInfo.valueLo>, %<iHiU1>"
  %%
  %if u1SearchMethod == searchEven
    %%
    %assign funcCall = funcCall + ", %<u1BreakPointInfo.spacingValue>"
  %endif
  %%
  %assign funcCall = funcCall + ");"
  %%
  %<funcCall>
  %%
  %% determine if the required utility has already been defined
  %% If it has not, then create the definition.
  %%
  %if !(ISFIELD(FixPtUtils,utilityName))
    %%
    %% register that utility is being defined
    %%
    %assign tmpRet = SETFIELD(FixPtUtils,utilityName,1)
    %<LibPushEmptyStackSharedUtils()>/
    %%
    %% determine the appropriate size for an unsigned type
    %%
    %assign typeForIndex = utilUnsignedTypeFrom2xDT(u0DT,u1DT)
    %%
    %assign typeForAdjustU0 = utilFloatOrUnsignedTypeFromDT(u0DT)
    %assign typeForAdjustU1 = utilFloatOrUnsignedTypeFromDT(u1DT)
    %%
    %assign adjustU0DT = Fixpt_GetDataTypeFromNativeType(typeForAdjustU0)
    %assign adjustU1DT = Fixpt_GetDataTypeFromNativeType(typeForAdjustU1)
 
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %% open a buffer to hold the utility definition
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %openfile utilityDef
    %%
    %% create first line of utility macro or function
    %%
    %assign fcnAbstract = "Lookup 2D Lookup Utility " + utilityName
    %assign fcnName = utilityName
    %assign fcnReturns = "void"
    %assign fcnParams = "%<y0DT.NativeType> *pY" + ...
      ", const %<y0DataDT.NativeType> *pYData" + ...
      ...
      ", %<u0DT.NativeType> u0" + ...
      ", %<u0DT.NativeType> u0Lo" + ...
      ", %<typeForIndex> idxU0Max"
    %%
    %if u0SearchMethod == searchEven
      %%
      %assign u0SpacingVarLabel = "u0Spacing"
      %%
      %assign fcnParams = fcnParams + ...
        ", %<typeForAdjustU0> %<u0SpacingVarLabel>"
    %else
      %assign u0SpacingVarLabel = "%<u0BreakPointInfo.spacingValue>"
    %endif
    %%
    %assign fcnParams = fcnParams + ...
      ", %<u1DT.NativeType> u1" + ...
      ", %<u1DT.NativeType> u1Lo" + ...
      ", %<typeForIndex> idxU1Max"
    %%
    %if u1SearchMethod == searchEven
      %%
      %assign u1SpacingVarLabel = "u1Spacing"
      %%
      %assign fcnParams = fcnParams + ...
        ", %<typeForAdjustU1> %<u1SpacingVarLabel>"
    %else
      %assign u1SpacingVarLabel = "%<u1BreakPointInfo.spacingValue>"
    %endif
    %%
 
    %assign staticSpecifier = LibGetStaticStorageSpecifierIfNeeded()
    %assign funcDecRoot = staticSpecifier + fcnReturns + " " + fcnName + "(" + fcnParams + ")"
    %%
    %openfile funcProto
    %<funcDecRoot>;
    %closefile funcProto
    %%
    %selectfile utilityDef
    %createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; ...
      Abstract fcnAbstract; Category "utility"; GeneratedBy "fixptlook2D.tlc"}
    %<SLibDumpFunctionBanner(fcnRec)>
    %undef fcnRec
    %<funcDecRoot>
    %%
    %if yDataIsComplex
      %assign y0FcnCategory = "real pointer to complex"
      %assign y0FcnDataCategory = "real pointer to complex"
    %else
      %assign y0FcnCategory = "pointer"
      %assign y0FcnDataCategory = "pointer"
    %endif
    %%
    {
      %<typeForIndex> idxU0Left = 0U;
      %<typeForIndex> idxU0Rght = 0U;
      %<typeForIndex> idxU1Left = 0U;
      %<typeForIndex> idxU1Rght = 0U;
       
      %<typeForAdjustU0> u0MinusLeft = %<FixPt_GetGroundValueOrNameFromDataTypeRec(adjustU0DT, TLC_FALSE)>;
      %<typeForAdjustU1> u1MinusLeft = %<FixPt_GetGroundValueOrNameFromDataTypeRec(adjustU1DT, TLC_FALSE)>;
       
      %<FixPt_IndexSearchEvenExtra(...
        "idxU0Left", ...
        "idxU0Rght",...
        "u0", ...
        u0DT, ...
        "u0Lo", ...
        "idxU0Max", ...
        "u0MinusLeft", ...
        adjustU0DT, ...
        typeForAdjustU0, ...
        typeForIndex, ...
        u0SpacingVarLabel, ...
        u0BreakPointInfo.spacingPow2Exp, ...
        u0SearchMethod)>/
          
      %<FixPt_IndexSearchEvenExtra(...
        "idxU1Left", ...
        "idxU1Rght",...
        "u1", ...
        u1DT, ...
        "u1Lo", ...
        "idxU1Max", ...
        "u1MinusLeft", ...
        adjustU1DT, ...
        typeForAdjustU1, ...
        typeForIndex, ...
        u1SpacingVarLabel, ...
        u1BreakPointInfo.spacingPow2Exp, ...
        u1SearchMethod)>/
          
      %assign u0MinusLeftLabel = utilDownCastTempExpression( u0DT, "u0MinusLeft" )
      %assign u1MinusLeftLabel = utilDownCastTempExpression( u1DT, "u1MinusLeft" )
      %assign u0SpacingLabel = utilDownCastTempExpression( u0DT, u0SpacingVarLabel )
      %assign u1SpacingLabel = utilDownCastTempExpression( u1DT, u1SpacingVarLabel )
      %%
      %% do interpolation calculations
      %%
      %<fxpInterpolate2DEvenEven(...
        "pY", y0DT, yDataIsComplex, ...
        u0MinusLeftLabel, u0DT, ...
        u0SpacingLabel,...
        u0SearchMethod != searchEven, ...
        u0BreakPointInfo.spacingPow2Exp, ...
        u1MinusLeftLabel, u1DT, ...
        u1SpacingLabel,...
        u1SearchMethod != searchEven, ...
        u1BreakPointInfo.spacingPow2Exp, ...
        "pYData", y0DataDT, ...
        "idxU0Left", "idxU0Rght", ...
        "idxU1Left", "idxU1Rght", ...
        "idxU0Max",...
        roundMode,satMode)>/
    }
    %closefile utilityDef
    %%
    %<SLibAddMathIncludeForUtilsSourceCode(utilityDef)>
    %<SLibDumpUtilsSourceCodeAndCacheFunctionPrototype(utilityName,funcProto,utilityDef)>/
    %%
    %assign GSUStackBuf = LibPopStackSharedUtilsIncludes()
  %endif %% definition of utility
%endfunction %% fxpLookup2DEvenEven
 
 
 
%%Function:fxpLookup2DUneven_Other==========================================
%%
%%
%function fxpLookup2DUneven_Other(...
           y0Label, y0DT,...
           u0Label, u0DT,...
           u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
           y0Data, y0DataDT, y0DataCategory,...
           u0Data, u0DataDT, u0DataCategory,...
           roundMode,satMode) Output
  %%
  %assign mootBreakPointInfo = FixPt_BreakPointInfoDefault()
  %%
  %% searchTrivial
  %% searchPow2
  %% searchEven
  %%
  {
    %<FixPt_uint_label> iLeftU0, iRghtU0, iLeftU1, iRghtU1;
     
    %%
    %% find u0 indices
    %%
    %<FixPt_IndexSearch("iLeftU0","iRghtU0",...
      u0Label, u0DT,...
      u0Data, u0DataDT, mootBreakPointInfo, u0DataCategory,...
      "Below")>
    %%
    %% find u1 indices
    %%
    %<FixPt_IndexSearchEven("iLeftU1","iRghtU1",...
      u1Label, u1DT, u1BreakPointInfo,...
      "Below")>/
    %%
    %% do interpolation calculations
    %%
    %<LibFixPtInterpolate2D_New(...
      y0Label, y0DT, "variable",...
      u0Label, u0DT, "variable",...
      u1Label, u1DT, "variable",...
      y0Data, y0DataDT, y0DataCategory,...
      u0Data, u0DataDT, mootBreakPointInfo, u0DataCategory,...
      "#error x", u1DT, u1BreakPointInfo, "#error x",...
      "iLeftU0","iRghtU0",...
      "iLeftU1","iRghtU1",...
      CAST( "Unsigned", SIZE(u0Data.Value, 1)), ...
      roundMode,satMode)>/
    %%
  }
%endfunction %% fxpLookup2DUneven_Other
 
 
 
%%Function:fxpLookup2D_OtherUneven==========================================
%%
%%
%function fxpLookup2D_OtherUneven(...
           y0Label, y0DT,...
           u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
           u1Label, u1DT,...
           y0Data, y0DataDT, y0DataCategory,...
           u1Data, u1DataDT, u1DataCategory,...
           roundMode,satMode) Output
  %%
  %assign mootBreakPointInfo = FixPt_BreakPointInfoDefault()
  %%
  %% searchTrivial
  %% searchPow2
  %% searchEven
  %%
  {
    %<FixPt_uint_label> iLeftU0, iRghtU0, iLeftU1, iRghtU1;
     
    %%
    %% find u0 indices
    %%
    %<FixPt_IndexSearchEven("iLeftU0","iRghtU0",...
      u0Label, u0DT, u0BreakPointInfo,...
      "Below")>/
    %%
    %% find u1 indices
    %%
    %<FixPt_IndexSearch("iLeftU1","iRghtU1",...
      u1Label, u1DT,...
      u1Data, u1DataDT, mootBreakPointInfo, u1DataCategory,...
      "Below")>
    %%
    %% do interpolation calculations
    %%
    %<LibFixPtInterpolate2D_New(...
      y0Label, y0DT, "variable",...
      u0Label, u0DT, "variable",...
      u1Label, u1DT, "variable",...
      y0Data, y0DataDT, y0DataCategory,...
      "#error x", u0DT, u0BreakPointInfo, "#error x",...
      u1Data, u1DataDT, mootBreakPointInfo, u1DataCategory,...
      "iLeftU0","iRghtU0",...
      "iLeftU1","iRghtU1",...
      "%",...
      roundMode,satMode)>/
    %%
  }
%endfunction %% fxpLookup2D_OtherUneven
 
 
 
%%Function:fxpLookup2D_Other_Other==========================================
%%
%%
%function fxpLookup2D_Other_Other(...
           y0Label, y0DT,...
           u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
           u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
           y0Data, y0DataDT, y0DataCategory,...
           roundMode,satMode) Output
  %%
  %% searchTrivial
  %% searchPow2
  %% searchEven
  %%
  %if u0SearchMethod == searchTrivial && ...
          u1SearchMethod == searchTrivial
    %%
    %<fxpLookup2DTrivTriv(...
      y0Label, y0DT,...
      u0Label, u0DT, u0BreakPointInfo,...
      u1Label, u1DT, u1BreakPointInfo,...
      y0Data, y0DataDT, y0DataCategory,...
      roundMode,satMode)>/
     
    %%
  %elseif ( u0SearchMethod == searchEven || ...
            u0SearchMethod == searchPow2 ) && ...
          ( u1SearchMethod == searchEven || ...
            u1SearchMethod == searchPow2 )
    %%
    %<fxpLookup2DEvenEven(...
      y0Label, y0DT,...
      u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
      u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
      y0Data, y0DataDT, y0DataCategory,...
      roundMode,satMode)>/
    %%
  %else
  %%
  {
    %<FixPt_uint_label> iLeftU0, iRghtU0, iLeftU1, iRghtU1;
     
    %%
    %% find u0 indices
    %%
    %<FixPt_IndexSearchEven("iLeftU0","iRghtU0",...
      u0Label, u0DT, u0BreakPointInfo,...
      "Below")>/
    %%
    %% find u1 indices
    %%
    %<FixPt_IndexSearchEven("iLeftU1","iRghtU1",...
      u1Label, u1DT, u1BreakPointInfo,...
      "Below")>/
    %%
    %% do interpolation calculations
    %%
    %<LibFixPtInterpolate2D_New(...
      y0Label, y0DT, "variable",...
      u0Label, u0DT, "variable",...
      u1Label, u1DT, "variable",...
      y0Data, y0DataDT, y0DataCategory,...
      "#error x", u0DT, u0BreakPointInfo, "#error x",...
      "#error x", u1DT, u1BreakPointInfo, "#error x",...
      "iLeftU0","iRghtU0",...
      "iLeftU1","iRghtU1",...
      "%",...
      roundMode,satMode)>/
    %%
  }
  %endif
%endfunction %% fxpLookup2D_Other_Other
 
 
 
%%Function:FixPt_SearchAndInterpolate2D==========================================
%%
%%
%function FixPt_SearchAndInterpolate2D(...
           y0Label, y0DT,...
           u0Label, u0DT,...
           u1Label, u1DT,...
           y0Data, y0DataDT, y0DataCategory,...
           u0Data, u0DataDT, u0DataBreakPointInfo, u0DataCategory,...
           u1Data, u1DataDT, u1DataBreakPointInfo, u1DataCategory,...
           roundMode,satMode) Output
  %%
  %<FixPt_CheckInputBreakpointDataTypes(u0DT,u0DataDT)>/
  %%
  %<FixPt_CheckInputBreakpointDataTypes(u1DT,u1DataDT)>/
  %%
  %assign u0SearchMethod = utilDecideSearchMethod(u0DT,u0DataDT,u0DataBreakPointInfo)
  %%
  %assign u1SearchMethod = utilDecideSearchMethod(u1DT,u1DataDT,u1DataBreakPointInfo)
  %%
  %if u0SearchMethod == searchUneven && ...
          u1SearchMethod == searchUneven
    %%
    %<fxpLookup2DUnevenUneven(...
      y0Label, y0DT, ...
      u0Label, u0DT, ...
      u1Label, u1DT, ...
      y0Data, y0DataDT, y0DataCategory, ...
      u0Data, u0DataDT, u0DataCategory, ...
      u1Data, u1DataDT, u1DataCategory, ...
      roundMode,satMode)>/
    %%
  %elseif u0SearchMethod == searchUneven
    %%
    %assign u1BreakPointInfo = FixPt_BreakPointInfoCast(u1DataBreakPointInfo,u1DataDT,u1DT)
    %%
    %<fxpLookup2DUneven_Other(...
      y0Label, y0DT, ...
      u0Label, u0DT, ...
      u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
      y0Data, y0DataDT, y0DataCategory, ...
      u0Data, u0DataDT, u0DataCategory, ...
      roundMode,satMode)>/
    %%
  %elseif u1SearchMethod == searchUneven
    %%
    %assign u0BreakPointInfo = FixPt_BreakPointInfoCast(u0DataBreakPointInfo,u0DataDT,u0DT)
    %%
    %<fxpLookup2D_OtherUneven(...
      y0Label, y0DT, ...
      u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
      u1Label, u1DT, ...
      y0Data, y0DataDT, y0DataCategory, ...
      u1Data, u1DataDT, u1DataCategory, ...
      roundMode,satMode)>/
    %%
  %else
    %%
    %assign u0BreakPointInfo = FixPt_BreakPointInfoCast(u0DataBreakPointInfo,u0DataDT,u0DT)
    %%
    %assign u1BreakPointInfo = FixPt_BreakPointInfoCast(u1DataBreakPointInfo,u1DataDT,u1DT)
    %%
    %<fxpLookup2D_Other_Other(...
      y0Label, y0DT, ...
      u0Label, u0DT, u0BreakPointInfo, u0SearchMethod, ...
      u1Label, u1DT, u1BreakPointInfo, u1SearchMethod, ...
      y0Data, y0DataDT, y0DataCategory, ...
      roundMode,satMode)>/
    %%
  %endif
%endfunction %% FixPt_SearchAndInterpolate2D
 
 
 
%%Function:LibFixPtInterpolate2D_New==========================================
%%
%%Abstract:Generatecodefora2Dtablelookup
%%
%%Synopsis:
%%
%%
%function LibFixPtInterpolate2D_New(...
            yLabel, yDT, yCategory, ...
            u0Label, u0DT, u0Category, ...
            u1Label, u1DT, u1Category, ...
            TableData, tableDataDT, tableDataCategory,...
            u0Data, u0DataDT, u0DataBreakPointInfo, u0DataCategory,...
            u1Data, u1DataDT, u1DataBreakPointInfo, u1DataCategory,...
            iU0LeftLabel, iU0RghtLabel,...
            iU1LeftLabel, iU1RghtLabel,...
            numU0ElementsLabel,...
            roundMode,satMode) Output
    %%
    %assign tableDataIsComplex = FixPt_HelperVarIsComplex(TableData, tableDataCategory)
    %%
    %if tableDataIsComplex
        %assign numCase = 2
    %else
        %assign numCase = 1
    %endif
    %%
    %% when inlining, determine if Data is evenly spaced
    %%
    %assign u0InterpTrivial = !FixPt_DataTypeIsFloat(u0DT) && ISEQUAL(u0DataBreakPointInfo.spacingValue,1) && FixPt_DataTypesSame(u0DT,u0DataDT)
    %assign u1InterpTrivial = !FixPt_DataTypeIsFloat(u1DT) && ISEQUAL(u1DataBreakPointInfo.spacingValue,1) && FixPt_DataTypesSame(u1DT,u1DataDT)
    %%
    %% Prep work
    %%
    %%
    %% create RadixOnly version of output Data Type
    %%
    %copyrecord yRadixDT yDT
    %%
    %assign yRadixDT.Bias = 0.0
    %assign yRadixDT.FracSlope = 1.0
    %%
    %% create RadixOnly version of output Data Type
    %%
    %copyrecord tableDataRadixDT tableDataDT
    %%
    %assign tableDataRadixDT.Bias = 0.0
    %assign tableDataRadixDT.FracSlope = 1.0
    %%
    %% more prep work
    %%
    %if u0InterpTrivial && u1InterpTrivial
        %%
        %%START_ASSERT
        %%
        %% Currently, all blocks catch the doubly trivial case, and avoid calling
        %% the interpolation routine.
        %%
        /* U0 and U1 Data is inlined, evenly space, and the spacing of the stored
         * integers is the trivial case of plus one. Therefore, interpolation
         * can be replaced by a simple indexing operation.
         */
        %%END_ASSERT
        %%
    %else
        %%
        %% create RadixOnly version of output Data Type
        %%
        %copyrecord u0RadixDT u0DT
        %%
        %assign u0RadixDT.Bias = 0.0
        %assign u0RadixDT.FracSlope = 1.0
        %%
        %% create RadixOnly version of output Data Type
        %%
        %copyrecord u0DataRadixDT u0DataDT
        %%
        %assign u0DataRadixDT.Bias = 0.0
        %assign u0DataRadixDT.FracSlope = 1.0
        %%
        %% create RadixOnly version of output Data Type
        %%
        %copyrecord u1RadixDT u1DT
        %%
        %assign u1RadixDT.Bias = 0.0
        %assign u1RadixDT.FracSlope = 1.0
        %%
        %% create RadixOnly version of output Data Type
        %%
        %copyrecord u1DataRadixDT u1DataDT
        %%
        %assign u1DataRadixDT.Bias = 0.0
        %assign u1DataRadixDT.FracSlope = 1.0
        %%
        %% Get output recs
        %%
        %assign yTempLabel = "yTemp"
        %assign yTempLabel2 = "yTemp2"
        %assign absDiffLabel = "absDiff"
        %%
        %if FixPt_DataTypeIsFloat(yDT) || ...
            FixPt_DataTypeIsFloat(u0DT) || ...
            FixPt_DataTypeIsFloat(u1DT) || ...
            FixPt_DataTypeIsFloat(tableDataDT) || ...
            FixPt_DataTypeIsFloat(u0DataDT) || ...
            FixPt_DataTypeIsFloat(u1DataDT)
            %%
            %assign doFloat = 1
            %%
            %if !FixPt_DataTypeIsSingle(yDT) || ...
                !FixPt_DataTypeIsSingle(u0DT) || ...
                !FixPt_DataTypeIsSingle(u1DT) || ...
                !FixPt_DataTypeIsSingle(tableDataDT) || ...
                !FixPt_DataTypeIsSingle(u0DataDT) || ...
                !FixPt_DataTypeIsSingle(u1DataDT)
                %%
                %assign allSingle = 0
            %else
                %%
                %assign allSingle = 1
            %endif
            %%
            %assign doU1BigProd = 0
            %assign doU0BigProd = 0
        %else
            %%
            %assign doFloat = 0
            %%
            %if yDT.RequiredBits > tableDataDT.RequiredBits
                %%
                %assign maxOutReqBits = yDT.RequiredBits
                %assign maxOutActBits = yDT.ActualBits
            %else
                %%
                %assign maxOutReqBits = tableDataDT.RequiredBits
                %assign maxOutActBits = tableDataDT.ActualBits
            %endif
            %%
            %if u0DT.RequiredBits > u0DataDT.RequiredBits
                %%
                %assign maxU0ReqBits = u0DT.RequiredBits
                %assign maxU0ActBits = u0DT.ActualBits
            %else
                %%
                %assign maxU0ReqBits = u0DataDT.RequiredBits
                %assign maxU0ActBits = u0DataDT.ActualBits
            %endif
            %%
            %if u1DT.RequiredBits > u1DataDT.RequiredBits
                %%
                %assign maxU1ReqBits = u1DT.RequiredBits
                %assign maxU1ActBits = u1DT.ActualBits
            %else
                %%
                %assign maxU1ReqBits = u1DataDT.RequiredBits
                %assign maxU1ActBits = u1DataDT.ActualBits
            %endif
            %%
            %% bigProduct is (yH-yL)*(x-xL)
            %% note it does not depend on the number of bits in y
            %%
            %assign u1BigProdBits = tableDataDT.RequiredBits + maxU1ReqBits
            %assign u0BigProdBits = tableDataDT.RequiredBits + maxU0ReqBits
            %%
            %assign doU1BigProd = !u1InterpTrivial && ( u1BigProdBits <= IntegerSizes.LongNumBits ) && ( u1BigProdBits <= 32 )
            %assign doU0BigProd = !u0InterpTrivial && ( u0BigProdBits <= IntegerSizes.LongNumBits ) && ( u0BigProdBits <= 32 )
        %endif
        %%
        %assign doU1Lambda = !u1InterpTrivial && !doU1BigProd
        %assign doU0Lambda = !u0InterpTrivial && !doU0BigProd
        %%
        %if doU1Lambda
            %%
            %if doFloat
              %%
              %if allSingle
                %assign u1LambdaDT = FixPt_GetDataTypeFromIndex(1)
              %else
                %assign u1LambdaDT = FixPt_GetDataTypeFromIndex(0)
              %endif
            %else
              %assign u1LambdaDT = fxpInterpolateGetLambdaDT( ...
                                      yDT, tableDataDT, u1DT, u1DataDT, ...
                                      u1DataBreakPointInfo.spacingIsPow2, ...
                                      u1DataBreakPointInfo.spacingPow2Exp, ...
                                      1 )
            %endif
            %%
            %assign u1LambdaLabel = "u1Lambda"
        %endif
        %%
        %if doU0Lambda
            %%
            %if doFloat
                %%
                %if allSingle
                    %assign u0LambdaDT = FixPt_GetDataTypeFromIndex(1)
                %else
                    %assign u0LambdaDT = FixPt_GetDataTypeFromIndex(0)
                %endif
            %else
              %assign u0LambdaDT = fxpInterpolateGetLambdaDT( ...
                                      yDT, tableDataDT, u0DT, u0DataDT, ...
                                      u0DataBreakPointInfo.spacingIsPow2, ...
                                      u0DataBreakPointInfo.spacingPow2Exp, ...
                                      1 )
            %endif
            %%
            %assign u0LambdaLabel = "u0Lambda"
        %endif
        %%
        {
            %if ( !u1InterpTrivial && !u0InterpTrivial )
                %<yDT.NativeType> %<yTempLabel>;
            %endif
            %%
            %if doU1Lambda
                %%
                %<u1LambdaDT.NativeType> %<u1LambdaLabel>;
                %%
            %endif
            %%
            %if doU0Lambda
                %%
                %<u0LambdaDT.NativeType> %<u0LambdaLabel>;
                %%
            %endif
            %%
%%%if(doU1Lambda||doU0Lambda)&&!yDT.IsSigned
%%%%
%%%<tableDataRadixDT.NativeType>%<absDiffLabel>;
%%%<yDT.NativeType>%<yTempLabel2>;
%%%%
%%%endif
            %%
            %if doU1Lambda
              %%
              %% calc u1 lambda
              %%
              %assign u1DataCategory = -1
              %%
              %% Check that storage types and scaling are supported
              %% and biases are zero
              %%
              %<FixPt_CheckInputBreakpointDataTypes(u1DT,u1DataDT)>/
              %%
              %assign u1BreakPointInfo = FixPt_BreakPointInfoCast(u1DataBreakPointInfo,u1DataDT,u1DT)
              %%
              %if u1BreakPointInfo.evenlySpaced
                %if iU1RghtLabel != ""
                  if ( %<iU1LeftLabel> != %<iU1RghtLabel> )
                  {
                %endif
                %%
                %assign uAdjLabel = "( %<u1Label>%<u1BreakPointInfo.zeroAdjustStr> )"
                %%
                %if u1BreakPointInfo.spacingIsPow2 && !doFloat
                  %%
                  %<fxpInterpolateCalcLambdaPow2(...
                    uAdjLabel, u1DT,...
                    u1LambdaLabel, u1LambdaDT,...
                    u1BreakPointInfo.spacingPow2Exp, ...
                    roundMode,satMode)>/
                  %%
                %else
                  %%
                  %<fxpInterpolateCalcLambdaEven(...
                    uAdjLabel, u1DT,...
                    u1LambdaLabel, u1LambdaDT,...
                    u1BreakPointInfo.spacingValue, ...
                    iU1LeftLabel,...
                    roundMode,satMode)>/
                  %%
                %endif
                %%
                %if iU1RghtLabel != ""
                  }
                  else
                  {
                    %<u1LambdaLabel> = %<FixPt_GetGroundValueOrNameFromDataTypeRec(u1LambdaDT, TLC_FALSE)>;
                  }
                %endif
              %else
                %%
                %if iU1RghtLabel == ""
                  %assign iCopyRghtLabel = "((%<iU1LeftLabel>)+1)"
                %else
                  %assign iCopyRghtLabel = iU1RghtLabel
                %endif
                %%
                %% Get left x data
                %%
                %assign u1LeftLabel = FixPt_HelperGetRValue( iU1LeftLabel, "", 0, "", u1Data, u1DataCategory)
                %%
                %% get right x data
                %%
                %assign u1RghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u1Data, u1DataCategory)
                %%
                %<fxpInterpolateCalcLambdaUneven( ...
                  u1Label, u1DT,...
                  u1LambdaLabel, u1LambdaDT,...
                  u1LeftLabel, u1RghtLabel, u1DataDT, ...
                  roundMode,satMode)>/
              %endif
              %%
            %endif
            %%
            %if doU0Lambda
              %%
              %% calc u0 lambda
              %%
              %assign u0DataCategory = -1
              %%
              %% Check that storage types and scaling are supported
              %% and biases are zero
              %%
              %<FixPt_CheckInputBreakpointDataTypes(u0DT,u0DataDT)>/
              %%
              %assign u0BreakPointInfo = FixPt_BreakPointInfoCast(u0DataBreakPointInfo,u0DataDT,u0DT)
              %%
              %if u0BreakPointInfo.evenlySpaced
                %if iU0RghtLabel != ""
                  if ( %<iU0LeftLabel> != %<iU0RghtLabel> )
                  {
                %endif
                %%
                %assign uAdjLabel = "( %<u0Label>%<u0BreakPointInfo.zeroAdjustStr> )"
                %%
                %if u0BreakPointInfo.spacingIsPow2 && !doFloat
                  %%
                  %<fxpInterpolateCalcLambdaPow2(...
                    uAdjLabel, u0DT,...
                    u0LambdaLabel, u0LambdaDT,...
                    u0BreakPointInfo.spacingPow2Exp, ...
                    roundMode,satMode)>/
                  %%
                %else
                  %%
                  %<fxpInterpolateCalcLambdaEven(...
                    uAdjLabel, u0DT,...
                    u0LambdaLabel, u0LambdaDT,...
                    u0BreakPointInfo.spacingValue, ...
                    iU0LeftLabel,...
                    roundMode,satMode)>/
                  %%
                %endif
                %%
                %if iU0RghtLabel != ""
                  }
                  else
                  {
                    %<u0LambdaLabel> = %<FixPt_GetGroundValueOrNameFromDataTypeRec(u0LambdaDT, TLC_FALSE)>;
                  }
                %endif
              %else
                %%
                %if iU0RghtLabel == ""
                  %assign iCopyRghtLabel = "((%<iU0LeftLabel>)+1)"
                %else
                  %assign iCopyRghtLabel = iU0RghtLabel
                %endif
                %%
                %% Get left x data
                %%
                %assign u0LeftLabel = FixPt_HelperGetRValue( iU0LeftLabel, "", 0, "", u0Data, u0DataCategory)
                %%
                %% get right x data
                %%
                %assign u0RghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u0Data, u0DataCategory)
                %%
                %<fxpInterpolateCalcLambdaUneven( ...
                  u0Label, u0DT,...
                  u0LambdaLabel, u0LambdaDT,...
                  u0LeftLabel, u0RghtLabel, u0DataDT, ...
                  roundMode,satMode)>/
              %endif
              %%
            %endif
        %%
        %% handle the case where the only the u0 Data
        %% is inline and evenly space, also,
        %% the spacing is the trivial case of +1.
        %%
        %if u0InterpTrivial
            /* U0 Data is inlined, evenly space, and the spacing of the stored
             * integers is the trivial case of plus one. Therefore, interpolation
             * along the u0 variable can be replaced by a simple indexing operation.
             */
        %endif
        %%
        %% handle the case where the only the U1 Data
        %% is inline and evenly space, also,
        %% the spacing is the trivial case of +1.
        %%
        %if u1InterpTrivial
            /* U1 Data is inlined, evenly space, and the spacing of the stored
             * integers is the trivial case of plus one. Therefore, interpolation
             * along the U1 variable can be replaced by a simple indexing operation.
             *
             * Interpolate along u0 variable
             * with the u1 variable locked on the left u1
             */
        %endif
    %endif
    %%
    %% handle real and if nec imag part
    %%
    %foreach iCase = numCase
        %%
        %if numCase > 1
          %if iCase == 0
            %assign idxReIm = "re0"
            %assign part = "real"
          %else
            %assign idxReIm = "im0"
            %assign part = "imag"
          %endif
        %else
          %assign idxReIm = "0"
          %assign part = ""
        %endif
        %%
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<numU0ElementsLabel>*%<iU1LeftLabel>)"
        %assign yU0RghtU1Left = FixPt_HelperGetRValue(matrixIndex,"",0, part, TableData, tableDataCategory)
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<numU0ElementsLabel>*%<iU1RghtLabel>)"
        %assign yU0RghtU1Rght = FixPt_HelperGetRValue(matrixIndex,"",0, part, TableData, tableDataCategory)
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<numU0ElementsLabel>*%<iU1LeftLabel>)"
        %assign yU0LeftU1Left = FixPt_HelperGetRValue(matrixIndex,"",0, part, TableData, tableDataCategory)
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<numU0ElementsLabel>*%<iU1RghtLabel>)"
        %assign yU0LeftU1Rght = FixPt_HelperGetRValue(matrixIndex,"",0, part, TableData, tableDataCategory)
        %%
        %%
        %% handle the case where the both the u0 and u1 Data
        %% is inline and evenly space, also,
        %% the spacing is the trivial case of +1.
        %%
        %if u0InterpTrivial && u1InterpTrivial
            %%
            %assign curYLabel = FixPt_HelperGetLValue("","",0, part, yLabel, yCategory)
            %%
            %<FixPt_Fix2FixAlwaysOutput(curYLabel,yRadixDT,yU0LeftU1Left,tableDataRadixDT,roundMode,satMode)>/
            %%
        %else
            %%
            %if !u1InterpTrivial
                %%
                /* Interpolate along u1 variable
                 * with the u0 variable locked on the left u0
                 */
                %if doU1BigProd
                    %%
                    %% call inter function
                    %%
                    %assign yAddrLabel = FixPt_HelperGetVarPtr("","",0,part,yLabel,yCategory)
                    %%
                    %if u1DataBreakPointInfo.evenlySpaced
                      %%
                      %assign xBreakPointInfo = FixPt_BreakPointInfoCast(u1DataBreakPointInfo,u1DataRadixDT,u1RadixDT)
                      %%
                      %if xBreakPointInfo.zeroAdjustStr == ""
                        %assign xMinusXLeftLabel = u1Label
                      %else
                        %assign xMinusXLeftLabel = "(%<u1Label>%<xBreakPointInfo.zeroAdjustStr>)"
                      %endif
                      %%
                      %if ISEQUAL(xBreakPointInfo.spacingValue,1)
                        %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-%<iU1LeftLabel>)"
                      %else
                        %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-(%<iU1LeftLabel>*%<xBreakPointInfo.spacingValue>))"
                      %endif
                      %assign xMinusXLeftLabel = utilDownCastTempExpression( u1DT, xMinusXLeftLabel )
                      %%
                      %<fxpInterpEvenBigProd(...
                        yAddrLabel, yRadixDT, ...
                        yU0LeftU1Left,yU0LeftU1Rght,tableDataRadixDT,...
                        xMinusXLeftLabel, u1DT,...
                        xBreakPointInfo.spacingValue, ...
                        roundMode,satMode)>/
                      %%
                    %else
                      %%
                      %assign xLeftLabel = FixPt_HelperGetRValue( iU1LeftLabel, "", 0, "", u1Data, u1DataCategory)
                      %%
                      %if iU1RghtLabel == ""
                        %assign iCopyRghtLabel = "((%<iU1LeftLabel>)+1)"
                      %else
                        %assign iCopyRghtLabel = iU1RghtLabel
                      %endif
                      %%
                      %assign xRghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u1Data, u1DataCategory)
                      %%
                      %<fxpInterpUnevenBigProd(...
                        yAddrLabel, yDT, ...
                        yU0LeftU1Left,yU0LeftU1Rght, tableDataDT,...
                        u1Label, u1DT,...
                        xLeftLabel, xRghtLabel, u1DataDT, ...
                        roundMode,satMode)>/
                    %endif
                %else
                    %%
                    %% do u1 lambda method
                    %%
                    %assign curYLabel = FixPt_HelperGetLValue("","",0, part, yLabel, yCategory)
                    %%
                    %<fxpInterpolateApplyLambda(...
                      curYLabel, yDT,...
                      yU0LeftU1Left, yU0LeftU1Rght, tableDataDT,...
                      u1LambdaLabel, u1LambdaDT,...
                      roundMode,satMode)>/
                %endif
                %%
                %% second part of double interp
                %%
                %if !u0InterpTrivial
                    %%
                    /* Interpolate along u1 variable
                     * with the u0 variable locked on the right u0
                     */
                    %if doU1BigProd
                        %%
                        %% call inter function
                        %%
                        %assign yTempAddrLabel = FixPt_HelperGetVarPtr("","",0,"",yTempLabel,"variable")
                        %%
                        %if u1DataBreakPointInfo.evenlySpaced
                          %%
                          %assign xBreakPointInfo = FixPt_BreakPointInfoCast(u1DataBreakPointInfo,u1DataRadixDT,u1RadixDT)
                          %%
                          %if xBreakPointInfo.zeroAdjustStr == ""
                            %assign xMinusXLeftLabel = u1Label
                          %else
                            %assign xMinusXLeftLabel = "(%<u1Label>%<xBreakPointInfo.zeroAdjustStr>)"
                          %endif
                          %%
                          %if ISEQUAL(xBreakPointInfo.spacingValue,1)
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-%<iU1LeftLabel>)"
                          %else
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-(%<iU1LeftLabel>*%<xBreakPointInfo.spacingValue>))"
                          %endif
                          %assign xMinusXLeftLabel = utilDownCastTempExpression( u1RadixDT, xMinusXLeftLabel )
                          %%
                          %<fxpInterpEvenBigProd(...
                            yTempAddrLabel, yRadixDT, ...
                            yU0RghtU1Left,yU0RghtU1Rght,tableDataRadixDT,...
                            xMinusXLeftLabel, u1RadixDT,...
                            xBreakPointInfo.spacingValue, ...
                            roundMode,satMode)>/
                          %%
                        %else
                          %%
                          %assign xLeftLabel = FixPt_HelperGetRValue( iU1LeftLabel, "", 0, "", u1Data, u1DataCategory)
                          %%
                          %if iU1RghtLabel == ""
                            %assign iCopyRghtLabel = "((%<iU1LeftLabel>)+1)"
                          %else
                            %assign iCopyRghtLabel = iU1RghtLabel
                          %endif
                          %%
                          %assign xRghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u1Data, u1DataCategory)
                          %%
                          %<fxpInterpUnevenBigProd(...
                            yTempAddrLabel, yDT, ...
                            yU0RghtU1Left,yU0RghtU1Rght,tableDataDT,...
                            u1Label, u1DT,...
                            xLeftLabel, xRghtLabel, u1DataDT, ...
                            roundMode,satMode)>/
                        %endif
                      %else
                        %%
                        %% do u1 lambda interp
                        %%
                        %<fxpInterpolateApplyLambda(...
                          yTempLabel, yDT,...
                          yU0RghtU1Left, yU0RghtU1Rght, tableDataDT,...
                          u1LambdaLabel, u1LambdaDT,...
                          roundMode,satMode)>/
                    %endif
                %endif
            %endif
            %%
            %if !u0InterpTrivial
                %%
                %% 3rd and final step in two way interp
                %%
                %if !u1InterpTrivial
                    %%
                    /*
                     * Interpolate along u0 variable
                     * with the u1 variable locked on its interpolated value
                     */
                    %if doU0BigProd
                        %%
                        %% call inter function
                        %%
                        %assign curYRValueLabel = FixPt_HelperGetRValue("","",0,part, yLabel,yCategory)
                        %%
                        %assign yAddrLabel = FixPt_HelperGetVarPtr("","",0,part,yLabel,yCategory)
                        %%
                        %if u0DataBreakPointInfo.evenlySpaced
                          %%
                          %assign xBreakPointInfo = FixPt_BreakPointInfoCast(u0DataBreakPointInfo,u0DataRadixDT,u0RadixDT)
                          %%
                          %if xBreakPointInfo.zeroAdjustStr == ""
                            %assign xMinusXLeftLabel = u0Label
                          %else
                            %assign xMinusXLeftLabel = "(%<u0Label>%<xBreakPointInfo.zeroAdjustStr>)"
                          %endif
                          %%
                          %if ISEQUAL(xBreakPointInfo.spacingValue,1)
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-%<iU0LeftLabel>)"
                          %else
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-(%<iU0LeftLabel>*%<xBreakPointInfo.spacingValue>))"
                          %endif
                          %assign xMinusXLeftLabel = utilDownCastTempExpression( u0RadixDT, xMinusXLeftLabel )
                          %%
                          %<fxpInterpEvenBigProd(...
                            yAddrLabel, yRadixDT, ...
                            curYRValueLabel, yTempLabel, yRadixDT, ...
                            xMinusXLeftLabel, u0RadixDT,...
                            xBreakPointInfo.spacingValue, ...
                            roundMode,satMode)>/
                          %%
                        %else
                          %%
                          %assign xLeftLabel = FixPt_HelperGetRValue( iU0LeftLabel, "", 0, "", u0Data, u0DataCategory)
                          %%
                          %if iU0RghtLabel == ""
                            %assign iCopyRghtLabel = "((%<iU0LeftLabel>)+1)"
                          %else
                            %assign iCopyRghtLabel = iU0RghtLabel
                          %endif
                          %%
                          %assign xRghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u0Data, u0DataCategory)
                          %%
                          %<fxpInterpUnevenBigProd(...
                            yAddrLabel, yDT, ...
                            curYRValueLabel, yTempLabel, yDT, ...
                            u0Label, u0DT,...
                            xLeftLabel, xRghtLabel, u0DataDT, ...
                            roundMode,satMode)>/
                        %endif
                    %else
                        %%
                        %% do u0 lambda method
                        %%
                        %assign curYLabel = FixPt_HelperGetLValue("","",0, part, yLabel, yCategory)
                        %%
                        %<fxpInterpolateApplyLambda(...
                          curYLabel, yDT,...
                          curYLabel, yTempLabel,yDT,...
                          u0LambdaLabel, u0LambdaDT,...
                          roundMode,satMode)>/
                    %endif
                %%
                %% special case where u1 interp was trivial
                %% but u0 is non-trivial
                %%
                %else
                    %%
                    /* Interpolate along u0 variable
                     * with the u1 variable locked on the left u1
                     */
                    %%
                    %if doU0BigProd
                        %%
                        %% call inter function
                        %%
                        %assign yAddrLabel = FixPt_HelperGetVarPtr("","",0,part,yLabel,yCategory)
                        %%
                        %if u0DataBreakPointInfo.evenlySpaced
                          %%
                          %assign xBreakPointInfo = FixPt_BreakPointInfoCast(u0DataBreakPointInfo,u0DataRadixDT,u0RadixDT)
                          %%
                          %if xBreakPointInfo.zeroAdjustStr == ""
                            %assign xMinusXLeftLabel = u0Label
                          %else
                            %assign xMinusXLeftLabel = "(%<u0Label>%<xBreakPointInfo.zeroAdjustStr>)"
                          %endif
                          %%
                          %if ISEQUAL(xBreakPointInfo.spacingValue,1)
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-%<iU0LeftLabel>)"
                          %else
                            %assign xMinusXLeftLabel = "(%<xMinusXLeftLabel>-(%<iU0LeftLabel>*%<xBreakPointInfo.spacingValue>))"
                          %endif
                          %assign xMinusXLeftLabel = utilDownCastTempExpression( u0RadixDT, xMinusXLeftLabel )
                          %%
                          %<fxpInterpEvenBigProd(...
                            yAddrLabel, yRadixDT, ...
                            yU0LeftU1Left, yU0RghtU1Left, tableDataRadixDT, ...
                            xMinusXLeftLabel, u0RadixDT,...
                            xBreakPointInfo.spacingValue, ...
                            roundMode,satMode)>/
                          %%
                        %else
                          %%
                          %assign xLeftLabel = FixPt_HelperGetRValue( iU0LeftLabel, "", 0, "", u0Data, u0DataCategory)
                          %%
                          %if iU0RghtLabel == ""
                            %assign iCopyRghtLabel = "((%<iU0LeftLabel>)+1)"
                          %else
                            %assign iCopyRghtLabel = iU0RghtLabel
                          %endif
                          %%
                          %assign xRghtLabel = FixPt_HelperGetRValue( iCopyRghtLabel, "", 0, "", u0Data, u0DataCategory)
                          %%
                          %<fxpInterpUnevenBigProd(...
                            yAddrLabel, yDT, ...
                            yU0LeftU1Left, yU0RghtU1Left, tableDataDT, ...
                            u0Label, u0DT,...
                            xLeftLabel, xRghtLabel, u0DataDT, ...
                            roundMode,satMode)>/
                        %endif
                      %else
                        %%
                        %% do u0 lambda method
                        %%
                        %assign curYLabel = FixPt_HelperGetLValue("","",0, part, yLabel, yCategory)
                        %%
                        %<fxpInterpolateApplyLambda(...
                          curYLabel, yDT,...
                          yU0LeftU1Left, yU0RghtU1Left, tableDataDT,...
                          u0LambdaLabel, u0LambdaDT,...
                          roundMode,satMode)>/
                    %endif
                %endif
            %endif
        %endif %% end NOT doubly trivial
    %endforeach
    %%
    %% clean up
    %%
    %if !u1InterpTrivial || !u0InterpTrivial
            }
    %endif
    %%
%endfunction %% LibFixPtInterpolate2D_New
 
 
 
%%Function:fxpInterpolate2DUnevenUneven===================================
%%
%function fxpInterpolate2DUnevenUneven(...
            yBaseAddrLabel, yDT, yIsComplex, ...
            u0Label, u0DT, ...
            u1Label, u1DT, ...
            yDataAddrLabel, yDataDT, ...
            u0DataAddrLabel, u0DataDT, ...
            u1DataAddrLabel, u1DataDT, ...
            iU0LeftLabel, iU0RghtLabel,...
            iU1LeftLabel, iU1RghtLabel,...
            iU0MaxLabel,...
            roundMode,satMode) Output
    %%
    %assert iU0LeftLabel != ""
    %assert iU0RghtLabel != ""
    %assert iU1LeftLabel != ""
    %assert iU1RghtLabel != ""
    %%
    %assert iU0MaxLabel != ""
    %%
    %if yIsComplex
        %assign numCase = 2
    %else
        %assign numCase = 1
    %endif
    %%
    %if yIsComplex
      %assign yCategory = "real pointer to complex"
      %assign yDataCategory = "real pointer to complex"
    %else
      %assign yCategory = "pointer"
      %assign yDataCategory = "pointer"
    %endif
    %%
    %assign yTempLabel = "yTemp"
    %assign yTempLabel2 = "yTemp2"
    %assign absDiffLabel = "absDiff"
    %%
    %assign u0InterpolateMethod = ...
       utilDecideInterpolateMethodUneven(yDT,yDataDT,u0DT,u0DataDT)
    %%
    %assign u1InterpolateMethod = ...
       utilDecideInterpolateMethodUneven(yDT,yDataDT,u1DT,u1DataDT)
    %%
    %%
    %assign doU1BigProd = u1InterpolateMethod == interpolateBigProduct
    %assign doU0BigProd = u0InterpolateMethod == interpolateBigProduct
    %%
    %assign doU1Lambda = !doU1BigProd
    %assign doU0Lambda = !doU0BigProd
    %%
    %if doU1Lambda
      %%
      %assign u1LambdaDT = fxpInterpolateGetLambdaDTUneven( ...
                             yDT, yDataDT, u1DT, u1DataDT, 1 )
      %%
      %assign u1LambdaLabel = "u1Lambda"
    %endif
    %%
    %if doU0Lambda
      %%
      %assign u0LambdaDT = fxpInterpolateGetLambdaDTUneven( ...
                             yDT, yDataDT, u0DT, u0DataDT, 1 )
      %%
      %assign u0LambdaLabel = "u0Lambda"
    %endif
    %%
    {
      %assign u0LeftLabel = "u0Left"
      %assign u0RghtLabel = "u0Rght"
      %%
      %assign u1LeftLabel = "u1Left"
      %assign u1RghtLabel = "u1Rght"
      %%
      %<u0DataDT.NativeType> %<u0LeftLabel> = %<FixPt_HelperGetRValue( iU0LeftLabel, "", 0, "", u0DataAddrLabel, "pointer")>;
      %<u0DataDT.NativeType> %<u0RghtLabel> = %<FixPt_HelperGetRValue( iU0RghtLabel, "", 0, "", u0DataAddrLabel, "pointer")>;
      %%
      %<u1DataDT.NativeType> %<u1LeftLabel> = %<FixPt_HelperGetRValue( iU1LeftLabel, "", 0, "", u1DataAddrLabel, "pointer")>;
      %<u1DataDT.NativeType> %<u1RghtLabel> = %<FixPt_HelperGetRValue( iU1RghtLabel, "", 0, "", u1DataAddrLabel, "pointer")>;
 
      %<yDT.NativeType> %<yTempLabel>;
       
      %assign yU0RghtU1Left = "yRghtLeft"
      %assign yU0RghtU1Rght = "yRghtRght"
      %assign yU0LeftU1Left = "yLeftLeft"
      %assign yU0LeftU1Rght = "yLeftRght"
      %%
      %<yDataDT.NativeType> %<yU0LeftU1Left>;
      %<yDataDT.NativeType> %<yU0LeftU1Rght>;
      %<yDataDT.NativeType> %<yU0RghtU1Left>;
      %<yDataDT.NativeType> %<yU0RghtU1Rght>;
       
      %if doU1Lambda
        %%
        %<u1LambdaDT.NativeType> %<u1LambdaLabel>;
         
      %endif
      %%
      %if doU0Lambda
        %%
        %<u0LambdaDT.NativeType> %<u0LambdaLabel>;
         
      %endif
      %%
      %if doU1Lambda
        %%
        %<fxpInterpolateCalcLambdaUneven( ...
          u1Label, u1DT,...
          u1LambdaLabel, u1LambdaDT,...
          u1LeftLabel, u1RghtLabel, u1DataDT, ...
          roundMode,satMode)>/
 
      %endif
      %%
      %if doU0Lambda
        %%
        %<fxpInterpolateCalcLambdaUneven( ...
          u0Label, u0DT,...
          u0LambdaLabel, u0LambdaDT,...
          u0LeftLabel, u0RghtLabel, u0DataDT, ...
          roundMode,satMode)>/
 
      %endif
      %%
      %<iU0MaxLabel>++;
      %<iU1LeftLabel> *= %<iU0MaxLabel>;
      %<iU1RghtLabel> *= %<iU0MaxLabel>;
 
      %%
      %% handle real and if nec imag part
      %%
      %foreach iCase = numCase
        %%
        %if numCase > 1
          %if iCase == 0
            %assign part = "real"
          %else
            %assign part = "imag"
          %endif
        %else
          %assign part = ""
        %endif
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<iU1LeftLabel>)"
        %<yU0RghtU1Left> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<iU1RghtLabel>)"
        %<yU0RghtU1Rght> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<iU1LeftLabel>)"
        %<yU0LeftU1Left> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<iU1RghtLabel>)"
        %<yU0LeftU1Rght> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
 
        %assign yPartLabel = FixPt_HelperGetLValue("","",0, part, yBaseAddrLabel, yCategory)
        %%
        %if doU1BigProd || doU0BigProd
          %%
          %assign yPartAddrLabel = FixPt_HelperGetVarPtr("","",0,part,yBaseAddrLabel,yCategory)
        %endif
        %%
        %if doU1BigProd
          %%
          %assign yTempAddrLabel = FixPt_HelperGetVarPtr("","",0,"",yTempLabel,"variable")
          %%
        %endif
        %%
        /* Interpolate along U1 variable
        * with the u0 variable locked on the left u0
        */
        %if doU1BigProd
          %%
          %<fxpInterpUnevenBigProd(...
            yPartAddrLabel, yDT, ...
            yU0LeftU1Left, yU0LeftU1Rght, yDataDT,...
            u1Label, u1DT,...
            u1LeftLabel, u1RghtLabel, u1DataDT, ...
            roundMode,satMode)>/
 
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yPartLabel, yDT,...
            yU0LeftU1Left, yU0LeftU1Rght, yDataDT,...
            u1LambdaLabel, u1LambdaDT,...
            roundMode,satMode)>/
 
        %endif
        %%
        /* Interpolate along U1 variable
        * with the u0 variable locked on the right u0
        */
        %if doU1BigProd
          %%
          %<fxpInterpUnevenBigProd(...
            yTempAddrLabel, yDT, ...
            yU0RghtU1Left, yU0RghtU1Rght, yDataDT,...
            u1Label, u1DT,...
            u1LeftLabel, u1RghtLabel, u1DataDT, ...
            roundMode,satMode)>/
 
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yTempLabel, yDT,...
            yU0RghtU1Left, yU0RghtU1Rght, yDataDT,...
            u1LambdaLabel, u1LambdaDT,...
            roundMode,satMode)>/
 
        %endif
        %%
        /*
        * Interpolate along u0 variable
        * with the u1 variable locked on its interpolated value
        */
        %if doU0BigProd
          %%
          %<fxpInterpUnevenBigProd(...
            yPartAddrLabel, yDT, ...
            yPartLabel, yTempLabel, yDT, ...
            u0Label, u0DT,...
            u0LeftLabel, u0RghtLabel, u0DataDT, ...
            roundMode,satMode)>/
 
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yPartLabel, yDT,...
            yPartLabel, yTempLabel, yDT,...
            u0LambdaLabel, u0LambdaDT,...
            roundMode,satMode)>/
 
        %endif
        %%
      %endforeach
    }
%endfunction %% fxpInterpolate2DUnevenUneven
 
 
 
%%Function:fxpInterpolate2DEvenEven===================================
%%
%function fxpInterpolate2DEvenEven(...
            yBaseAddrLabel, yDT, yIsComplex, ...
            u0MinusLeftLabel, u0DT, ...
            u0SpacingLabel,...
            u0SpacingIsPow2, ...
            u0SpacingPow2Exp, ...
            u1MinusLeftLabel, u1DT, ...
            u1SpacingLabel,...
            u1SpacingIsPow2, ...
            u1SpacingPow2Exp, ...
            yDataAddrLabel, yDataDT, ...
            iU0LeftLabel, iU0RghtLabel,...
            iU1LeftLabel, iU1RghtLabel,...
            iU0MaxLabel,...
            roundMode,satMode) Output
    %%
    %assert iU0LeftLabel != ""
    %assert iU0RghtLabel != ""
    %assert iU1LeftLabel != ""
    %assert iU1RghtLabel != ""
    %%
    %assert iU0MaxLabel != ""
    %%
    %if yIsComplex
        %assign numCase = 2
    %else
        %assign numCase = 1
    %endif
    %%
    %if yIsComplex
      %assign yCategory = "real pointer to complex"
      %assign yDataCategory = "real pointer to complex"
    %else
      %assign yCategory = "pointer"
      %assign yDataCategory = "pointer"
    %endif
    %%
    %assign yTempLabel = "yTemp"
    %assign yTempLabel2 = "yTemp2"
    %assign absDiffLabel = "absDiff"
    %%
    %assign u0InterpolateMethod = ...
       utilDecideInterpolateMethod(...
        yDT,yDataDT,u0DT,u0DT,...
        1,...
        u0SpacingLabel,...
        u0SpacingIsPow2)
    %%
    %assign u1InterpolateMethod = ...
       utilDecideInterpolateMethod(...
        yDT,yDataDT,u1DT,u1DT,...
        1,...
        u1SpacingLabel,...
        u1SpacingIsPow2)
    %%
    %assign doU1BigProd = u1InterpolateMethod == interpolateBigProduct
    %assign doU0BigProd = u0InterpolateMethod == interpolateBigProduct
    %%
    %assign doU1Lambda = !doU1BigProd
    %assign doU0Lambda = !doU0BigProd
    %%
    %if doU1Lambda
      %%
      %assign u1LambdaDT = fxpInterpolateGetLambdaDT( ...
                             yDT, yDataDT, u1DT, u1DT, ...
                             u1InterpolateMethod == interpolatePow2, ...
                             u1SpacingPow2Exp, ...
                             1 )
      %%
      %assign u1LambdaLabel = "u1Lambda"
    %endif
    %%
    %if doU0Lambda
      %%
      %assign u0LambdaDT = fxpInterpolateGetLambdaDT( ...
                             yDT, yDataDT, u0DT, u0DT, ...
                             u0InterpolateMethod == interpolatePow2, ...
                             u0SpacingPow2Exp, ...
                             1 )
      %%
      %assign u0LambdaLabel = "u0Lambda"
    %endif
    %%
    {
      %<yDT.NativeType> %<yTempLabel>;
       
      %assign yU0RghtU1Left = "yRghtLeft"
      %assign yU0RghtU1Rght = "yRghtRght"
      %assign yU0LeftU1Left = "yLeftLeft"
      %assign yU0LeftU1Rght = "yLeftRght"
      %%
      %<yDataDT.NativeType> %<yU0LeftU1Left>;
      %<yDataDT.NativeType> %<yU0LeftU1Rght>;
      %<yDataDT.NativeType> %<yU0RghtU1Left>;
      %<yDataDT.NativeType> %<yU0RghtU1Rght>;
       
      %%
      %if doU1Lambda
        %%
        %if u1InterpolateMethod != interpolatePow2
          %%
          %<u1LambdaDT.NativeType> %<u1LambdaLabel>;
           
        %else
          %assign u1LambdaLabel = u1MinusLeftLabel
        %endif
      %endif
      %%
      %if doU0Lambda
        %%
        %if u0InterpolateMethod != interpolatePow2
          %%
          %<u0LambdaDT.NativeType> %<u0LambdaLabel>;
 
        %else
          %assign u0LambdaLabel = u0MinusLeftLabel
        %endif
      %endif
      %%
      %if doU1Lambda
        %%
        %if u1InterpolateMethod != interpolatePow2
          %%
          %<fxpInterpolateCalcLambdaEven2(...
            u1MinusLeftLabel, u1DT,...
            u1LambdaLabel, u1LambdaDT,...
            u1SpacingLabel, ...
            roundMode,satMode)>/
 
        %endif
      %endif
      %%
      %if doU0Lambda
        %%
        %if u0InterpolateMethod != interpolatePow2
          %%
          %<fxpInterpolateCalcLambdaEven2(...
            u0MinusLeftLabel, u0DT,...
            u0LambdaLabel, u0LambdaDT,...
            u0SpacingLabel, ...
            roundMode,satMode)>/
 
        %endif
      %endif
      %%
      %<iU0MaxLabel>++;
      %<iU1LeftLabel> *= %<iU0MaxLabel>;
      %<iU1RghtLabel> *= %<iU0MaxLabel>;
 
      %%
      %% handle real and if nec imag part
      %%
      %foreach iCase = numCase
        %%
        %if numCase > 1
          %if iCase == 0
            %assign part = "real"
          %else
            %assign part = "imag"
          %endif
        %else
          %assign part = ""
        %endif
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<iU1LeftLabel>)"
        %<yU0RghtU1Left> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0RghtLabel>+%<iU1RghtLabel>)"
        %<yU0RghtU1Rght> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<iU1LeftLabel>)"
        %<yU0LeftU1Left> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
        %%
        %assign matrixIndex = "(%<iU0LeftLabel>+%<iU1RghtLabel>)"
        %<yU0LeftU1Rght> = %<FixPt_HelperGetRValue(matrixIndex,"",0, part, yDataAddrLabel, yDataCategory)>;
 
        %assign yPartLabel = FixPt_HelperGetLValue("","",0, part, yBaseAddrLabel, yCategory)
        %%
        %if doU1BigProd || doU0BigProd
          %%
          %assign yPartAddrLabel = FixPt_HelperGetVarPtr("","",0,part,yBaseAddrLabel,yCategory)
        %endif
        %%
        %if doU1BigProd
          %%
          %assign yTempAddrLabel = FixPt_HelperGetVarPtr("","",0,"",yTempLabel,"variable")
          %%
        %endif
        %%
        /* Interpolate along u1 variable
        * with the u0 variable locked on the left u0
        */
        %if doU1BigProd
          %%
          %<fxpInterpEvenBigProd(...
            yPartAddrLabel, yDT, ...
            yU0LeftU1Left, yU0LeftU1Rght, yDataDT,...
            u1MinusLeftLabel, u1DT,...
            u1SpacingLabel, ...
            roundMode,satMode)>/
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yPartLabel, yDT,...
            yU0LeftU1Left, yU0LeftU1Rght, yDataDT,...
            u1LambdaLabel, u1LambdaDT,...
            roundMode,satMode)>/
        %endif
        %%
        /* Interpolate along u1 variable
        * with the u0 variable locked on the right u0
        */
        %if doU1BigProd
          %%
          %<fxpInterpEvenBigProd(...
            yTempAddrLabel, yDT, ...
            yU0RghtU1Left, yU0RghtU1Rght, yDataDT,...
            u1MinusLeftLabel, u1DT,...
            u1SpacingLabel, ...
            roundMode,satMode)>/
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yTempLabel, yDT,...
            yU0RghtU1Left, yU0RghtU1Rght, yDataDT,...
            u1LambdaLabel, u1LambdaDT,...
            roundMode,satMode)>/
        %endif
        %%
        /*
        * Interpolate along u0 variable
        * with the u1 variable locked on its interpolated value
        */
        %if doU0BigProd
          %%
          %<fxpInterpEvenBigProd(...
            yPartAddrLabel, yDT, ...
            yPartLabel, yTempLabel, yDT, ...
            u0MinusLeftLabel, u0DT,...
            u0SpacingLabel, ...
            roundMode,satMode)>/
        %else
          %%
          %<fxpInterpolateApplyLambda(...
            yPartLabel, yDT,...
            yPartLabel, yTempLabel, yDT,...
            u0LambdaLabel, u0LambdaDT,...
            roundMode,satMode)>/
        %endif
        %%
      %endforeach
    }
%endfunction %% fxpInterpolate2DEvenEven
 
 
 
%%Function:Fixpt_GetDataTypeFromNativeType=========================================
%%Abstract:
%%Returnthedatatyperecordfromthenativetypename.
%%
%function Fixpt_GetDataTypeFromNativeType(nativType) void
  %assign found = TLC_FALSE
  %foreach nativeDtId = ::CompiledModel.DataTypes.NumDataTypes
    %if nativType == ::CompiledModel.DataTypes.DataType[nativeDtId].NativeType
      %assign result = FixPt_GetDataTypeFromIndex(nativeDtId)
      %assign found = TLC_TRUE
      %break
    %endif
  %endforeach
  %if !found
      %%START_ASSERT
      %<LibReportFatalError("Can not find data type for %<nativType>.")>
      %%END_ASSERT
  %endif
%return result
%endfunction
 
 
 
%endif %% _FIXPTLOOK2D_