Xilinx UG129 Answering Machine User Manual


 
PicoBlaze 8-bit Embedded Microcontroller www.xilinx.com 117
UG129 (v1.1.2) June 24, 2008
TEST sX, Operand — Test Bit Location in Register sX, Generate Odd Parity
R
Pseudocode
; logically AND the corresponding bits in sX and the Operand
for (i=0; i<= 7; i=i+1)
{
AND_TEST(i) Å sX(i) AND Operand(i)
}
if (AND_TEST = 0) then
ZERO Å 1
else
ZERO Å 0
end if
; logically XOR the corresponding bits in sX and the Operand
XOR_TEST = 0
for (i=0; i<= 7; i=i+1)
{
XOR_TEST Å AND_TEST(i) XOR XOR_TEST
}
if (XOR_TEST = 1) then; generate odd parity
CARRY Å 1 ; odd number of one’s, CARRY=1 for odd parity
else
CARRY Å 0 ; even number of one’s, CARRY=0 for odd parity
end if
PC Å PC + 1
Registers/Flags Altered
Registers: PC
Flags: ZERO, CARRY
The TEST instruction is only supported on PicoBlaze microcontrollers for Spartan-3,
Virtex-II, and Virtex-II Pro FPGAs.