Created
March 23, 2015 12:09
-
-
Save milesrout/c705e1502907358ea856 to your computer and use it in GitHub Desktop.
BIS: the Better Instruction Set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BIS: the Better Instruction Set | |
| REGISTERS | |
| --------- | |
| sixteen 32-bit general-purpose registers, numbered 0-15 | |
| one 16-bit status register | |
| four 16-bit arithmetic condition registers, numbered 0-3 | |
| INSTRUCTION FORMAT LEGEND | |
| ------------------------- | |
| n immediate | |
| c condition code | |
| r condition register | |
| x operand x | |
| y operand y | |
| z operand z | |
| STANDARD INSTRUCTION FORMAT | |
| --------------------------- | |
| - has support for conditional instruction | |
| - instructions are four bytes long | |
| - each instruction starts with 0 to | |
| distinguish them from the compact format. | |
| THREE-OPERAND FORMAT (64) | |
| 01oooooo 0rrrcccc 0000zzzz yyyyxxxx | |
| 01oooooo 1rrrcccc nnnnnnnn yyyyxxxx | |
| TWO-OPERAND FORMAT (32) | |
| 001ooooo 0rrrcccc 00000000 yyyyxxxx | |
| 001ooooo 1rrrcccc nnnnnnnn nnnnxxxx | |
| ONE-OPERAND FORMAT (16) | |
| 0001oooo 0rrrcccc 00000000 0000xxxx | |
| 0001oooo 1rrrcccc nnnnnnnn nnnnnnnn | |
| ZERO-OPERAND FORMAT (8) | |
| 00001ooo 0rrrcccc 00000000 00000000 | |
| COMPACT INSTRUCTION FORMAT | |
| -------------------------- | |
| - instructions are two bytes long | |
| - must be a multiple of two in a row, you | |
| can't have one just there on its own. | |
| - each two-byte instruction starts with 1. | |
| (to be expanded later) | |
| CONDITIONAL INSTRUCTIONS | |
| ------------------------ | |
| If the condition register is nonzero then the | |
| instruction is executed iff the corresponding | |
| condition bit is set. | |
| If the condition register is zero then the | |
| instruction is executed unconditionally. | |
| INSTRUCTION LISTING | |
| ------------------- | |
| lbz load byte and zero-extend | |
| lhs load half and sign-extend | |
| lhz load half and zero-extend | |
| lw load word | |
| THREE-OPERAND FORMAT (64) - instr x,y,z | |
| 01 0ooooo Arrrcccc zzzzzzzz yyyyxxxx | |
| 01 10oooo Arrrcccc zzzzzzzz yyyyxxxx | |
| 01 110000 Arrrcccc nnnnnnnn yyyyxxxx lbz x := ZERO_EXTEND_8_TO_32(*(y+n)) | |
| 01 110001 Arrrcccc nnnnnnnn yyyyxxxx lbzu x := ZERO_EXTEND_8_TO_32(*(y+n)); y := y+n | |
| 01 110010 Arrrcccc 0000zzzz yyyyxxxx lbzx x := ZERO_EXTEND_8_TO_32(*(y+z)) | |
| 01 110011 Arrrcccc 0000zzzz yyyyxxxx lbzux x := ZERO_EXTEND_8_TO_32(*(y+z)); y := y+z | |
| gist | |
| 01 1101oo Arrrcccc nnnnnnnn yyyyxxxx lhs x := SIGN_EXTEND_16_TO_32(*(y+n)) | |
| 01 1101oo Arrrcccc nnnnnnnn yyyyxxxx lhsu x := SIGN_EXTEND_16_TO_32(*(y+n)); y := y+n | |
| 01 1101oo Arrrcccc 0000zzzz yyyyxxxx lhsx x := SIGN_EXTEND_16_TO_32(*(y+z)) | |
| 01 1101oo Arrrcccc 0000zzzz yyyyxxxx lhsux x := SIGN_EXTEND_16_TO_32(*(y+z)); y := y+z | |
| 01 1110oo Arrrcccc nnnnnnnn yyyyxxxx lhz x := ZERO_EXTEND_16_TO_32(*(y+n)) | |
| 01 1110oo Arrrcccc nnnnnnnn yyyyxxxx lhzu x := ZERO_EXTEND_16_TO_32(*(y+n)); y := y+n | |
| 01 1110oo Arrrcccc 0000zzzz yyyyxxxx lhzx x := ZERO_EXTEND_16_TO_32(*(y+z)) | |
| 01 1110oo Arrrcccc 0000zzzz yyyyxxxx lhzux x := ZERO_EXTEND_16_TO_32(*(y+z)); y := y+z | |
| 01 1111oo Arrrcccc nnnnnnnn yyyyxxxx lw x := *(y+n) | |
| 01 1111oo Arrrcccc nnnnnnnn yyyyxxxx lwu x := *(y+n); y := y+n | |
| 01 1111oo Arrrcccc 0000zzzz yyyyxxxx lwx x := *(y+z) | |
| 01 1111oo Arrrcccc 0000zzzz yyyyxxxx lwux x := *(y+z); y := y+z | |
| TWO-OPERAND FORMAT (32) | |
| 001 00000 Arrrcccc yyyyyyyy yyyyxxxx mov x := y | |
| 001 00001 Arrrcccc yyyyyyyy yyyyxxxx swp x := y; y := x (in parallel) | |
| 001 00010 Arrrcccc yyyyyyyy yyyyxxxx not x := !y | |
| 001 00011 Arrrcccc yyyyyyyy yyyyxxxx (reserved) | |
| 001 00100 Arrrcccc yyyyyyyy yyyyxxxx sxtb x := SIGN_EXTEND_8_TO_32(y) | |
| 001 00101 Arrrcccc yyyyyyyy yyyyxxxx sxtw x := SIGN_EXTEND_16_TO_32(y) | |
| 001 00110 Arrrcccc yyyyyyyy yyyyxxxx zxtb x := ZERO_EXTEND_8_TO_32(y) | |
| 001 00111 Arrrcccc yyyyyyyy yyyyxxxx zxtw x := ZERO_EXTEND_16_TO_32(y) | |
| 001 01ooo Arrrcccc yyyyyyyy yyyyxxxx (reserved) | |
| 001 1oooo Arrrcccc yyyyyyyy yyyyxxxx (reserved) | |
| ONE-OPERAND FORMAT (16) | |
| 0001 0000 Arrrcccc xxxxxxxx xxxxxxxx (reserved) | |
| 0001 0001 Arrrcccc xxxxxxxx xxxxxxxx pop *(SP++)] := x | |
| 0001 0010 Arrrcccc xxxxxxxx xxxxxxxx push x := *(--SP) | |
| 0001 0011 Arrrcccc xxxxxxxx xxxxxxxx b PC := x | |
| 0001 0100 Arrrcccc xxxxxxxx xxxxxxxx call *(SP++) := PC; PC := x | |
| 0001 0101 Arrrcccc xxxxxxxx xxxxxxxx br PC += x | |
| 0001 0110 Arrrcccc xxxxxxxx xxxxxxxx callr *(SP++) := PC; PC += x | |
| 0001 0111 Arrrcccc xxxxxxxx xxxxxxxx int (software interrupt) | |
| 0001 1ooo Arrrcccc xxxxxxxx xxxxxxxx (reserved) | |
| ZERO-OPERAND FORMAT (8) | |
| 00001 000 0rrrcccc 00000000 00000000 ret PC := *(--SP) | |
| 00001 001 0rrrcccc 00000000 00000000 brk PC := PC | |
| 00001 010 0rrrcccc 00000000 00000000 sleep (sleep until interrupt) | |
| 00001 011 0rrrcccc 00000000 00000000 rfi (return from interrupt) | |
| 00001 ooo 0rrrcccc 00000000 00000000 (reserved) | |
| INTERRUPTS | |
| ---------- | |
| (to be expanded later) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment