R

Appendix : PicoBlaze Instruction Set and Event Reference

TEST sX, Operand — Test Bit Location in Register sX, Generate Odd Parity

The TEST instruction performs two related but separate operations. The ZERO flag indicates the result of a bitwise logical AND operation between register sX and the specified Operand. The ZERO flag is set if the resulting bitwise AND is zero, as shown in Figure C-11. The CARRY flag indicates the XOR of the result, as shown in Figure C-12, which behaves like an odd parity generator.

Register sY Literal kk

7

6

5 4 3

2

1

0

Register sX

7

 

6

 

 

5

 

 

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3

2

1

0

Bitwise AND

If all bit results are zero, set ZERO flag.

ZERO

UG129_c3_03_051404

Figure C-11:ZERO Flag Logic for TEST Instruction

Register sY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7

 

 

 

 

6

 

 

 

 

5

 

 

 

4

 

 

 

3

 

 

 

 

2

 

 

 

 

1

 

 

 

 

0

 

Literal kk

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Register sX

 

 

 

7

 

 

 

 

6

 

 

 

 

5

 

 

 

 

4

 

 

 

3

 

 

 

2

 

 

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Mask out unwanted bits. 0=mask bit, 1=include bit

0

Generate odd parity (XOR) from bit results.

CARRY

UG129_c3_04_051404

Figure C-12:CARRY Flag Logic for TEST Instruction

Examples

TEST sX, sY ; Test register sX using register sY as the test mask TEST sX, kk ; Test register sX using the immediate constant kk as the

; test mask

116

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

 

 

UG129 (v1.1.2) June 24, 2008

Page 116
Image 116
Xilinx UG129 manual Figure C-11ZERO Flag Logic for Test Instruction