Leading zero in primary opcode field confusion
Posted: Fri Aug 02, 2024 4:11 pm
I'm confused about how to read PowerPC opcodes.
In Chapter 12.2 of the IBM Gekko RISC Microprocessor User’s Manual (Version 1.2) on page 12-8 there is an example with addx. Its opcode is in the top-left corner of the box in hex:
And then the instruction encoding has a decimal 31 in bits 0 to 5 (the primary opcode field) and a decimal 266 in bits 22 to 30 (the extended opcode field). I understand where x214 comes from. You take the 266 and multiply by two (to shift it out of bit 31's way) and then get 532, which is x214 in hex.
But what about x7C? That's 0111 1100 in binary. So we have five contigious set bits like we need for 31, but we have this leading zero in the way. What's that about?
In Chapter 12.2 of the IBM Gekko RISC Microprocessor User’s Manual (Version 1.2) on page 12-8 there is an example with addx. Its opcode is in the top-left corner of the box in hex:
Code: Select all
x’7C00 0214’
But what about x7C? That's 0111 1100 in binary. So we have five contigious set bits like we need for 31, but we have this leading zero in the way. What's that about?