Opcode - Wikipedia
https://en.wikipedia.org/wiki/Opcode • 129 KB fetched Open original page
Opcode - Wikipedia
*
Home
*
Random
*
Nearby
*
Create account
*
Log in
*
Settings
Donate Now
If Wikipedia is useful to you, please give today.
*
About Wikipedia
*
Disclaimers
Search
User menu
*
Create account
*
Log in
Opcode
*
Article
*
Talk
*
Language
*
Watch
*
Edit
Page Template:Hlist/styles.css has no content.
In computing , an opcode (abbreviated from operation code ) [ 1 ] [ 2 ] is an enumerated value that specifies the operation to be performed. Opcodes are employed in hardware devices such as arithmetic logic units (ALUs), central processing units (CPUs), and software instruction sets. In ALUs, the opcode is directly applied to circuitry via an input signal bus. In contrast, in CPUs, the opcode is the portion of a machine language instruction that specifies the operation to be performed.
Contents
* 1 CPUs
* 1.1 Sample opcode table
* 2 Software instruction sets
* 3 See also
* 4 References
CPUs
edit
Opcodes are found in the machine language instructions of CPUs as well as in some abstract computing machines . In CPUs, an opcode may be referred to as an instruction machine code , [ 3 ] instruction code , [ 4 ] instruction syllable , [ 5 ] [ 6 ] [ 7 ] [ 8 ] instruction parcel, or opstring . [ 9 ] [ 2 ] For any particular processor (which may be a general CPU or a more specialized processing unit), the opcodes are defined by the processor's instruction set architecture (ISA). [ 10 ] They can be described using an opcode table . The types of operations may include arithmetic , data copying, logical operations , program control, and special instructions (e.g., CPUID ). [ 10 ]
In addition to the opcode, many instructions specify the data (known as operands ) the operation will act upon, although some instructions may have implicit operands or none. [ 10 ] Some instruction sets have nearly uniform fields for opcode and operand specifiers, whereas others (e.g., x86 architecture) have a less uniform, variable-length structure. [ 10 ] [ 11 ] Instruction sets can be extended through opcode prefixes , which add a subset of new instructions made up of existing opcodes following reserved byte sequences. [ 12 ]
Sample opcode table
edit
This table shows opcodes of a simple 8-bit microprocessor, the Intel 8008 from 1972.
Each opcode is 8 bits long. Each is shown as a binary pattern of ones and zeros in the Opcode column. Up to two additional fields may be embedded into the opcode. Some 3-bit fields are labeled DDD, SSS, CC, and ALU. The SSS (source) and DDD (destination) fields specify one of the eight possible 8008 registers or memory: A, B, C, D, E, H, L, or M. CC specifies one of eight result conditions that will activate certain JMP, CAL, and RET instructions. ALU specifies one of a possible eight arithmetic logic unit functions to be performed during an instruction, specifically, add, add with carry, subtract, subtract with borrow, logical AND, logical XOR, logical OR, and compare. The X in some fields means that either a 1 or 0 can be inserted with no effect .
The fixed ones and zeros are combined with the parameter fields to build the 8-bit opcode. Additionally, the full instruction might require one or two additional bytes of operands . These are shown in the second major column of the table, labeled Operands . If no operands are required, the column is filled with a dash ( — ).
Since the ones and zeros are difficult to remember, the Mnemonic column shows a short, easy to remember letter code that an assembly language programmer may use to invoke the required opcode.
The Description column shows the function performed by the microprocessor when it encounters a specific opcode.
Opcode Operands Mnemonic Description
7 6 5 4 3 2 1 0 b2 b3
0 0 0 0 0 0 0 X — — HLT Halt
0 0 DDD 0 0 0 — — INr DDD ← DDD + 1 (except A and M)
0 0 DDD 0 0 1 — — DCr DDD ← DDD - 1 (except A and M)
0 0 0 0 0 0 1 0 — — RLC A 1-7 ← A 0-6 ; A 0 ← Cy ← A 7
0 0 CC 0 1 1 — — Rcc (RET conditional) If cc true, P ← (stack)
0 0 ALU 1 0 0 data — ADI ACI SUI SBI NDI XRI ORI CPI data A ← A [ALU operation] data
0 0 N 1 0 1 — — RST n (stack) ← P, P ← N x 8
0 0 DDD 1 1 0 data — LrI data (Load r with immediate data) DDD ← data
0 0 X X X 1 1 1 — — RET P ← (stack)
0 0 0 0 1 0 1 0 — — RRC A 0-6 ← A 1-7 ; A 7 ← Cy ← A 0
0 0 0 1 0 0 1 0 — — RAL A 1-7 ← A 0-6 ; Cy ← A 7 ; A 0 ← Cy
0 0 0 1 1 0 1 0 — — RAR A 0-6 ← A 1-7 ; Cy ← A 0 ; A 7 ← Cy
0 1 CC 0 0 0 addlo addhi Jcc add (JMP conditional) If cc true, P ← add
0 1 0 0 port 1 — — INP port A ← Port (ports 0-7 only)
0 1 port 1 — — OUT port Port ← A (ports 8-31 only)
0 1 CC 0 1 0 addlo addhi Ccc add (CAL conditional) If cc true, (stack) ← P, P ← add
0 1 X X X 1 0 0 addlo addhi JMP add P ← add
0 1 X X X 1 1 0 addlo addhi CAL add (stack) ← P, P ← add
1 0 ALU SSS — — ADr ACr SUr SBr NDr XRr ORr CPr A ← A [ALU operation] SSS
1 1 DDD SSS — — Lds (Load d with s) DDD ← SSS
1 1 1 1 1 1 1 1 — — HLT Halt
7 6 5 4 3 2 1 0 b2 b3 Mnemonic Description
SSS DDD 2 1 0 CC ALU
A 0 0 0 FC, C false ADr ADI (A ← A + arg)
B 0 0 1 FZ, Z false ACr ACI (A ← A + arg + Cy)
C 0 1 0 FS, S false SUr SUI (A ← A - arg)
D 0 1 1 FP, P odd SBr SBI (A ← A - arg - Cy)
E 1 0 0 TC, C true NDr NDI (A ← A ∧ arg)
H 1 0 1 TZ, Z true XRr XRI (A ← A ⊻ arg)
L 1 1 0 TS, S true ORr ORI (A ← A ∨ arg)
M 1 1 1 TP, P even CPr CPI (A - arg)
SSS DDD 2 1 0 CC ALU
Software instruction sets
edit
Opcodes can be found in bytecodes and other representations intended for execution by software interpreters. These often employ slightly higher-level data types and operations than those found in hardware opcodes but are nevertheless constructed along similar lines. Examples include the byte code found in Java class files , which are interpreted by Java virtual machines , the byte code used in GNU Emacs for compiled Lisp code, and NET Common Intermediate Language . [ 13 ]
See also
edit
* Computer programming portal
* Gadget (machine instruction sequence)
* Illegal opcode
* Syllable (computing)
* Fused operation
References
edit
{{cite book |author-first=David William |author-last=Barron |author-link=David W. Barron |editor-first=J. John |editor-last=Floretin |title=Assemblers and Loaders |date=1978 |orig-year=1971, 1969 |edition=3 |publisher=[[Elsevier North-Holland Inc.]] |series=Computer Monographs |publication-place=New York, USA |location=[[University of Southampton]], Southampton, UK |isbn=0-444-19462-2 |lccn=78-19961 |chapter=2.1. Symbolic instructions |page=7}} (xii+100 pages)</ref>\n<ref name=\"Jones_2016_CISC\">{{cite web |title=A Minimal CISC |work=Computer Architecture On-Line Collection |author-first=Douglas W. |author-last=Jones |publisher=[[The University of Iowa]], Department of Computer Science |date=2016 |orig-year=2012 |location=Iowa City, USA |url=http://homepage.cs.uiowa.edu/~jones/arch/cisc/ |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20200302190911/http://homepage.cs.uiowa.edu/~jones/arch/cisc/ |archive-date=2020-03-02}}</ref>\n<ref name=\"Jones_1988_CISC\">{{cite journal |title=A Minimal CISC |author-first=Douglas W. |author-last=Jones<!-- |other=[[The University of Iowa]], Department of Computer Science, Iowa City, USA --> |journal=ACM SIGARCH Computer Architecture News |publisher=[[Association for Computing Machinery]] (ACM) |location=New York, USA |date=June 1988 |volume=16 |issue=3 |pages=56–63 |doi=10.1145/48675.48684 |s2cid=17280173 |doi-access=free }}</ref>\n<ref name=\"Domagała_2012\">{{cite book |title=Application of CLP to instruction modulo scheduling for VLIW processors |chapter=7.1.4. Benchmark suite |author-first=Łukasz |author-last=Domagała |publisher=Jacek Skalmierski Computer Studio |date=2012 |isbn=978-83-62652-42-6 |pages=80–83 [83<!-- relevant page -->] |location=Gliwice, Poland |url=https://books.google.com/books?id=e6apNOED26kC |chapter-url=https://books.google.com/books?id=e6apNOED26kC |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20200302192452/https://books.google.de/books?hl=de&id=e6apNOED26kC&jtp=83 |archive-date=2020-03-02}}</ref>\n<ref name=\"Smotherman_2013\">{{cite web |title=Multiple Instruction Issue |author-first=Mark |author-last=Smotherman |publisher=School of Computing, Clemson University |date=2016 |orig-year=2013 |url=https://people.cs.clemson.edu/~mark/330/ilp.txt |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20160528142545/https://people.cs.clemson.edu/~mark/330/ilp.txt |archive-date=2016-05-28}}</ref>\n<ref name=\"Schulman_2005\">{{cite magazine |title=Finding Binary Clones with Opstrings & Function Digests |author-first=Andrew |author-last=Schulman |magazine=[[Dr. Dobb's Journal]] |volume=30 |issue=7 |id=#374 |issn=1044-789X |publisher=[[CMP Media LLC]] |date=2005-07-01 |series=Part I |pages=69–73 |url=http://www.drdobbs.com/finding-binary-clones-with-opstrings-fu/184406152 |access-date=2020-03-02 |url-status=live |archive-url=https://web.archive.org/web/20200302175401/https://www.drdobbs.com/finding-binary-clones-with-opstrings-fu/184406152 |archive-date=2020-03-02 |postscript=none}}; {{cite magazine |title=Finding Binary Clones with Opstrings & Function Digests |author-first=Andrew |author-last=Schulman |magazine=[[Dr. Dobb's Journal]] |volume=30 |issue=8 |id=#375 |issn=1044-789X |publisher=[[CMP Media LLC]] |date=2005-08-01 |series=Part II |pages=56–61 |url=http://www.drdobbs.com/finding-binary-clones-with-opstrings-fu/184406203 |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20200302185255/https://www.drdobbs.com/finding-binary-clones-with-opstrings-fu/184406203 |archive-date=2020-03-02 |postscript=none}}; {{cite magazine |title=Finding Binary Clones with Opstrings & Function Digests |author-first=Andrew |author-last=Schulman |magazine=[[CMP Media LLC]] |volume=30 |issue=9 |id=#376 |issn=1044-789X |publisher=[[United Business Media]] |date=2005-09-01 |series=Part III |pages=64–70 |url=http://www.drdobbs.com/tools/finding-binary-clones-with-opstrings-fu/184406247 |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20200302185646/https://www.drdobbs.com/tools/finding-binary-clones-with-opstrings-fu/184406247?pgno=3 |archive-date=2020-03-02}}</ref>\n<ref name=\"Chiba_2007\">{{cite web |title=Javassist, a Java-bytecode translator toolkit |author-first=Shigeru |author-last=Chiba |date=2007 |orig-year=1999 |url=http://www.docjar.org/html/api/javassist/bytecode/InstructionPrinter.java.html |access-date=2016-05-27 |url-status=live |archive-url=https://web.archive.org/web/20200302185725/http://www.docjar.org/html/api/javassist/bytecode/InstructionPrinter.java.html |archive-date=2020-03-02}}</ref>\n<ref name=\"Hennessy_2017\">{{cite book |title=Computer architecture: A quantitative approach |author-last1=Hennessy |author-first1=John L. |author-last2=Patterson |author-first2=David A. |author-last3=Asanović |author-first3=Krste |author-link3=Krste Asanović |author-last4=Bakos |author-first4=Jason D. |author-last5=Colwell |author-first5=Robert P. |author-last6=Bhattacharjee |author-first6=Abhishek |author-last7=Conte |author-first7=Thomas M. |author-last8=Duato |author-first8=José |author-last9=Franklin |author-first9=Diana |author-last10=Goldberg |author-first10=David |author-last11=Jouppi |author-first11=Norman P. |author-last12=Li |author-first12=Sheng |author-last13=Muralimanohar |author-first13=Naveen |author-last14=Peterson |author-first14=Gregory D. |author-last15=Pinkston |author-first15=Timothy M. |author-last16=Ranganathan |author-first16=Parthasarathy |author-last17=Wood |author-first17=David A. |author-last18=Young |author-first18=Cliff |author-last19=Zaky |author-first19=Amr |date=2017-11-23 |edition=6 |publisher=[[Morgan Kaufmann Publishers]] |location=Cambridge, Massachusetts, USA |isbn=978-0-12811905-1 |oclc=983459758 }}</ref>\n<ref name=\"Mansfield_1983\">{{cite book |title=Machine Language For Beginners |chapter=Introduction: Why Machine Language? |author-first=Richard |author-last=Mansfield |date=1983 |series=[[Compute! Books]] |publisher=[[COMPUTE! Publications, Inc.]], [[American Broadcasting Companies, Inc.]]; [[Small System Services, Inc.]] |location=Greensboro, North Carolina, USA |isbn=0-942386-11-6 |edition=1 |url=https://www.atariarchives.org/mlb/index.php |chapter-url=http://www.atariarchives.org/mlb/introduction.php |access-date=2016-05-28 |url-status=live |archive-url=https://web.archive.org/web/20080213090055/http://www.atariarchives.org/mlb/introduction.php |archive-date=2008-02-13}}</ref>\n<ref name=\"bytecode\">{{cite magazine |title=bytecode Definition |series=PC Magazine Encyclopedia |magazine=[[PC Magazine]] |url=https://www.pcmag.com/encyclopedia_term/0,2542,t=bytecode&i=39108,00.asp |access-date=2015-10-10 |url-status=dead |archive-url=https://web.archive.org/web/20121006015213/http://www.pcmag.com/encyclopedia_term/0%2C2542%2Ct%3Dbytecode%26i%3D39108%2C00.asp |archive-date=6 October 2012 }}</ref>\n<ref name=\"Intel_1973_MCS-4\">{{cite book |title=MCS-4 Assembly Language Programming Manual - The INTELLEC 4 Microcomputer System Programming Manual |chapter=Appendix B - Instruction Machine Codes |edition=Preliminary |publisher=[[Intel Corporation]] |date=December 1973 |location=Santa Clara, California, USA |id=MCS-030-1273-1 |pages=B-1 – B-8 |chapter-url=http://bitsavers.trailing-edge.com/components/intel/MCS4/MCS-4_Assembly_Language_Programming_Manual_Dec73.pdf |access-date=2020-03-02 |url-status=live |archive-url=https://web.archive.org/web/20200301235541/http://bitsavers.trailing-edge.com/components/intel/MCS4/MCS-4_Assembly_Language_Programming_Manual_Dec73.pdf |archive-date=2020-03-01}}</ref>\n<ref name=\"Intel_1974_MCS-40\">{{cite book |title=MCS-40 User's Manual For Logic Designers |chapter=The Functions Of A Computer: Instruction Register And Decoder |publisher=[[Intel Corporation]] |editor-first=Howard A. |editor-last=Raphael |date=November 1974 |location=Santa Clara, California, USA |page=viii |chapter-url=http://bitsavers.trailing-edge.com/components/intel/MCS40/MCS-40_Users_Manual_Nov74.pdf |access-date=2020-03-03 |url-status=live |archive-url=https://web.archive.org/web/20200303024244/http://bitsavers.trailing-edge.com/components/intel/MCS40/MCS-40_Users_Manual_Nov74.pdf |archive-date=2020-03-03 |quote=[…] Each operation that the processor can perform is identified by a unique binary number known as an instruction code. […]}}</ref>"}},"i":0}}]}">
* ↑ Barron, David William (1978) [1971, 1969]. "2.1. Symbolic instructions". Written at University of Southampton , Southampton, UK. In Floretin, J. John (ed.). Assemblers and Loaders . Computer Monographs (3 ed.). New York, USA: Elsevier North-Holland Inc. p. 7. ISBN 0-444-19462-2 . LCCN 78-19961 . (xii+100 pages)
* 1 2 Chiba, Shigeru (2007) [1999]. "Javassist, a Java-bytecode translator toolkit" . Archived from the original on 2020-03-02 . Retrieved 2016-05-27 .
* ↑ "Appendix B - Instruction Machine Codes" (PDF) . MCS-4 Assembly Language Programming Manual - The INTELLEC 4 Microcomputer System Programming Manual (Preliminary ed.). Santa Clara, California, USA: Intel Corporation . December 1973. pp. B-1 – B-8 . MCS-030-1273-1. Archived (PDF) from the original on 2020-03-01 . Retrieved 2020-03-02 .
* ↑ Raphael, Howard A., ed. (November 1974). "The Functions Of A Computer: Instruction Register And Decoder" (PDF) . MCS-40 User's Manual For Logic Designers . Santa Clara, California, USA: Intel Corporation . p. viii. Archived (PDF) from the original on 2020-03-03 . Retrieved 2020-03-03 . […] Each operation that the processor can perform is identified by a unique binary number known as an instruction code. […]
* ↑ Jones, Douglas W. (June 1988). "A Minimal CISC" . ACM SIGARCH Computer Architecture News . 16 (3). New York, USA: Association for Computing Machinery (ACM): 56– 63. doi : 10.1145/48675.48684 . S2CID 17280173 .
* ↑ Domagała, Łukasz (2012). "7.1.4. Benchmark suite" . Application of CLP to instruction modulo scheduling for VLIW processors . Gliwice, Poland: Jacek Skalmierski Computer Studio. pp. 80–83 [83]. ISBN 978-83-62652-42-6 . Archived from the original on 2020-03-02 . Retrieved 2016-05-28 .
* ↑ Smotherman, Mark (2016) [2013]. "Multiple Instruction Issue" . School of Computing, Clemson University. Archived from the original on 2016-05-28 . Retrieved 2016-05-28 .
* ↑ Jones, Douglas W. (2016) [2012]. "A Minimal CISC" . Computer Architecture On-Line Collection . Iowa City, USA: The University of Iowa , Department of Computer Science. Archived from the original on 2020-03-02 . Retrieved 2016-05-28 .
* ↑ Schulman, Andrew (2005-07-01). "Finding Binary Clones with Opstrings & Function Digests" . Dr. Dobb's Journal . Part I. Vol. 30, no. 7. CMP Media LLC . pp. 69– 73. ISSN 1044-789X . #374. Archived from the original on 2020-03-02 . Retrieved 2020-03-02 ; Schulman, Andrew (2005-08-01). "Finding Binary Clones with Opstrings & Function Digests" . Dr. Dobb's Journal . Part II. Vol. 30, no. 8. CMP Media LLC . pp. 56– 61. ISSN 1044-789X . #375. Archived from the original on 2020-03-02 . Retrieved 2016-05-28 ; Schulman, Andrew (2005-09-01). "Finding Binary Clones with Opstrings & Function Digests" . CMP Media LLC . Part III. Vol. 30, no. 9. United Business Media . pp. 64– 70. ISSN 1044-789X . #376. Archived from the original on 2020-03-02 . Retrieved 2016-05-28 .
* 1 2 3 4 Hennessy, John L.; Patterson, David A.; Asanović, Krste ; Bakos, Jason D.; Colwell, Robert P.; Bhattacharjee, Abhishek; Conte, Thomas M.; Duato, José; Franklin, Diana; Goldberg, David; Jouppi, Norman P.; Li, Sheng; Muralimanohar, Naveen; Peterson, Gregory D.; Pinkston, Timothy M.; Ranganathan, Parthasarathy; Wood, David A.; Young, Cliff; Zaky, Amr (2017-11-23). Computer architecture: A quantitative approach (6 ed.). Cambridge, Massachusetts, USA: Morgan Kaufmann Publishers . ISBN 978-0-12811905-1 . OCLC
Links found on this page
- Home [direct]
- Random [direct]
- Nearby [direct]
- Create account [direct]
- Log in [direct]
- Settings [direct]
- Donate Now
If Wikipedia is useful to you, please give today. [direct]
- About Wikipedia [direct]
- Disclaimers [direct]
- Article [direct]
- Talk [direct]
- Edit [direct]
- Template:Hlist/styles.css [direct]
- computing [direct]
- enumerated value [direct]
- arithmetic logic units [direct]
- central processing units [direct]
- machine language [direct]
- instruction [direct]
- edit [direct]
- abstract computing machines [direct]
- instruction set architecture [direct]
- opcode table [direct]
- arithmetic [direct]
- logical operations [direct]
- CPUID [direct]
- operands [direct]
- x86 [direct]
- opcode prefixes [direct]
- edit [direct]
- Intel 8008 [direct]
- bits [direct]
- binary [direct]
- registers [direct]
- no effect [direct]
- assembly language [direct]
- edit [direct]
- bytecodes [direct]
- Java class files [direct]
- Java virtual machines [direct]
- GNU Emacs [direct]
- Lisp [direct]
- Common Intermediate Language [direct]
- edit [direct]
- Computer programming portal [direct]
- Gadget (machine instruction sequence) [direct]
- Illegal opcode [direct]
- Syllable (computing) [direct]
- Fused operation [direct]
- edit [direct]
- Barron, David William [direct]
- University of Southampton [direct]
- Elsevier North-Holland Inc. [direct]
- ISBN [direct]
- 0-444-19462-2 [direct]
- LCCN [direct]
- 78-19961 [direct]
- "Javassist, a Java-bytecode translator toolkit" [direct]
- Archived [direct]
- "Appendix B - Instruction Machine Codes" [direct]
- Intel Corporation [direct]
- Archived [direct]
- "The Functions Of A Computer: Instruction Register And Decoder" [direct]
- Archived [direct]
- "A Minimal CISC" [direct]
- Association for Computing Machinery [direct]
- doi [direct]
- S2CID [direct]
- 17280173 [direct]
- "7.1.4. Benchmark suite" [direct]
- 978-83-62652-42-6 [direct]
- Archived [direct]
- "Multiple Instruction Issue" [direct]
- Archived [direct]
- "A Minimal CISC" [direct]
- The University of Iowa [direct]
- Archived [direct]
- "Finding Binary Clones with Opstrings & Function Digests" [direct]
- Dr. Dobb's Journal [direct]
- CMP Media LLC [direct]
|