/* This C language subroutine computes the multiplication of a matrix by a scaler. z(i,j) = a*x(i,j) The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 5/25/90 Updated on 5/94 by AS Updated on 2/95 by AS - separated polymorphic functions #include
float matscalmult(float z[][], float x[][], float a, int r, int s); */ #include "lib_glob.h" #include "mat_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___matscalmultPD; ___matscalmultPD: smlt_core: readparam4(R0); readparam5(R2); R2=R0*R2 (SSI), dm_ptr=R8; /* Point to input */ pd_smlt: R2=R2-1, F8=DM(dm_ptr, dm_1); /* Compute size of matrix*/ IF LT JUMP (PC, restore_state); IF EQ JUMP (PC, pd_finished); /* Only one element! */ F0=F8*F12, F8=DM(dm_ptr, dm_1); R2=R2-1, pm_ptr=R4; /* Point to output */ IF EQ JUMP (PC, pd_stbf); /* Only two elements! */ LCNTR=R2, DO matrix_smultpd UNTIL LCE; matrix_smultpd: F0=F8*F12, F8=DM(dm_ptr, dm_1), PM(pm_ptr, pm_1)=F0; pd_stbf: PM(pm_ptr, pm_1)=F0; pd_finished: F0=F8*F12; PM(pm_ptr, pm_1)=F0; restore_state: R0=PASS R4, FETCH_RETURN RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;