How to know if an instruction requires microcode

discussion of forwardcom instruction set and corresponding hardware and software

Moderator: agner

Post Reply
JoeDuarte
Posts: 41
Joined: 2017-12-19, 18:51:45

How to know if an instruction requires microcode

Post 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?
agner
Site Admin
Posts: 177
Joined: 2017-10-15, 8:07:27
Contact:

Re: How to know if an instruction requires microcode

Post 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.
JoeDuarte
Posts: 41
Joined: 2017-12-19, 18:51:45

Re: How to know if an instruction requires microcode

Post 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?
agner
Site Admin
Posts: 177
Joined: 2017-10-15, 8:07:27
Contact:

Re: How to know if an instruction requires microcode

Post 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.
Post Reply