/* perrdsm_c subroutine * phase error of dsm fractional synthesizer * (Bram De Muer's model) * * Copyright (C) 2007-2009 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" /* perrdsm_c routine de calcul de l'erreur de phase d'un synthetiseur de fréquence * fractionnaire introduit par un modulateur sigma-delta * * Entrées : * n : dimension 1 de la matrice d'entrée (scalaire) * m : dimension 2 de la matrice de sortie (scalaire) * M : nombre d'états du modulateur sigma-delta (vecteur taille n*m) * K : état du modulateur sigma-delta (vecteur taille n*m) * i : compteur K/M (vecteur taille n*m ) * j : compteur 1/N (vecteur taille n*m ) * u : entrée modulateur sigma-delta (vecteur taille n*m) * * Sorties : * y : matrice de sortie * */ void perrdsm_c(int *n,int *m,int *M,int *K,int *i,int *j,int *u,int *y) { /*déclaration des variables compteurs*/ int k; for (k=0;k<(*m)*(*n);k++) { i[k]++; /* K/M */ j[k]+=u[k]; /* 1/N */ y[k]=(int) (j[k]*M[k] - i[k]*K[k]); } return; } void perrdsmy_c(int *n,int *m,int *M,int *K,long long int *i,long long int *j,int *u,int *y) { /*déclaration des variables compteurs*/ int k; int it,jt; for (k=0;k<(*m)*(*n);k++) { jt=j[k]+u[k]; it=i[k]+1; y[k]=(int) (jt*M[k] - it*K[k]); } return; } void perrdsmz_c(int *n,int *m,long long int *i,long long int *j,int *u) { /*déclaration des variables compteurs*/ int k; for (k=0;k<(*m)*(*n);k++) { i[k]++; /* K/M */ j[k]+=u[k]; /* 1/N */ } return; }