13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Advanced Function <strong>Instruction</strong>FUN125 PMCMPMATRIX COMPAREFUN125 PMCMPMd : Starting register of matrix aMb : Starting register of matrix bL : Length of matrix (Ma, Mb)Pr : Pointer registerMa, Mb may combine with V, Z, P0~P9 toserve indirect address applicationOperandRangeWX WY WM WS TMR CTR HR IR OR SR ROR DR K XRWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D4095Ma ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○Mb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○L ○ ○* ○ ○Pr ○ ○ ○ ○ ○ ○ ○ ○* ○* ○2∣256V、ZP0~P9• When comparison control "EN" = 1 or "EN↑" ( P instruction) has atransition from 0 to 1, then beginning from the top pair of bits (Ma 0and Mb 0) within the 2 matrixes Ma and Mb (when "FHD" = 1 or PrPrvalue is equal to 16L-1), or beginning from the next pair of bits (Mapr+ 1 and Mbpr + 1) pointed by pointer Pr (when "FHD" = 0 and Prvalue is less than L-1), this instruction will compare and search forpairs of bits with different value (when D/S = 1) or the same value(when D/S = 0). Once match found, pointer Pr will point to the bitMaMbnumber in the matrix met the search condition. The found objectiveflag "FND" will be set to 1. When it has searched to the final pair ofbits in the matrix (Ma 16L-1, Mb 16L-1), this execution of the instructionwill finish, no matter it has found or not. If this happen then Thecompare-to-end flag "END" will be set as 1, and the Pr value will setto 16L-1 and the next time that this instruction is executed, Pr willautomatically return to the starting point of the matrix (Pr = 0) to beginthe comparison search.LMapr : Mbpr• The range for the pointer value is 0 to 16L-1. The Pr value should not be changed by other instructions, as this willaffect the result of search. If the Pr value exceeds its range, then the pointer error flag "ERR" will be set to 1, andthis instruction will not be carried out.X0ENFHDD/S125P.MCMPMa : R 0Mb : R 10L :Pr :5R 20FNDENDERR• In the program at left, the "FHD" input is 0, so starting from aposition 1 greater than the pointer value at that time (markedby *), the instruction will do a search for bits with differentstatus (because D/S = 1). When X0 has a transition from 0→1 three times, the results are shown at right in the diagrambelow.Pr4 R20Ma15Ma0 Mb15Mb0↓ Ma *↓↓ Mb *↓R0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 R10 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1R1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0R2 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 R12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1R3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1R4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1↑↑↑Ma64Ma79Mb79Before executionMb64Pr FND END R20 39 1 0Pr FND END R20 79 0 1Pr FND END R20 2 1 0Execution result7-108

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!