30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

-15<br />

or<br />

smaller than -1.0. Analogously, the vector dot product and power operations<br />

could lead to saturation if the sum of products is greater than 1-2<br />

-15<br />

or smaller<br />

than -1.0.<br />

c) It is recommended that the Status register (SR) be examined after completion<br />

of<br />

each function call. In particular, users can inspect the SA, SB and SAB flags<br />

after<br />

the function returns to determine if saturation occurred.<br />

d) All the functions have been designed to operate on fractional vectors<br />

allocated<br />

in default RAM memory space (X-Data or Y-Data).<br />

e) Operations which return a destination vector can be nested, so that for<br />

instance<br />

if:<br />

a = Op1 (b, c), with b = Op2 (d), and c = Op3 (e, f), then<br />

a = Op1 (Op2 (d), Op3 (e, f))<br />

2.3.3 Additional Remarks<br />

The description of the functions limits its scope to what could be considered the<br />

regular<br />

usage of these operations. However, since no boundary checking is performed<br />

during<br />

computation of these functions, you have the freedom to interpret the operation<br />

and its<br />

results as it fits some particular needs.<br />

For instance, while computing the VectorMaxfunction, the length of the source<br />

vector<br />

could be greater than numElems. In this case, the function would be used to find<br />

the<br />

maximum value onlyamong the first numElemselements of the source vector.<br />

As another example, you may be interested in replacing numElemselements of a<br />

destination vector located between Nand N+numElems-1, with<br />

numElemselements from<br />

a source vector located between elements Mand M+numElems-1. Then, the<br />

VectorCopyfunction could be used as follows:<br />

fractional* dstV[DST_ELEMS] = {...};<br />

fractional* srcV[SRC_ELEMS] = {...};<br />

int n = NUM_ELEMS;<br />

int N = N_PLACE; /* NUM_ELEMS+N ≤DST_ELEMS */<br />

int M = M_PLACE; /* NUM_ELEMS+M ≤SRC_ELEMS */<br />

fractional* dstVector = dstV+N;<br />

int n = NUM_ELEMS;<br />

int N = N_PLACE; / * NUM_ELEMS + N ≤DST_ELEMS * /<br />

int M = M_PLACE; / * NUM_ELEMS + M ≤SRC_ELEMS * /<br />

phân đoạn * dstVector = DSTV + N;<br />

phân đoạn * srcVector = srcV + M;<br />

dstVector VectorCopy = (n, dstVector, srcVector);<br />

Cũng trong bối cảnh này, VectorZeroPadfunction có thể hoạt động tại chỗ, nơi<br />

bây giờ<br />

DSTV = srcV, numElemsis số phần tử atthe đầu vector nguồn<br />

bảo tồn, và numZerosthe số phần tử ở đuôi vector để thiết lập để không.<br />

Khả năng khác có thể được khai thác từ thực tế là không có kiểm tra ranh giới<br />

thực hiện.<br />

DSP Thư viện<br />

2004 Microchip Technology Inc DS51456B trang 15<br />

2.3.4 Chức năng cá nhân<br />

Trong phần tiếp theo, các chức năng cá nhân thực hiện các hoạt động vector<br />

được mô tả.<br />

VectorAdd<br />

Mô tả: VectorAddadds giá trị của mỗi elementin nguồn một vector<br />

với đối tác của mình trong nguồn hai véc tơ, và đặt kết quả trong<br />

vector đích.<br />

Bao gồm: dsp.h<br />

Nguyên mẫu: ở ngoài phân đoạn * VectorAdd (<br />

int numElems,<br />

phân đoạn * DSTV,<br />

phân đoạn * srcV1,<br />

phân đoạn * srcV2<br />

);<br />

Đối số: numElems số phần tử trong vector nguồn<br />

DSTV con trỏ tới vector điểm đến<br />

con trỏ srcV1 nguồn một vector<br />

con trỏ srcV2 nguồn hai vector<br />

Quay trở lại giá trị: Con trỏ trỏ tới địa chỉ cơ sở của vector đích.<br />

Ghi chú: Nếu giá trị tuyệt đối của srcV1 [n] + srcV2 [n] là lớn hơn 1-2<br />

-15<br />

,<br />

hoạt động này dẫn đến độ bão hòa cho các phần tử n-thứ.<br />

Chức năng này có thể được tính tại chỗ.<br />

Chức năng này có thể tự áp dụng.<br />

Source File: vadd.asm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!