Given an arbitrary CPU - Architecture and its instruction set... What would be the outcome of the given inverted instruction within that Architect?
For simplicity, let's use an 8-bit CPU architecture that has an 8-bit Bus design where that bus is used for both addressing and data transfer operations. A single instruction or micro instruction will act on an 8-bit string of binary digits per clock cycle. Each clock cycle may consist of 3,4,or 5 micro instructions before incrementing the instruction register for the next full instruction to be processed. These would account for the Fetch
, Decode
, and Execute
phases of a single CPU clock cycle instruction.
The following is a mock-up only to demonstrate or illustrate my curiosity and concern while designing the layout of a given ISA
(Instruction Set Architecture)...
Here we have the range of possible instructions from [0000 0000, 1111 1111]
which are all of the possible permutations that this arbitrary CPU-Architecture's Machine Language can support. We could use Ben Eater's 8-bit Bread Board CPU and its ISA
as an example... You can find that here along with other useful videos from his YouTube channel: Comparing C to Machine Language, and Programming 8-Bit Computer. With his given implementation, the first 4 bits are used to define the instruction
and the second 4 bits are used for data
{either memory address or immediate value}...
Now to my question: Given a specific instruction word and its accompanying data field, what would be the resulting outcome if we invert all of the instruction bits?
First, I know that this would be independent on each Architecture's ISA
design implementation... Second, I'm just curious to what the ramifications would be when designing your own specifications in that, would it be possible to carefully design and layout your bit fields per instruction in a manner that you could have a special invert operation, that would automatically invert a given instruction where that inversion would produce the opposite or inverse effect of the given incoming instruction? Now, the inversion won't necessarily happen to the entire instruction string that includes all 8-bits, but only to the bit-fields that pertain to the instruction type while preserving the data field... For example:
- If we have an Add instruction, the invert op would turn this to a Sub...
- If we have an And instruction, the invert op would turn this to an Or instruction...
- If we have either a Bit Shift Logical Left or Bit Shift Arithmetic Left, the invert op would respectively turn these into Bit Shift Logical/Arithmetic Right operations...
- And so on...
Would such a design be possible to have perfect symmetry within it's ISA?
-Note- I don't know if this is the correct StackExchange site for this question... if it is not please don't down vote it due to being irrelevant and be kind enough to point me in the right direction letting me know where the appropriate site for this question would be.