Sunday, December 4, 2011

Can someone explain to me what this JAVA boolean does?

switch ((ir%26gt;%26gt;6)%26amp;0x03) // IR(7:6)





ir is an 8 bit binary number variable which stands for instruction register which is set to whatever was read, I took this from a java emulation of a microcode program. Thanks!|||it seems that ir contains the register value, it right shifts its contents by 6-bits and get a value with 0x03





for example, if the register value if AB (you said it's only 8 bits), then bit pattern is


10101011


shifting 6 bits will have 10 left, then with %26amp; operator you will get 10 (binary) or 2


so the switch value could be 0, 1, 2, 3

No comments:

Post a Comment