/**************************************************************
File Name: vecsum.asm
Date Modified: 2/11/99 RFG
Purpose: Subroutine that implements a Vector Summation given
two vectors.
Equation: SUM(i) = A(i) * B(i)
Calling Parameters:
b0,i0 = address of vector A
b7,i7 = address of vector SUM
b8,i8 = address of vector B
r1 = (number of elements in vectors - 2) / 2
l0,l7,l8 = 0
m1,m9 = 2
Assumptions:
All arrays must start on even address boundaries.
All arrays must have an even number length (zero
pad if necessary)
Return Values:
f12=SUM
Registers Affected:
f0,f4,f8,f12
i0,i7,i8
Cycle Count:
9 + (N-2)/2 + 2 cache misses
Number of PM Locations:
10 instruction words
N for the Number of elements for the vector B
Number of DM Locations:
N for the Number of elements for the vector A
N for the Number of elements for the vector SUM
**************************************************************/
#include "def21161.h"
.global vector_summation;
/* program memory code */
.section/pm seg_pmco;
vector_summation:
/* start vector sum calculation */
/* alu, multiplier precision, SIMD Mode Enabled */
bit set MODE1 RND32 | PEYEN;
nop;
/* start vector sum main loop */
f0=dm(i0,m1), f4=pm(i8,m9);
lcntr=r1, do vecsum until lce; /* vector sum loop */
f8=f0+f4, f0=dm(i0,m1), f4=pm(i8,m9);
vecsum: dm(i7,m1)=f8;
f8=f0+f4;
rts (db);
bit clr MODE1 PEYEN;
dm(i7,m1) = f8; /* write last result */
vector_summation.end: