;; Copyright 1987 by NeXT Inc. ;; Author - John Strawn ;; ;; Modification history ;; -------------------- ;; 11/12/87/jms - initial file created from cvmul.asm ;; 02/15/88/jms - added OPTIONAL_NOP ;; 02/23/88/jms - cosmetic changes to code and documentation ;; 03/29/88/jms - fix bugs in CALLING DSP PROGRAM TEMPLATE ;; ;; ------------------------------ DOCUMENTATION --------------------------- ;; NAME ;; cvmov (AP macro) - complex vector move ;; - copy complex vector from one location to another ;; ;; SYNOPSIS ;; include 'stdmacros' ; load standard DSP macro package ;; cvmov pf,ic,sinp,ainp0,iinp0,sout,aout0,iout0,cnt0 ; invoke cvmov ;; ;; MACRO ARGUMENTS ;; pf = global label prefix (any text unique to invoking macro) ;; ic = instance count (such that pf\_cvmov_\ic is globally unique) ;; sinp = input vector memory space ('x' or 'y') ;; ainp0 = input vector base address ;; iinp0 = increment for input vector ;; sout = output vector memory space ('x' or 'y') ;; aout0 = output vector base address ;; iout0 = increment for output vector ;; cnt0 = element count ;; ;; DSP MEMORY ARGUMENTS ;; Access Description Initialization ;; ------ ----------- -------------- ;; x:(R_X)+ input vector base address ainp0 ;; x:(R_X)+ input vector increment iinp0 ;; x:(R_X)+ output vector base address aout0 ;; x:(R_X)+ output vector increment iout0 ;; x:(R_X)+ element count cnt0 ;; ;; DESCRIPTION ;; The cvmov array-processor macro copies the elements of one complex ;; vector to another vector of the same length. In pseudo-C notation: ;; ;; ainp = x:(R_X)+; /* input address */ ;; iinp = x:(R_X)+; /* input increment */ ;; aout = x:(R_X)+; /* output address */ ;; iout = x:(R_X)+; /* output increment */ ;; cnt = x:(R_X)+; /* number of elements */ ;; ;; for (n=0;n1,Y1 move x:(R_X)+,R_I1 ; input vector 1 address move x:(R_X)+,A ; input vector 1 increment sub Y1,A x:(R_X)+,R_O ; output vector address to R_O move x:(R_X)+,B ; output vector increment sub Y1,B A,N_I1 ; decremented input vector 1 increment to N_I1 move B,N_O ; decremented output vector increment to N_O move x:(R_X)+,B ; count ; set up loop and pipelining tst B sinp:(R_I1)+,A ; fetch real jeq pf\_cvmov_\ic\_loop ; test B to protect against count=0 ; inner loop do B,pf\_cvmov_\ic\_loop if "sinp"=="sout" move A,sout:(R_O)+ ; store real move sinp:(R_I1)+N_I1,B ; fetch imag move B,sout:(R_O)+N_O ; store imag move sinp:(R_I1)+,A ; fetch real else if "sinp"=='x' move sinp:(R_I1)+N_I1,B A,sout:(R_O)+ ; fetch imag, store real move sinp:(R_I1)+,A B,sout:(R_O)+N_O ; fetch real, store imag else move A,sout:(R_O)+ sinp:(R_I1)+N_I1,B ; fetch imag, store real move B,sout:(R_O)+N_O sinp:(R_I1)+,A ; fetch real, store imag endif endif pf\_cvmov_\ic\_loop OPTIONAL_NOP ; from defines.asm, to prevent the macro from ending ; at the end of a loop. If you remove the nop, or if ; you redefine OPTIONAL_NOP to be just ' ', then the ; macro loaded next might begin with an op code which ; is illegal after the end of a loop. end_mac 'cvmov' endm end_def 'cvmov'