|
кристалл TMS320VC5501, меньше 10-ти тугриков, жрач 1 мВт/мгц, на 30 мгц уложится :)
; interpolated table lookup
; input: memory location "freq"
; output: AC0, format Q.31
;
; a = table[(phase>>16) & 0xFF];
; b = table[1+ ((phase>>16) & 0xFF)];
; phase += freq;
; out = a + (b-a)*((phase & 0xFFFF)>>1); // signed mult
;
; CPU flags : SXMD=0; FRCT=1; SATD=0;
;
; CPU cycles: 9 (one cycle pipeline stall before first *ar0)
mov @phase,t0
mov dbl(@phase),ac0 || and #0ffh,t0
amov #sine_table,xar0
add @freq,ac0 || mov ac0,t1
mov ac0,dbl(@phase)
mov *ar0(t0)<<#16,ac0 || aadd #1,t0
sub ac0,*ar0(t0)<<#16,ac1 || sftl t1,#-1
mac ac1,t1,ac0; non-interpolated table
; input: memory location "freq"
; output: AC0, format Q.31
;
; out = table[(phase>>16) & 0xFF];
; phase += freq;
;
; CPU flags : SATD=0;
;
; CPU cycles: 7 (one cycle pipeline stall before first *ar0)
mov @phase,t0
mov dbl(@phase),ac0 || and #0ffh,t0
amov #sine_table,xar0
add @freq,ac0
mov ac0,dbl(@phase)
mov *ar0(t0)<<#16,ac0; "difference equation" generator
;
; input: t0 "A"-coefficient
;
; out (AC0) = y(n) = A*y(n-1) - y(n-2)
;
; CPU cycles: 4
.ref dly_line
amov #dly_line,xar0
mpym t3=*ar0+,t0,ac0
sub *ar0<<#16,ac0 || mov t3,*ar0
mov HI(ac0),*-ar0
E-mail: info@telesys.ru