Are x86 op codes arbitrary?
Is there a reason that hlt
is 0xf4 and the nop
is 0x90?
Are x86 op codes arbitrary?
Is there a reason that hlt
is 0xf4 and the nop
is 0x90?
Very early versions of this architecture (8008,8080) were implemented using extremely small numbers of transistors/logic gates.
At that time, I'm sure the designers chose opcodes and instruction formats in ways that were easy to decode (e.g., smallest number of gates). The instructions tended to be simple, and regular in format.
(I know I did this designing a 16 bit CPU back in the 1970s. Intel might have done a better job but they were always in a hurry. My CPUs insisted that 4 bit opcodes 0000 and 1111 were invalid and caused a trap; this prevented data from being executed by accident in most cases because integral values tend to be all zeros or ones in their top bits).
Success and competition demands evolution and addition of new features. There is constant pressure to invent/add new instructions that enable the CPUs to do things faster and better: floating point, 32 bit data, more registers, SIMD operations, encryption, ...
As new generations of processors came, with larger transistor budgets, two things happened as designers tried to add new instructions:
Repeat this process through a dozen generations of CPU until you reach modern times, with many-billion transistor chips. Now the instructions added get more exotic, and the patterns get more complex. It can look arbitrary; it isn't, but it isn't cleanly designed either.
What modern x86 chips do with instruction formats is pretty stunning, yet it works.
© 2022 - 2024 — McMap. All rights reserved.