Sx instruction decision tree

From Just in Time

The image below shows a decision tree that can be used by an SX instruction decoder. Such a decoder could examine the bits of an instruction word from most significant (left) to least significant (right), starting at the root of the tree. Depending on the bit value found, the decoder takes either the '1' or the '0' branch. When the decoder reaches a labeled node, we have decoded enough bits to identify the instruction. Example: when the encoder finds the bit values 0, 1, 0, 1, we've identified the 'setb_fr_bit' (SETB <fr>.<bit>) instruction.

Instead of '1' and '0', there are a few 'x', or don't-care values in this tree. This means that an instruction decoder that is only interested in documented instructions does not have to look at the corresponding bit, because either the 0, or 1-branch don't lead to known instructions. I've used one of those branches to introduce a BREAKPOINT-instruction, just for the SX emulator.

Sx instruction decision tree.png