View previous topic :: View next topic
|
Author |
Message |
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
Hi,
I couldn't understand how BC instruction works.
Ex: I want to Branch to the address 6050 if CC is 0 or 1.
Reg 10 contains 00 00 50 00
Reg 11 contains 00 00 10 00
Instruction
BC 12, X'50'(11,10)
A mask of 12 in Dec means that there are ones in instruction bits 8 and 9, zeros in 10 and 11. So branching takes place if Condition Code is 0 or 1.
I could see the above example for BC instruction.
Can anyone explain how X'C' (12 in Dec) means ones in bits 8 and 9??? Thanks |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
See the answers in your previous TM(Test Under Mask) instruction in assembler topic.
Too lazy to read the manual, huh? |
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
The example I have mentioned is from the Manual 'zArchitecture_Principles_of_operation' itself.
I didn't understand the explanation and the example given in the manaul.
Hence I have posted here if anyone has better understanding of this instruction. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
Hi Enrico,
Can you explain me the below table from the link you have given above?
___________ _____________ __________
| | Instruction | Mask |
| Condition | Bit No. of | Position |
| Code | Mask | Value |
|_________|_________________ | __________|
| 0 | 8 | 8 |
| 1 | 9 | 4 |
| 2 | 10 | 2 |
| 3 | 11 | 1 |
|___________|_____________|__________| |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
take an hex digit C in this case
use its binary representation 1100
overlay the four bits at the M1 mask location
and You will readily see the the ones in Your mask will occupy bits 8 and 9 of the instruction |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
vinayknj wrote: |
The example I have mentioned is from the Manual 'zArchitecture_Principles_of_operation' itself.
I didn't understand the explanation and the example given in the manaul.
Hence I have posted here if anyone has better understanding of this instruction. |
If you should have stated its a sample from the POP you dont understand, i wouldnt have answered the way i did.
Beside that a Google on branch on condition gave me this site :
csc.colstate.edu/woolbright/BC.HTM
and this one :
www.bixoft.nl/english/opcd/bc.htm
and of course some more hits.
And because im lazy, i always used the BNE, BE, BZ etc. instructions, so i didnt have to remember all those bit masks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Can anyone explain how X'C' (12 in Dec) means ones in bits 8 and 9??? Thanks |
that' s the question I was trying to answer |
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
Thanks Enrico and Peter.
I think I have understood. Please confirm if am right
Ex: IF Mask is given as B'pos1 pos2 pos3 pos4', I.E. in the mask if pos1 has value '1' then CC must be '0' for the branch to happen. if pos2 has '1' then CC must be '1', if pos3 has '1' then CC must be 2 and finally pos4 is '1' then CC must be 3 for the branch to take place.
Hope my understanding is correct. Thanks |
|
Back to top |
|
|
|