Page 1 of 1
How to know if an instruction requires microcode
Posted: 2019-02-16, 1:53:02
by JoeDuarte
Hi Agner -- What determines if an instruction will require microcode? You had mentioned in the past that you didn't want to use microcode or wanted to minimize the amount of microcode. How is this done? How do you know in advance whether instructions will need microcode?
Re: How to know if an instruction requires microcode
Posted: 2019-02-17, 5:53:58
by agner
Microprocessors generally use microcode for complex instructions that are doing complex things, or a sequence of multiple things. Typical examples are:
- Instructions that save or restore all registers on task switches
- Mathematical functions such as sin and cos
- Gather and scatter
The microcode works like a piece of software that runs from an on-chip ROM. The Forwardcom architecture should preferably have no microcode because it is inefficient on existing architectures. The complex functions should either be implemented as general (off-chip) software or in an attached FPGA. Saving and restoring all registers on Forwardcom is made with tiny instructions in order to make the necessary off-chip software more compact.
Re: How to know if an instruction requires microcode
Posted: 2019-02-18, 18:13:17
by JoeDuarte
Thanks Agner. If it's inefficient on current architectures why do they do it? Do you expect ForwardCom to be faster than x86-64, or would you be using less energy or something?
This looks like RISC. You had said at some point that you were drawing from both RISC and CISC approaches? Where is the CISC influence?
Re: How to know if an instruction requires microcode
Posted: 2019-02-19, 5:56:15
by agner
The x86 instruction set has developed through many years. What was optimal in the 1980s is not optimal today, but today's processors have to be backward compatible with everything that has been added through the years. For example, it is faster to calculate a sine using a function library, but you still have to support the old FSIN instruction that calculates the sine function using microcode, because a lot of legacy software uses the old instructions.
ForwardCom has a balance between RISC and CISC that I think is near optimal. The RISC principle gives a consistent instruction format that can be decoded fast. Decoding of instructions is a serioius bottleneck in x86. The CISC part is that you can calculate the address of a memory operand, load this operand, and do an arithmeting calculation with this operand in just one instruction where a true RISC design requires three or more instructions to do the same. I think this can make ForwardCom faster.