Microcode: Difference between revisions

Content deleted Content added
subsection
Overview: add more sane definition of instructions microops
Tags: nowiki added Visual edit
Line 3:
{{Program execution}}
 
In [[processor design]], '''microcode''' (μcode<ref name=":0">{{Cite web |title=XuCode: An Innovative Technology for Implementing Complex Instruction... |url=https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/secure-coding/xucode-implementing-complex-instruction-flows.html |access-date=2022-07-19 |website=Intel |language=en}}</ref>) is a technique that interposes a layer of [[computer organization]] between the [[central processing unit]] (CPU) hardware and the programmer-visible [[instruction set architecture]] of a computer.<ref name=Kent2813>{{cite book |last1=Kent |first1=Allen |last2=Williams |first2=James G. |title=Encyclopedia of Computer Science and Technology: Volume 28 - Supplement 13 |date=April 5, 1993 |publisher=Marcel Dekker, Inc |___location=New York |isbn=0-8247-2281-7 |url=https://books.google.com/books?id=EjWV8J8CQEYC |access-date=Jan 17, 2016 |archive-date=November 20, 2016 |url-status=live |archive-url=https://web.archive.org/web/20161120161636/https://books.google.com/books?id=EjWV8J8CQEYC}}</ref>{{Page needed|date=July 2022}} Microcode is a layer of hardware-level instructions that implement higher-level [[machine code]] instructions or internal [[finite-state machine]] sequencing in many [[digital processing]] elements. Microcode is used in general-purpose [[central processing unit]]s, although in current desktop CPUs, it is only a fallback path for cases that the faster [[hardwired control unit]] cannot handle.<ref name=FogMicro>{{cite report |last1=Fog |first1=Agner |date=2017-05-02 |title=The microarchitecture of Intel, AMD and VIA CPUs |publisher=Technical University of Denmark |url=http://www.agner.org/optimize/microarchitecture.pdf |access-date=2018-04-08 |url-status=live |archive-url=https://web.archive.org/web/20170328065929/http://agner.org/optimize/microarchitecture.pdf |archive-date=2017-03-28}}</ref>
 
Microcode typically resides in special high-speed memory and translates machine instructions, [[state machine]] data, or other input into sequences of detailed circuit-level operations. It separates the machine instructions from the underlying [[electronics]] so that instructions can be designed and altered more freely. It also facilitates the building of complex multi-step instructions, while reducing the complexity of computer circuits. Writing microcode is often called ''microprogramming'' and the microcode in a particular processor implementation is sometimes called a ''microprogram''.
Line 15:
=== Instruction decoding microcode ===
The lowest layer in a computer's software stack is traditionally raw [[machine code]] instructions for the processor. In microcoded processors, the microcode fetches and executes those instructions. To avoid confusion, each microprogram-related element is differentiated by the ''micro'' prefix: microinstruction, microassembler, microprogrammer, [[microarchitecture]], etc.{{Cn|date=July 2022}}
 
In a [[Complex instruction set computer|Complex Instruction Set]] (CISC) [[Instruction set architecture|instruction set architechture]]<nowiki/>s like [[X86|x86-64]], a stream of instructions fetched from memory are decoded into sequence of small operations known as micro-ops (μops). For some x86 instructions there is a simple 1:1 mapping to a microop, and for others sequence is mapped to many μop instructions. A collection of μops is what is often referred to as microcode. The amount of memory dedicated to the microcode is often finite due to space, performance or design requirements.<ref name=":0" />
 
=== Design ===