3
$\begingroup$

How I understand microcode translate an instruction to microinstructions. And CPU has a unit that stores all possible of microinstructions. These microinstructions can be changed, because it load every time after boot from motherboard. Can instruction set be changed?

I am sorry if i ask strange question, if I misunderstood , please correct , thanks and again I am sorry if my English grammar is bad. (google translate)

$\endgroup$
5
$\begingroup$

That depends completely on the CPU. Some CPUs don't use microcode at all. Some CPUs use a mixture of hardcoded instructions and microcoded instructions. This mixture can be anywhere between almost all hardcoded and only a few microcoded instructions to almost all microcoded and only a few hardcoded instructions.

For CPUs that have microcode, the microcode could be either modifiable or not modifiable.

If all instructions are microcoded (there are no hardcoded instructions) and the microcode is stored and loaded in such a way that you can load a different one at will, then it would theoretically be possible to load microcode that implements a completely different instruction set.

However, the feasibility of that still depends on the internal design of the CPU. An extreme example would be the Transmeta Crusoe and Efficeon CPUs. These were 128 bit VLIW designs internally, and in order to execute x86 code, they had a software layer called Code Morphing Software, which was essentially an interpreter and JIT compiler from x86 to the internal VLIW code. The Code Morphing Software was running entirely in the standard RAM. This makes it sound like it should have been very easy to just load a different version of the Code Morphing Software and turn the CPU into an ARM or PowerPC or SPARC or MIPS CPU, right?

Well, not according to Linus Torvalds, who worked for Transmeta at the time. He was asked this exact question, and his answer was that the internals of the CPU are so specifically optimized for interpreting x86 code that writing a CMS implementation for, say, MIPS would be no different (and no more performant) than simply writing a MIPS emulator for x86 … which already exist anyway.

On the other hand, the CPUs of the Xerox Alto, Dandelion, Dolphin, and Dorado workstations were explicitly designed to be microcoded for different use cases. They would run completely different microcode depending on whether they were running Interlisp, Smalltalk, or the Star system. For example, the Smalltalk system implemented the most important instructions of their VM in microcode, so that in some sense, the CPU could directly execute (parts of) Smalltalk byte code. You could say that when running the Smalltalk system, Smalltalk byte code was the ISA!

$\endgroup$
3
$\begingroup$

x86 CPUs (Intel, AMD) use a large amount of microcode, a part of this microcode can be downloaded in RAM and can be updated, principally for fixing bugs (and maybe for more hidden purposes such as disabling some parts of the CPU depending on the part number).

I doubt using different microcode would be enough to completely change the instruction set, because of the highly optimised nature of modern CPUs with very complex instruction decode.

There are a few other examples of CPUs with a complex internal microcode, for example the nVidia Denver with has an internal processor which dynamically translates the ARM instruction set, some rumors pretended that this project was initially targeting x86 before being redesigned as an ARM CPU, and I doubt supporting both x86 and ARM compatibility would be reasonably achievable.

There are a few historical examples of CPUs in the 60's and 70's which had all their microcode in RAM (for example IIRC DataGeneral Eclipse).

$\endgroup$
0
$\begingroup$
  • Microcode instructs the computer on how it has to do its work.
  • Machine code, which has a direct correspondence to the instruction, specifies the format for the work to be written in such that the computer can understand (decode) it.

Instruction Set architecture is the contract between the software team and the hardware architect, which ensures that software targeting that instruction set will run on the machine that supports it.

If Instruction Set Architecture changes, then the computer won't be able to run the code that was designed to run on it. That means applications distributed in binary form would no longer run on it.

Microcode is just a sequence of instructions that can be thought of as the code that controls the Finite State Machine that controls the CPU. It controls the behaviour of the CPU, however, it cannot change the instruction set.

Here are 2 more reasons why the instruction set cannot be changed:

  1. Instruction decoder is fixed.
  2. Register file is fixed.

See also: Is there code below microcode?

$\endgroup$
-1
$\begingroup$

I very much doubt that any modern CPU will use microinstructions nowadays, and the ability to change this would be an incredible security risk. Absolutely totally unacceptable.

Being able to change the microcode would mean you cannot trust any code in your computer at all.

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.