Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
ASM fir filter with double data
//extern void firAsm(chanend c, int H[],int X[], unsigned size);
#define NWORDS 7
// .cc_top biquadAsm, biquadAsm.func
.globl fir_ddAsm
.globl fir_ddAsm.nstackwords
.linkset fir_ddAsm.nstackwords,NWORDS
#define c r0
#define H r1
#define X r2
#define size r3
#define x r4
#define h r5
#define Xoff r6
#define i r7
#define state r8
#define Xm r9
#define ynl r10
#define ynh r11
entsp NWORDS
stw r4, sp[0]
stw r5, sp[1]
stw r6, sp[2]
stw r7, sp[3] // change to make sure that commit goes through to github
stw r8, sp[4]
ldc state,0
stw r9, sp[5]
ldaw Xm,X[size]
stw r10, sp[6]
.align 4
testct x,res[c]
bt x,allDone
in x,res[c] //read input to x
add i,size,0 //reset i to sizeof vector
stw x,X[state] // store word in X[state]
add r10,state,size
stw x,X[r10] // store word in X[state+size]
bf state,update //if state==0{state+=size}
sub state,state,1
ldc ynl,0 //reset MAC
ldc ynh,0 //reset MAC
bu entrypoint
add state,state,size
ldaw Xoff,Xm[-1];
bu updateR
.align 4
maccs ynh,ynl,h,x
ldw x,Xoff[i] //Xoffset = X-1*int32
sub i,i,1
ldw h,H[i]
bt i,subloop
maccs ynh,ynl,h,x
shl ynh,ynh,1
ldc r4,31
shr ynl,ynl,r4
or r4,ynh,ynl
out res[c],r4
ldaw Xoff,Xoff[-1];
bu mainloop
allDone: // Now just restore all registers.
inct r3, res[c]
ldw r4, sp[0]
ldw r5, sp[1]
ldw r6, sp[2]
ldw r7, sp[3]
ldw r8, sp[4]
ldw r9, sp[5]
ldw r10, sp[6]
retsp NWORDS
// .cc_bottom biquadAsm.func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.