instruction_set
Differences
This shows you the differences between two versions of the page.
| instruction_set [2026/06/01 04:19] – create mattst88 | instruction_set [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Alpha Instruction Set ===== | ||
| - | ==== Primer ==== | ||
| - | |||
| - | Raymond Chen's blog series about the Alpha is an excellent (albeit Windows-focused) discussion of the instruction set. | ||
| - | |||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | There were valuable comments on the blog posts, but they appear to have been lost when the blogging platform changed. | ||
| - | |||
| - | ==== Hello World! ==== | ||
| - | |||
| - | <code asm> | ||
| - | # hello.S | ||
| - | # gcc hello.S -o hello | ||
| - | # ./hello | ||
| - | .data | ||
| - | PRINT: | ||
| - | |||
| - | .text | ||
| - | .align 4 | ||
| - | .set noreorder | ||
| - | .arch ev4 | ||
| - | .globl main | ||
| - | .ent main | ||
| - | |||
| - | main: | ||
| - | stq $26, | ||
| - | |||
| - | lda $16, | ||
| - | # $16 is first argument to functions | ||
| - | jsr $26, | ||
| - | ldgp $gp, | ||
| - | # (necessary after function calls) | ||
| - | |||
| - | mov $31, | ||
| - | ldq $26, | ||
| - | ret $31, | ||
| - | .end main | ||
| - | </ | ||
| - | |||
| - | ==== Registers ==== | ||
| - | |||
| - | === Integer === | ||
| - | |||
| - | There are 32 integer registers. The **$31** register holds the constant value **0**. Writes to it are ignored. | ||
| - | |||
| - | By convention 12 registers are for temporary values, 6 are saved across function calls, and 6 are for passing arguments to functions. | ||
| - | |||
| - | ^ Register ^ Alternate Name ^ Preserved? ^ Purpose ^ | ||
| - | | **$0** | **$v0** | No | Return Value | | ||
| - | | **$1**–**$8** | **$t0**–**$t7** | No | Temporary Registers | | ||
| - | | **$9**–**$14** | **$s0**–**$s5** | Yes | Saved Registers | | ||
| - | | **$15** | **$s6** or **$fp** | Yes | Saved Register or Frame Pointer | | ||
| - | | **$16**–**$21** | **$a0**–**$a5** | No | Function Arguments | | ||
| - | | **$22**–**$25** | **$t8**–**$t11** | No | Temporary Registers | | ||
| - | | **$26** | **$ra** | Yes | Function Return Address | | ||
| - | | **$27** | **$pv** or **$t12** | No | Procedure Value or Temporary Register | | ||
| - | | **$28** | **$at** | No | Reserved for Assembler | | ||
| - | | **$29** | **$gp** | No | Global Pointer | | ||
| - | | **$30** | **$sp** | Yes | Stack Pointer | | ||
| - | | **$31** | **$zero** | | Zero Sink | | ||
| - | |||
| - | === Floating-Point === | ||
| - | |||
| - | There are 32 floating-point registers. The **$f31** register holds the constant value **0.0**. Writes to it are ignored. | ||
| - | |||
| - | By convention, 15 registers are for temporary values, 8 are saved across function calls, and 6 are for passing arguments to functions. | ||
| - | |||
| - | ^ Register ^ Preserved? ^ Purpose ^ | ||
| - | | **$f0** | No | Return Value | | ||
| - | | **$f1** | No | Return Value of Imaginary Part | | ||
| - | | **$f2**–**$f9** | Yes | Saved Registers | | ||
| - | | **$f10**–**$f15** | No | Temporary Registers | | ||
| - | | **$f16**–**$f21** | No | Function Arguments | | ||
| - | | **$f22**–**$f30** | No | Temporary Registers | | ||
| - | | **$f31** | | Zero Sink | | ||
| - | |||
| - | ==== ISA Extensions ==== | ||
| - | |||
| - | === Presence Detection === | ||
| - | |||
| - | To determine the presence of instruction set extensions at runtime, use the [[amask]] instruction. | ||
| - | |||
| - | === Byte/Word eXtensions (BWX) === | ||
| - | |||
| - | The [[wp> | ||
| - | |||
| - | ^ Mnemonic ^ Description ^ | ||
| - | | **ldbu** | Load byte unaligned | | ||
| - | | **ldwu** | Load word unaligned | | ||
| - | | **sextb** | Sign-extend byte | | ||
| - | | **sextw** | Sign-extend word | | ||
| - | | **stb** | Store byte | | ||
| - | | **stw** | Store word | | ||
| - | |||
| - | === Motion Video Instructions (MVI) === | ||
| - | |||
| - | [[wp> | ||
| - | |||
| - | |||
| - | ^ Mnemonic ^ Instruction ^ | ||
| - | | **maxsb8** | Vector Signed Byte Maximum | | ||
| - | | **maxsw4** | Vector Signed Word Maximum | | ||
| - | | **maxub8** | Vector Unsigned Byte Maximum | | ||
| - | | **maxuw4** | Vector Unsigned Word Maximum | | ||
| - | | **minsb8** | Vector Signed Byte Minimum | | ||
| - | | **minsw4** | Vector Signed Word Minimum | | ||
| - | | **minub8** | Vector Unsigned Byte Minimum | | ||
| - | | **minuw4** | Vector Unsigned Word Minimum | | ||
| - | | **perr** | Pixel Error | | ||
| - | | **pklb** | Pack Longwords to Bytes | | ||
| - | | **pkwb** | Pack Words to Bytes | | ||
| - | | **unpkbl** | Unpack Bytes to Longwords | | ||
| - | | **unpkbw** | Unpack Bytes to Words | | ||
| - | |||
| - | === Floating-point Instruction eXtensions (FIX) === | ||
| - | |||
| - | The [[wp> | ||
| - | |||
| - | ^ Mnemonic ^ Description ^ Floating-Point Format ^ | ||
| - | | **itofs** | Copy Low 32 bits from Integer Register to Floating-Point Register using S_floating Format | IEEE | | ||
| - | | **itoft** | Copy 64 bits from Integer Register to Floating-Point Register | IEEE | | ||
| - | | **itoff** | Copy Low 32 bits from Integer Register to Floating-Point Register using F_floating Format | VAX | | ||
| - | | **ftois** | Copy Floating-Point Register using S_floating Format to Integer Register | IEEE | | ||
| - | | **ftoit** | Copy 64 bits from Floating-Point Register to Integer Register | IEEE | | ||
| - | | **sqrts** | Calculate square root of S_floating Formatted Value | IEEE | | ||
| - | | **sqrtt** | Calculate square root of T_floating Formatted Value | IEEE | | ||
| - | | **sqrtf** | Calculate square root of F_floating Formatted Value | VAX | | ||
| - | | **sqrtg** | Calculate square root of G_floating Formatted Value | VAX | | ||
| - | |||
| - | === Count Instruction eXtensions (CIX) === | ||
| - | |||
| - | The [[wp> | ||
| - | |||
| - | ^ Mnemonic ^ Description ^ | ||
| - | | **ctlz** | Count Leading Zeros | | ||
| - | | **ctpop** | Count Population (Count number of 1's) | | ||
| - | | **cttz** | Count Trailing Zeros | | ||
instruction_set.1780287547.txt.gz · Last modified: by mattst88
