Routine bas-niveau
fr - eng


cpf_c - routine de calcul de comparateur phase fréquence trois états idéal

Paramètres

Contenu du fichier


/* cpf_c subroutine
 * Ideal discrete D Flip-Flop
 * Phase/Frequency Detector
 * IRCOM GROUP - Author : A.Layec
 *
 * Copyright (C) 2007 Alan Layec
 *
 * This file is part of modnumlib.
 *
 * modnumlib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * modnumlib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with modnumlib; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

/* REVISION HISTORY :
 * $Log$
 */

#include "modnum_lib.h"

/* cpf_c routine de calcul d'un comparateur phase fréquence trois états idéal
 *
 * Entrées :
 * n   : taille des vecteurs
 * nev : entrée d'activation des horloges des bascules 
 *      1: bascule 1
 *      2: bascule 2
 *      3: bascule 1&2 (rmq : non programmé)
 *      4: entrée RAZ des deux bascules
 *
 * Sorties :
 * y1 : etat de sortie bascule 1 
 * y2 : etat de sortie bascule 2
 * Entrées/sorties :
 * z1 : état de sortie précédent bascule 1
 * z2 : etat de sortie précédent bascule 2
 */

void cpf_c(int *n,int *nev,double *z1,double *z2,double *y1,double *y2)
{
 /*déclaration*/
 int i;

 for (i=0;i<(*n);i++)
 {
  switch (nev[i])
   {
    case 1 :
    {
     if ((z1[i]==0) && (z2[i]==0)) {y1[i] = 1; y2[i] = 0;}
     else if (z1[i] == 1) {y1[i] = 1; y2[i] = 0;}
     else if (z2[i] == 1) {y1[i] = 0; y2[i] = 0;}
     else {y1[i] = 1; y2[i] = 0;}
     break;
    }

    case 2 :
    {
     if ((z1[i] == 0) && (z2[i] == 0)) {y1[i] = 0; y2[i] = 1;}
     else if (z1[i] == 1) {y1[i] = 0; y2[i] = 0;}
     else if (z2[i] == 1) {y1[i] = 0; y2[i] = 1;}
     else {y1[i] = 0; y2[i] = 1;}
     break;
    }

    case 4 :
    {
     y1[i]=0;
     y2[i]=0;
     break;
    }

    y1[i] = 0 ;
    y2[i] = 0;
    break;
   }
  /*Met en mémoire les états*/ 
  z1[i]=y1[i];
  z2[i]=y2[i];
 }
 return;
}

Auteurs

IRCOM Group Alan Layec