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.

A batch file named makedsplib.batis provided to rebuild the DSP library. The<br />

MPLAB C30 compiler is required to rebuild the DSP library, and the batch file<br />

assumes<br />

that the compiler is installed in the default directory, c:\pic30_tools. If your<br />

language tools are installed in a different directory, you must modify the<br />

directories in the<br />

batch file to match the location of your language tools.<br />

DSP Library<br />

2004 Microchip Technology Inc. DS51456B-page 13<br />

2.3 VECTOR FUNCTIONS<br />

This section presents the concept of a fractional vector, as considered by the<br />

DSP<br />

Library, and describes the individual functions which perform vector operations.<br />

2.3.1 Fractional Vector Operations<br />

A fractional vector is a collection of numerical values, the vector elements,<br />

allocated<br />

contiguously in memory, with the first elementat the lowest memory address.<br />

One word<br />

of memory (two bytes) is used to store the value of each element, and this<br />

quantity<br />

must be interpreted as a fractional number represented in the 1.15 data format.<br />

A pointer addressing the first element of the vector is used as a handle which<br />

provides<br />

access to each of the vector values. The address of the first element is referred<br />

to as<br />

the base address of the vector. Because each element of the vector is 16 bits, the<br />

base<br />

address mustbe aligned to an even address.<br />

The one dimensional arrangement of a vector accommodates to the memory<br />

storage<br />

model of the device, so that the n-th element of an N-element vector can be<br />

accessed<br />

from the vector's base address BA as:<br />

BA + 2(n-1), for 1 ≤n ≤N.<br />

The factor of 2 is used because of the byte addressing capabilities of the<br />

dsPIC30F<br />

device.<br />

Unary and binary fractional vector operations are implemented in this library.<br />

The operand vector in a unary operation is called the source vector. In a binary<br />

operation the<br />

first operand is referred to as the source one vector, and the second as the source<br />

two<br />

vector. Each operation applies some computation to one or several elements of<br />

the<br />

source vector(s). Some operations produce a result which is a scalar value (also<br />

to be<br />

interpreted as a 1.15 fractional number), while other operations produce a result<br />

Hoạt động vector phân đoạn nguyên phân và nhị phân được thực hiện trong thư<br />

viện này. Các vector toán hạng trong một hoạt động nguyên phân được gọi là<br />

vector nguồn. Trong một hoạt động nhị phân<br />

toán hạng đầu tiên được gọi là một trong những nguồn vector, và thứ hai là<br />

nguồn hai<br />

vector. Mỗi hoạt động áp dụng một số tính toán cho một hoặc một số yếu tố của<br />

vector nguồn (s). Một số hoạt động sản xuất một kết quả mà là một giá trị vô<br />

hướng (cũng được<br />

hiểu là một số phân đoạn 1.15), trong khi các hoạt động khác tạo ra một kết quả<br />

mà<br />

là một vector. Khi kết quả cũng là một vector, điều này được gọi là vector đích.<br />

Một số hoạt động dẫn đến một vector cho phép tính toán tại chỗ. Điều này có<br />

nghĩa<br />

kết quả của các hoạt động được đặt trở lại vào vector nguồn (hoặc nguồn một<br />

vector<br />

cho các hoạt động nhị phân). Trong trường hợp này, các vector điểm đến được<br />

cho là (vật lý) thay thế<br />

nguồn (một) vector. Nếu một hoạt động có thể được tính tại chỗ, nó được chỉ<br />

định như vậy<br />

trong các ý kiến được cung cấp với mô tả chức năng.<br />

Đối với một số hoạt động nhị phân, hai toán hạng có thể giống nhau (vật lý)<br />

nguồn<br />

vector, có nghĩa là các hoạt động được áp dụng cho các vector nguồn và bản<br />

thân. Nếu loại<br />

tính toán là có thể cho một hoạt động nào đó, nó được chỉ định như vậy trong<br />

các ý kiến<br />

cung cấp với mô tả chức năng.<br />

Một số hoạt động có thể được cả hai tự áp dụng và tính toán tại chỗ.<br />

Tất cả các hoạt động vector phân đoạn trong thislibrary mất như một tham số số<br />

phần tử<br />

(Số phần tử) của vector toán hạng (s). Căn cứ vào giá trị của tham số này<br />

giả định sau đây được thực hiện:<br />

a) Tổng kích thước của tất cả các vectơ tham gia vào một hoạt động cụ thể nằm<br />

trong<br />

phạm vi của bộ nhớ dữ liệu có sẵn cho các thiết bị mục tiêu.<br />

b) Trong trường hợp hoạt động nhị phân, cardinalities của cả hai vectơ toán<br />

hạng phải<br />

tuân thủ các quy tắc của vector đại số (đặc biệt, xem các ghi nhận cho<br />

VectorConvolveand VectorCorrelatefunctions).<br />

c) Các vector đích mustbe đủ để chấp nhận các kết quả của một lớn<br />

hoạt động.<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 14<br />

2.3.2 Xem xét tài khoản<br />

2004 Microchip Technology Inc<br />

a) Không kiểm tra ranh giới được thực hiện bởi các chức năng này. Trong phạm

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

Saved successfully!

Ooh no, something went wrong!