亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? regshift.c

?? 3G源碼Mfiles有很詳實的內容哦適合3g初學者
?? C
字號:
/* $Revision: 1.21 $ */
/*
 * REGSHIFT   A Simulink triggered register_buff shift
 *
 *           Syntax:  [sys, x0] = regshift(t,x,u,flag,outDelay,tirgThreshold)
 *  This function has two inputs and a number of outputs. The first input is
 *  the signal to be stored and output. The second signal is the clock pulse.
 *  The function refreshes its register_buff and outputs only at the rising 
 *  edge of the clock pulse. The function assigns a maximum delay number in 
 *  outDelay as its register numebr. When the function finishes refreshing all
 *  registers, it is called a cycle.
 *
 *  outDelay is a scalar or vector which contains integers of desired delay
 *           steps from the input. The size of the vector determines the
 *           size of the output.
 *  trigThreshold is the threshold in detecting the rising edge of the clock
 *          pulse.
 *  The size of the output of this function is the size of outDelay pulse one.
 *  Each output element outputs the delay step as indicated in the corrsponding
 *  value in outDelay. The last output is zero and is one only at the time when
 *  the register_buff and output are triggered in a complete cycle (a cycle of
 *  complete a refresh cycle). The pulse keeps the same length as the input
 *  trigger pulse.
 *
 * Wes Wang  August 22, 1994
 * Copyright 1996-2001 The MathWorks, Inc.
 */

#define S_FUNCTION_NAME regshift

#ifdef MATLAB_MEX_FILE
#include "mex.h"      /* needed for declaration of mexErrMsgTxt */
#endif

/*
 * need to include simstruc.h for the definition of the SimStruct and
 * its associated macro definitions.
 */

#include "simstruc.h"
#include "tmwtypes.h"

/* For RTW */
#if defined(RT) || defined(NRT)  
#undef  mexPrintf
#define mexPrintf printf
#endif

/*
 * Defines for easy access of the input parameters
 */

#define NUM_ARGS   2
#define REGISTER_DELAY ssGetArg(S,0)
#define TRIG_THRESHOLD     ssGetArg(S,1)

/*
 * mdlInitializeSizes - called to initialize the sizes array stored in
 *                      the SimStruct.  The sizes array defines the
 *                      characteristics (number of inputs, outputs,
 *                      states, etc.) of the S-Function.
 */

static void mdlInitializeSizes(SimStruct *S)
{
    /*
     * Set-up size information.
     */ 
    
    if (ssGetNumArgs(S) == NUM_ARGS) {
      int_T i, regDelay, numOutput, maxDelay;
      numOutput = mxGetN(REGISTER_DELAY) * mxGetM(REGISTER_DELAY);
      if (numOutput < 1) {
#ifdef MATLAB_MEX_FILE
        char_T err_msg[256];
        sprintf(err_msg, "Output buffer is empty");
        mexErrMsgTxt(err_msg);
#endif  
      }
       
      maxDelay = 1;
      for(i=0; i<numOutput; i++) {
        regDelay = (int_T)(mxGetPr(REGISTER_DELAY)[i]);
        maxDelay = (maxDelay > regDelay) ? maxDelay : regDelay;
      }
      ssSetNumContStates(    S, 0);
      ssSetNumDiscStates(    S, 0);
      ssSetNumInputs(        S, 2);
      ssSetNumOutputs(       S, 1 + numOutput);
      ssSetDirectFeedThrough(S, 1);
      ssSetNumInputArgs(     S, NUM_ARGS);
      ssSetNumSampleTimes(   S, 1);
      ssSetNumRWork(         S, maxDelay+1);
      ssSetNumIWork(         S, 2);
      ssSetNumPWork(         S, 0);
    } else {
#ifdef MATLAB_MEX_FILE
      char_T err_msg[256];
      sprintf(err_msg, "Wrong number of input arguments passed to S-function MEX-file.\n"
         "%d input arguments were passed in when expecting %d input arguments.\n", ssGetNumArgs(S) + 4, NUM_ARGS + 4);
      mexErrMsgTxt(err_msg);
#endif
   }
}

/*
 * mdlInitializeSampleTimes - initializes the array of sample times stored in
 *                            the SimStruct associated with this S-Function.
 */

static void mdlInitializeSampleTimes(SimStruct *S)
{
    /*
     * Note, blocks that are continuous in nature should have a single
     * sample time of 0.0.
     */

    ssSetSampleTimeEvent(S, 0, INHERITED_SAMPLE_TIME);
    ssSetOffsetTimeEvent(S, 0, FIXED_IN_MINOR_STEP_OFFSET);
}

/*
 * mdlInitializeConditions - initializes the states for the S-Function
 */

static void mdlInitializeConditions(real_T *x0, SimStruct *S)
{
    real_T *register_buff       = ssGetRWork(S);

    int_T    *regIndex       = ssGetIWork(S);
    int_T    *lastTrig       = ssGetIWork(S) + 1;    

    int_T     numOutput      = ssGetNumOutputs(S);
    int_T     maxDelay       = ssGetNumRWork(S) - 1;
    
    real_T *lastTime       = ssGetRWork(S) + maxDelay;
    
    int_T i;
    
    /* 
     * Initialize the register_buff to all zeros.
     */
    
    for (i = 0; i < maxDelay; i++)
     *register_buff++ = 0.0;

    /*
     * Initialize the current buffer position and buffer start
     */
    
    *regIndex       = 0;
    *lastTrig       = 0;
    *lastTime       = -1.0;
}

/*
 * mdlOutputs - computes the outputs of the S-Function
 */

static void mdlOutputs(real_T *y, const real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
    real_T *register_buff        = ssGetRWork(S);
    real_T  trigThreshold   = mxGetPr(TRIG_THRESHOLD)[0];
    int_T    *regIndex        = ssGetIWork(S);
    int_T    *lastTrig        = ssGetIWork(S) + 1;    
    int_T     numOutput       = ssGetNumOutputs(S) - 1;
    int_T     maxDelay        = ssGetNumRWork(S) - 1;
    real_T *lastTime        = ssGetRWork(S) + maxDelay;
    
    int_T     i, outnum;
    real_T  currentTime     = ssGetT(S);

    /*
     * acquire the buffer data
     */

    if ((u[1] >= trigThreshold) & (*lastTrig == 0)) {

      for (i = 0; i < numOutput; i++) {
        outnum = (int_T)(mxGetPr(REGISTER_DELAY)[i]);

        if (outnum == 0)
          y[i] = *u;
        else
          y[i] = register_buff[(maxDelay + *regIndex - outnum) % maxDelay];
      }
      if (*regIndex == 0)
        y[numOutput] = 1.0;
      else
        y[numOutput] = 0.0;
        
      register_buff[(*regIndex)++] = *u;
      *regIndex %= maxDelay;
      *lastTrig = 1;
      *lastTime = currentTime;
     } else {
      if (currentTime <= 0.0) {
        for (i = 0; i < numOutput; i++)
          y[i] = 0.0;
      } else if ((currentTime - *lastTime) / currentTime < 0.00000001) {
        /* keep the most recent change in the buffer */
        /* this is backup the case when there are tow calls at the same time.
         * the two values of the same time are different.
         * This is assume the time variable is always increasing
         */

        if (u[1] >= trigThreshold) {
          int_T backIndex;
          backIndex = *regIndex - 1;
          if (backIndex < 0)
            backIndex = maxDelay - 1;                
          for (i = 0; i < numOutput; i++) {
            outnum = (int_T)(mxGetPr(REGISTER_DELAY)[i]);
            if (outnum == 0)
              y[i] = *u;
          }
          if (backIndex == 0)
            y[numOutput] = 1.0;
          else
            y[numOutput] = 0.0;         
          register_buff[backIndex] = *u;
        }
      }
      if (*lastTrig == 1) {
        if (u[1] < trigThreshold) {
          *lastTrig = 0;
          y[numOutput] = 0.0;
        }
      }
    }
}

/*
 * mdlUpdate - computes the discrete states of the S-Function
 */

static void mdlUpdate(real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
}

/*
 * mdlDerivatives - computes the derivatives of the S-Function
 */

static void mdlDerivatives(real_T *dx, const real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
}

/*
 * mdlTerminate - called at termination of model execution.
 */

static void mdlTerminate(SimStruct *S)
{
}

#ifdef  MATLAB_MEX_FILE    /* Is this file being compiled as a MEX-file? */
#include "simulink.c"      /* MEX-File interface mechanism */
#else
#include "cg_sfun.h"       /* Code generation registration function */
#endif





?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区三区在线看| 国产欧美一区二区精品久导航| 亚洲欧美另类久久久精品| 成人精品免费网站| 中文字幕一区二区三区不卡在线| 不卡高清视频专区| 午夜av一区二区三区| 久久综合色婷婷| 99r精品视频| 国内精品久久久久影院色| 亚洲欧洲性图库| 日韩情涩欧美日韩视频| 成人h精品动漫一区二区三区| 一区二区三区中文字幕| 欧美一区二区三区四区视频| 成人va在线观看| 美女一区二区在线观看| 一区精品在线播放| 久久嫩草精品久久久精品一| 精品视频999| 一本一道综合狠狠老| 国产白丝网站精品污在线入口| 亚洲午夜三级在线| 亚洲欧美在线另类| 国产精品情趣视频| 久久久噜噜噜久噜久久综合| 欧美日韩中字一区| 国产综合一区二区| 一区二区三区.www| 国产精品免费网站在线观看| 9191国产精品| 九九九精品视频| 免费美女久久99| 日韩精品一级中文字幕精品视频免费观看 | 欧美日韩成人综合在线一区二区| 精品亚洲欧美一区| 美女视频一区二区| 午夜亚洲福利老司机| 亚洲人123区| 国产蜜臀97一区二区三区| 91在线观看一区二区| 国产一区999| 国产成a人无v码亚洲福利| 视频一区欧美日韩| 日韩中文字幕不卡| 亚洲国产欧美另类丝袜| 亚洲高清免费视频| 日韩—二三区免费观看av| 五月婷婷欧美视频| 看国产成人h片视频| 精品亚洲porn| 99久久免费国产| 欧美中文字幕亚洲一区二区va在线| 一本久久综合亚洲鲁鲁五月天 | 亚洲成人av一区| 国模冰冰炮一区二区| 国产91露脸合集magnet| 国产在线精品不卡| 91精彩视频在线| 91超碰这里只有精品国产| 久久久亚洲精品石原莉奈| 中文字幕一区三区| 日韩—二三区免费观看av| 美女一区二区久久| 99久久99久久精品免费观看| 欧美日韩国产精选| 国产精品国产三级国产aⅴ原创| 亚洲成a人片综合在线| 国产一区二区成人久久免费影院| 成人免费视频国产在线观看| 色猫猫国产区一区二在线视频| 欧洲一区在线观看| 国产精品―色哟哟| 国产精品一区二区免费不卡| 欧美伦理影视网| 久久激五月天综合精品| 99免费精品在线观看| 精品国产91乱码一区二区三区| 一区二区三区中文字幕电影 | 亚洲欧美激情小说另类| 久久er99热精品一区二区| 欧美人xxxx| 日韩国产高清在线| 69av一区二区三区| 一区二区三区精品视频在线| 97精品久久久久中文字幕| 日本一区二区三区国色天香| 国产麻豆精品久久一二三| 久久综合一区二区| 国产**成人网毛片九色 | 91麻豆精品国产91久久久使用方法| 国产欧美日本一区视频| 不卡一区中文字幕| 中文字幕一区二区三区四区 | 色综合色狠狠综合色| 6080午夜不卡| 国产mv日韩mv欧美| 亚洲女子a中天字幕| 欧美高清一级片在线| 奇米精品一区二区三区四区| 精品久久国产字幕高潮| 国产精品一区二区三区网站| 国产精品久久久久aaaa樱花| av日韩在线网站| 五月婷婷激情综合| 欧美国产欧美综合| 91精品国产91热久久久做人人 | 亚洲亚洲精品在线观看| 91精品国产色综合久久不卡蜜臀 | 欧美一级片免费看| 国产成人aaaa| 极品瑜伽女神91| 夜夜操天天操亚洲| 中文字幕一区二区三区av| 精品伦理精品一区| 欧美视频一区二区三区四区| 高清在线不卡av| 黄一区二区三区| 久久国产欧美日韩精品| 国产日韩精品一区| 欧美成人a在线| 日韩视频在线观看一区二区| 91在线观看一区二区| 成人综合婷婷国产精品久久 | 日韩理论片中文av| 欧美国产精品一区| 国产欧美日韩不卡免费| www国产精品av| 久久精品视频在线免费观看| 亚洲人成网站影音先锋播放| 欧美美女一区二区三区| 欧美裸体一区二区三区| 欧美亚男人的天堂| 欧美日韩国产大片| 日韩欧美中文字幕一区| 日韩你懂的在线观看| 久久精品人人做人人综合| 国产日韩欧美在线一区| 国产精品美女久久久久aⅴ| 中文字幕亚洲综合久久菠萝蜜| 国产精品色哟哟网站| 日本美女视频一区二区| 成人精品视频.| 精品免费国产一区二区三区四区| 国产精品女同一区二区三区| 麻豆成人免费电影| 91麻豆免费视频| 国产偷国产偷精品高清尤物| 亚洲成人自拍偷拍| 色哟哟一区二区| 国产精品久久久久久久久动漫| 日韩高清不卡一区二区三区| 91香蕉视频黄| 亚洲精品自拍动漫在线| 91在线丨porny丨国产| 国产精品无人区| 99精品视频免费在线观看| 久久先锋资源网| 激情综合五月天| 精品播放一区二区| 国产综合成人久久大片91| 亚洲精品一区二区三区精华液| 青娱乐精品在线视频| 欧美成人一区二区三区| 秋霞午夜av一区二区三区| 欧美激情一区二区三区蜜桃视频 | 亚洲成人免费看| 日韩一级二级三级| 国产一区二区免费看| 国产精品丝袜在线| 欧美亚洲另类激情小说| 一区二区三区蜜桃网| 精品少妇一区二区三区日产乱码 | 久久精品视频一区二区| www.在线欧美| 免费观看成人av| 中文字幕一区二区三| 4438x亚洲最大成人网| 国产成a人亚洲| 青青草国产成人99久久| 国产精品高潮呻吟| 欧美一区二区黄| 91欧美激情一区二区三区成人| 日本欧美韩国一区三区| 国产精品久久久一区麻豆最新章节| 日本韩国精品在线| 激情偷乱视频一区二区三区| 亚洲美女精品一区| 久久天天做天天爱综合色| 欧美精品 国产精品| 欧美伊人久久久久久久久影院 | 中文字幕一区二区视频| 日韩一级在线观看| 欧美日韩精品福利| 在线观看日韩国产| 91色porny| 色94色欧美sute亚洲线路一ni| 国内精品免费**视频| 日韩电影在线看| 全部av―极品视觉盛宴亚洲|