VXi VT1422A 사용자 설명서

다운로드
페이지 529
198 Creating and Running Algorithms  
How Does it Work?
The example algorithm definition above will be used for this discussion. 
When a value for <swap_size> is specified at algorithm definition, the 
VT1422A allocates two identical algorithm spaces for ALG3, each the size 
specified by <swap_size> (in this example 1000 words). This is called a 
"double buffer," arbitrarily called space A and space B. The algorithm is 
loaded into ALG3's space A at first definition. Later, while algorithms are 
running, "replace" ALG3 by again executing:
ALG:DEF ALG3,#42435<2435char_alg_source>
Notice that <swap_size> is not (must not be) included this time. 
The ALG:DEF command works like an Update Request. The VT1422A 
translates and downloads the new algorithm into ALG3's space B while the 
old ALG3 is still running from space A. When the new algorithm has been 
completely loaded into space B and an ALG:UPDATE command has been 
sent, the VT1422A simply switches to executing ALG3's new algorithm 
from space B at the next Update Phase (see Figure 6-2). If yet another ALG3 
were sent, it would be loaded and executed from ALG3's space A.
Determining an
Algorithm's Size
In order to define an algorithm for swapping, it is necessary to know how 
much algorithm memory to allocate for it or any of its replacements. It can 
be queried from the VT1422A using the following sequence:
1. Define the algorithm without swapping enabled. This will cause the 
VT1422A to allocate only the memory actually required by the 
algorithm.
2. Execute the ALG:SIZE? <alg_name> command to query the amount 
of memory allocated. The minimum amount of memory required for 
the algorithm is now known.
3. Repeat 1 and 2 for each of the algorithms that are to be swapped with 
the original. From this, the minimum amount of memory required for 
the largest is known.
4. Execute *RST to erase all algorithms.
5. Re-define one of the algorithms with swapping enabled and specify 
<swap_size> at least as large as the value from step 3 above (and 
probably somewhat larger because as alternate algorithms declare 
different variables, space is allocated for total of all variables 
declared).
6. Swap each of the alternate algorithms for the one defined in step 5, 
ending with the one that is to be run now. Remember, not to send the 
<swap_size> parameter with these. If an "Algorithm too big" error is 
not received, then the value for <swap_size> in step 5 was large enough.
7. Define any other algorithms in the normal manner.