Example RAM contents
|
Fast Table Look-up
Finding a target bit pattern from a big table is one of commonly seen time
consuming routines in signal processing programs. The CD2470A has a quick
table look-up method where one cycle per one memory word comparison is possible.
The CMPB As,(Rij+) instruction compares the RAM data with As register, then
clear the Loop counter (termination of the Repeat operation) and the Rij
contents is copied to PM register, if they match. This instruction allows
to find the matched memory address in the PM register with the usage of
repeat function as follows.
Example:
You have a table of 62 words on RAM0. A value g0AA6h is in AH0 register
to find the address of the table having the value g0AA6h.
LDSI PM,0
LDI R0,@st
LDSI RC,61
CMPB AH0,(R0+)
LD AH0,PM
BRA @no_match, AHZ
This program takes 7 to 68 cycles to find a matched data. The bit pattern
to be searched is given in AH0, and the address of the matched data comes
in AH0.
An alternative program that does not use CMPB instruction takes about
5 times of the cycles. See an example coding.
LDI R0,@st
LDI R7,62
LP1:
CMP AH0,(R0+)
BRA @LP2,Z
BRA @LP1,NDRZ7
BRA @no_match
LP2:
MODR R4,R0-
LD AH0,R0
|