DSPRelated.com
Forums

MASH 1-1 sigma delta modulator

Started by adani September 6, 2007
hi all,

can somebody share the pseudo-code of MASH 1-1 sigma delta modulator for
fractional-N pll.


Thanks
adani


"adani" <adnan.shah@gmail.com> wrote in message 
news:i5WdnStaTNqjoX3bnZ2dnUVZ_oCvnZ2d@giganews.com...
> hi all, > > can somebody share the pseudo-code of MASH 1-1 sigma delta modulator for > fractional-N pll. > > > Thanks > adani > >
struct MASH { unsigned a[4]; // Accumulators unsigned c[4][4]; // Carry flip flops MASH() { // Initial values memset(c, 0, sizeof c); a[0] = 1; a[1] = 0; a[2] = 0; a[3] = 0; } int Clock(unsigned F); }; int MASH::Clock(unsigned F) { register union { __int64 i64; unsigned i32[2]; }; // Carry flip-flops c[3][3] = c[3][2]; c[3][2] = c[3][1]; c[3][1] = c[3][0]; c[2][2] = c[2][1]; c[2][1] = c[2][0]; c[1][1] = c[1][0]; // Accumulators i64=a[0]; i64+=F; a[0] = i32[0]; c[0][0] = i32[1]; i64=a[1]; i64+=a[0]; a[1] = i32[0]; c[1][0] = i32[1]; i64=a[2]; i64+=a[1]; a[2] = i32[0]; c[2][0] = i32[1]; i64=a[3]; i64+=a[2]; a[3] = i32[0]; c[3][0] = i32[1]; // Comment-out lines below to lower MASH order return c[0][0] + c[1][0] - c[1][1] + c[2][0] - 2*c[2][1] + c[2][2] + c[3][0] - 3*c[3][1] + 3*c[3][2] - c[3][3] ; }
Thanks!

it really helped.

Regards,
Adani
>"adani" <adnan.shah@gmail.com> wrote in message >news:i5WdnStaTNqjoX3bnZ2dnUVZ_oCvnZ2d@giganews.com... >> hi all, >> >> can somebody share the pseudo-code of MASH 1-1 sigma delta modulator
for
>> fractional-N pll. >> >> >> Thanks >> adani >> >> > >struct MASH { > unsigned a[4]; // Accumulators > unsigned c[4][4]; // Carry flip flops > > MASH() { > // Initial values > memset(c, 0, sizeof c); > a[0] = 1; > a[1] = 0; > a[2] = 0; > a[3] = 0; > } > > int Clock(unsigned F); >}; > > >int MASH::Clock(unsigned F) { > register union { > __int64 i64; > unsigned i32[2]; > }; > > // Carry flip-flops > c[3][3] = c[3][2]; c[3][2] = c[3][1]; c[3][1] = c[3][0]; > c[2][2] = c[2][1]; c[2][1] = c[2][0]; > c[1][1] = c[1][0]; > // Accumulators > i64=a[0]; i64+=F; a[0] = i32[0]; c[0][0] = i32[1]; > i64=a[1]; i64+=a[0]; a[1] = i32[0]; c[1][0] = i32[1]; > i64=a[2]; i64+=a[1]; a[2] = i32[0]; c[2][0] = i32[1]; > i64=a[3]; i64+=a[2]; a[3] = i32[0]; c[3][0] = i32[1]; > > // Comment-out lines below to lower MASH order > return c[0][0] > + c[1][0] - c[1][1] > + c[2][0] - 2*c[2][1] + c[2][2] > + c[3][0] - 3*c[3][1] + 3*c[3][2] - c[3][3] > ; >} > > >