cpu-architecturedumpopcodehexdumpspu

Decoding muli-length opcodes (SPU ISA)


I have produced a dump of 32-bit instructions in hex from an assembler I implemented. A subset of the instruction dump is show below:

enter image description here

The opcodes for the instructions are of lengths 4, 7, 8, 9, and 11. They are always the first bits in the instruction. I'm having trouble understanding how I would decode the instructions if the opcodes are of different lengths?

For example: When I read a single instruction, how would I know how many bits I should read for the opcode?

Here is an image of the instruction formats: format

Thank you


Solution

  • I figured it out. I read the maximum number of opcode bits (11) for all instructions, and ignore the bits that don't make sense (i.e the bits that wouldn't result in a possible opcode).