271
19.3 Operation of Bit Search Module
0 detection and 1 detection by the bit search module, and detection operation are
described.
■
0 Detection
Scans data that was written to the data register for 0 detection from the MSB to LSB, and returns the
position where the first "0" was detected.
The detection result can be obtained by reading the detection result register.
Relationship between the detected position and numeric value to be returned is as per Table 19.3-1 .
When "0" does not exist (in other words, when the numeric value is FFFFFFFF
H
), a value of 32 is returned
as the search result.
[Execution example]
Figure 19.3-1 Execution example of 0 detection
■
1 Detection
Scans data that was written to the data register for 1 detection from the MSB to LSB, and returns the
position where the first "1" was detected.
The detection result can be obtained by reading the detection result register.
Relationship between the detected position and value to be returned is as per Table 19.3-1 .
When "1" does not exist (in other words, when the numeric value is 00000000
H
), a value of 32 is returned
as the search result.
[Execution example]
Figure 19.3-2 Execution example of 1 detection
Program data Read data (decimal)
11111111111111111111000000000000
B
(FFFFF000
H
) 2 0
5
1
3 2
11111000010010011110000010101010
B
(F849E0AA
H
)
10000000000000101010101010101010
B
(8002AAAA
H
)
11111111111111111111111111111111
B
(FFFFFFFF
H
)
00100000000000000000000000000000
B
(20000000
H
)
2
7
1 4
3 1
3 2
00000001001000110100010101100111
B
(01234567
H
)
00000000000000111111111111111111
B
(0003FFFF
H
)
00000000000000000000000000000001
B
(00000001
H
)
00000000000000000000000000000000
B
(00000000
H
)
Program data Read data (decimal)