Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

© 2005-2011 Microchip Technology Inc. DS70157F-page 89
Section 4. Instruction Set Details
Instruction Set
Details
4
Table 4-13: Scaling Examples
As a practical example, assume that block processing is performed on a sequence of data with
very low dynamic range stored in 1.15 fractional format. To minimize quantization errors, the data
may be scaled up to prevent any quantization loss which may occur as it is processed. The FBCL
instruction can be executed on the sample with the largest magnitude to determine the optimal
scaling value for processing the data. Note that scaling the data up is performed by left shifting
the data. This is demonstrated with the code snippet below.
Example 4-23: Scaling with FBCL
Word Value Exponent
Full Scale Value
(Word Value << Exponent)
0x0001 14 0x4000
0x0002 13 0x4000
0x0004 12 0x4000
0x0100 6 0x4000
0x01FF 6 0x7FC0
0x0806 3 0x4030
0x2007 1 0x400E
0x4800 0 0x4800
0x7000 0 0x7000
0x8000 0 0x8000
0x900A 0 0x900A
0xE001 2 0x8004
0xFF07 7 0x8380
Note: For the word values 0x0000 and 0xFFFF, the FBCL instruction returns -15.
; assume W0 contains the largest absolute value of the data block
; assume W4 points to the beginning of the data block
; assume the block of data contains BLOCK_SIZE words
; determine the exponent to use for scaling
FBCL W0, W2 ; store exponent in W2
; scale the entire data block before processing
DO #(BLOCK_SIZE-1), SCALE
LAC [W4], A ; move the next data sample to ACCA
SFTAC A, W2 ; shift ACCA by W2 bits
SCALE:
SAC A, [W4++] ; store scaled input (overwrite original)
; now process the data
; (processing block goes here)

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh