Leading zero in primary opcode field confusion

Post Reply
User avatar
Lumina333
Posts: 85
Joined: Fri Jul 26, 2024 7:18 am

Leading zero in primary opcode field confusion

Post by Lumina333 » 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:

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?
User avatar
Extrems
Posts: 1352
Joined: Tue Aug 17, 2010 10:40 pm
Location: Québec, Canada
Contact:

Re: Leading zero in primary opcode field confusion

Post by Extrems » Fri Aug 02, 2024 4:28 pm

Bits 0 to 5 is 6 bits.
User avatar
Lumina333
Posts: 85
Joined: Fri Jul 26, 2024 7:18 am

Re: Leading zero in primary opcode field confusion

Post by Lumina333 » Fri Aug 02, 2024 4:31 pm

Of course. Thanks.
User avatar
Lumina333
Posts: 85
Joined: Fri Jul 26, 2024 7:18 am

Re: Leading zero in primary opcode field confusion

Post by Lumina333 » Fri Aug 02, 2024 4:53 pm

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.
Post Reply