Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Microcode
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Implementation== Each microinstruction in a microprogram provides the bits that control the functional elements that internally compose a CPU. The advantage over a hard-wired CPU is that internal CPU control becomes a specialized form of a computer program. Microcode thus transforms a complex electronic design challenge (the control of a CPU) into a less complex programming challenge. To take advantage of this, a CPU is divided into several parts: * An [[I-unit]] may decode instructions in hardware and determine the microcode address for processing the instruction in parallel with the [[Execution unit|E-unit]]. * A [[microsequencer]] picks the next word of the control store. A sequencer is mostly a counter, but usually also has some way to jump to a different part of the control store depending on some data, usually data from the [[instruction register]] and always some part of the control store. The simplest sequencer is just a register loaded from a few bits of the control store. * A [[processor register|register]] set is a fast memory containing the data of the central processing unit. It may include registers visible to application programs, such as [[general-purpose registers]] and the [[program counter]], and may also include other registers that are not easily accessible to the application programmer. Often the register set is a triple-ported [[register file]]; that is, two registers can be read, and a third written at the same time. * An [[arithmetic and logic unit]] performs calculations, usually addition, logical negation, a right shift, and logical AND. It often performs other functions, as well. There may also be a [[memory address register]] and a [[memory data register]], used to access the main [[computer storage]]. Together, these elements form an "[[execution unit]]". Most modern [[Central processing unit|CPUs]] have several execution units. Even simple computers usually have one unit to read and write memory, and another to execute user code. These elements could often be brought together as a single chip. This chip comes in a fixed width that would form a "slice" through the execution unit. These are known as "[[bit slicing|bit slice]]" chips. The [[AMD Am2900]] family is one of the best known examples of bit slice elements.<ref>{{cite book |title=Computer Architecture and Organization |last=Hayes |first=John P. |isbn=0-07-027363-4 |year=1978 |page=300|publisher=McGraw-Hill }}</ref> The parts of the execution units and the whole execution units are interconnected by a bundle of wires called a [[Computer bus|bus]]. Programmers develop microprograms, using basic software tools. A [[microassembler]] allows a programmer to define the table of bits symbolically. Because of its close relationship to the underlying architecture, "microcode has several properties that make it difficult to generate using a compiler."<ref name=Kent2813 /> A [[simulator]] program is intended to execute the bits in the same way as the electronics, and allows much more freedom to debug the microprogram. After the microprogram is finalized, and extensively tested, it is sometimes used as the input to a computer program that constructs logic to produce the same data.{{citation needed|date=February 2018}} This program is similar to those used to optimize a [[programmable logic device|programmable logic array]]. Even without fully optimal logic, heuristically optimized logic can vastly reduce the number of transistors from the number needed for a [[read-only memory]] (ROM) control store. This reduces the cost to produce, and the electricity used by, a CPU. Microcode can be characterized as ''horizontal'' or ''vertical'', referring primarily to whether each microinstruction controls CPU elements with little or no decoding (horizontal microcode){{efn|IBM horizontally microcoded processors had multiple micro-orders and register select fields that required decoding.}} or requires extensive decoding by [[combinatorial logic]] before doing so (vertical microcode). Consequently, each horizontal microinstruction is wider (contains more bits) and occupies more storage space than a vertical microinstruction. ===Horizontal microcode=== "Horizontal microcode has several discrete micro-operations that are combined in a single microinstruction for simultaneous operation."<ref name=Kent2813 /> Horizontal microcode is typically contained in a fairly wide control store; it is not uncommon for each word to be 108 bits or more. On each tick of a sequencer clock a microcode word is read, decoded, and used to control the functional elements that make up the CPU. In a typical implementation a horizontal microprogram word comprises fairly tightly defined groups of bits. For example, one simple arrangement might be: {| class="wikitable" |- | Register source A || Register source B || Destination register || [[Arithmetic and logic unit]] operation || Type of jump || Jump address |} For this type of micromachine to implement a JUMP instruction with the address following the opcode, the microcode might require two clock ticks. The engineer designing it would write microassembler source code looking something like this: {{sxhl| # Any line starting with a number-sign is a comment # This is just a label, the ordinary way assemblers symbolically represent a # memory address. InstructionJUMP: # To prepare for the next instruction, the instruction-decode microcode has already # moved the program counter to the memory address register. This instruction fetches # the target address of the jump instruction from the memory word following the # jump opcode, by copying from the memory data register to the memory address register. # This gives the memory system two clock ticks to fetch the next # instruction to the memory data register for use by the instruction decode. # The sequencer instruction "next" means just add 1 to the control word address. MDR, NONE, MAR, COPY, NEXT, NONE # This places the address of the next instruction into the PC. # This gives the memory system a clock tick to finish the fetch started on the # previous microinstruction. # The sequencer instruction is to jump to the start of the instruction decode. MAR, 1, PC, ADD, JMP, InstructionDecode # The instruction decode is not shown, because it is usually a mess, very particular # to the exact processor being emulated. Even this example is simplified. # Many CPUs have several ways to calculate the address, rather than just fetching # it from the word following the op-code. Therefore, rather than just one # jump instruction, those CPUs have a family of related jump instructions. |ucode}} For each tick it is common to find that only some portions of the CPU are used, with the remaining groups of bits in the microinstruction being no-ops. With careful design of hardware and microcode, this property can be exploited to parallelise operations that use different areas of the CPU; for example, in the case above, the ALU is not required during the first tick, so it could potentially be used to complete an earlier arithmetic instruction. ===Vertical microcode=== In vertical microcode, each microinstruction is significantly encoded, that is, the bit fields generally pass through intermediate combinatory logic that, in turn, generates the control and sequencing signals for internal CPU elements (ALU, registers, etc.). This is in contrast with horizontal microcode, in which the bit fields either directly produce the control and sequencing signals or are only minimally encoded. Consequently, vertical microcode requires smaller instruction lengths and less storage, but requires more time to decode, resulting in a slower CPU clock.<ref>{{cite web |url = http://euler.mat.uson.mx/~havillam/ca/CS323/0708.cs-323003.html |title = CS-323: High Performance Microprocessors – Chapter 1. Microprogramming |date = 2009-10-12 |access-date = 2015-08-08 |author1 = Neal Harman |author2 = Andy Gimblett |website = mat.uson.mx |archive-date = 2015-04-19 |archive-url = https://web.archive.org/web/20150419164703/http://euler.mat.uson.mx/~havillam/ca/CS323/0708.cs-323003.html |url-status = dead }}</ref> Some vertical microcode is just the assembly language of a simple conventional computer that is emulating a more complex computer. Some processors, such as [[DEC Alpha]] processors and the CMOS microprocessors on later IBM mainframes [[System/390]] and [[z/Architecture]], use machine code, running in a special mode that gives it access to special instructions, special registers, and other hardware resources unavailable to regular machine code, to implement some instructions and other functions,<ref>{{cite book |last=Vaupel |first=Robert |year=2013 |url=https://books.google.com/books?id=1-dt0ABZQOcC&q=millicode |title=High Availability and Scalability of Mainframe Environments using System z and z/OS as example |page=26 |publisher=KIT Scientific |isbn=978-3-7315-0022-3}}</ref><ref>{{cite journal |last=Rogers |first=Bob |date=September–October 2012 |title=The What and Why of zEnterprise Millicode |journal=IBM Systems Magazine |url=http://www.ibmsystemsmag.com/mainframe/administrator/performance/millicode_rogers/ |access-date=2013-11-07 |url-status=dead |archive-url=https://web.archive.org/web/20131016100828/http://ibmsystemsmag.com/mainframe/administrator/performance/millicode_rogers/ |archive-date=2013-10-16}}</ref> such as page table walks on Alpha processors.<ref>{{cite web |url=http://download.majix.org/dec/palcode_dsgn_gde.pdf|title=PALcode for Alpha Microprocessors System Design Guide |publisher=[[Digital Equipment Corporation]] |date=May 1996 |access-date=November 7, 2013 |url-status=live |archive-url=https://web.archive.org/web/20110815022514/http://download.majix.org/dec/palcode_dsgn_gde.pdf |archive-date=August 15, 2011}}</ref> This is called [[PALcode]] on Alpha processors and [[millicode]] on IBM mainframe processors. Another form of vertical microcode has two fields: {| class="wikitable" |- | Field select || Field value |} The ''field select'' selects which part of the CPU will be controlled by this word of the control store. The ''field value'' controls that part of the CPU. With this type of microcode, a designer explicitly chooses to make a slower CPU to save money by reducing the unused bits in the control store; however, the reduced complexity may increase the CPU's clock frequency, which lessens the effect of an increased number of cycles per instruction. As transistors grew cheaper, horizontal microcode came to dominate the design of CPUs using microcode, with vertical microcode being used less often. When both vertical and horizontal microcode are used, the horizontal microcode may be referred to as ''nanocode'' or ''picocode''.<ref>{{cite book |last=Spruth |first=Wilhelm |date=December 2012 |title=The Design of a Microprocessor |publisher=Springer Science & Business Media |isbn=978-3-642-74916-2 |page=31 |url=https://books.google.com/books?id=0YmqCAAAQBAJ |access-date=Jan 18, 2015 |url-status=live |archive-url=https://web.archive.org/web/20161120195023/https://books.google.com/books?id=0YmqCAAAQBAJ |archive-date=November 20, 2016}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)