Page 1 of 1

Leading zero in primary opcode field confusion

Posted: Fri Aug 02, 2024 4:11 pm
by Lumina333
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:

Code: Select all

x’7C00 0214’
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?

Re: Leading zero in primary opcode field confusion

Posted: Fri Aug 02, 2024 4:28 pm
by Extrems
Bits 0 to 5 is 6 bits.

Re: Leading zero in primary opcode field confusion

Posted: Fri Aug 02, 2024 4:31 pm
by Lumina333
Of course. Thanks.

Re: Leading zero in primary opcode field confusion

Posted: Fri Aug 02, 2024 4:53 pm
by Lumina333
Also kind of weird how in Appendix A they spell out every bit position number except 1 to 4 (and the whitespace is missing for the last three paired-single tables), but whatever.